Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Ice Face ignoring move effects #3755

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
21 changes: 21 additions & 0 deletions src/battle_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions src/battle_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions test/battle/move_effect/hit_escape.c
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
}
Loading