summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/consumehelditem.asm29
-rw-r--r--engine/battle/core.asm58
-rw-r--r--engine/battle/effect_commands.asm29
-rw-r--r--engine/battle/effect_commands/metronome.asm17
-rwxr-xr-xengine/battle/effect_commands/present.asm11
-rw-r--r--engine/battle/misc.asm41
-rwxr-xr-xengine/battle/read_trainer_party.asm3
-rwxr-xr-xengine/battle/used_move_text.asm1
8 files changed, 35 insertions, 154 deletions
diff --git a/engine/battle/consumehelditem.asm b/engine/battle/consumehelditem.asm
index a6f7766fb..58ded0922 100644
--- a/engine/battle/consumehelditem.asm
+++ b/engine/battle/consumehelditem.asm
@@ -18,7 +18,7 @@ ConsumeHeldItem: ; 27192
ld a, [de]
ld b, a
farcall GetItemHeldEffect
- ld hl, .ConsumableEffects
+ ld hl, ConsumableEffects
.loop
ld a, [hli]
cp b
@@ -46,7 +46,7 @@ ConsumeHeldItem: ; 27192
jr z, .done
.ourturn
- ld [hl], $0
+ ld [hl], NO_ITEM
.done
pop bc
@@ -54,27 +54,4 @@ ConsumeHeldItem: ; 27192
pop hl
ret
-.ConsumableEffects: ; 271de
-; Consumable items?
- db HELD_BERRY
- db HELD_2
- db HELD_5
- db HELD_HEAL_POISON
- db HELD_HEAL_FREEZE
- db HELD_HEAL_BURN
- db HELD_HEAL_SLEEP
- db HELD_HEAL_PARALYZE
- db HELD_HEAL_STATUS
- db HELD_30
- db HELD_ATTACK_UP
- db HELD_DEFENSE_UP
- db HELD_SPEED_UP
- db HELD_SP_ATTACK_UP
- db HELD_SP_DEFENSE_UP
- db HELD_ACCURACY_UP
- db HELD_EVASION_UP
- db HELD_38
- db HELD_71
- db HELD_ESCAPE
- db HELD_CRITICAL_UP
- db -1
+INCLUDE "data/battle/held_consumables.asm"
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index f52cc3b97..4326c297b 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -1807,10 +1807,13 @@ HandleWeather: ; 3cb9e
; 3cc2d
.WeatherMessages:
+; entries correspond to WEATHER_* constants
dw BattleText_RainContinuesToFall
dw BattleText_TheSunlightIsStrong
dw BattleText_TheSandstormRages
+
.WeatherEndedMessages:
+; entries correspond to WEATHER_* constants
dw BattleText_TheRainStopped
dw BattleText_TheSunlightFaded
dw BattleText_TheSandstormSubsided
@@ -2557,9 +2560,10 @@ WinTrainerBattle: ; 3cfa4
; 3d0ab
.SentToMomTexts: ; 3d0ab
- dw SentSomeToMomText ; MOM_SAVING_SOME_MONEY_F
- dw SentHalfToMomText ; MOM_SAVING_HALF_MONEY_F
- dw SentAllToMomText ; MOM_SAVING_ALL_MONEY_F
+; entries correspond to MOM_SAVING_* constants
+ dw SentSomeToMomText
+ dw SentHalfToMomText
+ dw SentAllToMomText
; 3d0b1
.CheckMaxedOutMomMoney: ; 3d0b1
@@ -4488,7 +4492,7 @@ ItemRecoveryAnim: ; 3ddc8
UseHeldStatusHealingItem: ; 3dde9
callfar GetOpponentItem
- ld hl, .Statuses
+ ld hl, HeldStatusHealingEffects
.loop
ld a, [hli]
cp $ff
@@ -4541,15 +4545,7 @@ UseHeldStatusHealingItem: ; 3dde9
ret
; 3de44
-.Statuses: ; 3de44
- db HELD_HEAL_POISON, 1 << PSN
- db HELD_HEAL_FREEZE, 1 << FRZ
- db HELD_HEAL_BURN, 1 << BRN
- db HELD_HEAL_SLEEP, SLP
- db HELD_HEAL_PARALYZE, 1 << PAR
- db HELD_HEAL_STATUS, ALL_STATUS
- db -1 ; end
-; 3de51
+INCLUDE "data/battle/held_heal_status.asm"
UseConfusionHealingItem: ; 3de51
ld a, BATTLE_VARS_SUBSTATUS3_OPP
@@ -4624,10 +4620,10 @@ HandleStatBoostingHeldItems: ; 3de97
ld a, [bc]
ld b, a
callfar GetItemHeldEffect
- ld hl, .StatUpItems
+ ld hl, HeldStatUpItems
.loop
ld a, [hli]
- cp $ff
+ cp -1
jr z, .finish
inc hl
inc hl
@@ -4664,16 +4660,7 @@ HandleStatBoostingHeldItems: ; 3de97
ret
; 3defc
-.StatUpItems:
- dbw HELD_ATTACK_UP, BattleCommand_AttackUp
- dbw HELD_DEFENSE_UP, BattleCommand_DefenseUp
- dbw HELD_SPEED_UP, BattleCommand_SpeedUp
- dbw HELD_SP_ATTACK_UP, BattleCommand_SpecialAttackUp
- dbw HELD_SP_DEFENSE_UP, BattleCommand_SpecialDefenseUp
- dbw HELD_ACCURACY_UP, BattleCommand_AccuracyUp
- dbw HELD_EVASION_UP, BattleCommand_EvasionUp
- db -1 ; end
-; 3df12
+INCLUDE "data/battle/held_stat_up.asm"
GetPartymonItem: ; 3df12
ld hl, PartyMon1Item
@@ -6902,7 +6889,7 @@ ApplyStatLevelMultiplier: ; 3ecb7
.okay2
pop bc
push hl
- ld hl, .StatLevelMultipliers
+ ld hl, StatLevelMultipliers_Applied
dec b
sla b
ld c, b
@@ -6951,24 +6938,7 @@ ApplyStatLevelMultiplier: ; 3ecb7
ret
; 3ed2b
-.StatLevelMultipliers:
-; /
- db 25, 100 ; 25%
- db 28, 100 ; 28%
- db 33, 100 ; 33%
- db 40, 100 ; 40%
- db 50, 100 ; 50%
- db 66, 100 ; 66%
-
- db 1, 1 ; 100%
-
- db 15, 10 ; 150%
- db 2, 1 ; 200%
- db 25, 10 ; 250%
- db 3, 1 ; 300%
- db 35, 10 ; 350%
- db 4, 1 ; 400%
-; 3ed45
+INCLUDE "data/battle/stat_multipliers_2.asm"
BadgeStatBoosts: ; 3ed45
; Raise BattleMon stats depending on which badges have been obtained.
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index 166904472..55d56734c 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -2713,7 +2713,7 @@ BattleCommand_RageDamage: ; 3527b
dec a
add hl, bc
jr nc, .rage_loop
- ld hl, -1
+ ld hl, $ffff
.done
ld a, h
ld [CurDamage], a
@@ -3766,11 +3766,11 @@ BattleCommand_ConstantDamage: ; 35726
ld [hDividend + 2], a
.skip_to_divide
- ld b, $4
+ ld b, 4
call Divide
ld a, [hQuotient + 2]
ld b, a
- ld hl, .FlailPower
+ ld hl, FlailReversalPower
.reversal_loop
ld a, [hli]
@@ -3803,15 +3803,7 @@ BattleCommand_ConstantDamage: ; 35726
ld [hl], 1
ret
-.FlailPower:
- ; px, bp
- db 1, 200
- db 4, 150
- db 9, 100
- db 16, 80
- db 32, 40
- db 48, 20
-; 35813
+INCLUDE "data/battle/flail_reversal_power.asm"
BattleCommand_Counter: ; 35813
@@ -8920,7 +8912,7 @@ BattleCommand_GetMagnitude: ; 37991
push bc
call BattleRandom
ld b, a
- ld hl, .Magnitudes
+ ld hl, MagnitudePower
.loop
ld a, [hli]
cp b
@@ -8942,16 +8934,7 @@ BattleCommand_GetMagnitude: ; 37991
pop bc
ret
-.Magnitudes:
- ; /255, BP, magnitude
- db 13, 10, 4
- db 38, 30, 5
- db 89, 50, 6
- db 166, 70, 7
- db 217, 90, 8
- db 242, 110, 9
- db 255, 150, 10
-; 379c9
+INCLUDE "data/battle/magnitude_power.asm"
BattleCommand_BatonPass: ; 379c9
diff --git a/engine/battle/effect_commands/metronome.asm b/engine/battle/effect_commands/metronome.asm
index 1908df84d..6835ab569 100644
--- a/engine/battle/effect_commands/metronome.asm
+++ b/engine/battle/effect_commands/metronome.asm
@@ -43,19 +43,4 @@ BattleCommand_Metronome: ; 37418
; 37454
-MetronomeExcepts: ; 37454
- db NO_MOVE
- db METRONOME
- db STRUGGLE
- db SKETCH
- db MIMIC
- db COUNTER
- db MIRROR_COAT
- db PROTECT
- db DETECT
- db ENDURE
- db DESTINY_BOND
- db SLEEP_TALK
- db THIEF
- db -1
-; 37462
+INCLUDE "data/battle/metronome_exception_moves.asm"
diff --git a/engine/battle/effect_commands/present.asm b/engine/battle/effect_commands/present.asm
index 2b358e8b9..1af6b4b49 100755
--- a/engine/battle/effect_commands/present.asm
+++ b/engine/battle/effect_commands/present.asm
@@ -27,7 +27,7 @@ BattleCommand_Present: ; 37874
push bc
call BattleRandom
ld b, a
- ld hl, .PresentPower
+ ld hl, PresentPower
ld c, 0
.next
ld a, [hli]
@@ -49,7 +49,7 @@ BattleCommand_Present: ; 37874
.heal_effect
pop bc
- ld a, $3
+ ld a, 3
ld [wPresentPower], a
call AnimateCurrentMove
call BattleCommand_SwitchTurn
@@ -85,9 +85,4 @@ BattleCommand_Present: ; 37874
.do_animation
jp EndMoveEffect
-.PresentPower:
- db 40 percent, 40
- db 70 percent + 1, 80
- db 80 percent, 120
- db -1 ; end
-; 3790e
+INCLUDE "data/battle/present_power.asm"
diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm
index a41d31d9a..ec616fa79 100644
--- a/engine/battle/misc.asm
+++ b/engine/battle/misc.asm
@@ -52,7 +52,7 @@ GetPlayerBackpicCoords: ; fbd9d (3e:7d9d)
DoWeatherModifiers: ; fbda4
- ld de, .WeatherTypeModifiers
+ ld de, WeatherTypeModifiers
ld a, [Weather]
ld b, a
ld a, [wd265] ; move type
@@ -78,7 +78,7 @@ DoWeatherModifiers: ; fbda4
.done_weather_types
- ld de, .WeatherMoveModifiers
+ ld de, WeatherMoveModifiers
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
@@ -145,17 +145,7 @@ DoWeatherModifiers: ; fbda4
.done
ret
-.WeatherTypeModifiers:
- db WEATHER_RAIN, WATER, MORE_EFFECTIVE
- db WEATHER_RAIN, FIRE, NOT_VERY_EFFECTIVE
- db WEATHER_SUN, FIRE, MORE_EFFECTIVE
- db WEATHER_SUN, WATER, NOT_VERY_EFFECTIVE
- db -1 ; end
-
-.WeatherMoveModifiers:
- db WEATHER_RAIN, EFFECT_SOLARBEAM, NOT_VERY_EFFECTIVE
- db -1 ; end
-; fbe24
+INCLUDE "data/battle/weather_modifiers.asm"
DoBadgeTypeBoosts: ; fbe24
@@ -174,7 +164,7 @@ DoBadgeTypeBoosts: ; fbe24
push de
push bc
- ld hl, .BadgeTypes
+ ld hl, BadgeTypeBoosts
ld a, [wKantoBadges]
ld b, a
@@ -235,25 +225,4 @@ DoBadgeTypeBoosts: ; fbe24
pop de
ret
-.BadgeTypes:
-; entries correspond to wJohtoBadges constants
- db FLYING ; ZEPHYRBADGE
- db BUG ; HIVEBADGE
- db NORMAL ; PLAINBADGE
- db GHOST ; FOGBADGE
- db STEEL ; MINERALBADGE
- db FIGHTING ; STORMBADGE
- db ICE ; GLACIERBADGE
- db DRAGON ; RISINGBADGE
- ; fallthrough
-; entries correspond to wKantoBadges constants
- db ROCK ; BOULDERBADGE
- db WATER ; CASCADEBADGE
- db ELECTRIC ; THUNDERBADGE
- db GRASS ; RAINBOWBADGE
- db POISON ; SOULBADGE
- db PSYCHIC ; MARSHBADGE
- db FIRE ; VOLCANOBADGE
- db GROUND ; EARTHBADGE
- db -1 ; end
-; fbe91
+INCLUDE "data/battle/badge_type_boosts.asm"
diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm
index a09c6dd08..e9d8c60a9 100755
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -44,7 +44,7 @@ ReadTrainerParty: ; 39771
jr z, .got_trainer
.loop
ld a, [hli]
- cp $ff
+ cp -1
jr nz, .loop
jr .skip_trainer
.got_trainer
@@ -82,6 +82,7 @@ ReadTrainerParty: ; 39771
; 397e3
TrainerTypes: ; 397e3
+; entries correspond to TRAINERTYPE_* constants
dw TrainerType1 ; level, species
dw TrainerType2 ; level, species, moves
dw TrainerType3 ; level, species, item
diff --git a/engine/battle/used_move_text.asm b/engine/battle/used_move_text.asm
index 1b5aa564c..4ebcbe283 100755
--- a/engine/battle/used_move_text.asm
+++ b/engine/battle/used_move_text.asm
@@ -114,6 +114,7 @@ MoveNameText: ; 105e23
; 105e39
.endusedmovetexts ; 105e39
+; entries correspond to MoveGrammar sets
dw EndUsedMove1Text
dw EndUsedMove2Text
dw EndUsedMove3Text