Skip to content

Commit

Permalink
Add meaningful aliases for wd265
Browse files Browse the repository at this point in the history
Introduce MONICON_* constants
Introduce BATTLEPLAYERACTION_* constants
  • Loading branch information
Rangi42 committed Jul 29, 2018
1 parent 2ec900d commit 9dec80b
Show file tree
Hide file tree
Showing 83 changed files with 436 additions and 404 deletions.
10 changes: 8 additions & 2 deletions constants/battle_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ MOVE_LENGTH EQU const_value
const STAT_SATK
NUM_EXP_STATS EQU const_value + -1
const STAT_SDEF
NUM_STATS EQU const_value +- 1
STAT_SPC EQU STAT_SATK
NUM_STATS EQU const_value + -1
NUM_BATTLE_STATS EQU NUM_STATS + -1 ; don't count HP

; stat formula constants
STAT_MIN_NORMAL EQU 5
Expand Down Expand Up @@ -244,6 +244,12 @@ SUBSTATUS_CURLED EQU 0
const BATTLEACTION_E
const BATTLEACTION_FORFEIT

; wBattlePlayerAction
const_def
const BATTLEPLAYERACTION_USEMOVE
const BATTLEPLAYERACTION_USEITEM
const BATTLEPLAYERACTION_SWITCH

; wBattleResult
const_def
const WIN
Expand Down
10 changes: 10 additions & 0 deletions constants/icon_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@
const ICON_SLOWPOKE
const ICON_SUDOWOODO
const ICON_BIGMON

; LoadMenuMonIcon.Jumptable indexes (see engine/gfx/mon_icons.asm)
const_def
const MONICON_PARTYMENU
const MONICON_NAMINGSCREEN
const MONICON_MOVES
const MONICON_TRADE
const MONICON_MOBILE1
const MONICON_MOBILE2
const MONICON_UNUSED
6 changes: 3 additions & 3 deletions data/text/battle.asm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SandstormHitsText:
PerishCountText:
text "<USER>'s"
line "PERISH count is @"
deciram wd265, 1, 1
deciram wDeciramBuffer, 1, 1
text "!"
prompt

Expand Down Expand Up @@ -669,7 +669,7 @@ SpiteEffectText:
text_from_ram wStringBuffer1
text " was"
cont "reduced by @"
deciram wd265, 1, 1
deciram wDeciramBuffer, 1, 1
text "!"
prompt

Expand Down Expand Up @@ -1029,7 +1029,7 @@ SafeguardProtectText:

MagnitudeText:
text "Magnitude @"
deciram wd265, 1, 1
deciram wDeciramBuffer, 1, 1
text "!"
prompt

Expand Down
4 changes: 2 additions & 2 deletions data/text/common_1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ UnknownText_0x1bc0a2::
text_from_ram wStringBuffer1
text_start
line "recovered @"
deciram wd1f3, 2, 3
deciram wCurHPAnimDeltaHP, 2, 3
text "HP!"
done

Expand Down Expand Up @@ -1155,7 +1155,7 @@ Text_BreedingIsNotPossible::
UnknownText_0x1bd0d8::
text "The compatibility"
line "is @"
deciram wd265, 1, 3
deciram wDeciramBuffer, 1, 3
text "."
cont "Should they breed?"
done
Expand Down
2 changes: 1 addition & 1 deletion data/text/common_2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ UnknownText_0x1c0531::
text_from_ram wc850
text "'s CARD was"
line "listed as no.@"
deciram wd265, 1, 2
deciram wDeciramBuffer, 1, 2
text "."
prompt

Expand Down
2 changes: 1 addition & 1 deletion engine/battle/ai/items.asm
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ PrintText_UsedItemOn_AND_AIUpdateHUD:

PrintText_UsedItemOn:
ld a, [wCurEnemyItem]
ld [wd265], a
ld [wNamedObjectIndexBuffer], a
call GetItemName
ld hl, wStringBuffer1
ld de, wMonOrItemNameBuffer
Expand Down
34 changes: 17 additions & 17 deletions engine/battle/ai/scoring.asm
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ AI_Types:
pop bc
pop hl

ld a, [wd265]
ld a, [wTypeMatchup]
and a
jr z, .immune
cp 10 ; 1.0
cp EFFECTIVE
jr z, .checkmove
jr c, .noteffective

Expand Down Expand Up @@ -415,8 +415,8 @@ AI_Smart_LeechHit:
pop hl

; 60% chance to discourage this move if not very effective.
ld a, [wd265]
cp 10 ; 1.0
ld a, [wTypeMatchup]
cp EFFECTIVE
jr c, .asm_38815

; Do nothing if effectiveness is neutral.
Expand Down Expand Up @@ -491,8 +491,8 @@ AI_Smart_LockOn:
push hl
push bc
farcall BattleCheckTypeMatchup
ld a, [wd265]
cp $a
ld a, [wTypeMatchup]
cp EFFECTIVE
pop bc
pop hl
jr c, .asm_3884f
Expand Down Expand Up @@ -1292,8 +1292,8 @@ AI_Smart_Mimic:
ld [hBattleTurn], a
callfar BattleCheckTypeMatchup

ld a, [wd265]
cp $a
ld a, [wTypeMatchup]
cp EFFECTIVE
pop hl
jr c, .asm_38bef
jr z, .asm_38bd4
Expand Down Expand Up @@ -1408,8 +1408,8 @@ AI_Smart_Encore:
predef CheckTypeMatchup

pop hl
ld a, [wd265]
cp $a
ld a, [wTypeMatchup]
cp EFFECTIVE
jr nc, .asm_38c68

and a
Expand Down Expand Up @@ -1679,8 +1679,8 @@ AI_Smart_Conversion2:

callfar BattleCheckTypeMatchup

ld a, [wd265]
cp $a
ld a, [wTypeMatchup]
cp EFFECTIVE
pop hl
jr c, .asm_38dc9
ret z
Expand Down Expand Up @@ -2293,8 +2293,8 @@ AI_Smart_HiddenPower:
pop hl

; Discourage Hidden Power if not very effective.
ld a, [wd265]
cp 10
ld a, [wTypeMatchup]
cp EFFECTIVE
jr c, .bad

; Discourage Hidden Power if its base power is lower than 50.
Expand All @@ -2303,8 +2303,8 @@ AI_Smart_HiddenPower:
jr c, .bad

; Encourage Hidden Power if super-effective.
ld a, [wd265]
cp 11
ld a, [wTypeMatchup]
cp EFFECTIVE + 1
jr nc, .good

; Encourage Hidden Power if its base power is 70.
Expand Down Expand Up @@ -3125,7 +3125,7 @@ AI_Status:
pop bc
pop hl

ld a, [wd265]
ld a, [wTypeMatchup]
and a
jr nz, .checkmove

Expand Down
Loading

0 comments on commit 9dec80b

Please sign in to comment.