Fixes and added Poison chance to Shell Side Arm (needs contact on physical)

This commit is contained in:
MissingNoL 2021-05-28 11:11:03 -07:00
parent f30a9542ee
commit 0f09055cfe
4 changed files with 60 additions and 56 deletions

View File

@ -372,9 +372,12 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
BattleScript_EffectShellSideArm:
shellsidearmcheck
setmoveeffect MOVE_EFFECT_POISON
goto BattleScript_EffectHit
BattleScript_EffectPhotonGeyser:
photongeysercheck
goto BattleScript_EffectHit
BattleScript_EffectSleepHit:
setmoveeffect MOVE_EFFECT_SLEEP

View File

@ -7126,55 +7126,6 @@ static void Cmd_various(void)
switch (gBattlescriptCurrInstr[2])
{
case VARIOUS_PHOTON_GEYSER_CHECK:
{
u32 attStat = gBattleMons[gActiveBattler].attack;
u8 atkStage = gBattleMons[gActiveBattler].statStages[STAT_ATK];
u32 spaStat = gBattleMons[gActiveBattler].spAttack;
attStat *= gStatStageRatios[atkStage][0];
attStat /= gStatStageRatios[atkStage][1];
atkStage = gBattleMons[gActiveBattler].statStages[STAT_SPATK];
spaStat *= gStatStageRatios[atkStage][0];
spaStat /= gStatStageRatios[atkStage][1];
if (attStat > spaStat)
gSwapDamageCategory = TRUE;
}
case VARIOUS_SHELL_SIDE_ARM_CHECK: // according to DaWoblefet, 0% chance GameFreak actually checks this way, but this is the only functional explanation at the moment
{
u32 attStat = gBattleMons[gBattlerAttacker].attack;
u8 atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK];
u32 attStatDef = gBattleMons[gBattlerTarget].attack;
u32 physical;
u32 spaStat = gBattleMons[gBattlerAttacker].spAttack;
u32 spaStatDef = gBattleMons[gBattlerTarget].spAttack;
u32 special;
attStat *= gStatStageRatios[atkStage][0];
attStat /= gStatStageRatios[atkStage][1];
atkStage = gBattleMons[gBattlerTarget].statStages[STAT_ATK];
attStatDef *= gStatStageRatios[atkStage][0];
attStatDef /= gStatStageRatios[atkStage][1];
physical = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * attStat) / attStatDef) / 50);
atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK];
spaStat *= gStatStageRatios[atkStage][0];
spaStat /= gStatStageRatios[atkStage][1];
atkStage = gBattleMons[gBattlerTarget].statStages[STAT_SPATK];
spaStatDef *= gStatStageRatios[atkStage][0];
spaStatDef /= gStatStageRatios[atkStage][1];
special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * spaStat) / spaStatDef) / 50);
if (((physical > special) || (physical == special && (Random() % 2) == 0)))
gSwapDamageCategory = TRUE;
}
// Roar will fail in a double wild battle when used by the player against one of the two alive wild mons.
// Also when an opposing wild mon uses it againt its partner.
case VARIOUS_JUMP_IF_ROAR_FAILS:
@ -8429,6 +8380,57 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 7; // exit if loop failed (failsafe)
}
return;
case VARIOUS_PHOTON_GEYSER_CHECK:
{
u32 attStat = gBattleMons[gActiveBattler].attack;
u8 atkStage = gBattleMons[gActiveBattler].statStages[STAT_ATK];
u32 spaStat = gBattleMons[gActiveBattler].spAttack;
attStat *= gStatStageRatios[atkStage][0];
attStat /= gStatStageRatios[atkStage][1];
atkStage = gBattleMons[gActiveBattler].statStages[STAT_SPATK];
spaStat *= gStatStageRatios[atkStage][0];
spaStat /= gStatStageRatios[atkStage][1];
if (attStat > spaStat)
gSwapDamageCategory = TRUE;
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 attStat = gBattleMons[gBattlerAttacker].attack;
u8 atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_ATK];
u32 attStatDef = gBattleMons[gBattlerTarget].attack;
u32 physical;
u32 spaStat = gBattleMons[gBattlerAttacker].spAttack;
u32 spaStatDef = gBattleMons[gBattlerTarget].spAttack;
u32 special;
attStat *= gStatStageRatios[atkStage][0];
attStat /= gStatStageRatios[atkStage][1];
atkStage = gBattleMons[gBattlerTarget].statStages[STAT_ATK];
attStatDef *= gStatStageRatios[atkStage][0];
attStatDef /= gStatStageRatios[atkStage][1];
physical = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * attStat) / attStatDef) / 50);
atkStage = gBattleMons[gBattlerAttacker].statStages[STAT_SPATK];
spaStat *= gStatStageRatios[atkStage][0];
spaStat /= gStatStageRatios[atkStage][1];
atkStage = gBattleMons[gBattlerTarget].statStages[STAT_SPATK];
spaStatDef *= gStatStageRatios[atkStage][0];
spaStatDef /= gStatStageRatios[atkStage][1];
special = ((((2 * gBattleMons[gBattlerAttacker].level / 5 + 2) * 90 * spaStat) / spaStatDef) / 50);
if (((physical > special) || (physical == special && (Random() % 2) == 0)))
gSwapDamageCategory = TRUE;
break;
}
}
gBattlescriptCurrInstr += 3;

View File

@ -8366,12 +8366,11 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
u8 GetBattleMoveSplit(u32 moveId)
{
if (gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky
return SPLIT_PHYSICAL;
if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4)
if (gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky
return SPLIT_PHYSICAL;
else
return gBattleMoves[moveId].split;
else if (gBattleMoves[moveId].type < TYPE_MYSTERY || gSwapDamageCategory == TRUE) // Photon Geyser, Shell Side Arm, Light That Burns the Sky
return gBattleMoves[moveId].split;
else if (gBattleMoves[moveId].type < TYPE_MYSTERY)
return SPLIT_PHYSICAL;
else
return SPLIT_SPECIAL;

View File

@ -10348,7 +10348,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.type = TYPE_PSYCHIC,
.accuracy = 100,
.pp = 5,
.secondaryEffectChance = 100,
.secondaryEffectChance = 0,
.target = MOVE_TARGET_FOES_AND_ALLY,
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_TARGET_ABILITY_IGNORED,
@ -11183,7 +11183,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
.type = TYPE_POISON,
.accuracy = 100,
.pp = 10,
.secondaryEffectChance = 100,
.secondaryEffectChance = 20,
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED,