Beast Boost and Receiver

This commit is contained in:
DizzyEggg 2020-04-19 12:07:56 +02:00
parent ee8a00be81
commit e62f1475d4
7 changed files with 86 additions and 3 deletions

View File

@ -1439,6 +1439,14 @@
various \battler, VARIOUS_TRY_ACTIVATE_MOXIE
.endm
.macro tryactivatebeastboost battler:req
various \battler, VARIOUS_TRY_ACTIVATE_BEAST_BOOST
.endm
.macro tryactivatereceiver battler:req
various \battler, VARIOUS_TRY_ACTIVATE_RECEIVER
.endm
.macro tryactivatesoulheart
various BS_ATTACKER, VARIOUS_TRY_ACTIVATE_SOULHEART
.endm

View File

@ -4784,6 +4784,7 @@ BattleScript_FaintAttacker::
printstring STRINGID_ATTACKERFAINTED
cleareffectsonfaint BS_ATTACKER
tryactivatesoulheart
tryactivatereceiver BS_ATTACKER
trytrainerslidefirstdownmsg BS_ATTACKER
return
@ -4794,9 +4795,11 @@ BattleScript_FaintTarget::
dofaintanimation BS_TARGET
printstring STRINGID_TARGETFAINTED
cleareffectsonfaint BS_TARGET
tryactivatesoulheart
tryactivatemoxie BS_ATTACKER
tryactivatefellstinger BS_ATTACKER
tryactivatesoulheart
tryactivatereceiver BS_TARGET
tryactivatemoxie BS_ATTACKER
tryactivatebeastboost BS_ATTACKER
trytrainerslidefirstdownmsg BS_TARGET
return
@ -6405,6 +6408,13 @@ BattleScript_TraceActivatesEnd3::
call BattleScript_TraceActivates
end3
BattleScript_ReceiverActivates::
call BattleScript_AbilityPopUp
printstring STRINGID_RECEIVERABILITYTAKEOVER
waitmessage 0x40
settracedability BS_ABILITY_BATTLER
return
BattleScript_RainDishActivates::
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSXRESTOREDHPALITTLE2

View File

@ -335,5 +335,6 @@ extern const u8 BattleScript_AnticipationActivates[];
extern const u8 BattleScript_SlowStartEnds[];
extern const u8 BattleScript_HealerActivates[];
extern const u8 BattleScript_ScriptingAbilityStatRaise[];
extern const u8 BattleScript_ReceiverActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -150,6 +150,8 @@
#define VARIOUS_JUMP_IF_FULL_HP 87
#define VARIOUS_LOSE_TYPE 88
#define VARIOUS_TRY_ACTIVATE_SOULHEART 89
#define VARIOUS_TRY_ACTIVATE_RECEIVER 90
#define VARIOUS_TRY_ACTIVATE_BEAST_BOOST 91
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -544,7 +544,8 @@
#define STRINGID_ATTACKERLOSTFIRETYPE 540
#define STRINGID_HEALERCURE 541
#define STRINGID_SCRIPTINGABILITYSTATRAISE 542
#define STRINGID_RECEIVERABILITYTAKEOVER 543
#define BATTLESTRINGS_COUNT 543
#define BATTLESTRINGS_COUNT 544
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -665,9 +665,11 @@ static const u8 sText_IllusionWoreOff[] = _("{B_DEF_NAME_WITH_PREFIX}'s Illusion
static const u8 sText_AttackerCuredTargetStatus[] = _("{B_ATK_NAME_WITH_PREFIX} cured\n{B_DEF_NAME_WITH_PREFIX}'s problem!");
static const u8 sText_AttackerLostFireType[] = _("{B_ATK_NAME_WITH_PREFIX} burned itself out!");
static const u8 sText_HealerCure[] = _("{B_ATK_NAME_WITH_PREFIX}'s {B_LAST_ABILITY}\ncured {B_SCR_ACTIVE_NAME_WITH_PREFIX}'s problem!");
static const u8 sText_ReceiverAbilityTakeOver[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\nwas taken over!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_RECEIVERABILITYTAKEOVER - 12] = sText_ReceiverAbilityTakeOver,
[STRINGID_SCRIPTINGABILITYSTATRAISE - 12] = sText_ScriptingAbilityRaisedStat,
[STRINGID_HEALERCURE - 12] = sText_HealerCure,
[STRINGID_ATTACKERLOSTFIRETYPE - 12] = sText_AttackerLostFireType,

View File

@ -6759,6 +6759,22 @@ static void RecalcBattlerStats(u32 battler, struct Pokemon *mon)
gBattleMons[battler].type2 = gBaseStats[gBattleMons[battler].species].type2;
}
static u32 GetHighestStatId(u32 battlerId)
{
u32 i, highestId = STAT_ATK, highestStat = gBattleMons[battlerId].attack;
for (i = STAT_DEF; i < NUM_STATS; i++)
{
u16 *statVal = &gBattleMons[battlerId].attack + (i - 1);
if (*statVal > highestStat)
{
highestStat = *statVal;
highestId = i;
}
}
return highestId;
}
static void Cmd_various(void)
{
struct Pokemon *mon;
@ -6803,6 +6819,7 @@ static void Cmd_various(void)
return;
case VARIOUS_TRACE_ABILITY:
gBattleMons[gActiveBattler].ability = gBattleStruct->tracedAbility[gActiveBattler];
RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability);
break;
case VARIOUS_TRY_ILLUSION_OFF:
if (GetIllusionMonPtr(gActiveBattler) != NULL)
@ -7124,6 +7141,48 @@ static void Cmd_various(void)
return;
}
break;
case VARIOUS_TRY_ACTIVATE_RECEIVER: // Partner gets fainted's ally ability
gBattlerAbility = BATTLE_PARTNER(gActiveBattler);
i = GetBattlerAbility(gBattlerAbility);
if (IsBattlerAlive(gBattlerAbility)
&& (i == ABILITY_RECEIVER || i == ABILITY_POWER_OF_ALCHEMY))
{
switch (gBattleMons[gActiveBattler].ability)
{ // Can't copy these abilities.
case ABILITY_POWER_OF_ALCHEMY: case ABILITY_RECEIVER:
case ABILITY_FORECAST: case ABILITY_MULTITYPE:
case ABILITY_FLOWER_GIFT: case ABILITY_ILLUSION:
case ABILITY_WONDER_GUARD: case ABILITY_ZEN_MODE:
case ABILITY_STANCE_CHANGE: case ABILITY_IMPOSTER:
case ABILITY_POWER_CONSTRUCT: case ABILITY_BATTLE_BOND:
case ABILITY_SCHOOLING: case ABILITY_COMATOSE:
case ABILITY_SHIELDS_DOWN: case ABILITY_DISGUISE:
case ABILITY_RKS_SYSTEM: case ABILITY_TRACE:
break;
default:
gBattleStruct->tracedAbility[gBattlerAbility] = gBattleMons[gActiveBattler].ability; // re-using the variable for trace
gBattleScripting.battler = gActiveBattler;
BattleScriptPush(gBattlescriptCurrInstr + 3);
gBattlescriptCurrInstr = BattleScript_ReceiverActivates;
return;
}
}
break;
case VARIOUS_TRY_ACTIVATE_BEAST_BOOST:
i = GetHighestStatId(gActiveBattler);
if (GetBattlerAbility(gActiveBattler) == ABILITY_BEAST_BOOST
&& HasAttackerFaintedTarget()
&& !NoAliveMonsForEitherParty()
&& gBattleMons[gBattlerAttacker].statStages[i] != 12)
{
gBattleMons[gBattlerAttacker].statStages[i]++;
SET_STATCHANGER(i, 1, FALSE);
PREPARE_STAT_BUFFER(gBattleTextBuff1, i);
BattleScriptPush(gBattlescriptCurrInstr + 3);
gBattlescriptCurrInstr = BattleScript_AttackerAbilityStatRaise;
return;
}
break;
case VARIOUS_TRY_ACTIVATE_SOULHEART:
while (gBattleStruct->soulheartBattlerId < gBattlersCount)
{