pokecrystal-board/engine/battle/ai/redundant.asm

199 lines
3.6 KiB
NASM
Raw Normal View History

2015-12-13 11:15:16 -08:00
AI_Redundant: ; 2c41a
; Check if move effect c will fail because it's already been used.
; Return z if the move is a good choice.
; Return nz if the move is a bad choice.
ld a, c
ld de, 3
ld hl, .Moves
call IsInArray
jp nc, .NotRedundant
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
2015-12-13 11:15:16 -08:00
.Moves: ; 2c42c
dbw EFFECT_DREAM_EATER, .DreamEater
dbw EFFECT_HEAL, .Heal
dbw EFFECT_LIGHT_SCREEN, .LightScreen
dbw EFFECT_MIST, .Mist
dbw EFFECT_FOCUS_ENERGY, .FocusEnergy
dbw EFFECT_CONFUSE, .Confuse
dbw EFFECT_TRANSFORM, .Transform
dbw EFFECT_REFLECT, .Reflect
dbw EFFECT_SUBSTITUTE, .Substitute
dbw EFFECT_LEECH_SEED, .LeechSeed
dbw EFFECT_DISABLE, .Disable
dbw EFFECT_ENCORE, .Encore
dbw EFFECT_SNORE, .Snore
dbw EFFECT_SLEEP_TALK, .SleepTalk
dbw EFFECT_MEAN_LOOK, .MeanLook
dbw EFFECT_NIGHTMARE, .Nightmare
dbw EFFECT_SPIKES, .Spikes
dbw EFFECT_FORESIGHT, .Foresight
dbw EFFECT_PERISH_SONG, .PerishSong
dbw EFFECT_SANDSTORM, .Sandstorm
dbw EFFECT_ATTRACT, .Attract
dbw EFFECT_SAFEGUARD, .Safeguard
dbw EFFECT_RAIN_DANCE, .RainDance
dbw EFFECT_SUNNY_DAY, .SunnyDay
dbw EFFECT_TELEPORT, .Teleport
dbw EFFECT_MORNING_SUN, .MorningSun
dbw EFFECT_SYNTHESIS, .Synthesis
dbw EFFECT_MOONLIGHT, .Moonlight
dbw EFFECT_SWAGGER, .Swagger
dbw EFFECT_FUTURE_SIGHT, .FutureSight
db -1
.LightScreen: ; 2c487
2018-01-23 14:39:09 -08:00
ld a, [wEnemyScreens]
2015-12-13 11:15:16 -08:00
bit SCREENS_LIGHT_SCREEN, a
ret
.Mist: ; 2c48d
2018-01-23 14:39:09 -08:00
ld a, [wEnemySubStatus4]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_MIST, a
ret
.FocusEnergy: ; 2c493
2018-01-23 14:39:09 -08:00
ld a, [wEnemySubStatus4]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_FOCUS_ENERGY, a
ret
.Confuse: ; 2c499
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus3]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_CONFUSED, a
ret nz
2018-01-23 14:39:09 -08:00
ld a, [wPlayerScreens]
2015-12-13 11:15:16 -08:00
bit SCREENS_SAFEGUARD, a
ret
.Transform: ; 2c4a5
2018-01-23 14:39:09 -08:00
ld a, [wEnemySubStatus5]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_TRANSFORMED, a
ret
.Reflect: ; 2c4ab
2018-01-23 14:39:09 -08:00
ld a, [wEnemyScreens]
2015-12-13 11:15:16 -08:00
bit SCREENS_REFLECT, a
ret
.Substitute: ; 2c4b1
2018-01-23 14:39:09 -08:00
ld a, [wEnemySubStatus4]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_SUBSTITUTE, a
ret
.LeechSeed: ; 2c4b7
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus4]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_LEECH_SEED, a
ret
.Disable: ; 2c4bd
2018-01-23 14:39:09 -08:00
ld a, [wPlayerDisableCount]
2015-12-13 11:15:16 -08:00
and a
ret
.Encore: ; 2c4c2
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus5]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_ENCORED, a
ret
.Snore:
.SleepTalk: ; 2c4c8
2018-01-23 14:39:09 -08:00
ld a, [wEnemyMonStatus]
2015-12-13 11:15:16 -08:00
and SLP
jr z, .Redundant
jr .NotRedundant
.MeanLook: ; 2c4d1
2018-01-23 14:39:09 -08:00
ld a, [wEnemySubStatus5]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_CANT_RUN, a
ret
.Nightmare: ; 2c4d7
2018-01-23 14:39:09 -08:00
ld a, [wBattleMonStatus]
2015-12-13 11:15:16 -08:00
and a
jr z, .Redundant
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus1]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_NIGHTMARE, a
ret
.Spikes: ; 2c4e3
2018-01-23 14:39:09 -08:00
ld a, [wPlayerScreens]
2015-12-13 11:15:16 -08:00
bit SCREENS_SPIKES, a
ret
.Foresight: ; 2c4e9
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus1]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_IDENTIFIED, a
ret
.PerishSong: ; 2c4ef
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus1]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_PERISH, a
ret
.Sandstorm: ; 2c4f5
ld a, [wBattleWeather]
2015-12-13 11:15:16 -08:00
cp WEATHER_SANDSTORM
jr z, .Redundant
jr .NotRedundant
.Attract: ; 2c4fe
2017-12-24 09:47:30 -08:00
farcall CheckOppositeGender
2015-12-13 11:15:16 -08:00
jr c, .Redundant
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus1]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_IN_LOVE, a
ret
.Safeguard: ; 2c50c
2018-01-23 14:39:09 -08:00
ld a, [wEnemyScreens]
2015-12-13 11:15:16 -08:00
bit SCREENS_SAFEGUARD, a
ret
.RainDance: ; 2c512
ld a, [wBattleWeather]
2015-12-13 11:15:16 -08:00
cp WEATHER_RAIN
jr z, .Redundant
jr .NotRedundant
.SunnyDay: ; 2c51b
ld a, [wBattleWeather]
2015-12-13 11:15:16 -08:00
cp WEATHER_SUN
jr z, .Redundant
jr .NotRedundant
.DreamEater: ; 2c524
2018-01-23 14:39:09 -08:00
ld a, [wBattleMonStatus]
2015-12-13 11:15:16 -08:00
and SLP
jr z, .Redundant
jr .NotRedundant
.Swagger: ; 2c52d
2018-01-23 14:39:09 -08:00
ld a, [wPlayerSubStatus3]
2015-12-13 11:15:16 -08:00
bit SUBSTATUS_CONFUSED, a
ret
.FutureSight: ; 2c533
2018-01-23 14:39:09 -08:00
ld a, [wEnemyScreens]
2015-12-13 11:15:16 -08:00
bit 5, a
ret
.Heal:
.MorningSun:
.Synthesis:
.Moonlight: ; 2c539
2017-12-24 09:47:30 -08:00
farcall AICheckEnemyMaxHP
2015-12-13 11:15:16 -08:00
jr nc, .NotRedundant
.Teleport:
.Redundant: ; 2c541
ld a, 1
and a
ret
.NotRedundant: ; 2c545
xor a
ret