mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
move gSwapDamagecategory to battle struct, use GetSplitBasedOnStats for photon geyser check
This commit is contained in:
parent
f2ee9f3ba0
commit
2b5bb9f6e4
@ -1928,8 +1928,8 @@
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro photongeysercheck
|
||||
various BS_ATTACKER, VARIOUS_PHOTON_GEYSER_CHECK
|
||||
.macro photongeysercheck battler:req
|
||||
various \battler, VARIOUS_PHOTON_GEYSER_CHECK
|
||||
.endm
|
||||
|
||||
.macro shellsidearmcheck
|
||||
|
@ -722,7 +722,7 @@ BattleScript_EffectPhotonGeyser:
|
||||
critcalc
|
||||
damagecalc
|
||||
adjustdamage
|
||||
photongeysercheck
|
||||
photongeysercheck BS_ATTACKER
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
|
@ -615,6 +615,7 @@ struct BattleStruct
|
||||
u8 quickClawBattlerId;
|
||||
struct StolenItem itemStolen[PARTY_SIZE]; // Player's team that had items stolen (two bytes per party member)
|
||||
u8 blunderPolicy:1; // should blunder policy activate
|
||||
u8 swapDamageCategory:1;
|
||||
u8 ballSpriteIds[2]; // item gfx, window gfx
|
||||
u8 stickyWebUser;
|
||||
u8 appearedInBattle; // Bitfield to track which Pokemon appeared in battle. Used for Burmy's form change
|
||||
@ -938,7 +939,6 @@ extern u8 gBattleControllerData[MAX_BATTLERS_COUNT];
|
||||
extern bool8 gHasFetchedBall;
|
||||
extern u8 gLastUsedBall;
|
||||
extern u16 gLastThrownBall;
|
||||
extern bool8 gSwapDamageCategory; // Photon Geyser, Shell Side Arm, Light That Burns the Sky
|
||||
extern u8 gPartyCriticalHits[PARTY_SIZE];
|
||||
|
||||
#endif // GUARD_BATTLE_H
|
||||
|
@ -7867,7 +7867,7 @@ void AnimTask_PrimalReversion(u8 taskId)
|
||||
|
||||
void AnimTask_ShellSideArm(u8 taskId)
|
||||
{
|
||||
if (gSwapDamageCategory)
|
||||
if (gBattleStruct->swapDamageCategory)
|
||||
gBattleAnimArgs[0] = TRUE;
|
||||
else
|
||||
gBattleAnimArgs[0] = FALSE;
|
||||
|
@ -239,7 +239,6 @@ EWRAM_DATA struct TotemBoost gTotemBoosts[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA bool8 gHasFetchedBall = FALSE;
|
||||
EWRAM_DATA u8 gLastUsedBall = 0;
|
||||
EWRAM_DATA u16 gLastThrownBall = 0;
|
||||
EWRAM_DATA bool8 gSwapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky
|
||||
EWRAM_DATA u8 gPartyCriticalHits[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA static u8 sTriedEvolving = 0;
|
||||
|
||||
@ -3007,7 +3006,7 @@ static void BattleStartClearSetData(void)
|
||||
gPartyCriticalHits[i] = 0;
|
||||
}
|
||||
|
||||
gSwapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky
|
||||
gBattleStruct->swapDamageCategory = FALSE; // Photon Geyser, Shell Side Arm, Light That Burns the Sky
|
||||
}
|
||||
|
||||
void SwitchInClearSetData(void)
|
||||
|
@ -9404,24 +9404,8 @@ static void Cmd_various(void)
|
||||
gBattlescriptCurrInstr += 9;
|
||||
return;
|
||||
case VARIOUS_PHOTON_GEYSER_CHECK:
|
||||
{
|
||||
u32 attackerAtkStat = gBattleMons[gBattlerAttacker].attack;
|
||||
u8 attackerAtkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK];
|
||||
u32 attackerSpAtkStat = gBattleMons[gBattlerAttacker].spAttack;
|
||||
|
||||
gSwapDamageCategory = FALSE;
|
||||
|
||||
attackerAtkStat *= gStatStageRatios[attackerAtkStage][0];
|
||||
attackerAtkStat /= gStatStageRatios[attackerAtkStage][1];
|
||||
|
||||
attackerAtkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK];
|
||||
attackerSpAtkStat *= gStatStageRatios[attackerAtkStage][0];
|
||||
attackerSpAtkStat /= gStatStageRatios[attackerAtkStage][1];
|
||||
|
||||
if (attackerAtkStat > attackerSpAtkStat)
|
||||
gSwapDamageCategory = TRUE;
|
||||
gBattleStruct->swapDamageCategory = (GetSplitBasedOnStats(gActiveBattler) == SPLIT_SPECIAL);
|
||||
break;
|
||||
}
|
||||
case VARIOUS_SHELL_SIDE_ARM_CHECK: // 0% chance GameFreak actually checks this way according to DaWobblefet, but this is the only functional explanation at the moment
|
||||
{
|
||||
u32 attackerAtkStat = gBattleMons[gBattlerAttacker].attack;
|
||||
@ -9432,7 +9416,7 @@ static void Cmd_various(void)
|
||||
u32 physical;
|
||||
u32 special;
|
||||
|
||||
gSwapDamageCategory = FALSE;
|
||||
gBattleStruct->swapDamageCategory = FALSE;
|
||||
|
||||
statStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK];
|
||||
attackerAtkStat *= gStatStageRatios[statStage][0];
|
||||
@ -9455,7 +9439,7 @@ static void Cmd_various(void)
|
||||
special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * gBattleMoves[gCurrentMove].power * attackerSpAtkStat) / targetSpDefStat) / 50);
|
||||
|
||||
if (((physical > special) || (physical == special && (Random() % 2) == 0)))
|
||||
gSwapDamageCategory = TRUE;
|
||||
gBattleStruct->swapDamageCategory = TRUE;
|
||||
break;
|
||||
}
|
||||
case VARIOUS_JUMP_IF_LEAF_GUARD_PROTECTED:
|
||||
|
@ -7740,7 +7740,7 @@ bool32 IsMoveMakingContact(u16 move, u8 battlerAtk)
|
||||
{
|
||||
if (!(gBattleMoves[move].flags & FLAG_MAKES_CONTACT))
|
||||
{
|
||||
if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gSwapDamageCategory)
|
||||
if (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->swapDamageCategory)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -7773,7 +7773,7 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
|
||||
// Protective Pads doesn't stop Unseen Fist from bypassing Protect effects, so IsMoveMakingContact() isn't used here.
|
||||
// This means extra logic is needed to handle Shell Side Arm.
|
||||
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_UNSEEN_FIST
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT || (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gSwapDamageCategory)))
|
||||
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT || (gBattleMoves[move].effect == EFFECT_SHELL_SIDE_ARM && gBattleStruct->swapDamageCategory)))
|
||||
return FALSE;
|
||||
else if (!(gBattleMoves[move].flags & FLAG_PROTECT_AFFECTED))
|
||||
return FALSE;
|
||||
@ -9685,7 +9685,7 @@ u8 GetBattleMoveSplit(u32 moveId)
|
||||
{
|
||||
if (gBattleStruct != NULL && gBattleStruct->zmove.active && !IS_MOVE_STATUS(moveId))
|
||||
return gBattleStruct->zmove.activeSplit;
|
||||
if (gSwapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky
|
||||
if (gBattleStruct != NULL && gBattleStruct->swapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky
|
||||
return SPLIT_PHYSICAL;
|
||||
else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4)
|
||||
return gBattleMoves[moveId].split;
|
||||
|
Loading…
Reference in New Issue
Block a user