This commit is contained in:
Llinos Evans 2025-07-25 17:31:12 +01:00
parent 178cfd2f2d
commit 919250bd73
67 changed files with 94 additions and 1035 deletions

View file

@ -387,8 +387,6 @@ AI_Smart_EffectHandlers:
dbw EFFECT_SOLARBEAM, AI_Smart_Solarbeam
dbw EFFECT_THUNDER, AI_Smart_Thunder
dbw EFFECT_FLY, AI_Smart_Fly
dbw EFFECT_SURF, AI_Smart_Surf
dbw EFFECT_WHIRLPOOL, AI_Smart_Whirlpool
db -1 ; end
AI_Smart_Sleep:
@ -1139,19 +1137,15 @@ AI_Smart_SpDefenseUp2:
ret
AI_Smart_Fly:
; Fly, Dig, Dive, Bounce
; Fly, Dig
; Greatly encourage this move if the player is
; flying or underground, and slower than the enemy.
ld a, [wPlayerSubStatus3]
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jr nz, .player_hidden
ld a, [wPlayerSubStatus4]
and 1 << SUBSTATUS_UNDERWATER
ret z
.player_hidden
call AICompareSpeed
ret nc
@ -1643,13 +1637,10 @@ AI_Smart_PriorityHit:
call AICompareSpeed
ret c
; Dismiss this move if the player is flying, underwater, or underground.
; Dismiss this move if the player is flying or underground.
ld a, [wPlayerSubStatus3]
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jp nz, AIDiscourageMove
ld a, [wPlayerSubStatus4]
and 1 << SUBSTATUS_UNDERWATER
jp nz, AIDiscourageMove
; Greatly encourage this move if it will KO the player.
ld a, 1
@ -1672,31 +1663,6 @@ AI_Smart_PriorityHit:
dec [hl]
dec [hl]
ret
AI_Smart_Surf:
AI_Smart_Whirlpool:
; Greatly encourage this move if the player is underwater and the enemy is faster.
ld a, [wLastPlayerCounterMove]
ld bc, WATER_SPORT
call CompareMove
ret nz
ld a, [wPlayerSubStatus4]
bit SUBSTATUS_UNDERWATER, a
jr z, .could_dive
call AICompareSpeed
ret nc
dec [hl]
dec [hl]
ret
.could_dive
; Try to predict if the player will use Dive this turn.
; 50% chance to encourage this move if the enemy is slower than the player.
call AICompareSpeed
ret c
call AI_50_50
ret c
dec [hl]
ret
AI_Smart_Thief:
; Don't use Thief unless it's the only move available.
@ -2667,19 +2633,15 @@ AI_Smart_Gust:
AI_Smart_FutureSight:
; Greatly encourage this move if the player is
; flying, underwater, or underground, and slower than the enemy.
; flying or underground, and slower than the enemy.
call AICompareSpeed
ret nc
ld a, [wPlayerSubStatus3]
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jr nz, .player_hidden
ld a, [wPlayerSubStatus4]
and 1 << SUBSTATUS_UNDERWATER
ret z
.player_hidden
dec [hl]
dec [hl]
ret

View file

@ -1119,15 +1119,7 @@ ResidualDamage:
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jr nz, .not_flying_or_underground
call Call_PlayBattleAnim_OnlyIfVisible
jr .called
.not_flying_or_underground
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
and 1 << SUBSTATUS_UNDERWATER
call z, Call_PlayBattleAnim_OnlyIfVisible
.called
call SwitchTurnCore
call GetEighthMaxHP
@ -1310,11 +1302,6 @@ HandleWrap:
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jr nz, .skip_anim
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVar
and 1 << SUBSTATUS_UNDERWATER
jr nz, .skip_anim
call SwitchTurnCore
xor a
@ -7107,11 +7094,6 @@ Call_PlayBattleAnim_OnlyIfVisible:
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret nz
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVar
and 1 << SUBSTATUS_UNDERWATER
ret nz
Call_PlayBattleAnim:
ld a, e

View file

@ -1,9 +1,3 @@
; Heavily edited when adding Water Sport's effect.
; If errors occur (especially involving Substitute), check https://github.com/Rangi42/pokecrystal/commit/c21561ea717feef9b2eb3785c2ea112cd0d19ba0#diff-88dbff1eb3920f69b17a3d5f613643e1a41096514706bc09f449e4aa637f20e4R5647
; There is a high chance you will run out of memory and I am not sure how this is resolved.
; I imagine bankswitches will be necessary.
DoPlayerTurn:
call SetPlayerTurn
@ -366,9 +360,6 @@ CantMove:
res SUBSTATUS_UNDERGROUND, [hl]
res SUBSTATUS_FLYING, [hl]
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVarAddr
res SUBSTATUS_UNDERWATER, [hl]
jp AppearUserRaiseSub
OpponentCantMove:
@ -533,17 +524,12 @@ CheckEnemyTurn:
xor a
ld [wNumHits], a
; Flicker the monster pic unless flying, underwater, or underground.
; Flicker the monster pic unless flying or underground.
ld de, ANIM_HIT_CONFUSION
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jr nz, .no_flicker
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
and 1 << SUBSTATUS_UNDERWATER
call z, PlayFXAnimID
.no_flicker
ld c, TRUE
call DoEnemyDamage
@ -641,17 +627,12 @@ HitConfusion:
xor a
ld [wNumHits], a
; Flicker the monster pic unless flying, underwater, or underground.
; Flicker the monster pic unless flying or underground.
ld de, ANIM_HIT_CONFUSION
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jr nz, .no_flicker
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
and 1 << SUBSTATUS_UNDERWATER
call z, PlayFXAnimID
.no_flicker
ld hl, UpdatePlayerHUD
call CallBattleCore
@ -1771,47 +1752,13 @@ BattleCommand_CheckHit:
ret
.FlyDigMoves:
; Check for moves that can hit underground/flying opponents. And divers.
; Check for moves that can hit underground/flying opponents.
; Return z if the current move can hit the opponent.
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jr nz, .flying_or_underground
ld a, BATTLE_VARS_SUBSTATUS4_OPP
call GetBattleVar
and 1 << SUBSTATUS_UNDERWATER
ret z
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
ld hl, SURF
call GetMoveIDFromIndex
ld a, h
if HIGH(SURF)
cp HIGH(SURF)
else
and a
endc
ld a, l
pop hl
ret nz
cp LOW(SURF)
ret z
ld hl, WHIRLPOOL
call GetMoveIDFromIndex
ld a, h
if HIGH(WHIRLPOOL)
cp HIGH(WHIRLPOOL)
else
and a
endc
ld a, l
pop hl
ret nz
cp LOW(WHIRLPOOL)
ret
.flying_or_underground
bit SUBSTATUS_FLYING, a
@ -2089,6 +2036,11 @@ BattleCommand_MoveAnimNoSub:
ret nc
jp AppearUserLowerSub
.fly_dig_moves
dw FLY
dw DIG
dw -1
.alternate_anim
ld a, [wBattleAnimParam]
and 1
@ -2200,12 +2152,14 @@ BattleCommand_FailureText:
call GetBattleVarAddr
res SUBSTATUS_UNDERGROUND, [hl]
res SUBSTATUS_FLYING, [hl]
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVarAddr
res SUBSTATUS_UNDERWATER, [hl]
call AppearUserRaiseSub
jp EndMoveEffect
.fly_dig_moves
dw FLY
dw DIG
dw -1
BattleCommand_ApplyDamage:
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVar
@ -3473,11 +3427,6 @@ FarPlayBattleAnimation:
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
ret nz
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVar
and 1 << SUBSTATUS_UNDERWATER
ret nz
; fallthrough
@ -3664,12 +3613,7 @@ DoSubstituteDamage:
ld a, BATTLE_VARS_SUBSTATUS3
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
jr nz, .dont_lower_sub
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVar
and 1 << SUBSTATUS_UNDERWATER
call z, AppearUserLowerSub
.dont_lower_sub
call BattleCommand_SwitchTurn
ld a, BATTLE_VARS_MOVE_EFFECT
@ -5608,9 +5552,6 @@ BattleCommand_CheckCharge:
res SUBSTATUS_CHARGED, [hl]
res SUBSTATUS_UNDERGROUND, [hl]
res SUBSTATUS_FLYING, [hl]
ld a, BATTLE_VARS_SUBSTATUS4
call GetBattleVarAddr
res SUBSTATUS_UNDERWATER, [hl]
ld b, charge_command
jp SkipToBattleCommand
@ -5644,58 +5585,20 @@ BattleCommand_Charge:
call LoadMoveAnim
ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar
ld hl, WATER_SPORT
call GetMoveIDFromIndex
ld a, h
if HIGH(WATER_SPORT)
cp HIGH(WATER_SPORT)
ld h, a
ld bc, FLY
call CompareMove
ld a, 1 << SUBSTATUS_FLYING
jr z, .got_move_type
if HIGH(FLY) != HIGH(DIG)
ld bc, DIG
else
and a
ld c, LOW(DIG)
endc
ld a, l
pop hl
ret nz
cp LOW(WATER_SPORT)
jp z, .set_diving
ld hl, FLY
call GetMoveIDFromIndex
ld a, h
if HIGH(FLY)
cp HIGH(FLY)
else
and a
endc
ld a, l
pop hl
ret nz
cp LOW(FLY)
jr z, .set_flying
ld hl, BOUNCE
call GetMoveIDFromIndex
ld a, h
if HIGH(BOUNCE)
cp HIGH(BOUNCE)
else
and a
endc
ld a, l
pop hl
ret nz
cp LOW(BOUNCE)
jr z, .set_flying
ld hl, DIG
call GetMoveIDFromIndex
ld a, h
if HIGH(DIG)
cp HIGH(DIG)
else
and a
endc
ld a, l
pop hl
ret nz
cp LOW(DIG)
jr z, .set_flying
call CompareMove
ld a, 1 << SUBSTATUS_UNDERGROUND
jr z, .got_move_type
call BattleCommand_RaiseSub
jr .not_flying
@ -5824,8 +5727,6 @@ BattleCommand_Charge:
dw SKY_ATTACK, .BattleGlowingText
dw FLY, .BattleFlewText
dw DIG, .BattleDugText
dw BOUNCE, .BattleFlewText
dw WATER_SPORT, .BattleWaterSportText
dw -1
.BattleMadeWhirlwindText:
@ -5852,10 +5753,9 @@ BattleCommand_Charge:
text_far _BattleDugText
text_end
.BattleWaterSportText:
; 'hid underwater!'
text_jump HidUnderwaterText
db "@"
BattleCommand_Unused3C:
; effect0x3c
ret
BattleCommand_TrapTarget:
ld a, [wAttackMissed]
@ -6619,6 +6519,10 @@ INCLUDE "engine/battle/move_effects/sandstorm.asm"
INCLUDE "engine/battle/move_effects/rollout.asm"
BattleCommand_Unused5D:
; effect0x5d
ret
INCLUDE "engine/battle/move_effects/fury_cutter.asm"
INCLUDE "engine/battle/move_effects/attract.asm"