From be6148d876fb15d9e9b916587982aee5e616da7c Mon Sep 17 00:00:00 2001 From: sneed Date: Mon, 2 May 2022 04:54:25 +0300 Subject: [PATCH 01/10] Add missing Heal Block functionalities --- src/battle_script_commands.c | 2 +- src/battle_util.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d6edb0ab2d..e20832bb5e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7872,7 +7872,7 @@ static void Cmd_various(void) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); return; case VARIOUS_CHECK_IF_GRASSY_TERRAIN_HEALS: - if ((gStatuses3[gActiveBattler] & (STATUS3_SEMI_INVULNERABLE)) + if ((gStatuses3[gActiveBattler] & (STATUS3_SEMI_INVULNERABLE | STATUS3_HEAL_BLOCK)) || BATTLER_MAX_HP(gActiveBattler) || !gBattleMons[gActiveBattler].hp || !(IsBattlerGrounded(gActiveBattler))) diff --git a/src/battle_util.c b/src/battle_util.c index c0a7f2150e..775c8eebca 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1689,6 +1689,7 @@ bool32 IsHealBlockPreventingMove(u32 battler, u32 move) case EFFECT_HEALING_WISH: case EFFECT_WISH: case EFFECT_DREAM_EATER: + case EFFECT_STRENGTH_SAP: return TRUE; default: return FALSE; @@ -6082,7 +6083,7 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId) static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) { - if (HasEnoughHpToEatBerry(battlerId, 2, itemId)) + if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) { PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavorId); @@ -6268,7 +6269,7 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) { - if (HasEnoughHpToEatBerry(battlerId, 2, itemId) + if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) && !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)) { if (percentHeal) @@ -6707,7 +6708,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case HOLD_EFFECT_LEFTOVERS: LEFTOVERS: - if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn) + if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn + && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) { gBattleMoveDamage = gBattleMons[battlerId].maxHP / 16; if (gBattleMoveDamage == 0) @@ -7137,7 +7139,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) if (gSpecialStatuses[gBattlerAttacker].damagedMons // Need to have done damage && gBattlerAttacker != gBattlerTarget && gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP - && gBattleMons[gBattlerAttacker].hp != 0) + && gBattleMons[gBattlerAttacker].hp != 0 + && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) { gLastUsedItem = atkItem; gPotentialItemEffectBattler = gBattlerAttacker; From b17d1f7816bde54b64c306968a1c6fdc0d42da85 Mon Sep 17 00:00:00 2001 From: sneed Date: Mon, 2 May 2022 17:56:09 +0300 Subject: [PATCH 02/10] Add generation specific interactions --- data/battle_scripts_1.s | 4 ++++ include/constants/battle_config.h | 2 ++ src/battle_util.c | 32 +++++++++++++++++++++++++------ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6574e26ab3..a58dc13395 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1272,6 +1272,7 @@ BattleScript_StrengthSapTryHp: attackanimation waitanimation BattleScript_StrengthSapHp: + jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_MoveEnd jumpiffullhp BS_ATTACKER, BattleScript_MoveEnd manipulatedamage DMG_BIG_ROOT healthbarupdate BS_ATTACKER @@ -3103,6 +3104,7 @@ BattleScript_EffectAbsorb:: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG + jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_AbsorbHealBlock setdrainedhp manipulatedamage DMG_BIG_ROOT orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE @@ -3122,6 +3124,7 @@ BattleScript_AbsorbUpdateHp:: waitmessage B_WAIT_TIME_LONG BattleScript_AbsorbTryFainting:: tryfaintmon BS_ATTACKER +BattleScript_AbsorbHealBlock:: tryfaintmon BS_TARGET goto BattleScript_MoveEnd @@ -3228,6 +3231,7 @@ BattleScript_DreamEaterWorked: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG + jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_DreamEaterTryFaintEnd setdrainedhp manipulatedamage DMG_BIG_ROOT orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index a3ef7cc94b..29395dc808 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -170,6 +170,8 @@ #define B_BRICK_BREAK GEN_7 // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune. #define B_WISH_HP_SOURCE GEN_7 // In Gen5+, Wish heals half of the user's max HP instead of the target's. #define B_RAMPAGE_CANCELLING GEN_7 // In Gen5+, a failed Thrash, etc, will cancel except on its last turn. +#define B_HEAL_BLOCKING GEN_7 // In Gen5+, Heal Block prevents healing by Black Sludge, Leftovers, Shell Bell. Affected Pokémon will not consume held HP-restoring Berries or Berry Juice. + // Draining abilities will not heal but will prevent damage. In Gen6+, Heal Block prevents the use of most HP-draining moves. // Ability settings #define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters. diff --git a/src/battle_util.c b/src/battle_util.c index 775c8eebca..1aa917f822 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1680,7 +1680,11 @@ bool32 IsHealBlockPreventingMove(u32 battler, u32 move) switch (gBattleMoves[move].effect) { +#if B_HEAL_BLOCKING >= GEN_6 case EFFECT_ABSORB: + case EFFECT_STRENGTH_SAP: + case EFFECT_DREAM_EATER: +#endif case EFFECT_MORNING_SUN: case EFFECT_MOONLIGHT: case EFFECT_RESTORE_HP: @@ -1688,8 +1692,6 @@ bool32 IsHealBlockPreventingMove(u32 battler, u32 move) case EFFECT_ROOST: case EFFECT_HEALING_WISH: case EFFECT_WISH: - case EFFECT_DREAM_EATER: - case EFFECT_STRENGTH_SAP: return TRUE; default: return FALSE; @@ -4908,7 +4910,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move if (effect == 1) // Drain Hp ability. { +#if B_HEAL_BLOCKING >= GEN_5 if (BATTLER_MAX_HP(battler) || gStatuses3[battler] & STATUS3_HEAL_BLOCK) +#else + if (BATTLER_MAX_HP(battler)) +#endif { if ((gProtectStructs[gBattlerAttacker].notFirstStrike)) gBattlescriptCurrInstr = BattleScript_MonMadeMoveUseless; @@ -6083,7 +6089,11 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId) static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) { +#if B_HEAL_BLOCKING >= GEN_5 if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) +#else + if (HasEnoughHpToEatBerry(battlerId, 2, itemId)) +#endif { PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavorId); @@ -6269,7 +6279,11 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) { +#if B_HEAL_BLOCKING >= GEN_5 if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) +#else + if (HasEnoughHpToEatBerry(battlerId, 2, itemId) +#endif && !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)) { if (percentHeal) @@ -6708,8 +6722,11 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case HOLD_EFFECT_LEFTOVERS: LEFTOVERS: - if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn - && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) +#if B_HEAL_BLOCKING >= GEN_5 + if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) +#else + if (gBattleMons[battlerId].hp < gBattleMons[battlerId].maxHP && !moveTurn) +#endif { gBattleMoveDamage = gBattleMons[battlerId].maxHP / 16; if (gBattleMoveDamage == 0) @@ -7139,8 +7156,11 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) if (gSpecialStatuses[gBattlerAttacker].damagedMons // Need to have done damage && gBattlerAttacker != gBattlerTarget && gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP - && gBattleMons[gBattlerAttacker].hp != 0 - && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) +#if B_HEAL_BLOCKING >= GEN_5 + && gBattleMons[gBattlerAttacker].hp != 0 && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) +#else + && gBattleMons[gBattlerAttacker].hp != 0) +#endif { gLastUsedItem = atkItem; gPotentialItemEffectBattler = gBattlerAttacker; From 60d7d8f97e044f8c69a52daa72ef30ed6c1aa119 Mon Sep 17 00:00:00 2001 From: sneed Date: Tue, 3 May 2022 03:38:44 +0300 Subject: [PATCH 03/10] Initial Commit --- data/battle_scripts_1.s | 45 +++++++++++++++++++++++++ include/constants/battle_move_effects.h | 3 +- src/battle_script_commands.c | 2 +- src/data/battle_moves.h | 2 +- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6574e26ab3..61fbf91aad 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -410,6 +410,51 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectHit @ EFFECT_RISING_VOLTAGE .4byte BattleScript_EffectHit @ EFFECT_BEAK_BLAST .4byte BattleScript_EffectCourtChange @ EFFECT_COURT_CHANGE + .4byte BattleScript_EffectSteelBeam @ EFFECT_STEEL_BEAM + +BattleScript_EffectSteelBeam:: + attackcanceler + attackstring + ppreduce + accuracycheck BattleScript_SteelBeamMiss, ACC_CURR_MOVE + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage B_WAIT_TIME_LONG + resultmessage + waitmessage B_WAIT_TIME_LONG + seteffectwithchance + jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_SteelBeamAfterSelfDamage + call BattleScript_SteelBeamSelfDamage +BattleScript_SteelBeamAfterSelfDamage:: + waitstate + tryfaintmon BS_ATTACKER + tryfaintmon BS_TARGET + goto BattleScript_MoveEnd +BattleScript_SteelBeamMiss:: + pause B_WAIT_TIME_SHORT + effectivenesssound + resultmessage + waitmessage B_WAIT_TIME_LONG + jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_MoveEnd + bichalfword gMoveResultFlags, MOVE_RESULT_MISSED + call BattleScript_SteelBeamSelfDamage + orhalfword gMoveResultFlags, MOVE_RESULT_MISSED + goto BattleScript_SteelBeamAfterSelfDamage + +BattleScript_SteelBeamSelfDamage:: + dmg_1_2_attackerhp + healthbarupdate BS_ATTACKER + datahpupdate BS_ATTACKER + return BattleScript_EffectCourtChange:: attackcanceler diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 3cc3d72b39..c3460bcfef 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -393,7 +393,8 @@ #define EFFECT_RISING_VOLTAGE 387 #define EFFECT_BEAK_BLAST 388 #define EFFECT_COURT_CHANGE 389 +#define EFFECT_STEEL_BEAM 390 -#define NUM_BATTLE_MOVE_EFFECTS 390 +#define NUM_BATTLE_MOVE_EFFECTS 391 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d6edb0ab2d..072130b8b1 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9882,7 +9882,7 @@ static void Cmd_manipulatedamage(void) gBattleMoveDamage = GetDrainedBigRootHp(gBattlerAttacker, gBattleMoveDamage); break; case DMG_1_2_ATTACKER_HP: - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2; + gBattleMoveDamage = (gBattleMons[gBattlerAttacker].maxHP + 1) / 2; // Half of Max HP Rounded UP break; case DMG_RECOIL_FROM_IMMUNE: gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2; diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 1f90abf033..2035acff74 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -11221,7 +11221,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_STEEL_BEAM] = { - .effect = EFFECT_RECOIL_50, + .effect = EFFECT_STEEL_BEAM, .power = 140, .type = TYPE_STEEL, .accuracy = 95, From 865b771db7ad3ad31b427ad45ce537e8f4ba4bd4 Mon Sep 17 00:00:00 2001 From: sneed Date: Thu, 5 May 2022 00:57:19 +0300 Subject: [PATCH 04/10] initial commit --- include/constants/battle_config.h | 2 +- src/battle_util.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index a3ef7cc94b..a8d6ebdf74 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -181,7 +181,7 @@ #define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. #define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. #define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. -#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. +#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. // Item settings #define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. diff --git a/src/battle_util.c b/src/battle_util.c index c0a7f2150e..c18e4f1137 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1581,6 +1581,16 @@ void PrepareStringBattle(u16 stringId, u8 battler) else SET_STATCHANGER(STAT_SPATK, 2, FALSE); } +#if B_UPDATED_INTIMIDATE >= GEN_8 + else if (stringId == STRINGID_PKMNCUTSATTACKWITH && targetAbility == ABILITY_RATTLED + && CompareStat(gBattlerTarget, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN)) + { + gBattlerAbility = gBattlerTarget; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_DefiantActivates; + SET_STATCHANGER(STAT_SPEED, 1, FALSE); + } +#endif gActiveBattler = battler; BtlController_EmitPrintString(BUFFER_A, stringId); From 6c23eb431de0f3f6538d49c1e8a98fe835feedb4 Mon Sep 17 00:00:00 2001 From: sneed Date: Thu, 5 May 2022 13:56:59 +0300 Subject: [PATCH 05/10] Heal Pulse and Pollen Puff --- data/battle_scripts_1.s | 2 ++ src/battle_util.c | 1 + 2 files changed, 3 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a58dc13395..132a8ea35f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2410,6 +2410,8 @@ BattleScript_EffectHealPulse: attackcanceler attackstring ppreduce + jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_MoveUsedHealBlockPrevents @ stops pollen puff + jumpifstatus3 BS_TARGET, STATUS3_HEAL_BLOCK, BattleScript_MoveUsedHealBlockPrevents accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON jumpifsubstituteblocks BattleScript_ButItFailed tryhealpulse BS_TARGET, BattleScript_AlreadyAtFullHp diff --git a/src/battle_util.c b/src/battle_util.c index 1aa917f822..6569c6a1b2 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1692,6 +1692,7 @@ bool32 IsHealBlockPreventingMove(u32 battler, u32 move) case EFFECT_ROOST: case EFFECT_HEALING_WISH: case EFFECT_WISH: + case EFFECT_HEAL_PULSE: return TRUE; default: return FALSE; From 07b42d62ef9db2d01b45b2312c53d5351b4453cc Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Thu, 5 May 2022 20:46:45 -0700 Subject: [PATCH 06/10] fixed shed shell --- src/battle_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/battle_main.c b/src/battle_main.c index 479cafae6a..3edbea48b9 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4020,10 +4020,18 @@ static void HandleTurnActionSelectionState(void) { BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); } + #ifdef ITEM_EXPANSION + else if ((i = IsAbilityPreventingEscape(gActiveBattler) + && ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item) != HOLD_EFFECT_SHED_SHELL)) + { + BtlController_EmitChoosePokemon(BUFFER_A, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gBattleMons[i - 1].ability, gBattleStruct->battlerPartyOrders[gActiveBattler]); + } + #else else if ((i = IsAbilityPreventingEscape(gActiveBattler))) { BtlController_EmitChoosePokemon(BUFFER_A, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gBattleMons[i - 1].ability, gBattleStruct->battlerPartyOrders[gActiveBattler]); } + #endif else { if (gActiveBattler == 2 && gChosenActionByBattler[0] == B_ACTION_SWITCH) From aff1d3949f23d253cd3a3692d2f49a5f8489784c Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Thu, 5 May 2022 21:58:16 -0700 Subject: [PATCH 07/10] fixed spotlight function --- src/battle_message.c | 2 +- src/battle_script_commands.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/battle_message.c b/src/battle_message.c index 3e2d9abd92..8cf9a508b2 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -220,7 +220,7 @@ static const u8 sText_PkmnForesawAttack[] = _("{B_ATK_NAME_WITH_PREFIX} foresaw\ static const u8 sText_PkmnTookAttack[] = _("{B_DEF_NAME_WITH_PREFIX} took the\n{B_BUFF1} attack!"); static const u8 sText_PkmnChoseXAsDestiny[] = _("{B_ATK_NAME_WITH_PREFIX} chose\n{B_CURRENT_MOVE} as its destiny!"); static const u8 sText_PkmnAttack[] = _("{B_BUFF1}'s attack!"); -static const u8 sText_PkmnCenterAttention[] = _("{B_ATK_NAME_WITH_PREFIX} became the\ncenter of attention!"); +static const u8 sText_PkmnCenterAttention[] = _("{B_DEF_NAME_WITH_PREFIX} became the\ncenter of attention!"); static const u8 sText_PkmnChargingPower[] = _("{B_ATK_NAME_WITH_PREFIX} began\ncharging power!"); static const u8 sText_NaturePowerTurnedInto[] = _("NATURE POWER turned into\n{B_CURRENT_MOVE}!"); static const u8 sText_PkmnStatusNormal[] = _("{B_ATK_NAME_WITH_PREFIX}'s status\nreturned to normal!"); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d6edb0ab2d..227d2f573d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12397,9 +12397,9 @@ static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento static void Cmd_setforcedtarget(void) // follow me { - gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTimer = 1; - gSideTimers[GetBattlerSide(gBattlerAttacker)].followmeTarget = gBattlerAttacker; - gSideTimers[GetBattlerSide(gBattlerAttacker)].followmePowder = TestMoveFlags(gCurrentMove, FLAG_POWDER); + gSideTimers[GetBattlerSide(gBattlerTarget)].followmeTimer = 1; + gSideTimers[GetBattlerSide(gBattlerTarget)].followmeTarget = gBattlerTarget; + gSideTimers[GetBattlerSide(gBattlerTarget)].followmePowder = TestMoveFlags(gCurrentMove, FLAG_POWDER); gBattlescriptCurrInstr++; } From 74cc8c5ecb18962204f3ff1a42c8e9cc7f998b60 Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Thu, 5 May 2022 22:37:28 -0700 Subject: [PATCH 08/10] fixed bolt beak switch-in boost --- src/battle_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index c0a7f2150e..55602cdc1d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8119,7 +8119,8 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower *= 2; break; case EFFECT_BOLT_BEAK: - if (GetBattlerTurnOrderNum(battlerAtk) < GetBattlerTurnOrderNum(battlerDef)) + if (GetBattlerTurnOrderNum(battlerAtk) < GetBattlerTurnOrderNum(battlerDef) + || gDisableStructs[battlerDef].isFirstTurn == 2) basePower *= 2; break; case EFFECT_ROUND: From 382cd41d12c22ef7e4ea1dfddb0be5263f0b0ac0 Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Thu, 5 May 2022 22:49:46 -0700 Subject: [PATCH 09/10] realized hold effect is defined already --- src/battle_main.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index 3edbea48b9..4adca19878 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4020,18 +4020,11 @@ static void HandleTurnActionSelectionState(void) { BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]); } - #ifdef ITEM_EXPANSION else if ((i = IsAbilityPreventingEscape(gActiveBattler) && ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item) != HOLD_EFFECT_SHED_SHELL)) { BtlController_EmitChoosePokemon(BUFFER_A, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gBattleMons[i - 1].ability, gBattleStruct->battlerPartyOrders[gActiveBattler]); } - #else - else if ((i = IsAbilityPreventingEscape(gActiveBattler))) - { - BtlController_EmitChoosePokemon(BUFFER_A, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gBattleMons[i - 1].ability, gBattleStruct->battlerPartyOrders[gActiveBattler]); - } - #endif else { if (gActiveBattler == 2 && gChosenActionByBattler[0] == B_ACTION_SWITCH) From ef7cd3cdfecad531ec57230e6876db4cff68e7b6 Mon Sep 17 00:00:00 2001 From: sneed Date: Fri, 6 May 2022 11:15:24 +0300 Subject: [PATCH 10/10] BattleScript_DefiantActivates rename --- data/battle_scripts_1.s | 2 +- include/battle_scripts.h | 2 +- src/battle_util.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 6574e26ab3..0dc88eb43f 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7925,7 +7925,7 @@ BattleScript_DrizzleActivates:: call BattleScript_WeatherFormChanges end3 -BattleScript_DefiantActivates:: +BattleScript_AbilityRaisesDefenderStat:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp statbuffchange 0, NULL diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 740d27148a..5fd70159b8 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -308,7 +308,7 @@ extern const u8 BattleScript_MistySurgeActivates[]; extern const u8 BattleScript_ElectricSurgeActivates[]; extern const u8 BattleScript_SpectralThiefSteal[]; extern const u8 BattleScript_StatUpMsg[]; -extern const u8 BattleScript_DefiantActivates[]; +extern const u8 BattleScript_AbilityRaisesDefenderStat[]; extern const u8 BattleScript_PowderMoveNoEffect[]; extern const u8 BattleScript_GrassyTerrainHeals[]; extern const u8 BattleScript_VCreateStatLoss[]; diff --git a/src/battle_util.c b/src/battle_util.c index c18e4f1137..a5542e225a 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1575,7 +1575,7 @@ void PrepareStringBattle(u16 stringId, u8 battler) gBattleScripting.stickyWebStatDrop = 0; gBattlerAbility = gBattlerTarget; BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_DefiantActivates; + gBattlescriptCurrInstr = BattleScript_AbilityRaisesDefenderStat; if (targetAbility == ABILITY_DEFIANT) SET_STATCHANGER(STAT_ATK, 2, FALSE); else @@ -1587,7 +1587,7 @@ void PrepareStringBattle(u16 stringId, u8 battler) { gBattlerAbility = gBattlerTarget; BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_DefiantActivates; + gBattlescriptCurrInstr = BattleScript_AbilityRaisesDefenderStat; SET_STATCHANGER(STAT_SPEED, 1, FALSE); } #endif