mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Fix Corrosion, Poison Touch
- CanBePoisoned now calls CanPoisonType instead of overriding it. Poison Touch now activates only if the attacker actually damaged the target. Partially implemented Pastel Veil.
This commit is contained in:
parent
6b65ef5bcf
commit
52054e4bfe
@ -167,7 +167,7 @@ bool32 IsEntrainmentBannedAbilityAttacker(u16 ability);
|
||||
bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability);
|
||||
|
||||
bool32 CanSleep(u8 battlerId);
|
||||
bool32 CanBePoisoned(u8 battlerId);
|
||||
bool32 CanBePoisoned(u8 gBattlerAttacker, u8 battlerTarget);
|
||||
bool32 CanBeBurned(u8 battlerId);
|
||||
bool32 CanBeParalyzed(u8 battlerId);
|
||||
bool32 CanBeFrozen(u8 battlerId);
|
||||
|
@ -2616,7 +2616,7 @@ bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move,
|
||||
bool32 AI_CanBePoisoned(u8 battler, u16 ability)
|
||||
{
|
||||
if (ability == ABILITY_IMMUNITY
|
||||
|| ability == ABILITY_PASTEL_VEIL
|
||||
|| IsAbilityOnSide(battler, ABILITY_PASTEL_VEIL)
|
||||
|| gBattleMons[battler].status1 & STATUS1_ANY
|
||||
|| IsAbilityStatusProtected(battler)
|
||||
|| gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_SAFEGUARD)
|
||||
|
@ -2682,9 +2682,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_STATUS_HAD_NO_EFFECT;
|
||||
RESET_RETURN
|
||||
}
|
||||
if (!CanPoisonType(gBattleScripting.battler, gEffectBattler))
|
||||
break;
|
||||
if (!CanBePoisoned(gEffectBattler))
|
||||
if (!CanBePoisoned(gBattleScripting.battler, gEffectBattler))
|
||||
break;
|
||||
|
||||
statusChanged = TRUE;
|
||||
@ -2809,11 +2807,8 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||
}
|
||||
if (gBattleMons[gEffectBattler].status1)
|
||||
break;
|
||||
if (CanPoisonType(gBattleScripting.battler, gEffectBattler))
|
||||
if (CanBePoisoned(gBattleScripting.battler, gEffectBattler))
|
||||
{
|
||||
if (!CanBePoisoned(gEffectBattler))
|
||||
break;
|
||||
|
||||
// It's redundant, because at this point we know the status1 value is 0.
|
||||
gBattleMons[gEffectBattler].status1 &= ~(STATUS1_TOXIC_POISON);
|
||||
gBattleMons[gEffectBattler].status1 &= ~(STATUS1_POISON);
|
||||
@ -7257,9 +7252,8 @@ static void HandleTerrainMove(u32 moveEffect)
|
||||
|
||||
bool32 CanPoisonType(u8 battlerAttacker, u8 battlerTarget)
|
||||
{
|
||||
return (GetBattlerAbility(battlerAttacker) == ABILITY_CORROSION
|
||||
|| !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON)
|
||||
|| IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL)));
|
||||
return ((GetBattlerAbility(battlerAttacker) == ABILITY_CORROSION && gBattleMoves[gCurrentMove].split == SPLIT_STATUS)
|
||||
|| !(IS_BATTLER_OF_TYPE(battlerTarget, TYPE_POISON) || IS_BATTLER_OF_TYPE(battlerTarget, TYPE_STEEL)));
|
||||
}
|
||||
|
||||
bool32 CanParalyzeType(u8 battlerAttacker, u8 battlerTarget)
|
||||
|
@ -4961,7 +4961,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
&& gBattleMons[gBattlerAttacker].hp != 0
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& CanBePoisoned(gBattlerAttacker)
|
||||
&& CanBePoisoned(gBattlerAttacker, gBattlerTarget)
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker)
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
@ -5148,8 +5148,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& gBattleMons[gBattlerTarget].hp != 0
|
||||
&& !gProtectStructs[gBattlerTarget].confusionSelfDmg
|
||||
&& CanBePoisoned(gBattlerTarget)
|
||||
&& CanBePoisoned(gBattlerAttacker, gBattlerTarget)
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker)
|
||||
&& TARGET_TURN_DAMAGED // Need to actually hit the target
|
||||
&& (Random() % 3) == 0)
|
||||
{
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_POISON;
|
||||
@ -5589,18 +5590,19 @@ bool32 CanSleep(u8 battlerId)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 CanBePoisoned(u8 battlerId)
|
||||
bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget)
|
||||
{
|
||||
u16 ability = GetBattlerAbility(battlerId);
|
||||
if (IS_BATTLER_OF_TYPE(battlerId, TYPE_POISON)
|
||||
|| IS_BATTLER_OF_TYPE(battlerId, TYPE_STEEL)
|
||||
|| gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD
|
||||
|| gBattleMons[battlerId].status1 & STATUS1_ANY
|
||||
u16 ability = GetBattlerAbility(battlerTarget);
|
||||
|
||||
if (!(CanPoisonType(battlerAttacker, battlerTarget))
|
||||
|| gSideStatuses[GetBattlerSide(battlerTarget)] & SIDE_STATUS_SAFEGUARD
|
||||
|| gBattleMons[battlerTarget].status1 & STATUS1_ANY
|
||||
|| ability == ABILITY_IMMUNITY
|
||||
|| ability == ABILITY_COMATOSE
|
||||
|| gBattleMons[battlerId].status1 & STATUS1_ANY
|
||||
|| IsAbilityStatusProtected(battlerId)
|
||||
|| IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN))
|
||||
|| IsAbilityOnSide(battlerTarget, ABILITY_PASTEL_VEIL)
|
||||
|| gBattleMons[battlerTarget].status1 & STATUS1_ANY
|
||||
|| IsAbilityStatusProtected(battlerTarget)
|
||||
|| IsBattlerTerrainAffected(battlerTarget, STATUS_FIELD_MISTY_TERRAIN))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user