Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AI_Status:
- ; Dismiss status moves that don't affect the player.
- ld hl, wEnemyAIMoveScores - 1
- ld de, wEnemyMonMoves
- ld b, NUM_MOVES + 1
- .checkmove
- dec b
- ret z
- ld c, 0 ; Cleaning register c.
- inc hl
- ld a, [de]
- and a
- ret z
- inc de
- call AIGetEnemyMove
- ld a, [wEnemyMoveStruct + MOVE_EFFECT]
- cp EFFECT_TOXIC
- jr z, .poisonimmunity
- cp EFFECT_POISON
- jr z, .poisonimmunity
- cp EFFECT_SLEEP
- jr z, .typeimmunity
- cp EFFECT_PARALYZE
- jr z, .typeimmunity
- ; Discourage moves that inflict status ailments, confuse or lower stats
- ; against a subtitute.
- ; This check also applies for both Leech Seed and Swagger.
- cp EFFECT_LEECH_SEED
- jr z, .subs_check
- cp EFFECT_SWAGGER
- jr z, .subs_check
- cp EFFECT_CONFUSE
- jr z, .subs_check
- ; Stat-lowering moves
- cp EFFECT_ATTACK_DOWN
- jr c, .powercheck
- cp EFFECT_EVASION_DOWN + 1
- jr c, .subs_check
- cp EFFECT_ATTACK_DOWN_2
- jr c, .powercheck
- cp EFFECT_EVASION_DOWN_2 + 1
- jr c, .subs_check
- .powercheck
- ld a, [wEnemyMoveStruct + MOVE_POWER]
- and a
- ld c, a ; Store Move's Power in c.
- jr z, .checkmove
- jr .typeimmunity
- .poisonimmunity
- ld a, [wBattleMonType1]
- cp POISON
- jr z, .immune
- ld a, [wBattleMonType2]
- cp POISON
- jr z, .immune
- .typeimmunity
- push hl
- push bc
- push de
- ld a, 1
- ldh [hBattleTurn], a
- callfar BattleCheckTypeMatchup
- pop de
- pop bc
- pop hl
- ld a, [wTypeMatchup]
- and a
- jr z, .immune
- ; fallthrough
- ; ** Substitute check goes here **
- .subs_check
- ld a, BATTLE_VARS_SUBSTATUS4_OPP
- call GetBattleVar
- bit SUBSTATUS_SUBSTITUTE, a
- jp z, .checkmove
- ld a, c ; Load Move's Power back into a.
- and a
- jp nz, .checkmove
- .immune
- call AIDiscourageMove
- jp .checkmove
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement