diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 511299a11..852150a63 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -347,10 +347,20 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectVCreate .4byte BattleScript_EffectMatBlock .4byte BattleScript_EffectStompingTantrum - .4byte BattleScript_EffectPlaceholder - .4byte BattleScript_EffectPlaceholder + .4byte BattleScript_EffectCoreEnforcer .4byte BattleScript_EffectThroatChop +BattleScript_EffectCoreEnforcer: + setmoveeffect MOVE_EFFECT_CORE_ENFORCER | MOVE_EFFECT_CERTAIN + goto BattleScript_EffectHit + +BattleScript_MoveEffectCoreEnforcer:: + setgastroacid BattleScript_CoreEnforcerRet + printstring STRINGID_PKMNSABILITYSUPPRESSED + waitmessage 0x40 +BattleScript_CoreEnforcerRet: + return + BattleScript_EffectVCreate: setmoveeffect MOVE_EFFECT_V_CREATE | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -6442,6 +6452,7 @@ BattleScript_RoughSkinActivates:: BattleScript_SpikyShieldEffect:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER printstring STRINGID_PKMNHURTSWITH @@ -6449,6 +6460,23 @@ BattleScript_SpikyShieldEffect:: tryfaintmon BS_ATTACKER, FALSE, NULL return +BattleScript_KingsShieldEffect:: + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 + bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT + seteffectsecondary + setmoveeffect 0 + copybyte sBATTLER, gBattlerTarget + copybyte gBattlerTarget, gBattlerAttacker + copybyte gBattlerAttacker, sBATTLER + return + +BattleScript_BanefulBunkerEffect:: + orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_x100000 + bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT + seteffectsecondary + setmoveeffect 0 + return + BattleScript_CuteCharmActivates:: call BattleScript_AbilityPopUp status2animation BS_ATTACKER, STATUS2_INFATUATION diff --git a/include/battle_scripts.h b/include/battle_scripts.h index e80dcbba6..cf8504f6c 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -300,8 +300,11 @@ extern const u8 BattleScript_PowderMoveNoEffect[]; extern const u8 BattleScript_GrassyTerrainLoop[]; extern const u8 BattleScript_VCreateStatLoss[]; extern const u8 BattleScript_SpikyShieldEffect[]; +extern const u8 BattleScript_KingsShieldEffect[]; +extern const u8 BattleScript_BanefulBunkerEffect[]; extern const u8 BattleScript_FlowerVeilProtectsRet[]; extern const u8 BattleScript_SweetVeilProtectsRet[]; +extern const u8 BattleScript_MoveEffectCoreEnforcer[]; extern const u8 BattleScript_SelectingNotAllowedMoveThroatChop[]; extern const u8 BattleScript_MoveUsedIsThroatChopPrevented[]; extern const u8 BattleScript_SelectingNotAllowedMoveThroatChopInPalace[]; diff --git a/include/constants/battle.h b/include/constants/battle.h index 3761a5d87..42b80d173 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -328,7 +328,7 @@ #define MOVE_EFFECT_SPECTRAL_THIEF 0x3F #define MOVE_EFFECT_V_CREATE 0x40 #define MOVE_EFFECT_HAPPY_HOUR 0x41 - +#define MOVE_EFFECT_CORE_ENFORCER 0x42 #define MOVE_EFFECT_THROAT_CHOP 0x43 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index a250decd6..7da5079f3 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -335,6 +335,7 @@ #define EFFECT_V_CREATE 329 #define EFFECT_MAT_BLOCK 330 #define EFFECT_STOMPING_TANTRUM 331 +#define EFFECT_CORE_ENFORCER 332 #define EFFECT_THROAT_CHOP 334 diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 681838f76..334b4b349 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -162,7 +162,7 @@ #define ATK48_DONT_CHECK_LOWER 0x8 // atk49, moveend cases -#define ATK49_SPIKY_SHIELD 0 +#define ATK49_PROTECT_LIKE_EFFECT 0 #define ATK49_RAGE 1 #define ATK49_DEFROST 2 #define ATK49_SYNCHRONIZE_TARGET 3 diff --git a/src/battle_message.c b/src/battle_message.c index 0694d22e5..055f1ff66 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -87,7 +87,7 @@ static const u8 sText_PkmnAlreadyAsleep[] = _("{B_DEF_NAME_WITH_PREFIX} is\nalre static const u8 sText_PkmnAlreadyAsleep2[] = _("{B_ATK_NAME_WITH_PREFIX} is\nalready asleep!"); static const u8 sText_PkmnWasntAffected[] = _("{B_DEF_NAME_WITH_PREFIX}\nwasn't affected!"); static const u8 sText_PkmnWasPoisoned[] = _("{B_EFF_NAME_WITH_PREFIX}\nwas poisoned!"); -static const u8 sText_PkmnPoisonedBy[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\npoisoned {B_EFF_NAME_WITH_PREFIX}!"); +static const u8 sText_PkmnPoisonedBy[] = _("{B_EFF_NAME_WITH_PREFIX} was poisoned by\n{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_BUFF1}!"); static const u8 sText_PkmnHurtByPoison[] = _("{B_ATK_NAME_WITH_PREFIX} is hurt\nby poison!"); static const u8 sText_PkmnAlreadyPoisoned[] = _("{B_DEF_NAME_WITH_PREFIX} is already\npoisoned."); static const u8 sText_PkmnBadlyPoisoned[] = _("{B_EFF_NAME_WITH_PREFIX} is badly\npoisoned!"); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b0ed189bd..b066c19d5 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2809,6 +2809,13 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_VCreateStatLoss; break; + case MOVE_EFFECT_CORE_ENFORCER: + if (GetBattlerTurnOrderNum(gBattlerAttacker) > GetBattlerTurnOrderNum(gBattlerTarget)) + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_MoveEffectCoreEnforcer; + } + break; case MOVE_EFFECT_THROAT_CHOP: gDisableStructs[gEffectBattler].throatChopTimer = 2; gBattlescriptCurrInstr++; @@ -4218,19 +4225,37 @@ static void atk49_moveend(void) { switch (gBattleScripting.atk49_state) { - case ATK49_SPIKY_SHIELD: - if (gProtectStructs[gBattlerTarget].spikyShielded - && gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT - && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) + case ATK49_PROTECT_LIKE_EFFECT: + if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) { - gMoveResultFlags &= ~(MOVE_RESULT_NO_EFFECT); - gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_SPIKY_SHIELD); - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_SpikyShieldEffect; - effect = 1; + if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD) + { + gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 8; + if (gBattleMoveDamage == 0) + gBattleMoveDamage = 1; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_SPIKY_SHIELD); + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_SpikyShieldEffect; + effect = 1; + } + else if (gProtectStructs[gBattlerTarget].kingsShielded) + { + i = gBattlerAttacker; + gBattlerAttacker = gBattlerTarget; + gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable + gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_2; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_KingsShieldEffect; + effect = 1; + } + else if (gProtectStructs[gBattlerTarget].banefulBunkered) + { + gBattleScripting.moveEffect = MOVE_EFFECT_POISON | MOVE_EFFECT_AFFECTS_USER; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_BANEFUL_BUNKER); + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_BanefulBunkerEffect; + effect = 1; + } } gBattleScripting.atk49_state++; break; diff --git a/src/battle_util.c b/src/battle_util.c index aa6a7efc8..3e4b1b4f0 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3314,6 +3314,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleScripting.moveEffect += MOVE_EFFECT_AFFECTS_USER; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; + PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_EFFECT_SPORE); gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; effect++; } @@ -3327,6 +3328,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA && (Random() % 3) == 0) { gBattleScripting.moveEffect = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_POISON; + PREPARE_ABILITY_BUFFER(gBattleTextBuff1, ABILITY_POISON_POINT); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; @@ -5668,6 +5670,9 @@ static inline void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, mod = UQ_4_12(2.0); if (moveType == TYPE_GROUND && defType == TYPE_FLYING && IsBattlerGrounded(battlerDef)) mod = UQ_4_12(1.0); + + if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT) + mod = UQ_4_12(1.0); MulModifier(modifier, mod); } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index fe3b7cbc3..e692255e6 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -9124,7 +9124,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_CORE_ENFORCER] = { - .effect = EFFECT_PLACEHOLDER, + .effect = EFFECT_CORE_ENFORCER, .power = 100, .type = TYPE_DRAGON, .accuracy = 100,