Fix Ice Face ignoring move effects (#3755)

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
DizzyEggg 2023-12-18 16:02:07 +01:00 committed by GitHub
parent 64f8635496
commit 59a159c338
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 16 deletions

View file

@ -9096,14 +9096,8 @@ BattleScript_SoundproofProtected::
goto BattleScript_MoveEnd
BattleScript_IceFaceNullsDamage::
attackstring
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
call BattleScript_TargetFormChangeWithString
goto BattleScript_MoveEnd
return
BattleScript_DazzlingProtected::
attackstring

View file

@ -59,6 +59,7 @@ struct ResourceFlags
#define RESOURCE_FLAG_TRACED 0x10
#define RESOURCE_FLAG_EMERGENCY_EXIT 0x20
#define RESOURCE_FLAG_NEUTRALIZING_GAS 0x40
#define RESOURCE_FLAG_ICE_FACE 0x80
struct DisableStruct
{

View file

@ -2016,6 +2016,16 @@ static void Cmd_adjustdamage(void)
gBattleStruct->enduredDamage |= gBitTable[gBattlerTarget];
goto END;
}
if (GetBattlerAbility(gBattlerTarget) == ABILITY_ICE_FACE && IS_MOVE_PHYSICAL(gCurrentMove) && gBattleMons[gBattlerTarget].species == SPECIES_EISCUE)
{
// Damage deals typeless 0 HP.
gMoveResultFlags &= ~(MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE);
gBattleMoveDamage = 0;
RecordAbilityBattle(gBattlerTarget, ABILITY_ICE_FACE);
gBattleResources->flags->flags[gBattlerTarget] |= RESOURCE_FLAG_ICE_FACE;
// Form change will be done after attack animation in Cmd_resultmessage.
goto END;
}
if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage)
goto END;
@ -2483,6 +2493,17 @@ static void Cmd_resultmessage(void)
if (gBattleControllerExecFlags)
return;
// Do Ice Face form change which was set up in Cmd_adjustdamage.
if (gBattleResources->flags->flags[gBattlerTarget] & RESOURCE_FLAG_ICE_FACE)
{
gBattleResources->flags->flags[gBattlerTarget] &= ~(RESOURCE_FLAG_ICE_FACE);
gBattleMons[gBattlerTarget].species = SPECIES_EISCUE_NOICE_FACE;
gBattleScripting.battler = gBattlerTarget; // For STRINGID_PKMNTRANSFORMED
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_IceFaceNullsDamage;
return;
}
if (gMoveResultFlags & MOVE_RESULT_MISSED && (!(gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE) || gBattleCommunication[MISS_TYPE] > B_MSG_AVOIDED_ATK))
{
if (gBattleCommunication[MISS_TYPE] > B_MSG_AVOIDED_ATK) // Wonder Guard or Levitate - show the ability pop-up

View file

@ -5061,15 +5061,6 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
gBattlescriptCurrInstr = BattleScript_GoodAsGoldActivates;
effect = 1;
}
else if (gLastUsedAbility == ABILITY_ICE_FACE && IS_MOVE_PHYSICAL(move) && gBattleMons[gBattlerTarget].species == SPECIES_EISCUE_ICE_FACE)
{
gBattleMons[gBattlerTarget].species = SPECIES_EISCUE_NOICE_FACE;
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)
gHitMarker |= HITMARKER_NO_PPDEDUCT;
gBattleScripting.battler = gBattlerTarget; // For STRINGID_PKMNTRANSFORMED
gBattlescriptCurrInstr = BattleScript_IceFaceNullsDamage;
effect = 1;
}
break;
}
case ABILITYEFFECT_ABSORBING: // 3

View file

@ -94,3 +94,21 @@ SINGLE_BATTLE_TEST("U-turn switches the user out if Wimp Out fails to activate")
MESSAGE("Your foe's weak! Get 'em, Wynaut!");
}
}
SINGLE_BATTLE_TEST("U-turn switches the user out after Ice Face activates")
{
GIVEN {
ASSUME(P_GEN_8_POKEMON == TRUE);
PLAYER(SPECIES_BEEDRILL);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_EISCUE) { Ability(ABILITY_ICE_FACE); }
} WHEN {
TURN { MOVE(player, MOVE_U_TURN); SEND_OUT(player, 1); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_U_TURN, player);
HP_BAR(opponent);
ABILITY_POPUP(opponent, ABILITY_ICE_FACE);
MESSAGE("Foe Eiscue transformed!");
MESSAGE("Go! Wynaut!");
}
}