You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Merge branch 'master' of https://github.com/pret/pokecrystal
# Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
This commit is contained in:
@@ -12,7 +12,7 @@ AI_SwitchOrTryItem: ; 38000
|
||||
farcall CheckEnemyLockedIn
|
||||
ret nz
|
||||
|
||||
ld a, [PlayerSubStatus5]
|
||||
ld a, [wPlayerSubStatus5]
|
||||
bit SUBSTATUS_CANT_RUN, a
|
||||
jr nz, DontSwitch
|
||||
|
||||
@@ -21,11 +21,11 @@ AI_SwitchOrTryItem: ; 38000
|
||||
jr nz, DontSwitch
|
||||
|
||||
ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH
|
||||
ld a, [InBattleTowerBattle] ; Load always the first TrainerClass for BattleTower-Trainers
|
||||
ld a, [wInBattleTowerBattle] ; always load the first trainer class in wTrainerClass for BattleTower-Trainers
|
||||
and a
|
||||
jr nz, .ok
|
||||
|
||||
ld a, [TrainerClass]
|
||||
ld a, [wTrainerClass]
|
||||
dec a
|
||||
ld bc, NUM_TRAINER_ATTRIBUTES
|
||||
call AddNTimes
|
||||
@@ -151,7 +151,7 @@ SwitchSometimes: ; 380c1
|
||||
|
||||
|
||||
CheckSubstatusCantRun: ; 380ff
|
||||
ld a, [EnemySubStatus5]
|
||||
ld a, [wEnemySubStatus5]
|
||||
bit SUBSTATUS_CANT_RUN, a
|
||||
ret
|
||||
; 38105
|
||||
@@ -159,7 +159,7 @@ CheckSubstatusCantRun: ; 380ff
|
||||
|
||||
AI_TryItem: ; 38105
|
||||
; items are not allowed in the BattleTower
|
||||
ld a, [InBattleTowerBattle]
|
||||
ld a, [wInBattleTowerBattle]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
@@ -172,7 +172,7 @@ AI_TryItem: ; 38105
|
||||
call .IsHighestLevel
|
||||
ret nc
|
||||
|
||||
ld a, [TrainerClass]
|
||||
ld a, [wTrainerClass]
|
||||
dec a
|
||||
ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH
|
||||
ld bc, NUM_TRAINER_ATTRIBUTES
|
||||
@@ -226,29 +226,29 @@ AI_TryItem: ; 38105
|
||||
inc a
|
||||
ld [wEnemyGoesFirst], a
|
||||
|
||||
ld hl, EnemySubStatus3
|
||||
ld hl, wEnemySubStatus3
|
||||
res SUBSTATUS_BIDE, [hl]
|
||||
|
||||
xor a
|
||||
ld [EnemyFuryCutterCount], a
|
||||
ld [EnemyProtectCount], a
|
||||
ld [wEnemyFuryCutterCount], a
|
||||
ld [wEnemyProtectCount], a
|
||||
ld [wEnemyRageCounter], a
|
||||
|
||||
ld hl, EnemySubStatus4
|
||||
ld hl, wEnemySubStatus4
|
||||
res SUBSTATUS_RAGE, [hl]
|
||||
|
||||
xor a
|
||||
ld [LastEnemyCounterMove], a
|
||||
ld [wLastEnemyCounterMove], a
|
||||
|
||||
scf
|
||||
ret
|
||||
|
||||
|
||||
.IsHighestLevel: ; 38170
|
||||
ld a, [OTPartyCount]
|
||||
ld a, [wOTPartyCount]
|
||||
ld d, a
|
||||
ld e, 0
|
||||
ld hl, OTPartyMon1Level
|
||||
ld hl, wOTPartyMon1Level
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
.next
|
||||
ld a, [hl]
|
||||
@@ -260,8 +260,8 @@ AI_TryItem: ; 38105
|
||||
dec d
|
||||
jr nz, .next
|
||||
|
||||
ld a, [CurOTMon]
|
||||
ld hl, OTPartyMon1Level
|
||||
ld a, [wCurOTMon]
|
||||
ld hl, wOTPartyMon1Level
|
||||
call AddNTimes
|
||||
ld a, [hl]
|
||||
cp e
|
||||
@@ -302,7 +302,7 @@ AI_Items: ; 39196
|
||||
; 381ca
|
||||
|
||||
.Status: ; 381ca (e:41ca)
|
||||
ld a, [EnemyMonStatus]
|
||||
ld a, [wEnemyMonStatus]
|
||||
and a
|
||||
jp z, .DontUse
|
||||
|
||||
@@ -318,17 +318,17 @@ AI_Items: ; 39196
|
||||
jp .DontUse
|
||||
|
||||
.StatusCheckContext:
|
||||
ld a, [EnemySubStatus5]
|
||||
ld a, [wEnemySubStatus5]
|
||||
bit SUBSTATUS_TOXIC, a
|
||||
jr z, .FailToxicCheck
|
||||
ld a, [EnemyToxicCount]
|
||||
ld a, [wEnemyToxicCount]
|
||||
cp 4
|
||||
jr c, .FailToxicCheck
|
||||
call Random
|
||||
cp 1 + 50 percent
|
||||
jp c, .Use
|
||||
.FailToxicCheck:
|
||||
ld a, [EnemyMonStatus]
|
||||
ld a, [wEnemyMonStatus]
|
||||
and 1 << FRZ | SLP
|
||||
jp z, .DontUse
|
||||
jp .Use
|
||||
@@ -419,8 +419,8 @@ AI_Items: ; 39196
|
||||
callfar AICheckEnemyMaxHP
|
||||
jr c, .dont_use
|
||||
push bc
|
||||
ld de, EnemyMonMaxHP + 1
|
||||
ld hl, EnemyMonHP + 1
|
||||
ld de, wEnemyMonMaxHP + 1
|
||||
ld hl, wEnemyMonHP + 1
|
||||
ld a, [de]
|
||||
sub [hl]
|
||||
jr z, .check_40_percent
|
||||
@@ -509,7 +509,7 @@ AI_Items: ; 39196
|
||||
; 3834d
|
||||
|
||||
.XItem: ; 3834d (e:434d)
|
||||
ld a, [EnemyTurnsTaken]
|
||||
ld a, [wEnemyTurnsTaken]
|
||||
and a
|
||||
jr nz, .notfirstturnout
|
||||
ld a, [bc]
|
||||
@@ -571,37 +571,37 @@ EnemyUsedFullHeal: ; 383a3 (e:43a3)
|
||||
|
||||
EnemyUsedMaxPotion: ; 383ae (e:43ae)
|
||||
ld a, MAX_POTION
|
||||
ld [CurEnemyItem], a
|
||||
ld [wCurEnemyItem], a
|
||||
jr FullRestoreContinue
|
||||
|
||||
EnemyUsedFullRestore: ; 383b5 (e:43b5)
|
||||
call AI_HealStatus
|
||||
ld a, FULL_RESTORE
|
||||
ld [CurEnemyItem], a
|
||||
ld hl, EnemySubStatus3
|
||||
ld [wCurEnemyItem], a
|
||||
ld hl, wEnemySubStatus3
|
||||
res SUBSTATUS_CONFUSED, [hl]
|
||||
xor a
|
||||
ld [EnemyConfuseCount], a
|
||||
ld [wEnemyConfuseCount], a
|
||||
|
||||
FullRestoreContinue: ; 383c6
|
||||
ld de, wCurHPAnimOldHP
|
||||
ld hl, EnemyMonHP + 1
|
||||
ld hl, wEnemyMonHP + 1
|
||||
ld a, [hld]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld hl, EnemyMonMaxHP + 1
|
||||
ld hl, wEnemyMonMaxHP + 1
|
||||
ld a, [hld]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld [wCurHPAnimMaxHP], a
|
||||
ld [EnemyMonHP + 1], a
|
||||
ld [wEnemyMonHP + 1], a
|
||||
ld a, [hl]
|
||||
ld [de], a
|
||||
ld [wCurHPAnimMaxHP + 1], a
|
||||
ld [EnemyMonHP], a
|
||||
ld [wEnemyMonHP], a
|
||||
jr EnemyPotionFinish
|
||||
; 383e8 (e:43e8)
|
||||
|
||||
@@ -620,8 +620,8 @@ EnemyUsedHyperPotion: ; 383f4 (e:43f4)
|
||||
ld b, 200
|
||||
|
||||
EnemyPotionContinue: ; 383f8
|
||||
ld [CurEnemyItem], a
|
||||
ld hl, EnemyMonHP + 1
|
||||
ld [wCurEnemyItem], a
|
||||
ld hl, wEnemyMonHP + 1
|
||||
ld a, [hl]
|
||||
ld [wCurHPAnimOldHP], a
|
||||
add b
|
||||
@@ -638,7 +638,7 @@ EnemyPotionContinue: ; 383f8
|
||||
inc hl
|
||||
ld a, [hld]
|
||||
ld b, a
|
||||
ld de, EnemyMonMaxHP + 1
|
||||
ld de, wEnemyMonMaxHP + 1
|
||||
ld a, [de]
|
||||
dec de
|
||||
ld [wCurHPAnimMaxHP], a
|
||||
@@ -671,9 +671,9 @@ EnemyPotionFinish: ; 38436
|
||||
AI_TrySwitch: ; 3844b
|
||||
; Determine whether the AI can switch based on how many Pokemon are still alive.
|
||||
; If it can switch, it will.
|
||||
ld a, [OTPartyCount]
|
||||
ld a, [wOTPartyCount]
|
||||
ld c, a
|
||||
ld hl, OTPartyMon1HP
|
||||
ld hl, wOTPartyMon1HP
|
||||
ld d, 0
|
||||
.SwitchLoop:
|
||||
ld a, [hli]
|
||||
@@ -701,20 +701,20 @@ AI_Switch: ; 3846c
|
||||
ld a, $1
|
||||
ld [wEnemyIsSwitching], a
|
||||
ld [wEnemyGoesFirst], a
|
||||
ld hl, EnemySubStatus4
|
||||
ld hl, wEnemySubStatus4
|
||||
res SUBSTATUS_RAGE, [hl]
|
||||
xor a
|
||||
ld [hBattleTurn], a
|
||||
callfar PursuitSwitch
|
||||
|
||||
push af
|
||||
ld a, [CurOTMon]
|
||||
ld hl, OTPartyMon1Status
|
||||
ld a, [wCurOTMon]
|
||||
ld hl, wOTPartyMon1Status
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld hl, EnemyMonStatus
|
||||
ld hl, wEnemyMonStatus
|
||||
ld bc, MON_MAXHP - MON_STATUS
|
||||
call CopyBytes
|
||||
pop af
|
||||
@@ -728,7 +728,7 @@ AI_Switch: ; 3846c
|
||||
ld [wBattleHasJustStarted], a
|
||||
callfar NewEnemyMonStatus
|
||||
callfar ResetEnemyStatLevels
|
||||
ld hl, PlayerSubStatus1
|
||||
ld hl, wPlayerSubStatus1
|
||||
res SUBSTATUS_IN_LOVE, [hl]
|
||||
farcall EnemySwitch
|
||||
farcall ResetBattleParticipants
|
||||
@@ -754,25 +754,25 @@ Function384d5: ; This appears to be unused
|
||||
; 384e0
|
||||
|
||||
AI_HealStatus: ; 384e0
|
||||
ld a, [CurOTMon]
|
||||
ld hl, OTPartyMon1Status
|
||||
ld a, [wCurOTMon]
|
||||
ld hl, wOTPartyMon1Status
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
xor a
|
||||
ld [hl], a
|
||||
ld [EnemyMonStatus], a
|
||||
ld [wEnemyMonStatus], a
|
||||
; Bug: this should reset SUBSTATUS_NIGHTMARE too
|
||||
; Uncomment the lines below to fix
|
||||
; ld hl, EnemySubStatus1
|
||||
; ld hl, wEnemySubStatus1
|
||||
; res SUBSTATUS_NIGHTMARE, [hl]
|
||||
ld hl, EnemySubStatus5
|
||||
ld hl, wEnemySubStatus5
|
||||
res SUBSTATUS_TOXIC, [hl]
|
||||
ret
|
||||
; 384f7
|
||||
|
||||
EnemyUsedXAccuracy: ; 384f7
|
||||
call AIUsedItemSound
|
||||
ld hl, EnemySubStatus4
|
||||
ld hl, wEnemySubStatus4
|
||||
set SUBSTATUS_X_ACCURACY, [hl]
|
||||
ld a, X_ACCURACY
|
||||
jp PrintText_UsedItemOn_AND_AIUpdateHUD
|
||||
@@ -780,7 +780,7 @@ EnemyUsedXAccuracy: ; 384f7
|
||||
|
||||
EnemyUsedGuardSpec: ; 38504
|
||||
call AIUsedItemSound
|
||||
ld hl, EnemySubStatus4
|
||||
ld hl, wEnemySubStatus4
|
||||
set SUBSTATUS_MIST, [hl]
|
||||
ld a, GUARD_SPEC
|
||||
jp PrintText_UsedItemOn_AND_AIUpdateHUD
|
||||
@@ -788,7 +788,7 @@ EnemyUsedGuardSpec: ; 38504
|
||||
|
||||
EnemyUsedDireHit: ; 38511
|
||||
call AIUsedItemSound
|
||||
ld hl, EnemySubStatus4
|
||||
ld hl, wEnemySubStatus4
|
||||
set SUBSTATUS_FOCUS_ENERGY, [hl]
|
||||
ld a, DIRE_HIT
|
||||
jp PrintText_UsedItemOn_AND_AIUpdateHUD
|
||||
@@ -796,7 +796,7 @@ EnemyUsedDireHit: ; 38511
|
||||
|
||||
Function3851e: ; This appears to be unused
|
||||
ld [hDivisor], a
|
||||
ld hl, EnemyMonMaxHP
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
ld [hDividend], a
|
||||
ld a, [hl]
|
||||
@@ -807,7 +807,7 @@ Function3851e: ; This appears to be unused
|
||||
ld c, a
|
||||
ld a, [hQuotient + 1]
|
||||
ld b, a
|
||||
ld hl, EnemyMonHP + 1
|
||||
ld hl, wEnemyMonHP + 1
|
||||
ld a, [hld]
|
||||
ld e, a
|
||||
ld a, [hl]
|
||||
@@ -847,7 +847,7 @@ EnemyUsedXSpecial: ; 38553
|
||||
; a = ITEM_CONSTANT
|
||||
; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION)
|
||||
EnemyUsedXItem:
|
||||
ld [CurEnemyItem], a
|
||||
ld [wCurEnemyItem], a
|
||||
push bc
|
||||
call PrintText_UsedItemOn
|
||||
pop bc
|
||||
@@ -859,16 +859,16 @@ EnemyUsedXItem:
|
||||
; Parameter
|
||||
; a = ITEM_CONSTANT
|
||||
PrintText_UsedItemOn_AND_AIUpdateHUD: ; 38568
|
||||
ld [CurEnemyItem], a
|
||||
ld [wCurEnemyItem], a
|
||||
call PrintText_UsedItemOn
|
||||
jp AIUpdateHUD
|
||||
; 38571
|
||||
|
||||
PrintText_UsedItemOn: ; 38571
|
||||
ld a, [CurEnemyItem]
|
||||
ld a, [wCurEnemyItem]
|
||||
ld [wd265], a
|
||||
call GetItemName
|
||||
ld hl, StringBuffer1
|
||||
ld hl, wStringBuffer1
|
||||
ld de, wMonOrItemNameBuffer
|
||||
ld bc, ITEM_NAME_LENGTH
|
||||
call CopyBytes
|
||||
|
@@ -1,5 +1,5 @@
|
||||
AIChooseMove: ; 440ce
|
||||
; Score each move in EnemyMonMoves starting from Buffer1. Lower is better.
|
||||
; Score each move in wEnemyMonMoves starting from wBuffer1. Lower is better.
|
||||
; Pick the move with the lowest score.
|
||||
|
||||
; Wildmons attack at random.
|
||||
@@ -18,18 +18,18 @@ AIChooseMove: ; 440ce
|
||||
|
||||
; The default score is 20. Unusable moves are given a score of 80.
|
||||
ld a, 20
|
||||
ld hl, Buffer1
|
||||
ld hl, wBuffer1
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
|
||||
; Don't pick disabled moves.
|
||||
ld a, [EnemyDisabledMove]
|
||||
ld a, [wEnemyDisabledMove]
|
||||
and a
|
||||
jr z, .CheckPP
|
||||
|
||||
ld hl, EnemyMonMoves
|
||||
ld hl, wEnemyMonMoves
|
||||
ld c, 0
|
||||
.CheckDisabledMove:
|
||||
cp [hl]
|
||||
@@ -38,20 +38,20 @@ AIChooseMove: ; 440ce
|
||||
inc hl
|
||||
jr .CheckDisabledMove
|
||||
.ScoreDisabledMove:
|
||||
ld hl, Buffer1
|
||||
ld hl, wBuffer1
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld [hl], 80
|
||||
|
||||
; Don't pick moves with 0 PP.
|
||||
.CheckPP:
|
||||
ld hl, Buffer1 - 1
|
||||
ld de, EnemyMonPP
|
||||
ld hl, wBuffer1 - 1
|
||||
ld de, wEnemyMonPP
|
||||
ld b, 0
|
||||
.CheckMovePP:
|
||||
inc b
|
||||
ld a, b
|
||||
cp EnemyMonMovesEnd - EnemyMonMoves + 1
|
||||
cp wEnemyMonMovesEnd - wEnemyMonMoves + 1
|
||||
jr z, .ApplyLayers
|
||||
inc hl
|
||||
ld a, [de]
|
||||
@@ -66,13 +66,13 @@ AIChooseMove: ; 440ce
|
||||
.ApplyLayers:
|
||||
ld hl, TrainerClassAttributes + TRNATTR_AI_MOVE_WEIGHTS
|
||||
|
||||
; If we have a battle in BattleTower just load the Attributes of the first TrainerClass (Falkner)
|
||||
; If we have a battle in BattleTower just load the Attributes of the first trainer class in wTrainerClass (Falkner)
|
||||
; so we have always the same AI, regardless of the loaded class of trainer
|
||||
ld a, [InBattleTowerBattle]
|
||||
ld a, [wInBattleTowerBattle]
|
||||
bit 0, a
|
||||
jr nz, .battle_tower_skip
|
||||
|
||||
ld a, [TrainerClass]
|
||||
ld a, [wTrainerClass]
|
||||
dec a
|
||||
ld bc, 7 ; Trainer2AI - Trainer1AI
|
||||
call AddNTimes
|
||||
@@ -119,9 +119,9 @@ AIChooseMove: ; 440ce
|
||||
|
||||
; Decrement the scores of all moves one by one until one reaches 0.
|
||||
.DecrementScores:
|
||||
ld hl, Buffer1
|
||||
ld de, EnemyMonMoves
|
||||
ld c, EnemyMonMovesEnd - EnemyMonMoves
|
||||
ld hl, wBuffer1
|
||||
ld de, wEnemyMonMoves
|
||||
ld c, wEnemyMonMovesEnd - wEnemyMonMoves
|
||||
|
||||
.DecrementNextScore:
|
||||
; If the enemy has no moves, this will infinite.
|
||||
@@ -154,8 +154,8 @@ AIChooseMove: ; 440ce
|
||||
cp NUM_MOVES + 1
|
||||
jr nz, .move_loop
|
||||
|
||||
ld hl, Buffer1
|
||||
ld de, EnemyMonMoves
|
||||
ld hl, wBuffer1
|
||||
ld de, wEnemyMonMoves
|
||||
ld c, NUM_MOVES
|
||||
|
||||
; Give a score of 0 to a blank move
|
||||
@@ -184,7 +184,7 @@ AIChooseMove: ; 440ce
|
||||
|
||||
; Randomly choose one of the moves with a score of 1
|
||||
.ChooseMove:
|
||||
ld hl, Buffer1
|
||||
ld hl, wBuffer1
|
||||
call Random
|
||||
maskbits NUM_MOVES
|
||||
ld c, a
|
||||
@@ -194,9 +194,9 @@ AIChooseMove: ; 440ce
|
||||
and a
|
||||
jr z, .ChooseMove
|
||||
|
||||
ld [CurEnemyMove], a
|
||||
ld [wCurEnemyMove], a
|
||||
ld a, c
|
||||
ld [CurEnemyMoveNum], a
|
||||
ld [wCurEnemyMoveNum], a
|
||||
ret
|
||||
; 441af
|
||||
|
||||
|
@@ -47,95 +47,95 @@ AI_Redundant: ; 2c41a
|
||||
db -1
|
||||
|
||||
.LightScreen: ; 2c487
|
||||
ld a, [EnemyScreens]
|
||||
ld a, [wEnemyScreens]
|
||||
bit SCREENS_LIGHT_SCREEN, a
|
||||
ret
|
||||
|
||||
.Mist: ; 2c48d
|
||||
ld a, [EnemySubStatus4]
|
||||
ld a, [wEnemySubStatus4]
|
||||
bit SUBSTATUS_MIST, a
|
||||
ret
|
||||
|
||||
.FocusEnergy: ; 2c493
|
||||
ld a, [EnemySubStatus4]
|
||||
ld a, [wEnemySubStatus4]
|
||||
bit SUBSTATUS_FOCUS_ENERGY, a
|
||||
ret
|
||||
|
||||
.Confuse: ; 2c499
|
||||
ld a, [PlayerSubStatus3]
|
||||
ld a, [wPlayerSubStatus3]
|
||||
bit SUBSTATUS_CONFUSED, a
|
||||
ret nz
|
||||
ld a, [PlayerScreens]
|
||||
ld a, [wPlayerScreens]
|
||||
bit SCREENS_SAFEGUARD, a
|
||||
ret
|
||||
|
||||
.Transform: ; 2c4a5
|
||||
ld a, [EnemySubStatus5]
|
||||
ld a, [wEnemySubStatus5]
|
||||
bit SUBSTATUS_TRANSFORMED, a
|
||||
ret
|
||||
|
||||
.Reflect: ; 2c4ab
|
||||
ld a, [EnemyScreens]
|
||||
ld a, [wEnemyScreens]
|
||||
bit SCREENS_REFLECT, a
|
||||
ret
|
||||
|
||||
.Substitute: ; 2c4b1
|
||||
ld a, [EnemySubStatus4]
|
||||
ld a, [wEnemySubStatus4]
|
||||
bit SUBSTATUS_SUBSTITUTE, a
|
||||
ret
|
||||
|
||||
.LeechSeed: ; 2c4b7
|
||||
ld a, [PlayerSubStatus4]
|
||||
ld a, [wPlayerSubStatus4]
|
||||
bit SUBSTATUS_LEECH_SEED, a
|
||||
ret
|
||||
|
||||
.Disable: ; 2c4bd
|
||||
ld a, [PlayerDisableCount]
|
||||
ld a, [wPlayerDisableCount]
|
||||
and a
|
||||
ret
|
||||
|
||||
.Encore: ; 2c4c2
|
||||
ld a, [PlayerSubStatus5]
|
||||
ld a, [wPlayerSubStatus5]
|
||||
bit SUBSTATUS_ENCORED, a
|
||||
ret
|
||||
|
||||
.Snore:
|
||||
.SleepTalk: ; 2c4c8
|
||||
ld a, [EnemyMonStatus]
|
||||
ld a, [wEnemyMonStatus]
|
||||
and SLP
|
||||
jr z, .Redundant
|
||||
jr .NotRedundant
|
||||
|
||||
.MeanLook: ; 2c4d1
|
||||
ld a, [EnemySubStatus5]
|
||||
ld a, [wEnemySubStatus5]
|
||||
bit SUBSTATUS_CANT_RUN, a
|
||||
ret
|
||||
|
||||
.Nightmare: ; 2c4d7
|
||||
ld a, [BattleMonStatus]
|
||||
ld a, [wBattleMonStatus]
|
||||
and a
|
||||
jr z, .Redundant
|
||||
ld a, [PlayerSubStatus1]
|
||||
ld a, [wPlayerSubStatus1]
|
||||
bit SUBSTATUS_NIGHTMARE, a
|
||||
ret
|
||||
|
||||
.Spikes: ; 2c4e3
|
||||
ld a, [PlayerScreens]
|
||||
ld a, [wPlayerScreens]
|
||||
bit SCREENS_SPIKES, a
|
||||
ret
|
||||
|
||||
.Foresight: ; 2c4e9
|
||||
ld a, [PlayerSubStatus1]
|
||||
ld a, [wPlayerSubStatus1]
|
||||
bit SUBSTATUS_IDENTIFIED, a
|
||||
ret
|
||||
|
||||
.PerishSong: ; 2c4ef
|
||||
ld a, [PlayerSubStatus1]
|
||||
ld a, [wPlayerSubStatus1]
|
||||
bit SUBSTATUS_PERISH, a
|
||||
ret
|
||||
|
||||
.Sandstorm: ; 2c4f5
|
||||
ld a, [Weather]
|
||||
ld a, [wBattleWeather]
|
||||
cp WEATHER_SANDSTORM
|
||||
jr z, .Redundant
|
||||
jr .NotRedundant
|
||||
@@ -143,40 +143,40 @@ AI_Redundant: ; 2c41a
|
||||
.Attract: ; 2c4fe
|
||||
farcall CheckOppositeGender
|
||||
jr c, .Redundant
|
||||
ld a, [PlayerSubStatus1]
|
||||
ld a, [wPlayerSubStatus1]
|
||||
bit SUBSTATUS_IN_LOVE, a
|
||||
ret
|
||||
|
||||
.Safeguard: ; 2c50c
|
||||
ld a, [EnemyScreens]
|
||||
ld a, [wEnemyScreens]
|
||||
bit SCREENS_SAFEGUARD, a
|
||||
ret
|
||||
|
||||
.RainDance: ; 2c512
|
||||
ld a, [Weather]
|
||||
ld a, [wBattleWeather]
|
||||
cp WEATHER_RAIN
|
||||
jr z, .Redundant
|
||||
jr .NotRedundant
|
||||
|
||||
.SunnyDay: ; 2c51b
|
||||
ld a, [Weather]
|
||||
ld a, [wBattleWeather]
|
||||
cp WEATHER_SUN
|
||||
jr z, .Redundant
|
||||
jr .NotRedundant
|
||||
|
||||
.DreamEater: ; 2c524
|
||||
ld a, [BattleMonStatus]
|
||||
ld a, [wBattleMonStatus]
|
||||
and SLP
|
||||
jr z, .Redundant
|
||||
jr .NotRedundant
|
||||
|
||||
.Swagger: ; 2c52d
|
||||
ld a, [PlayerSubStatus3]
|
||||
ld a, [wPlayerSubStatus3]
|
||||
bit SUBSTATUS_CONFUSED, a
|
||||
ret
|
||||
|
||||
.FutureSight: ; 2c533
|
||||
ld a, [EnemyScreens]
|
||||
ld a, [wEnemyScreens]
|
||||
bit 5, a
|
||||
ret
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e
|
||||
push bc
|
||||
ld a, 10
|
||||
ld [wEnemyAISwitchScore], a
|
||||
ld hl, PlayerUsedMoves
|
||||
ld hl, wPlayerUsedMoves
|
||||
ld a, [hl]
|
||||
and a
|
||||
jr z, .unknown_moves
|
||||
@@ -27,7 +27,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e
|
||||
|
||||
inc hl
|
||||
call GetMoveByte
|
||||
ld hl, EnemyMonType
|
||||
ld hl, wEnemyMonType
|
||||
call CheckTypeMatchup
|
||||
ld a, [wTypeMatchup]
|
||||
cp 10 + 1 ; 1.0 + 0.1
|
||||
@@ -70,16 +70,16 @@ CheckPlayerMoveTypeMatchups: ; 3484e
|
||||
jr .done
|
||||
|
||||
.unknown_moves
|
||||
ld a, [BattleMonType1]
|
||||
ld a, [wBattleMonType1]
|
||||
ld b, a
|
||||
ld hl, EnemyMonType1
|
||||
ld hl, wEnemyMonType1
|
||||
call CheckTypeMatchup
|
||||
ld a, [wTypeMatchup]
|
||||
cp 10 + 1 ; 1.0 + 0.1
|
||||
jr c, .ok
|
||||
call .DecreaseScore
|
||||
.ok
|
||||
ld a, [BattleMonType2]
|
||||
ld a, [wBattleMonType2]
|
||||
cp b
|
||||
jr z, .ok2
|
||||
call CheckTypeMatchup
|
||||
@@ -99,7 +99,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e
|
||||
|
||||
|
||||
.CheckEnemyMoveMatchups: ; 348de
|
||||
ld de, EnemyMonMoves
|
||||
ld de, wEnemyMonMoves
|
||||
ld b, NUM_MOVES + 1
|
||||
ld c, 0
|
||||
|
||||
@@ -122,7 +122,7 @@ CheckPlayerMoveTypeMatchups: ; 3484e
|
||||
|
||||
inc hl
|
||||
call GetMoveByte
|
||||
ld hl, BattleMonType1
|
||||
ld hl, wBattleMonType1
|
||||
call CheckTypeMatchup
|
||||
|
||||
ld a, [wTypeMatchup]
|
||||
@@ -183,11 +183,11 @@ CheckAbleToSwitch: ; 34941
|
||||
call FindAliveEnemyMons
|
||||
ret c
|
||||
|
||||
ld a, [EnemySubStatus1]
|
||||
ld a, [wEnemySubStatus1]
|
||||
bit SUBSTATUS_PERISH, a
|
||||
jr z, .no_perish
|
||||
|
||||
ld a, [EnemyPerishCount]
|
||||
ld a, [wEnemyPerishCount]
|
||||
cp 1
|
||||
jr nz, .no_perish
|
||||
|
||||
@@ -229,7 +229,7 @@ CheckAbleToSwitch: ; 34941
|
||||
cp 11
|
||||
ret nc
|
||||
|
||||
ld a, [LastPlayerCounterMove]
|
||||
ld a, [wLastPlayerCounterMove]
|
||||
and a
|
||||
jr z, .no_last_counter_move
|
||||
|
||||
@@ -296,7 +296,7 @@ CheckAbleToSwitch: ; 34941
|
||||
|
||||
|
||||
FindAliveEnemyMons: ; 349f4
|
||||
ld a, [OTPartyCount]
|
||||
ld a, [wOTPartyCount]
|
||||
cp 2
|
||||
jr c, .only_one
|
||||
|
||||
@@ -304,10 +304,10 @@ FindAliveEnemyMons: ; 349f4
|
||||
ld e, 0
|
||||
ld b, 1 << (PARTY_LENGTH - 1)
|
||||
ld c, 0
|
||||
ld hl, OTPartyMon1HP
|
||||
ld hl, wOTPartyMon1HP
|
||||
|
||||
.loop
|
||||
ld a, [CurOTMon]
|
||||
ld a, [wCurOTMon]
|
||||
cp e
|
||||
jr z, .next
|
||||
|
||||
@@ -348,8 +348,8 @@ FindAliveEnemyMons: ; 349f4
|
||||
|
||||
|
||||
FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
|
||||
ld hl, OTPartyMon1
|
||||
ld a, [OTPartyCount]
|
||||
ld hl, wOTPartyMon1
|
||||
ld a, [wOTPartyCount]
|
||||
ld b, a
|
||||
ld c, 1 << (PARTY_LENGTH - 1)
|
||||
ld d, 0
|
||||
@@ -357,7 +357,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
|
||||
ld [wEnemyAISwitchScore], a
|
||||
|
||||
.loop
|
||||
ld a, [CurOTMon]
|
||||
ld a, [wCurOTMon]
|
||||
cp d
|
||||
push hl
|
||||
jr z, .next
|
||||
@@ -375,11 +375,11 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
|
||||
jr z, .next
|
||||
|
||||
ld a, [hl]
|
||||
ld [CurSpecies], a
|
||||
ld [wCurSpecies], a
|
||||
call GetBaseData
|
||||
|
||||
; the player's last move is damaging...
|
||||
ld a, [LastPlayerCounterMove]
|
||||
ld a, [wLastPlayerCounterMove]
|
||||
dec a
|
||||
ld hl, Moves + MOVE_POWER
|
||||
call GetMoveAttr
|
||||
@@ -389,7 +389,7 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
|
||||
; and the Pokemon is immune to it...
|
||||
inc hl
|
||||
call GetMoveByte
|
||||
ld hl, BaseType
|
||||
ld hl, wBaseType
|
||||
call CheckTypeMatchup
|
||||
ld a, [wTypeMatchup]
|
||||
and a
|
||||
@@ -417,9 +417,9 @@ FindEnemyMonsImmuneToLastCounterMove: ; 34a2a
|
||||
|
||||
FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85
|
||||
push bc
|
||||
ld a, [OTPartyCount]
|
||||
ld a, [wOTPartyCount]
|
||||
ld e, a
|
||||
ld hl, OTPartyMon1HP
|
||||
ld hl, wOTPartyMon1HP
|
||||
ld b, 1 << (PARTY_LENGTH - 1)
|
||||
ld c, 0
|
||||
.loop
|
||||
@@ -434,7 +434,7 @@ FindAliveEnemyMonsWithASuperEffectiveMove: ; 34a85
|
||||
.next
|
||||
srl b
|
||||
push bc
|
||||
ld bc, PartyMon2HP - (PartyMon1HP + 1)
|
||||
ld bc, wPartyMon2HP - (wPartyMon1HP + 1)
|
||||
add hl, bc
|
||||
pop bc
|
||||
dec e
|
||||
@@ -449,7 +449,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
|
||||
|
||||
ld a, -1
|
||||
ld [wEnemyAISwitchScore], a
|
||||
ld hl, OTPartyMon1Moves
|
||||
ld hl, wOTPartyMon1Moves
|
||||
ld b, 1 << (PARTY_LENGTH - 1)
|
||||
ld d, 0
|
||||
ld e, 0
|
||||
@@ -480,7 +480,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
|
||||
; check type matchups
|
||||
inc hl
|
||||
call GetMoveByte
|
||||
ld hl, BattleMonType1
|
||||
ld hl, wBattleMonType1
|
||||
call CheckTypeMatchup
|
||||
|
||||
; if immune or not very effective: continue
|
||||
@@ -556,7 +556,7 @@ FindEnemyMonsWithASuperEffectiveMove: ; 34aa7
|
||||
|
||||
FindEnemyMonsThatResistPlayer: ; 34b20
|
||||
push bc
|
||||
ld hl, OTPartySpecies
|
||||
ld hl, wOTPartySpecies
|
||||
ld b, 1 << (PARTY_LENGTH - 1)
|
||||
ld c, 0
|
||||
|
||||
@@ -566,9 +566,9 @@ FindEnemyMonsThatResistPlayer: ; 34b20
|
||||
jr z, .done
|
||||
|
||||
push hl
|
||||
ld [CurSpecies], a
|
||||
ld [wCurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [LastPlayerCounterMove]
|
||||
ld a, [wLastPlayerCounterMove]
|
||||
and a
|
||||
jr z, .skip_move
|
||||
|
||||
@@ -583,16 +583,16 @@ FindEnemyMonsThatResistPlayer: ; 34b20
|
||||
jr .check_type
|
||||
|
||||
.skip_move
|
||||
ld a, [BattleMonType1]
|
||||
ld hl, BaseType
|
||||
ld a, [wBattleMonType1]
|
||||
ld hl, wBaseType
|
||||
call CheckTypeMatchup
|
||||
ld a, [wTypeMatchup]
|
||||
cp 10 + 1
|
||||
jr nc, .dont_choose_mon
|
||||
ld a, [BattleMonType2]
|
||||
ld a, [wBattleMonType2]
|
||||
|
||||
.check_type
|
||||
ld hl, BaseType
|
||||
ld hl, wBaseType
|
||||
call CheckTypeMatchup
|
||||
ld a, [wTypeMatchup]
|
||||
cp 10 + 1
|
||||
@@ -618,10 +618,10 @@ FindEnemyMonsThatResistPlayer: ; 34b20
|
||||
|
||||
FindEnemyMonsWithAtLeastQuarterMaxHP: ; 34b77
|
||||
push bc
|
||||
ld de, OTPartySpecies
|
||||
ld de, wOTPartySpecies
|
||||
ld b, 1 << (PARTY_LENGTH - 1)
|
||||
ld c, 0
|
||||
ld hl, OTPartyMon1HP
|
||||
ld hl, wOTPartyMon1HP
|
||||
|
||||
.loop
|
||||
ld a, [de]
|
||||
|
@@ -275,10 +275,10 @@ HPBarAnim_UpdateHPRemaining: ; d784
|
||||
ld [hld], a
|
||||
dec hl
|
||||
ld a, [wCurHPAnimOldHP]
|
||||
ld [StringBuffer2 + 1], a
|
||||
ld [wStringBuffer2 + 1], a
|
||||
ld a, [wCurHPAnimOldHP + 1]
|
||||
ld [StringBuffer2], a
|
||||
ld de, StringBuffer2
|
||||
ld [wStringBuffer2], a
|
||||
ld de, wStringBuffer2
|
||||
lb bc, 2, 3
|
||||
call PrintNum
|
||||
pop hl
|
||||
@@ -311,7 +311,7 @@ HPBarAnim_BGMapUpdate: ; d7c9
|
||||
jr z, .load_0
|
||||
cp $1
|
||||
jr z, .load_1
|
||||
ld a, [CurPartyMon]
|
||||
ld a, [wCurPartyMon]
|
||||
cp $3
|
||||
jr nc, .bottom_half_of_screen
|
||||
ld c, $0
|
||||
|
@@ -198,12 +198,12 @@ BattleTransitionJumptable: ; 8c314
|
||||
StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
|
||||
; The screen flashes a different number of times depending on the level of
|
||||
; your lead Pokemon relative to the opponent's.
|
||||
; BUG: BattleMonLevel and EnemyMonLevel are not set at this point, so whatever
|
||||
; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever
|
||||
; values happen to be there will determine the animation.
|
||||
ld de, 0
|
||||
ld a, [BattleMonLevel]
|
||||
ld a, [wBattleMonLevel]
|
||||
add 3
|
||||
ld hl, EnemyMonLevel
|
||||
ld hl, wEnemyMonLevel
|
||||
cp [hl]
|
||||
jr nc, .okay
|
||||
set 0, e
|
||||
@@ -298,7 +298,7 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab)
|
||||
|
||||
StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
|
||||
farcall Function5602
|
||||
ld a, BANK(LYOverrides)
|
||||
ld a, BANK(wLYOverrides)
|
||||
ld [rSVBK], a
|
||||
|
||||
call StartTrainerBattle_NextScene
|
||||
@@ -334,8 +334,8 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)
|
||||
ld d, [hl]
|
||||
add [hl]
|
||||
ld [hl], a
|
||||
ld a, LYOverridesEnd - LYOverrides
|
||||
ld bc, LYOverrides
|
||||
ld a, wLYOverridesEnd - wLYOverrides
|
||||
ld bc, wLYOverrides
|
||||
ld e, $0
|
||||
|
||||
.loop
|
||||
@@ -356,7 +356,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)
|
||||
|
||||
StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d)
|
||||
farcall Function5602
|
||||
ld a, BANK(LYOverrides)
|
||||
ld a, BANK(wLYOverrides)
|
||||
ld [rSVBK], a
|
||||
call StartTrainerBattle_NextScene
|
||||
xor a
|
||||
@@ -498,7 +498,7 @@ ENDM
|
||||
|
||||
StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578)
|
||||
farcall Function5602
|
||||
ld a, BANK(LYOverrides)
|
||||
ld a, BANK(wLYOverrides)
|
||||
ld [rSVBK], a
|
||||
call StartTrainerBattle_NextScene
|
||||
ld a, $10
|
||||
@@ -566,13 +566,13 @@ StartTrainerBattle_SpeckleToBlack: ; 8c58f (23:458f)
|
||||
ret
|
||||
|
||||
StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
|
||||
ld a, [OtherTrainerClass]
|
||||
ld a, [wOtherTrainerClass]
|
||||
and a
|
||||
jp z, .nextscene ; don't need to be here if wild
|
||||
|
||||
xor a
|
||||
ld [hBGMapMode], a
|
||||
hlcoord 0, 0, AttrMap
|
||||
hlcoord 0, 0, wAttrMap
|
||||
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
||||
inc b
|
||||
inc c
|
||||
@@ -639,7 +639,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
|
||||
|
||||
.cgb
|
||||
ld hl, .daypals
|
||||
ld a, [TimeOfDayPal]
|
||||
ld a, [wTimeOfDayPal]
|
||||
maskbits NUM_DAYTIMES
|
||||
cp DARKNESS_F
|
||||
jr nz, .daytime
|
||||
@@ -699,7 +699,7 @@ INCLUDE "gfx/overworld/trainer_battle_nite.pal"
|
||||
; 8c6b1
|
||||
|
||||
.loadpokeballgfx
|
||||
ld a, [OtherTrainerClass]
|
||||
ld a, [wOtherTrainerClass]
|
||||
ld de, PokeBallTransition
|
||||
ret
|
||||
|
||||
@@ -724,12 +724,12 @@ PokeBallTransition:
|
||||
WipeLYOverrides: ; 8c6d8
|
||||
ld a, [rSVBK]
|
||||
push af
|
||||
ld a, BANK(LYOverrides)
|
||||
ld a, BANK(wLYOverrides)
|
||||
ld [rSVBK], a
|
||||
|
||||
ld hl, LYOverrides
|
||||
ld hl, wLYOverrides
|
||||
call .wipe
|
||||
ld hl, LYOverridesBackup
|
||||
ld hl, wLYOverridesBackup
|
||||
call .wipe
|
||||
|
||||
pop af
|
||||
|
@@ -7,7 +7,7 @@ CheckBattleScene: ; 4ea44
|
||||
cp LINK_MOBILE
|
||||
jr z, .mobile
|
||||
|
||||
ld a, [Options]
|
||||
ld a, [wOptions]
|
||||
bit BATTLE_SCENE, a
|
||||
jr nz, .off
|
||||
|
||||
|
@@ -4,13 +4,13 @@ ConsumeHeldItem: ; 27192
|
||||
push bc
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
ld hl, OTPartyMon1Item
|
||||
ld de, EnemyMonItem
|
||||
ld a, [CurOTMon]
|
||||
ld hl, wOTPartyMon1Item
|
||||
ld de, wEnemyMonItem
|
||||
ld a, [wCurOTMon]
|
||||
jr z, .theirturn
|
||||
ld hl, PartyMon1Item
|
||||
ld de, BattleMonItem
|
||||
ld a, [CurBattleMon]
|
||||
ld hl, wPartyMon1Item
|
||||
ld de, wBattleMonItem
|
||||
ld a, [wCurBattleMon]
|
||||
|
||||
.theirturn
|
||||
push hl
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
||||
HiddenPowerDamage: ; fbced
|
||||
; Override Hidden Power's type and power based on the user's DVs.
|
||||
|
||||
ld hl, BattleMonDVs
|
||||
ld hl, wBattleMonDVs
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_dvs
|
||||
ld hl, EnemyMonDVs
|
||||
ld hl, wEnemyMonDVs
|
||||
.got_dvs
|
||||
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
DetermineLinkBattleResult: ; 2b930
|
||||
farcall UpdateEnemyMonInParty
|
||||
ld hl, PartyMon1HP
|
||||
ld hl, wPartyMon1HP
|
||||
call .CountMonsRemaining
|
||||
push bc
|
||||
ld hl, OTPartyMon1HP
|
||||
ld hl, wOTPartyMon1HP
|
||||
call .CountMonsRemaining
|
||||
ld a, c
|
||||
pop bc
|
||||
@@ -20,10 +20,10 @@ DetermineLinkBattleResult: ; 2b930
|
||||
jr z, .victory
|
||||
cp $2
|
||||
jr z, .defeat
|
||||
ld hl, PartyMon1HP
|
||||
ld hl, wPartyMon1HP
|
||||
call .CalcPercentHPRemaining
|
||||
push de
|
||||
ld hl, OTPartyMon1HP
|
||||
ld hl, wOTPartyMon1HP
|
||||
call .CalcPercentHPRemaining
|
||||
pop hl
|
||||
ld a, d
|
||||
@@ -118,16 +118,16 @@ DetermineLinkBattleResult: ; 2b930
|
||||
ret
|
||||
|
||||
.BothSides_CheckNumberMonsAtFullHealth: ; 2b9e1
|
||||
ld hl, PartyMon1HP
|
||||
ld hl, wPartyMon1HP
|
||||
call .CheckFaintedOrFullHealth
|
||||
jr nz, .finish ; we have a pokemon that's neither fainted nor at full health
|
||||
ld hl, OTPartyMon1HP
|
||||
ld hl, wOTPartyMon1HP
|
||||
call .CheckFaintedOrFullHealth
|
||||
ld e, $1
|
||||
ret
|
||||
|
||||
.finish
|
||||
ld hl, OTPartyMon1HP
|
||||
ld hl, wOTPartyMon1HP
|
||||
call .CheckFaintedOrFullHealth
|
||||
ld e, $0
|
||||
ret nz ; we both have pokemon that are neither fainted nor at full health
|
||||
|
@@ -53,7 +53,7 @@ GetPlayerBackpicCoords: ; fbd9d (3e:7d9d)
|
||||
DoWeatherModifiers: ; fbda4
|
||||
|
||||
ld de, WeatherTypeModifiers
|
||||
ld a, [Weather]
|
||||
ld a, [wBattleWeather]
|
||||
ld b, a
|
||||
ld a, [wd265] ; move type
|
||||
ld c, a
|
||||
@@ -105,7 +105,7 @@ DoWeatherModifiers: ; fbda4
|
||||
.ApplyModifier:
|
||||
xor a
|
||||
ld [hMultiplicand + 0], a
|
||||
ld hl, CurDamage
|
||||
ld hl, wCurDamage
|
||||
ld a, [hli]
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
@@ -138,9 +138,9 @@ DoWeatherModifiers: ; fbda4
|
||||
|
||||
.Update:
|
||||
ld a, b
|
||||
ld [CurDamage], a
|
||||
ld [wCurDamage], a
|
||||
ld a, c
|
||||
ld [CurDamage + 1], a
|
||||
ld [wCurDamage + 1], a
|
||||
|
||||
.done
|
||||
ret
|
||||
@@ -153,7 +153,7 @@ DoBadgeTypeBoosts: ; fbe24
|
||||
and a
|
||||
ret nz
|
||||
|
||||
ld a, [InBattleTowerBattle]
|
||||
ld a, [wInBattleTowerBattle]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
@@ -189,10 +189,10 @@ DoBadgeTypeBoosts: ; fbe24
|
||||
jr .CheckBadge
|
||||
|
||||
.ApplyBoost:
|
||||
ld a, [CurDamage]
|
||||
ld a, [wCurDamage]
|
||||
ld h, a
|
||||
ld d, a
|
||||
ld a, [CurDamage + 1]
|
||||
ld a, [wCurDamage + 1]
|
||||
ld l, a
|
||||
ld e, a
|
||||
|
||||
@@ -216,9 +216,9 @@ DoBadgeTypeBoosts: ; fbe24
|
||||
|
||||
.Update:
|
||||
ld a, h
|
||||
ld [CurDamage], a
|
||||
ld [wCurDamage], a
|
||||
ld a, l
|
||||
ld [CurDamage + 1], a
|
||||
ld [wCurDamage + 1], a
|
||||
|
||||
.done
|
||||
pop bc
|
||||
|
@@ -1,6 +1,6 @@
|
||||
BattleCommand_Attract: ; 377ce
|
||||
; attract
|
||||
ld a, [AttackMissed]
|
||||
ld a, [wAttackMissed]
|
||||
and a
|
||||
jr nz, .failed
|
||||
call CheckOppositeGender
|
||||
@@ -28,12 +28,12 @@ CheckOppositeGender: ; 377f5
|
||||
ld a, MON_SPECIES
|
||||
call BattlePartyAttr
|
||||
ld a, [hl]
|
||||
ld [CurPartySpecies], a
|
||||
ld [wCurPartySpecies], a
|
||||
|
||||
ld a, [CurBattleMon]
|
||||
ld [CurPartyMon], a
|
||||
ld a, [wCurBattleMon]
|
||||
ld [wCurPartyMon], a
|
||||
xor a
|
||||
ld [MonType], a
|
||||
ld [wMonType], a
|
||||
|
||||
farcall GetGender
|
||||
jr c, .genderless_samegender
|
||||
@@ -44,20 +44,20 @@ CheckOppositeGender: ; 377f5
|
||||
|
||||
.got_gender
|
||||
push bc
|
||||
ld a, [TempEnemyMonSpecies]
|
||||
ld [CurPartySpecies], a
|
||||
ld hl, EnemyMonDVs
|
||||
ld a, [EnemySubStatus5]
|
||||
ld a, [wTempEnemyMonSpecies]
|
||||
ld [wCurPartySpecies], a
|
||||
ld hl, wEnemyMonDVs
|
||||
ld a, [wEnemySubStatus5]
|
||||
bit SUBSTATUS_TRANSFORMED, a
|
||||
jr z, .not_transformed
|
||||
ld hl, wEnemyBackupDVs
|
||||
.not_transformed
|
||||
ld a, [hli]
|
||||
ld [TempMonDVs], a
|
||||
ld [wTempMonDVs], a
|
||||
ld a, [hl]
|
||||
ld [TempMonDVs + 1], a
|
||||
ld [wTempMonDVs + 1], a
|
||||
ld a, 3
|
||||
ld [MonType], a
|
||||
ld [wMonType], a
|
||||
farcall GetGender
|
||||
pop bc
|
||||
jr c, .genderless_samegender
|
||||
|
@@ -90,7 +90,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67
|
||||
ret z
|
||||
|
||||
ld a, 1
|
||||
ld [wPlayerAction], a
|
||||
ld [wBattlePlayerAction], a
|
||||
|
||||
call LoadStandardMenuHeader
|
||||
ld hl, LinkBattleSendReceiveAction
|
||||
@@ -98,7 +98,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67
|
||||
call CloseWindow
|
||||
|
||||
xor a
|
||||
ld [wPlayerAction], a
|
||||
ld [wBattlePlayerAction], a
|
||||
ret
|
||||
|
||||
; 37a82
|
||||
@@ -113,7 +113,7 @@ BatonPass_LinkEnemySwitch: ; 37a82
|
||||
ld hl, LinkBattleSendReceiveAction
|
||||
call CallBattleCore
|
||||
|
||||
ld a, [OTPartyCount]
|
||||
ld a, [wOTPartyCount]
|
||||
add BATTLEACTION_SWITCH1
|
||||
ld b, a
|
||||
ld a, [wBattleAction]
|
||||
@@ -123,7 +123,7 @@ BatonPass_LinkEnemySwitch: ; 37a82
|
||||
jr c, .switch
|
||||
|
||||
.baton_pass
|
||||
ld a, [CurOTMon]
|
||||
ld a, [wCurOTMon]
|
||||
add BATTLEACTION_SWITCH1
|
||||
ld [wBattleAction], a
|
||||
.switch
|
||||
@@ -157,11 +157,11 @@ ResetBatonPassStatus: ; 37ab1
|
||||
call ResetActorDisable
|
||||
|
||||
; Attraction isn't passed.
|
||||
ld hl, PlayerSubStatus1
|
||||
ld hl, wPlayerSubStatus1
|
||||
res SUBSTATUS_IN_LOVE, [hl]
|
||||
ld hl, EnemySubStatus1
|
||||
ld hl, wEnemySubStatus1
|
||||
res SUBSTATUS_IN_LOVE, [hl]
|
||||
ld hl, PlayerSubStatus5
|
||||
ld hl, wPlayerSubStatus5
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS5
|
||||
call GetBattleVarAddr
|
||||
@@ -182,10 +182,10 @@ ResetBatonPassStatus: ; 37ab1
|
||||
|
||||
|
||||
CheckAnyOtherAlivePartyMons: ; 37ae9
|
||||
ld hl, PartyMon1HP
|
||||
ld a, [PartyCount]
|
||||
ld hl, wPartyMon1HP
|
||||
ld a, [wPartyCount]
|
||||
ld d, a
|
||||
ld a, [CurBattleMon]
|
||||
ld a, [wCurBattleMon]
|
||||
ld e, a
|
||||
jr CheckAnyOtherAliveMons
|
||||
|
||||
@@ -193,10 +193,10 @@ CheckAnyOtherAlivePartyMons: ; 37ae9
|
||||
|
||||
|
||||
CheckAnyOtherAliveEnemyMons: ; 37af6
|
||||
ld hl, OTPartyMon1HP
|
||||
ld a, [OTPartyCount]
|
||||
ld hl, wOTPartyMon1HP
|
||||
ld a, [wOTPartyCount]
|
||||
ld d, a
|
||||
ld a, [CurOTMon]
|
||||
ld a, [wCurOTMon]
|
||||
ld e, a
|
||||
|
||||
; fallthrough
|
||||
|
@@ -5,27 +5,27 @@ BattleCommand_BeatUp: ; 35461
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jp nz, .enemy_beats_up
|
||||
ld a, [PlayerSubStatus3]
|
||||
ld a, [wPlayerSubStatus3]
|
||||
bit SUBSTATUS_IN_LOOP, a
|
||||
jr nz, .next_mon
|
||||
ld c, 20
|
||||
call DelayFrames
|
||||
xor a
|
||||
ld [PlayerRolloutCount], a
|
||||
ld [wPlayerRolloutCount], a
|
||||
ld [wd002], a
|
||||
ld [wBeatUpHitAtLeastOnce], a
|
||||
jr .got_mon
|
||||
|
||||
.next_mon
|
||||
ld a, [PlayerRolloutCount]
|
||||
ld a, [wPlayerRolloutCount]
|
||||
ld b, a
|
||||
ld a, [PartyCount]
|
||||
ld a, [wPartyCount]
|
||||
sub b
|
||||
ld [wd002], a
|
||||
|
||||
.got_mon
|
||||
ld a, [wd002]
|
||||
ld hl, PartyMonNicknames
|
||||
ld hl, wPartyMonNicknames
|
||||
call GetNick
|
||||
ld a, MON_HP
|
||||
call GetBeatupMonLocation
|
||||
@@ -34,11 +34,11 @@ BattleCommand_BeatUp: ; 35461
|
||||
jp z, .beatup_fail ; fainted
|
||||
ld a, [wd002]
|
||||
ld c, a
|
||||
ld a, [CurBattleMon]
|
||||
ld a, [wCurBattleMon]
|
||||
; BUG: this can desynchronize link battles
|
||||
; Change "cp [hl]" to "cp c" to fix
|
||||
cp [hl]
|
||||
ld hl, BattleMonStatus
|
||||
ld hl, wBattleMonStatus
|
||||
jr z, .active_mon
|
||||
ld a, MON_STATUS
|
||||
call GetBeatupMonLocation
|
||||
@@ -51,18 +51,18 @@ BattleCommand_BeatUp: ; 35461
|
||||
ld [wBeatUpHitAtLeastOnce], a
|
||||
ld hl, BeatUpAttackText
|
||||
call StdBattleTextBox
|
||||
ld a, [EnemyMonSpecies]
|
||||
ld [CurSpecies], a
|
||||
ld a, [wEnemyMonSpecies]
|
||||
ld [wCurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseDefense]
|
||||
ld a, [wBaseDefense]
|
||||
ld c, a
|
||||
push bc
|
||||
ld a, MON_SPECIES
|
||||
call GetBeatupMonLocation
|
||||
ld a, [hl]
|
||||
ld [CurSpecies], a
|
||||
ld [wCurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseAttack]
|
||||
ld a, [wBaseAttack]
|
||||
pop bc
|
||||
ld b, a
|
||||
push bc
|
||||
@@ -76,20 +76,20 @@ BattleCommand_BeatUp: ; 35461
|
||||
ret
|
||||
|
||||
.enemy_beats_up
|
||||
ld a, [EnemySubStatus3]
|
||||
ld a, [wEnemySubStatus3]
|
||||
bit SUBSTATUS_IN_LOOP, a
|
||||
jr nz, .not_first_enemy_beatup
|
||||
|
||||
xor a
|
||||
ld [EnemyRolloutCount], a
|
||||
ld [wEnemyRolloutCount], a
|
||||
ld [wd002], a
|
||||
ld [wBeatUpHitAtLeastOnce], a
|
||||
jr .enemy_continue
|
||||
|
||||
.not_first_enemy_beatup
|
||||
ld a, [EnemyRolloutCount]
|
||||
ld a, [wEnemyRolloutCount]
|
||||
ld b, a
|
||||
ld a, [OTPartyCount]
|
||||
ld a, [wOTPartyCount]
|
||||
sub b
|
||||
ld [wd002], a
|
||||
.enemy_continue
|
||||
@@ -101,14 +101,14 @@ BattleCommand_BeatUp: ; 35461
|
||||
and a
|
||||
jr nz, .link_or_tower
|
||||
|
||||
ld a, [InBattleTowerBattle]
|
||||
ld a, [wInBattleTowerBattle]
|
||||
and a
|
||||
jr nz, .link_or_tower
|
||||
|
||||
ld a, [wd002]
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, OTPartySpecies
|
||||
ld hl, wOTPartySpecies
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
ld [wNamedObjectIndexBuffer], a
|
||||
@@ -117,10 +117,10 @@ BattleCommand_BeatUp: ; 35461
|
||||
|
||||
.link_or_tower
|
||||
ld a, [wd002]
|
||||
ld hl, OTPartyMonNicknames
|
||||
ld hl, wOTPartyMonNicknames
|
||||
ld bc, NAME_LENGTH
|
||||
call AddNTimes
|
||||
ld de, StringBuffer1
|
||||
ld de, wStringBuffer1
|
||||
call CopyBytes
|
||||
.got_enemy_nick
|
||||
ld a, MON_HP
|
||||
@@ -130,9 +130,9 @@ BattleCommand_BeatUp: ; 35461
|
||||
jp z, .beatup_fail
|
||||
ld a, [wd002]
|
||||
ld b, a
|
||||
ld a, [CurOTMon]
|
||||
ld a, [wCurOTMon]
|
||||
cp b
|
||||
ld hl, EnemyMonStatus
|
||||
ld hl, wEnemyMonStatus
|
||||
jr z, .active_enemy
|
||||
|
||||
ld a, MON_STATUS
|
||||
@@ -147,7 +147,7 @@ BattleCommand_BeatUp: ; 35461
|
||||
jr .finish_beatup
|
||||
|
||||
.wild
|
||||
ld a, [EnemyMonSpecies]
|
||||
ld a, [wEnemyMonSpecies]
|
||||
ld [wNamedObjectIndexBuffer], a
|
||||
call GetPokemonName
|
||||
ld hl, BeatUpAttackText
|
||||
@@ -157,18 +157,18 @@ BattleCommand_BeatUp: ; 35461
|
||||
.finish_beatup
|
||||
ld hl, BeatUpAttackText
|
||||
call StdBattleTextBox
|
||||
ld a, [BattleMonSpecies]
|
||||
ld [CurSpecies], a
|
||||
ld a, [wBattleMonSpecies]
|
||||
ld [wCurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseDefense]
|
||||
ld a, [wBaseDefense]
|
||||
ld c, a
|
||||
push bc
|
||||
ld a, MON_SPECIES
|
||||
call GetBeatupMonLocation
|
||||
ld a, [hl]
|
||||
ld [CurSpecies], a
|
||||
ld [wCurSpecies], a
|
||||
call GetBaseData
|
||||
ld a, [BaseAttack]
|
||||
ld a, [wBaseAttack]
|
||||
pop bc
|
||||
ld b, a
|
||||
push bc
|
||||
@@ -207,9 +207,9 @@ GetBeatupMonLocation: ; 355bd
|
||||
ld b, 0
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
ld hl, PartyMon1Species
|
||||
ld hl, wPartyMon1Species
|
||||
jr z, .got_species
|
||||
ld hl, OTPartyMon1Species
|
||||
ld hl, wOTPartyMon1Species
|
||||
|
||||
.got_species
|
||||
ld a, [wd002]
|
||||
|
@@ -4,7 +4,7 @@ BattleCommand_BellyDrum: ; 37c1a
|
||||
; before checking that it has enough HP to use the move.
|
||||
; Swap the order of these two blocks to fix.
|
||||
call BattleCommand_AttackUp2
|
||||
ld a, [AttackMissed]
|
||||
ld a, [wAttackMissed]
|
||||
and a
|
||||
jr nz, .failed
|
||||
|
||||
|
@@ -6,11 +6,11 @@ BattleCommand_StoreEnergy: ; 36671
|
||||
bit SUBSTATUS_BIDE, a
|
||||
ret z
|
||||
|
||||
ld hl, PlayerRolloutCount
|
||||
ld hl, wPlayerRolloutCount
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .check_still_storing_energy
|
||||
ld hl, EnemyRolloutCount
|
||||
ld hl, wEnemyRolloutCount
|
||||
.check_still_storing_energy
|
||||
dec [hl]
|
||||
jr nz, .still_storing
|
||||
@@ -26,30 +26,30 @@ BattleCommand_StoreEnergy: ; 36671
|
||||
call GetBattleVarAddr
|
||||
ld a, 1
|
||||
ld [hl], a
|
||||
ld hl, PlayerDamageTaken + 1
|
||||
ld hl, wPlayerDamageTaken + 1
|
||||
ld de, wPlayerCharging ; player
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .player
|
||||
ld hl, EnemyDamageTaken + 1
|
||||
ld hl, wEnemyDamageTaken + 1
|
||||
ld de, wEnemyCharging ; enemy
|
||||
.player
|
||||
ld a, [hld]
|
||||
add a
|
||||
ld b, a
|
||||
ld [CurDamage + 1], a
|
||||
ld [wCurDamage + 1], a
|
||||
ld a, [hl]
|
||||
rl a
|
||||
ld [CurDamage], a
|
||||
ld [wCurDamage], a
|
||||
jr nc, .not_maxed
|
||||
ld a, $ff
|
||||
ld [CurDamage], a
|
||||
ld [CurDamage + 1], a
|
||||
ld [wCurDamage], a
|
||||
ld [wCurDamage + 1], a
|
||||
.not_maxed
|
||||
or b
|
||||
jr nz, .built_up_something
|
||||
ld a, 1
|
||||
ld [AttackMissed], a
|
||||
ld [wAttackMissed], a
|
||||
.built_up_something
|
||||
xor a
|
||||
ld [hli], a
|
||||
@@ -75,13 +75,13 @@ BattleCommand_StoreEnergy: ; 36671
|
||||
BattleCommand_UnleashEnergy: ; 366e5
|
||||
; unleashenergy
|
||||
|
||||
ld de, PlayerDamageTaken
|
||||
ld bc, PlayerRolloutCount
|
||||
ld de, wPlayerDamageTaken
|
||||
ld bc, wPlayerRolloutCount
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_damage
|
||||
ld de, EnemyDamageTaken
|
||||
ld bc, EnemyRolloutCount
|
||||
ld de, wEnemyDamageTaken
|
||||
ld bc, wEnemyRolloutCount
|
||||
.got_damage
|
||||
ld a, BATTLE_VARS_SUBSTATUS3
|
||||
call GetBattleVarAddr
|
||||
|
@@ -1,17 +1,17 @@
|
||||
BattleCommand_Conversion: ; 3707f
|
||||
; conversion
|
||||
|
||||
ld hl, BattleMonMoves
|
||||
ld de, BattleMonType1
|
||||
ld hl, wBattleMonMoves
|
||||
ld de, wBattleMonType1
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .got_moves
|
||||
ld hl, EnemyMonMoves
|
||||
ld de, EnemyMonType1
|
||||
ld hl, wEnemyMonMoves
|
||||
ld de, wEnemyMonType1
|
||||
.got_moves
|
||||
push de
|
||||
ld c, 0
|
||||
ld de, StringBuffer1
|
||||
ld de, wStringBuffer1
|
||||
.loop
|
||||
push hl
|
||||
ld b, 0
|
||||
@@ -41,7 +41,7 @@ BattleCommand_Conversion: ; 3707f
|
||||
inc de
|
||||
ld [de], a
|
||||
pop de
|
||||
ld hl, StringBuffer1
|
||||
ld hl, wStringBuffer1
|
||||
.loop2
|
||||
ld a, [hl]
|
||||
cp -1
|
||||
@@ -70,7 +70,7 @@ BattleCommand_Conversion: ; 3707f
|
||||
maskbits NUM_MOVES
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, StringBuffer1
|
||||
ld hl, wStringBuffer1
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
cp -1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user