Another small condition fix and small optimization
-Checking for IsBattlerAlive is incorrect because Gulp Missile's counterattack should happen even if Cramorant faints. -Made the code a bit more readable.
This commit is contained in:
parent
ceffaa4e76
commit
e783cde387
1 changed files with 26 additions and 31 deletions
|
@ -4985,44 +4985,39 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ABILITY_GULP_MISSILE:
|
case ABILITY_GULP_MISSILE:
|
||||||
gBattlerAttacker = battler;
|
|
||||||
gBattlerTarget = BATTLE_OPPOSITE(battler);
|
|
||||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||||
&& TARGET_TURN_DAMAGED
|
&& TARGET_TURN_DAMAGED)
|
||||||
&& IsBattlerAlive(gBattlerAttacker)
|
|
||||||
&& gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GORGING)
|
|
||||||
{
|
{
|
||||||
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species;
|
if (gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GORGING)
|
||||||
gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT;
|
|
||||||
if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
|
||||||
{
|
{
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4;
|
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species;
|
||||||
if (gBattleMoveDamage == 0)
|
gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT;
|
||||||
gBattleMoveDamage = 1;
|
if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
||||||
|
{
|
||||||
|
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4;
|
||||||
|
if (gBattleMoveDamage == 0)
|
||||||
|
gBattleMoveDamage = 1;
|
||||||
|
}
|
||||||
|
BattleScriptPushCursor();
|
||||||
|
gBattlescriptCurrInstr = BattleScript_GulpMissileGorging;
|
||||||
|
effect++;
|
||||||
}
|
}
|
||||||
BattleScriptPushCursor();
|
else if (gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GULPING)
|
||||||
gBattlescriptCurrInstr = BattleScript_GulpMissileGorging;
|
|
||||||
effect++;
|
|
||||||
}
|
|
||||||
else if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
|
||||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
|
||||||
&& TARGET_TURN_DAMAGED
|
|
||||||
&& IsBattlerAlive(gBattlerAttacker)
|
|
||||||
&& gBattleMons[gBattlerTarget].species == SPECIES_CRAMORANT_GULPING)
|
|
||||||
{
|
|
||||||
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species;
|
|
||||||
gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT;
|
|
||||||
if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
|
||||||
{
|
{
|
||||||
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4;
|
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerTarget]] = gBattleMons[gBattlerTarget].species;
|
||||||
if (gBattleMoveDamage == 0)
|
gBattleMons[gBattlerTarget].species = SPECIES_CRAMORANT;
|
||||||
gBattleMoveDamage = 1;
|
if (GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
||||||
|
{
|
||||||
|
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 4;
|
||||||
|
if (gBattleMoveDamage == 0)
|
||||||
|
gBattleMoveDamage = 1;
|
||||||
|
}
|
||||||
|
SET_STATCHANGER(STAT_DEF, 1, TRUE);
|
||||||
|
BattleScriptPushCursor();
|
||||||
|
gBattlescriptCurrInstr = BattleScript_GulpMissileGulping;
|
||||||
|
effect++;
|
||||||
}
|
}
|
||||||
SET_STATCHANGER(STAT_DEF, 1, TRUE);
|
|
||||||
BattleScriptPushCursor();
|
|
||||||
gBattlescriptCurrInstr = BattleScript_GulpMissileGulping;
|
|
||||||
effect++;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue