Poison Touch fix

This commit is contained in:
DizzyEggg 2020-04-19 14:43:54 +02:00
parent d5307c3e54
commit c01ed5325c
4 changed files with 60 additions and 51 deletions

View File

@ -12,16 +12,17 @@
#define ABILITYEFFECT_ENDTURN 0x1
#define ABILITYEFFECT_MOVES_BLOCK 0x2
#define ABILITYEFFECT_ABSORBING 0x3
#define ABILITYEFFECT_MOVE_END 0x4
#define ABILITYEFFECT_IMMUNITY 0x5
#define ABILITYEFFECT_FORECAST 0x6
#define ABILITYEFFECT_SYNCHRONIZE 0x7
#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x8
#define ABILITYEFFECT_INTIMIDATE1 0x9
#define ABILITYEFFECT_INTIMIDATE2 0xA
#define ABILITYEFFECT_TRACE1 0xB
#define ABILITYEFFECT_TRACE2 0xC
#define ABILITYEFFECT_MOVE_END_OTHER 0xD
#define ABILITYEFFECT_MOVE_END_ATTACKER 0x4
#define ABILITYEFFECT_MOVE_END 0x5
#define ABILITYEFFECT_IMMUNITY 0x6
#define ABILITYEFFECT_FORECAST 0x7
#define ABILITYEFFECT_SYNCHRONIZE 0x8
#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x9
#define ABILITYEFFECT_INTIMIDATE1 0xA
#define ABILITYEFFECT_INTIMIDATE2 0xB
#define ABILITYEFFECT_TRACE1 0xC
#define ABILITYEFFECT_TRACE2 0xD
#define ABILITYEFFECT_MOVE_END_OTHER 0xE
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
#define ITEMEFFECT_ON_SWITCH_IN 0x0

View File

@ -183,24 +183,25 @@
#define MOVEEND_DEFROST 2
#define MOVEEND_SYNCHRONIZE_TARGET 3
#define MOVEEND_ABILITIES 4
#define MOVEEND_STATUS_IMMUNITY_ABILITIES 5
#define MOVEEND_SYNCHRONIZE_ATTACKER 6
#define MOVEEND_CHOICE_MOVE 7
#define MOVEEND_CHANGED_ITEMS 8
#define MOVEEND_ATTACKER_INVISIBLE 9
#define MOVEEND_ATTACKER_VISIBLE 10
#define MOVEEND_TARGET_VISIBLE 11
#define MOVEEND_ITEM_EFFECTS_TARGET 12
#define MOVEEND_ITEM_EFFECTS_ALL 13
#define MOVEEND_KINGSROCK_SHELLBELL 14
#define MOVEEND_SUBSTITUTE 15
#define MOVEEND_UPDATE_LAST_MOVES 16
#define MOVEEND_MIRROR_MOVE 17
#define MOVEEND_NEXT_TARGET 18
#define MOVEEND_LIFE_ORB 19
#define MOVEEND_DANCER 20
#define MOVEEND_CLEAR_BITS 21
#define MOVEEND_COUNT 22
#define MOVEEND_ABILITIES_ATTACKER 5
#define MOVEEND_STATUS_IMMUNITY_ABILITIES 6
#define MOVEEND_SYNCHRONIZE_ATTACKER 7
#define MOVEEND_CHOICE_MOVE 8
#define MOVEEND_CHANGED_ITEMS 9
#define MOVEEND_ATTACKER_INVISIBLE 10
#define MOVEEND_ATTACKER_VISIBLE 11
#define MOVEEND_TARGET_VISIBLE 12
#define MOVEEND_ITEM_EFFECTS_TARGET 13
#define MOVEEND_ITEM_EFFECTS_ALL 14
#define MOVEEND_KINGSROCK_SHELLBELL 15
#define MOVEEND_SUBSTITUTE 16
#define MOVEEND_UPDATE_LAST_MOVES 17
#define MOVEEND_MIRROR_MOVE 18
#define MOVEEND_NEXT_TARGET 19
#define MOVEEND_LIFE_ORB 20
#define MOVEEND_DANCER 21
#define MOVEEND_CLEAR_BITS 22
#define MOVEEND_COUNT 23
// stat flags for Cmd_playstatchangeanimation
#define BIT_HP 0x1

View File

@ -4528,8 +4528,10 @@ static void Cmd_moveend(void)
case MOVEEND_ABILITIES: // Such as abilities activating on contact(Poison Spore, Rough Skin, etc.).
if (AbilityBattleEffects(ABILITYEFFECT_MOVE_END, gBattlerTarget, 0, 0, 0))
effect = TRUE;
// Poison Touch, possibly other in the future
else if (AbilityBattleEffects(ABILITYEFFECT_MOVE_END, gBattlerAttacker, 0, 0, 0))
gBattleScripting.moveendState++;
break;
case MOVEEND_ABILITIES_ATTACKER: // Poison Touch, possibly other in the future
if (AbilityBattleEffects(ABILITYEFFECT_MOVE_END_ATTACKER, gBattlerAttacker, 0, 0, 0))
effect = TRUE;
gBattleScripting.moveendState++;
break;

View File

@ -3582,27 +3582,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
effect++;
}
break;
case ABILITY_POISON_TOUCH:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gBattleMons[gBattlerTarget].hp != 0
&& !gProtectStructs[gBattlerTarget].confusionSelfDmg
&& !IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_POISON)
&& !IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_STEEL)
&& GetBattlerAbility(gBattlerTarget) != ABILITY_IMMUNITY
&& !(gBattleMons[gBattlerTarget].status1 & STATUS1_ANY)
&& !IsFlowerVeilProtected(gBattlerTarget)
&& !IsLeafGuardProtected(gBattlerTarget)
&& IsMoveMakingContact(move, gBattlerAttacker)
&& (Random() % 3) == 0)
{
gBattleScripting.moveEffect = MOVE_EFFECT_POISON;
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
}
break;
case ABILITY_FLAME_BODY:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gBattleMons[gBattlerAttacker].hp != 0
@ -3654,6 +3633,32 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
break;
}
break;
case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker
switch (gLastUsedAbility)
{
case ABILITY_POISON_TOUCH:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& gBattleMons[gBattlerTarget].hp != 0
&& !gProtectStructs[gBattlerTarget].confusionSelfDmg
&& !IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_POISON)
&& !IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_STEEL)
&& GetBattlerAbility(gBattlerTarget) != ABILITY_IMMUNITY
&& !(gBattleMons[gBattlerTarget].status1 & STATUS1_ANY)
&& !IsFlowerVeilProtected(gBattlerTarget)
&& !IsLeafGuardProtected(gBattlerTarget)
&& IsMoveMakingContact(move, gBattlerAttacker)
&& (Random() % 3) == 0)
{
gBattleScripting.moveEffect = MOVE_EFFECT_POISON;
PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gLastUsedAbility);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AbilityStatusEffect;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
}
break;
}
break;
case ABILITYEFFECT_MOVE_END_OTHER: // Abilities that activate on *another* battler's moveend: Dancer, Soul-Heart, Receiver, Symbiosis
switch (GetBattlerAbility(battler))
{