Only thing left is making IsMoveMakingContact work when hitting King's Shield, etc.

This commit is contained in:
MissingNoL 2021-06-05 13:47:05 -07:00
parent 0f09055cfe
commit c4b700a8e7
2 changed files with 10 additions and 7 deletions

View File

@ -4708,7 +4708,7 @@ static void Cmd_moveend(void)
switch (gBattleScripting.moveendState)
{
case MOVEEND_PROTECT_LIKE_EFFECT:
if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT)
if (gBattleMoves[gCurrentMove].flags & FLAG_MAKES_CONTACT) // needs to be IsMoveMakingContact, but this file does not reference include/battle_util.h or src/battle_util.c
{
if (gProtectStructs[gBattlerTarget].spikyShielded && GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
{

View File

@ -4556,7 +4556,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& IsBattlerAlive(gBattlerAttacker)
&& TARGET_TURN_DAMAGED
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
&& (IsMoveMakingContact(move, gBattlerAttacker)))
{
switch (gBattleMons[gBattlerAttacker].ability)
{
@ -4745,7 +4745,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gBattleMons[gBattlerAttacker].hp != 0
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
&& (IsMoveMakingContact(move, gBattlerAttacker))
&& TARGET_TURN_DAMAGED
&& !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_FIRE)
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_WATER_VEIL
@ -4764,7 +4764,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gBattleMons[gBattlerAttacker].hp != 0
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
&& (IsMoveMakingContact(move, gBattlerAttacker))
&& TARGET_TURN_DAMAGED
&& gBattleMons[gBattlerTarget].hp != 0
&& (Random() % 3) == 0
@ -4832,7 +4832,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
&& TARGET_TURN_DAMAGED
&& IsBattlerAlive(battler)
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
&& (IsMoveMakingContact(move, gBattlerAttacker))
&& !(gStatuses3[gBattlerAttacker] & STATUS3_PERISH_SONG))
{
if (!(gStatuses3[battler] & STATUS3_PERISH_SONG))
@ -6665,7 +6665,10 @@ u32 GetBattlerHoldEffectParam(u8 battlerId)
bool32 IsMoveMakingContact(u16 move, u8 battlerAtk)
{
if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
return FALSE;
if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gSwapDamageCategory == TRUE)
return TRUE;
else
return FALSE;
else if (GetBattlerAbility(battlerAtk) == ABILITY_LONG_REACH)
return FALSE;
else if (GetBattlerHoldEffect(battlerAtk, TRUE) == HOLD_EFFECT_PROTECTIVE_PADS)
@ -7135,7 +7138,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, UQ_4_12(1.3));
break;
case ABILITY_TOUGH_CLAWS:
if (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
if (IsMoveMakingContact(move, battlerAtk))
MulModifier(&modifier, UQ_4_12(1.3));
break;
case ABILITY_STRONG_JAW: