Implemented Ice Face

Thanks to Benício Gonçalves#3454 who provided a base to work with.
This commit is contained in:
LOuroboros 2022-08-24 13:45:27 -03:00
parent 21fe205f0f
commit b7ca63d151
6 changed files with 96 additions and 4 deletions

View File

@ -7591,6 +7591,44 @@ BattleScript_TargetFormChange::
handleformchange BS_TARGET, 2
return
BattleScript_TargetFormChangeWithString::
pause 5
copybyte gBattlerAbility, gBattlerTarget
call BattleScript_AbilityPopUp
printstring STRINGID_EMPTYSTRING3
waitmessage 1
handleformchange BS_TARGET, 0
handleformchange BS_TARGET, 1
playanimation BS_TARGET, B_ANIM_FORM_CHANGE, NULL
waitanimation
handleformchange BS_TARGET, 2
printstring STRINGID_PKMNTRANSFORMED
waitmessage B_WAIT_TIME_LONG
return
BattleScript_TargetFormChangeWithStringEnd3::
call BattleScript_TargetFormChangeWithString
end3
BattleScript_AttackerFormChangeWithString::
pause 5
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
printstring STRINGID_EMPTYSTRING3
waitmessage 1
handleformchange BS_ATTACKER, 0
handleformchange BS_ATTACKER, 1
playanimation BS_ATTACKER, B_ANIM_FORM_CHANGE, NULL
waitanimation
handleformchange BS_ATTACKER, 2
printstring STRINGID_PKMNTRANSFORMED
waitmessage B_WAIT_TIME_LONG
return
BattleScript_AttackerFormChangeWithStringEnd3::
call BattleScript_AttackerFormChangeWithString
end3
BattleScript_IllusionOff::
spriteignore0hp TRUE
playanimation BS_TARGET, B_ANIM_ILLUSION_OFF
@ -8547,6 +8585,16 @@ BattleScript_SoundproofProtected::
orhalfword gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE
goto BattleScript_MoveEnd
BattleScript_IceFaceNullsDamage::
attackstring
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
call BattleScript_TargetFormChangeWithString
goto BattleScript_MoveEnd
BattleScript_DazzlingProtected::
attackstring
ppreduce

View File

@ -619,6 +619,7 @@ struct BattleStruct
u8 stickyWebUser;
u8 appearedInBattle; // Bitfield to track which Pokemon appeared in battle. Used for Burmy's form change
u8 skyDropTargets[MAX_BATTLERS_COUNT]; // For Sky Drop, to account for if multiple Pokemon use Sky Drop in a double battle.
bool8 allowedToChangeFormInWeather[PARTY_SIZE][2]; // For each party member and side, used by Ice Face.
};
#define F_DYNAMIC_TYPE_1 (1 << 6)

View File

@ -420,6 +420,11 @@ extern const u8 BattleScript_MagicianActivates[];
extern const u8 BattleScript_BeakBlastSetUp[];
extern const u8 BattleScript_BeakBlastBurn[];
extern const u8 BattleScript_DefDownSpeedUp[];
extern const u8 BattleScript_IceFaceNullsDamage[];
extern const u8 BattleScript_TargetFormChangeWithString[];
extern const u8 BattleScript_TargetFormChangeWithStringEnd3[];
extern const u8 BattleScript_AttackerFormChangeWithString[];
extern const u8 BattleScript_AttackerFormChangeWithStringEnd3[];
// zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -2987,10 +2987,12 @@ static void BattleStartClearSetData(void)
for (i = 0; i < PARTY_SIZE; i++)
{
gBattleStruct->usedHeldItems[i][0] = 0;
gBattleStruct->usedHeldItems[i][1] = 0;
gBattleStruct->usedHeldItems[i][B_SIDE_PLAYER] = 0;
gBattleStruct->usedHeldItems[i][B_SIDE_OPPONENT] = 0;
gBattleStruct->itemStolen[i].originalItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
gPartyCriticalHits[i] = 0;
gBattleStruct->allowedToChangeFormInWeather[i][B_SIDE_PLAYER] = 0;
gBattleStruct->allowedToChangeFormInWeather[i][B_SIDE_OPPONENT] = 0;
}
gBattleStruct->swapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky

View File

@ -754,7 +754,6 @@ static const u8 sText_MeteorBeamCharging[] = _("{B_ATK_NAME_WITH_PREFIX} is over
static const u8 sText_HeatingUpBeak[] = _("{B_ATK_NAME_WITH_PREFIX} started\nheating up its beak!");
static const u8 sText_CourtChange[] = _("{B_ATK_NAME_WITH_PREFIX} swapped the battle\neffects affecting each side!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_ZPOWERSURROUNDS - BATTLESTRINGS_TABLE_START] = sText_ZPowerSurrounds,

View File

@ -3999,6 +3999,21 @@ static const u16 sWeatherFlagsInfo[][3] =
[ENUM_WEATHER_STRONG_WINDS] = {B_WEATHER_STRONG_WINDS, B_WEATHER_STRONG_WINDS, HOLD_EFFECT_NONE},
};
static void ShouldChangeFormInWeather(u8 battler)
{
int i;
int side = GetBattlerSide(battler);
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_EISCUE_NOICE_FACE)
gBattleStruct->allowedToChangeFormInWeather[i][side] = 1;
else
gBattleStruct->allowedToChangeFormInWeather[i][side] = 0;
}
}
bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
{
u16 battlerAbility = GetBattlerAbility(battler);
@ -4007,6 +4022,7 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
&& !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1]))
{
gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]);
ShouldChangeFormInWeather(battler);
return TRUE;
}
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY
@ -4023,7 +4039,7 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
gWishFutureKnock.weatherDuration = 8;
else
gWishFutureKnock.weatherDuration = 5;
ShouldChangeFormInWeather(battler);
return TRUE;
}
@ -4862,6 +4878,18 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect++;
}
break;
case ABILITY_ICE_FACE:
if (IsBattlerWeatherAffected(battler, B_WEATHER_HAIL)
&& gBattleMons[battler].species == SPECIES_EISCUE_NOICE_FACE
&& !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
&& gBattleStruct->allowedToChangeFormInWeather[gBattlerPartyIndexes[battler]][GetBattlerSide(battler)])
{
gBattleStruct->allowedToChangeFormInWeather[gBattlerPartyIndexes[battler]][GetBattlerSide(battler)] = 0;
gBattleMons[battler].species = SPECIES_EISCUE;
gBattleScripting.battler = battler; // For STRINGID_PKMNTRANSFORMED
BattleScriptPushCursorAndCallback(BattleScript_AttackerFormChangeWithStringEnd3);
effect++;
}
}
}
break;
@ -4898,6 +4926,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster;
effect = 1;
}
else if (gLastUsedAbility == ABILITY_ICE_FACE && IS_MOVE_PHYSICAL(move) && gBattleMons[gBattlerTarget].species == SPECIES_EISCUE)
{
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