Merge pull request #2255 from LOuroboros/iceFaceRedux

Implemented Ice Face
This commit is contained in:
ghoulslash 2023-01-09 17:24:33 -05:00 committed by GitHub
commit 5eb62199cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 83 additions and 1 deletions

View File

@ -7807,6 +7807,35 @@ 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_BattlerFormChangeWithStringEnd3::
pause 5
call BattleScript_AbilityPopUp
printstring STRINGID_EMPTYSTRING3
waitmessage 1
handleformchange BS_SCRIPTING, 0
handleformchange BS_SCRIPTING, 1
playanimation BS_SCRIPTING, B_ANIM_FORM_CHANGE, NULL
waitanimation
handleformchange BS_SCRIPTING, 2
printstring STRINGID_PKMNTRANSFORMED
waitmessage B_WAIT_TIME_LONG
end3
BattleScript_IllusionOff::
spriteignore0hp TRUE
playanimation BS_TARGET, B_ANIM_ILLUSION_OFF
@ -8871,6 +8900,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

@ -656,6 +656,7 @@ struct BattleStruct
u8 beatUpSlot:3;
u8 targetsDone[MAX_BATTLERS_COUNT]; // Each battler as a bit.
u16 overwrittenAbilities[MAX_BATTLERS_COUNT]; // abilities overwritten during battle (keep separate from battle history in case of switching)
bool8 allowedToChangeFormInWeather[PARTY_SIZE][2]; // For each party member and side, used by Ice Face.
};
#define F_DYNAMIC_TYPE_1 (1 << 6)

View File

@ -449,6 +449,8 @@ extern const u8 BattleScript_CostarActivates[];
extern const u8 BattleScript_ToxicDebrisActivates[];
extern const u8 BattleScript_EarthEaterActivates[];
extern const u8 BattleScript_MimicryActivates_End3[];
extern const u8 BattleScript_IceFaceNullsDamage[];
extern const u8 BattleScript_BattlerFormChangeWithStringEnd3[];
// zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -3047,6 +3047,8 @@ static void BattleStartClearSetData(void)
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] = FALSE;
gBattleStruct->allowedToChangeFormInWeather[i][B_SIDE_OPPONENT] = FALSE;
}
gBattleStruct->swapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky

View File

@ -4141,6 +4141,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] = TRUE;
else
gBattleStruct->allowedToChangeFormInWeather[i][side] = FALSE;
}
}
bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
{
u16 battlerAbility = GetBattlerAbility(battler);
@ -4156,6 +4171,7 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
else if (viaAbility && !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1]))
{
gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]);
ShouldChangeFormInWeather(battler);
return TRUE;
}
#endif
@ -4166,7 +4182,7 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
gWishFutureKnock.weatherDuration = 8;
else
gWishFutureKnock.weatherDuration = 5;
ShouldChangeFormInWeather(battler);
return TRUE;
}
@ -5136,6 +5152,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
gBattlescriptCurrInstr = BattleScript_GoodAsGoldActivates;
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
@ -6156,6 +6181,18 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
*(&gBattleStruct->formToChangeInto) = effect - 1;
}
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)] = FALSE;
gBattleMons[battler].species = SPECIES_EISCUE;
BattleScriptPushCursorAndCallback(BattleScript_BattlerFormChangeWithStringEnd3);
effect++;
}
break;
case ABILITY_PROTOSYNTHESIS:
if (!gSpecialStatuses[battler].weatherAbilityDone && IsBattlerWeatherAffected(battler, B_WEATHER_SUN))
{
@ -10088,6 +10125,7 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
static const u16 species[][3] =
{
// Changed Form ID Default Form ID Should change on switch
{SPECIES_EISCUE_NOICE_FACE, SPECIES_EISCUE, TRUE},
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU, FALSE},
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND, FALSE},
{SPECIES_MELOETTA_PIROUETTE, SPECIES_MELOETTA, FALSE},