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 pull request #548 from Rangi42/master
Add meaningful aliases for wd265
This commit is contained in:
@@ -64,7 +64,7 @@ MOVE_LENGTH EQU const_value
|
|||||||
NUM_EXP_STATS EQU const_value + -1
|
NUM_EXP_STATS EQU const_value + -1
|
||||||
const STAT_SDEF
|
const STAT_SDEF
|
||||||
NUM_STATS EQU const_value + -1
|
NUM_STATS EQU const_value + -1
|
||||||
STAT_SPC EQU STAT_SATK
|
NUM_BATTLE_STATS EQU NUM_STATS + -1 ; don't count HP
|
||||||
|
|
||||||
; stat formula constants
|
; stat formula constants
|
||||||
STAT_MIN_NORMAL EQU 5
|
STAT_MIN_NORMAL EQU 5
|
||||||
@@ -244,6 +244,12 @@ SUBSTATUS_CURLED EQU 0
|
|||||||
const BATTLEACTION_E
|
const BATTLEACTION_E
|
||||||
const BATTLEACTION_FORFEIT
|
const BATTLEACTION_FORFEIT
|
||||||
|
|
||||||
|
; wBattlePlayerAction
|
||||||
|
const_def
|
||||||
|
const BATTLEPLAYERACTION_USEMOVE
|
||||||
|
const BATTLEPLAYERACTION_USEITEM
|
||||||
|
const BATTLEPLAYERACTION_SWITCH
|
||||||
|
|
||||||
; wBattleResult
|
; wBattleResult
|
||||||
const_def
|
const_def
|
||||||
const WIN
|
const WIN
|
||||||
|
@@ -39,3 +39,13 @@
|
|||||||
const ICON_SLOWPOKE
|
const ICON_SLOWPOKE
|
||||||
const ICON_SUDOWOODO
|
const ICON_SUDOWOODO
|
||||||
const ICON_BIGMON
|
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
|
||||||
|
@@ -87,7 +87,7 @@ SandstormHitsText:
|
|||||||
PerishCountText:
|
PerishCountText:
|
||||||
text "<USER>'s"
|
text "<USER>'s"
|
||||||
line "PERISH count is @"
|
line "PERISH count is @"
|
||||||
deciram wd265, 1, 1
|
deciram wDeciramBuffer, 1, 1
|
||||||
text "!"
|
text "!"
|
||||||
prompt
|
prompt
|
||||||
|
|
||||||
@@ -669,7 +669,7 @@ SpiteEffectText:
|
|||||||
text_from_ram wStringBuffer1
|
text_from_ram wStringBuffer1
|
||||||
text " was"
|
text " was"
|
||||||
cont "reduced by @"
|
cont "reduced by @"
|
||||||
deciram wd265, 1, 1
|
deciram wDeciramBuffer, 1, 1
|
||||||
text "!"
|
text "!"
|
||||||
prompt
|
prompt
|
||||||
|
|
||||||
@@ -1029,7 +1029,7 @@ SafeguardProtectText:
|
|||||||
|
|
||||||
MagnitudeText:
|
MagnitudeText:
|
||||||
text "Magnitude @"
|
text "Magnitude @"
|
||||||
deciram wd265, 1, 1
|
deciram wDeciramBuffer, 1, 1
|
||||||
text "!"
|
text "!"
|
||||||
prompt
|
prompt
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ UnknownText_0x1bc0a2::
|
|||||||
text_from_ram wStringBuffer1
|
text_from_ram wStringBuffer1
|
||||||
text_start
|
text_start
|
||||||
line "recovered @"
|
line "recovered @"
|
||||||
deciram wd1f3, 2, 3
|
deciram wCurHPAnimDeltaHP, 2, 3
|
||||||
text "HP!"
|
text "HP!"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -1155,7 +1155,7 @@ Text_BreedingIsNotPossible::
|
|||||||
UnknownText_0x1bd0d8::
|
UnknownText_0x1bd0d8::
|
||||||
text "The compatibility"
|
text "The compatibility"
|
||||||
line "is @"
|
line "is @"
|
||||||
deciram wd265, 1, 3
|
deciram wBreedingCompatibility, 1, 3
|
||||||
text "."
|
text "."
|
||||||
cont "Should they breed?"
|
cont "Should they breed?"
|
||||||
done
|
done
|
||||||
|
@@ -262,7 +262,7 @@ UnknownText_0x1c0531::
|
|||||||
text_from_ram wc850
|
text_from_ram wc850
|
||||||
text "'s CARD was"
|
text "'s CARD was"
|
||||||
line "listed as no.@"
|
line "listed as no.@"
|
||||||
deciram wd265, 1, 2
|
deciram wDeciramBuffer, 1, 2
|
||||||
text "."
|
text "."
|
||||||
prompt
|
prompt
|
||||||
|
|
||||||
|
@@ -306,7 +306,7 @@ This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider
|
|||||||
**Fix:** Edit `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
|
**Fix:** Edit `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
-CheckHiddenOpponent:
|
CheckHiddenOpponent:
|
||||||
-; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_CheckHit does these checks properly.
|
-; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_CheckHit does these checks properly.
|
||||||
- ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
- ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
||||||
- call GetBattleVar
|
- call GetBattleVar
|
||||||
@@ -887,15 +887,15 @@ CopyPokemonName_Buffer1_Buffer3:
|
|||||||
|
|
||||||
([Video](https://www.youtube.com/watch?v=eij_1060SMc))
|
([Video](https://www.youtube.com/watch?v=eij_1060SMc))
|
||||||
|
|
||||||
|
There are three things wrong here:
|
||||||
|
|
||||||
|
- `wEnemyMonLevel` isn't initialized yet
|
||||||
|
- `wBattleMonLevel` gets overwritten after it's initialized by `FindFirstAliveMonAndStartBattle`
|
||||||
|
- `wBattleMonLevel` isn't initialized until much later when the battle is with a trainer
|
||||||
|
|
||||||
**Fix:**
|
**Fix:**
|
||||||
|
|
||||||
There's three things wrong here.
|
First, edit [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
|
||||||
|
|
||||||
* `wEnemyMonLevel` doesn't have the value its name implies yet; it'll be populated later from `wCurPartyLevel`.
|
|
||||||
* `wBattleMonLevel` gets overwritten between when the value is written in `FindFirstAliveMonAndStartBattle` and when it's read.
|
|
||||||
* `wBattleMonLevel` isn't set until much later when the battle is with a trainer; extra code is needed to read a trainer's party and get the level of their lead Pokémon.
|
|
||||||
|
|
||||||
First, in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
|
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
StartTrainerBattle_DetermineWhichAnimation:
|
StartTrainerBattle_DetermineWhichAnimation:
|
||||||
@@ -957,7 +957,7 @@ StartTrainerBattle_DetermineWhichAnimation:
|
|||||||
db BATTLETRANSITION_NO_CAVE_STRONGER
|
db BATTLETRANSITION_NO_CAVE_STRONGER
|
||||||
```
|
```
|
||||||
|
|
||||||
In [engine/battle/start_battle.asm](/engine/battle/start_battle.asm):
|
Then edit [engine/battle/start_battle.asm](/engine/battle/start_battle.asm):
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
FindFirstAliveMonAndStartBattle:
|
FindFirstAliveMonAndStartBattle:
|
||||||
@@ -984,54 +984,55 @@ FindFirstAliveMonAndStartBattle:
|
|||||||
predef DoBattleTransition
|
predef DoBattleTransition
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, add this code to the end of [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer_party.asm):
|
Finally, edit [engine/battle/read_trainer_party.asm](/engine/battle/read_trainer_party.asm):
|
||||||
|
|
||||||
```asm
|
```asm
|
||||||
SetTrainerBattleLevel:
|
INCLUDE "data/trainers/parties.asm"
|
||||||
ld a, 255
|
+
|
||||||
ld [wCurPartyLevel], a
|
+SetTrainerBattleLevel:
|
||||||
|
+ ld a, 255
|
||||||
ld a, [wInBattleTowerBattle]
|
+ ld [wCurPartyLevel], a
|
||||||
bit 0, a
|
+
|
||||||
ret nz
|
+ ld a, [wInBattleTowerBattle]
|
||||||
|
+ bit 0, a
|
||||||
ld a, [wLinkMode]
|
+ ret nz
|
||||||
and a
|
+
|
||||||
ret nz
|
+ ld a, [wLinkMode]
|
||||||
|
+ and a
|
||||||
ld a, [wOtherTrainerClass]
|
+ ret nz
|
||||||
dec a
|
+
|
||||||
ld c, a
|
+ ld a, [wOtherTrainerClass]
|
||||||
ld b, 0
|
+ dec a
|
||||||
ld hl, TrainerGroups
|
+ ld c, a
|
||||||
rept 2
|
+ ld b, 0
|
||||||
add hl, bc
|
+ ld hl, TrainerGroups
|
||||||
endr
|
+ add hl, bc
|
||||||
ld a, [hli]
|
+ add hl, bc
|
||||||
ld h, [hl]
|
+ ld a, [hli]
|
||||||
ld l, a
|
+ ld h, [hl]
|
||||||
|
+ ld l, a
|
||||||
ld a, [wOtherTrainerID]
|
+
|
||||||
ld b, a
|
+ ld a, [wOtherTrainerID]
|
||||||
.skip_trainer
|
+ ld b, a
|
||||||
dec b
|
+.skip_trainer
|
||||||
jr z, .got_trainer
|
+ dec b
|
||||||
.loop1
|
+ jr z, .got_trainer
|
||||||
ld a, [hli]
|
+.loop1
|
||||||
cp $ff
|
+ ld a, [hli]
|
||||||
jr nz, .loop1
|
+ cp $ff
|
||||||
jr .skip_trainer
|
+ jr nz, .loop1
|
||||||
.got_trainer
|
+ jr .skip_trainer
|
||||||
|
+.got_trainer
|
||||||
.skip_name
|
+
|
||||||
ld a, [hli]
|
+.skip_name
|
||||||
cp "@"
|
+ ld a, [hli]
|
||||||
jr nz, .skip_name
|
+ cp "@"
|
||||||
|
+ jr nz, .skip_name
|
||||||
inc hl
|
+
|
||||||
ld a, [hl]
|
+ inc hl
|
||||||
ld [wCurPartyLevel], a
|
+ ld a, [hl]
|
||||||
ret
|
+ ld [wCurPartyLevel], a
|
||||||
|
+ ret
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -1138,7 +1139,7 @@ The exact cause of this bug is unknown.
|
|||||||
```diff
|
```diff
|
||||||
.Cry:
|
.Cry:
|
||||||
- call Pokedex_GetSelectedMon
|
- call Pokedex_GetSelectedMon
|
||||||
- ld a, [wd265]
|
- ld a, [wTempSpecies]
|
||||||
- call GetCryIndex
|
- call GetCryIndex
|
||||||
- ld e, c
|
- ld e, c
|
||||||
- ld d, b
|
- ld d, b
|
||||||
|
@@ -175,7 +175,7 @@ Modify `GetFrontpicPointer`:
|
|||||||
|
|
||||||
And `GetMonBackpic`:
|
And `GetMonBackpic`:
|
||||||
|
|
||||||
```asm
|
```diff
|
||||||
- ; These are assumed to be at the same address in their respective banks.
|
- ; These are assumed to be at the same address in their respective banks.
|
||||||
- ld hl, PokemonPicPointers ; UnownPicPointers
|
- ld hl, PokemonPicPointers ; UnownPicPointers
|
||||||
ld a, b
|
ld a, b
|
||||||
|
@@ -818,7 +818,7 @@ PrintText_UsedItemOn_AND_AIUpdateHUD:
|
|||||||
|
|
||||||
PrintText_UsedItemOn:
|
PrintText_UsedItemOn:
|
||||||
ld a, [wCurEnemyItem]
|
ld a, [wCurEnemyItem]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
call GetItemName
|
call GetItemName
|
||||||
ld hl, wStringBuffer1
|
ld hl, wStringBuffer1
|
||||||
ld de, wMonOrItemNameBuffer
|
ld de, wMonOrItemNameBuffer
|
||||||
|
@@ -171,10 +171,10 @@ AI_Types:
|
|||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
|
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
and a
|
and a
|
||||||
jr z, .immune
|
jr z, .immune
|
||||||
cp 10 ; 1.0
|
cp EFFECTIVE
|
||||||
jr z, .checkmove
|
jr z, .checkmove
|
||||||
jr c, .noteffective
|
jr c, .noteffective
|
||||||
|
|
||||||
@@ -415,8 +415,8 @@ AI_Smart_LeechHit:
|
|||||||
pop hl
|
pop hl
|
||||||
|
|
||||||
; 60% chance to discourage this move if not very effective.
|
; 60% chance to discourage this move if not very effective.
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp 10 ; 1.0
|
cp EFFECTIVE
|
||||||
jr c, .asm_38815
|
jr c, .asm_38815
|
||||||
|
|
||||||
; Do nothing if effectiveness is neutral.
|
; Do nothing if effectiveness is neutral.
|
||||||
@@ -491,8 +491,8 @@ AI_Smart_LockOn:
|
|||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
farcall BattleCheckTypeMatchup
|
farcall BattleCheckTypeMatchup
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp $a
|
cp EFFECTIVE
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
jr c, .asm_3884f
|
jr c, .asm_3884f
|
||||||
@@ -1292,8 +1292,8 @@ AI_Smart_Mimic:
|
|||||||
ld [hBattleTurn], a
|
ld [hBattleTurn], a
|
||||||
callfar BattleCheckTypeMatchup
|
callfar BattleCheckTypeMatchup
|
||||||
|
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp $a
|
cp EFFECTIVE
|
||||||
pop hl
|
pop hl
|
||||||
jr c, .asm_38bef
|
jr c, .asm_38bef
|
||||||
jr z, .asm_38bd4
|
jr z, .asm_38bd4
|
||||||
@@ -1408,8 +1408,8 @@ AI_Smart_Encore:
|
|||||||
predef CheckTypeMatchup
|
predef CheckTypeMatchup
|
||||||
|
|
||||||
pop hl
|
pop hl
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp $a
|
cp EFFECTIVE
|
||||||
jr nc, .asm_38c68
|
jr nc, .asm_38c68
|
||||||
|
|
||||||
and a
|
and a
|
||||||
@@ -1679,8 +1679,8 @@ AI_Smart_Conversion2:
|
|||||||
|
|
||||||
callfar BattleCheckTypeMatchup
|
callfar BattleCheckTypeMatchup
|
||||||
|
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp $a
|
cp EFFECTIVE
|
||||||
pop hl
|
pop hl
|
||||||
jr c, .asm_38dc9
|
jr c, .asm_38dc9
|
||||||
ret z
|
ret z
|
||||||
@@ -2293,8 +2293,8 @@ AI_Smart_HiddenPower:
|
|||||||
pop hl
|
pop hl
|
||||||
|
|
||||||
; Discourage Hidden Power if not very effective.
|
; Discourage Hidden Power if not very effective.
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp 10
|
cp EFFECTIVE
|
||||||
jr c, .bad
|
jr c, .bad
|
||||||
|
|
||||||
; Discourage Hidden Power if its base power is lower than 50.
|
; Discourage Hidden Power if its base power is lower than 50.
|
||||||
@@ -2303,8 +2303,8 @@ AI_Smart_HiddenPower:
|
|||||||
jr c, .bad
|
jr c, .bad
|
||||||
|
|
||||||
; Encourage Hidden Power if super-effective.
|
; Encourage Hidden Power if super-effective.
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp 11
|
cp EFFECTIVE + 1
|
||||||
jr nc, .good
|
jr nc, .good
|
||||||
|
|
||||||
; Encourage Hidden Power if its base power is 70.
|
; Encourage Hidden Power if its base power is 70.
|
||||||
@@ -3125,7 +3125,7 @@ AI_Status:
|
|||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
|
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
and a
|
and a
|
||||||
jr nz, .checkmove
|
jr nz, .checkmove
|
||||||
|
|
||||||
|
@@ -373,7 +373,7 @@ HandleBerserkGene:
|
|||||||
push bc
|
push bc
|
||||||
callfar GetUserItem
|
callfar GetUserItem
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
sub BERSERK_GENE
|
sub BERSERK_GENE
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
@@ -447,7 +447,7 @@ DetermineMoveOrder:
|
|||||||
sub BATTLEACTION_SWITCH1
|
sub BATTLEACTION_SWITCH1
|
||||||
jr c, .use_move
|
jr c, .use_move
|
||||||
ld a, [wBattlePlayerAction]
|
ld a, [wBattlePlayerAction]
|
||||||
cp $2
|
cp BATTLEPLAYERACTION_SWITCH
|
||||||
jr nz, .switch
|
jr nz, .switch
|
||||||
ld a, [hSerialConnectionStatus]
|
ld a, [hSerialConnectionStatus]
|
||||||
cp USING_INTERNAL_CLOCK
|
cp USING_INTERNAL_CLOCK
|
||||||
@@ -472,7 +472,7 @@ DetermineMoveOrder:
|
|||||||
|
|
||||||
.use_move
|
.use_move
|
||||||
ld a, [wBattlePlayerAction]
|
ld a, [wBattlePlayerAction]
|
||||||
and a
|
and a ; BATTLEPLAYERACTION_USEMOVE?
|
||||||
jp nz, .player_first
|
jp nz, .player_first
|
||||||
call CompareMovePriority
|
call CompareMovePriority
|
||||||
jr z, .equal_priority
|
jr z, .equal_priority
|
||||||
@@ -611,7 +611,7 @@ ParsePlayerAction:
|
|||||||
|
|
||||||
.not_encored
|
.not_encored
|
||||||
ld a, [wBattlePlayerAction]
|
ld a, [wBattlePlayerAction]
|
||||||
cp $2
|
cp BATTLEPLAYERACTION_SWITCH
|
||||||
jr z, .reset_rage
|
jr z, .reset_rage
|
||||||
and a
|
and a
|
||||||
jr nz, .reset_bide
|
jr nz, .reset_bide
|
||||||
@@ -900,7 +900,7 @@ Battle_EnemyFirst:
|
|||||||
call ResidualDamage
|
call ResidualDamage
|
||||||
jp z, HandlePlayerMonFaint
|
jp z, HandlePlayerMonFaint
|
||||||
call RefreshBattleHuds
|
call RefreshBattleHuds
|
||||||
xor a
|
xor a ; BATTLEPLAYERACTION_USEMOVE
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -949,7 +949,7 @@ Battle_PlayerFirst:
|
|||||||
call ResidualDamage
|
call ResidualDamage
|
||||||
jp z, HandleEnemyMonFaint
|
jp z, HandleEnemyMonFaint
|
||||||
call RefreshBattleHuds
|
call RefreshBattleHuds
|
||||||
xor a
|
xor a ; BATTLEPLAYERACTION_USEMOVE
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -1161,7 +1161,7 @@ HandlePerishSong:
|
|||||||
ret z
|
ret z
|
||||||
dec [hl]
|
dec [hl]
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wd265], a
|
ld [wDeciramBuffer], a
|
||||||
push af
|
push af
|
||||||
ld hl, PerishCountText
|
ld hl, PerishCountText
|
||||||
call StdBattleTextBox
|
call StdBattleTextBox
|
||||||
@@ -1235,7 +1235,7 @@ HandleWrap:
|
|||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
ld [wFXAnimID], a
|
ld [wFXAnimID], a
|
||||||
call GetMoveName
|
call GetMoveName
|
||||||
dec [hl]
|
dec [hl]
|
||||||
@@ -1288,7 +1288,7 @@ HandleLeftovers:
|
|||||||
|
|
||||||
callfar GetUserItem
|
callfar GetUserItem
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
call GetItemName
|
call GetItemName
|
||||||
ld a, b
|
ld a, b
|
||||||
cp HELD_LEFTOVERS
|
cp HELD_LEFTOVERS
|
||||||
@@ -1397,7 +1397,7 @@ HandleMysteryberry:
|
|||||||
push bc
|
push bc
|
||||||
push bc
|
push bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wd265], a
|
ld [wTempByteValue], a
|
||||||
ld de, wBattleMonMoves - 1
|
ld de, wBattleMonMoves - 1
|
||||||
ld hl, wBattleMonPP
|
ld hl, wBattleMonPP
|
||||||
ld a, [hBattleTurn]
|
ld a, [hBattleTurn]
|
||||||
@@ -1417,7 +1417,7 @@ HandleMysteryberry:
|
|||||||
pop de
|
pop de
|
||||||
pop bc
|
pop bc
|
||||||
|
|
||||||
ld a, [wd265]
|
ld a, [wTempByteValue]
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nz, .skip_checks
|
jr nz, .skip_checks
|
||||||
ld a, [hBattleTurn]
|
ld a, [hBattleTurn]
|
||||||
@@ -1434,7 +1434,7 @@ HandleMysteryberry:
|
|||||||
.skip_checks
|
.skip_checks
|
||||||
callfar GetUserItem
|
callfar GetUserItem
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
xor a
|
xor a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
call GetPartymonItem
|
call GetPartymonItem
|
||||||
@@ -2048,18 +2048,18 @@ HandleEnemyMonFaint:
|
|||||||
call CheckMobileBattleError
|
call CheckMobileBattleError
|
||||||
jp c, WildFled_EnemyFled_LinkBattleCanceled
|
jp c, WildFled_EnemyFled_LinkBattleCanceled
|
||||||
|
|
||||||
ld a, $1
|
ld a, BATTLEPLAYERACTION_USEITEM
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
call HandleEnemySwitch
|
call HandleEnemySwitch
|
||||||
jp z, WildFled_EnemyFled_LinkBattleCanceled
|
jp z, WildFled_EnemyFled_LinkBattleCanceled
|
||||||
jr DoubleSwitch
|
jr DoubleSwitch
|
||||||
|
|
||||||
.player_mon_not_fainted
|
.player_mon_not_fainted
|
||||||
ld a, $1
|
ld a, BATTLEPLAYERACTION_USEITEM
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
call HandleEnemySwitch
|
call HandleEnemySwitch
|
||||||
jp z, WildFled_EnemyFled_LinkBattleCanceled
|
jp z, WildFled_EnemyFled_LinkBattleCanceled
|
||||||
xor a
|
xor a ; BATTLEPLAYERACTION_USEMOVE
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -2088,7 +2088,7 @@ DoubleSwitch:
|
|||||||
call PlayerPartyMonEntrance
|
call PlayerPartyMonEntrance
|
||||||
|
|
||||||
.done
|
.done
|
||||||
xor a
|
xor a ; BATTLEPLAYERACTION_USEMOVE
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -2636,7 +2636,7 @@ HandlePlayerMonFaint:
|
|||||||
ld a, c
|
ld a, c
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
ld a, $1
|
ld a, BATTLEPLAYERACTION_USEITEM
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
call HandleEnemySwitch
|
call HandleEnemySwitch
|
||||||
jp z, WildFled_EnemyFled_LinkBattleCanceled
|
jp z, WildFled_EnemyFled_LinkBattleCanceled
|
||||||
@@ -2716,12 +2716,12 @@ ForcePlayerMonChoice:
|
|||||||
ld a, [wLinkMode]
|
ld a, [wLinkMode]
|
||||||
and a
|
and a
|
||||||
jr z, .skip_link
|
jr z, .skip_link
|
||||||
ld a, $1
|
ld a, BATTLEPLAYERACTION_USEITEM
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
call LinkBattleSendReceiveAction
|
call LinkBattleSendReceiveAction
|
||||||
|
|
||||||
.skip_link
|
.skip_link
|
||||||
xor a
|
xor a ; BATTLEPLAYERACTION_USEMOVE
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
call CheckMobileBattleError
|
call CheckMobileBattleError
|
||||||
jr c, .enemy_fainted_mobile_error
|
jr c, .enemy_fainted_mobile_error
|
||||||
@@ -3287,8 +3287,8 @@ LookUpTheEffectivenessOfEveryMove:
|
|||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
ld a, [wd265] ; Get The Effectiveness Modifier
|
ld a, [wTypeMatchup]
|
||||||
cp 10 + 1 ; 1.0 + 0.1
|
cp EFFECTIVE + 1
|
||||||
jr c, .loop
|
jr c, .loop
|
||||||
ld hl, wBuffer1
|
ld hl, wBuffer1
|
||||||
set 0, [hl]
|
set 0, [hl]
|
||||||
@@ -3319,14 +3319,14 @@ IsThePlayerMonTypesEffectiveAgainstOTMon:
|
|||||||
ld [wPlayerMoveStruct + MOVE_TYPE], a
|
ld [wPlayerMoveStruct + MOVE_TYPE], a
|
||||||
call SetPlayerTurn
|
call SetPlayerTurn
|
||||||
callfar BattleCheckTypeMatchup
|
callfar BattleCheckTypeMatchup
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp 10 + 1 ; 1.0 + 0.1
|
cp EFFECTIVE + 1
|
||||||
jr nc, .super_effective
|
jr nc, .super_effective
|
||||||
ld a, [wBattleMonType2]
|
ld a, [wBattleMonType2]
|
||||||
ld [wPlayerMoveStruct + MOVE_TYPE], a
|
ld [wPlayerMoveStruct + MOVE_TYPE], a
|
||||||
callfar BattleCheckTypeMatchup
|
callfar BattleCheckTypeMatchup
|
||||||
ld a, [wd265]
|
ld a, [wTypeMatchup]
|
||||||
cp 10 + 1 ; 1.0 + 0.1
|
cp EFFECTIVE + 1
|
||||||
jr nc, .super_effective
|
jr nc, .super_effective
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
@@ -3695,7 +3695,7 @@ TryToRunAwayFromBattle:
|
|||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
ld a, [wBattleMonItem]
|
ld a, [wBattleMonItem]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
ld b, a
|
ld b, a
|
||||||
callfar GetItemHeldEffect
|
callfar GetItemHeldEffect
|
||||||
ld a, b
|
ld a, b
|
||||||
@@ -3732,7 +3732,7 @@ TryToRunAwayFromBattle:
|
|||||||
|
|
||||||
xor a
|
xor a
|
||||||
ld [hMultiplicand], a
|
ld [hMultiplicand], a
|
||||||
ld a, $20
|
ld a, 32
|
||||||
ld [hMultiplier], a
|
ld [hMultiplier], a
|
||||||
call Multiply
|
call Multiply
|
||||||
ld a, [hProduct + 2]
|
ld a, [hProduct + 2]
|
||||||
@@ -3772,7 +3772,7 @@ TryToRunAwayFromBattle:
|
|||||||
ld a, [hQuotient + 2]
|
ld a, [hQuotient + 2]
|
||||||
cp b
|
cp b
|
||||||
jr nc, .can_escape
|
jr nc, .can_escape
|
||||||
ld a, $1
|
ld a, BATTLEPLAYERACTION_USEITEM
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
ld hl, BattleText_CantEscape2
|
ld hl, BattleText_CantEscape2
|
||||||
jr .print_inescapable_text
|
jr .print_inescapable_text
|
||||||
@@ -3786,7 +3786,7 @@ TryToRunAwayFromBattle:
|
|||||||
|
|
||||||
.print_inescapable_text
|
.print_inescapable_text
|
||||||
call StdBattleTextBox
|
call StdBattleTextBox
|
||||||
ld a, $1
|
ld a, TRUE
|
||||||
ld [wFailedToFlee], a
|
ld [wFailedToFlee], a
|
||||||
call LoadTileMapToTempTileMap
|
call LoadTileMapToTempTileMap
|
||||||
and a
|
and a
|
||||||
@@ -3798,7 +3798,7 @@ TryToRunAwayFromBattle:
|
|||||||
ld a, DRAW
|
ld a, DRAW
|
||||||
jr z, .fled
|
jr z, .fled
|
||||||
call LoadTileMapToTempTileMap
|
call LoadTileMapToTempTileMap
|
||||||
xor a
|
xor a ; BATTLEPLAYERACTION_USEMOVE
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
ld a, $f
|
ld a, $f
|
||||||
ld [wCurMoveNum], a
|
ld [wCurMoveNum], a
|
||||||
@@ -4429,7 +4429,7 @@ UseConfusionHealingItem:
|
|||||||
|
|
||||||
.heal_status
|
.heal_status
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
||||||
call GetBattleVarAddr
|
call GetBattleVarAddr
|
||||||
res SUBSTATUS_CONFUSED, [hl]
|
res SUBSTATUS_CONFUSED, [hl]
|
||||||
@@ -4496,7 +4496,7 @@ HandleStatBoostingHeldItems:
|
|||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
pop bc
|
pop bc
|
||||||
ld a, [bc]
|
ld a, [bc]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
push bc
|
push bc
|
||||||
dec hl
|
dec hl
|
||||||
dec hl
|
dec hl
|
||||||
@@ -4952,7 +4952,7 @@ BattleMenu_Pack:
|
|||||||
|
|
||||||
farcall BattlePack
|
farcall BattlePack
|
||||||
ld a, [wBattlePlayerAction]
|
ld a, [wBattlePlayerAction]
|
||||||
and a
|
and a ; BATTLEPLAYERACTION_USEMOVE?
|
||||||
jr z, .didnt_use_item
|
jr z, .didnt_use_item
|
||||||
jr .got_item
|
jr .got_item
|
||||||
|
|
||||||
@@ -5157,7 +5157,7 @@ TryPlayerSwitch:
|
|||||||
jp z, BattleMenuPKMN_Loop
|
jp z, BattleMenuPKMN_Loop
|
||||||
ld a, [wCurBattleMon]
|
ld a, [wCurBattleMon]
|
||||||
ld [wLastPlayerMon], a
|
ld [wLastPlayerMon], a
|
||||||
ld a, $2
|
ld a, BATTLEPLAYERACTION_SWITCH
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
call ClearPalettes
|
call ClearPalettes
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
@@ -5270,8 +5270,8 @@ PassedBattleMonEntrance:
|
|||||||
ld [wCurBattleMon], a
|
ld [wCurBattleMon], a
|
||||||
call AddBattleParticipant
|
call AddBattleParticipant
|
||||||
call InitBattleMon
|
call InitBattleMon
|
||||||
xor a
|
xor a ; FALSE
|
||||||
ld [wd265], a
|
ld [wApplyStatLevelMultipliersToEnemy], a
|
||||||
call ApplyStatLevelMultiplierOnAllStats
|
call ApplyStatLevelMultiplierOnAllStats
|
||||||
call SendOutPlayerMon
|
call SendOutPlayerMon
|
||||||
call EmptyBattleTextBox
|
call EmptyBattleTextBox
|
||||||
@@ -5286,11 +5286,11 @@ BattleMenu_Run:
|
|||||||
ld hl, wBattleMonSpeed
|
ld hl, wBattleMonSpeed
|
||||||
ld de, wEnemyMonSpeed
|
ld de, wEnemyMonSpeed
|
||||||
call TryToRunAwayFromBattle
|
call TryToRunAwayFromBattle
|
||||||
ld a, $0
|
ld a, FALSE
|
||||||
ld [wFailedToFlee], a
|
ld [wFailedToFlee], a
|
||||||
ret c
|
ret c
|
||||||
ld a, [wBattlePlayerAction]
|
ld a, [wBattlePlayerAction]
|
||||||
and a
|
and a ; BATTLEPLAYERACTION_USEMOVE?
|
||||||
ret nz
|
ret nz
|
||||||
jp BattleMenu
|
jp BattleMenu
|
||||||
|
|
||||||
@@ -5770,7 +5770,7 @@ ParseEnemyAction:
|
|||||||
call EmptyBattleTextBox
|
call EmptyBattleTextBox
|
||||||
call LoadTileMapToTempTileMap
|
call LoadTileMapToTempTileMap
|
||||||
ld a, [wBattlePlayerAction]
|
ld a, [wBattlePlayerAction]
|
||||||
and a
|
and a ; BATTLEPLAYERACTION_USEMOVE?
|
||||||
call z, LinkBattleSendReceiveAction
|
call z, LinkBattleSendReceiveAction
|
||||||
call Call_LoadTempTileMapToTileMap
|
call Call_LoadTempTileMapToTileMap
|
||||||
ld a, [wBattleAction]
|
ld a, [wBattleAction]
|
||||||
@@ -5989,7 +5989,7 @@ LoadEnemyMon:
|
|||||||
; Used for Ho-Oh, Lugia and Snorlax encounters
|
; Used for Ho-Oh, Lugia and Snorlax encounters
|
||||||
ld a, [wBattleType]
|
ld a, [wBattleType]
|
||||||
cp BATTLETYPE_FORCEITEM
|
cp BATTLETYPE_FORCEITEM
|
||||||
ld a, [wBaseItems]
|
ld a, [wBaseItem1]
|
||||||
jr z, .UpdateItem
|
jr z, .UpdateItem
|
||||||
|
|
||||||
; Failing that, it's all up to chance
|
; Failing that, it's all up to chance
|
||||||
@@ -6007,9 +6007,9 @@ LoadEnemyMon:
|
|||||||
; From there, an 8% chance for Item2
|
; From there, an 8% chance for Item2
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
cp 8 percent ; 8% of 25% = 2% Item2
|
cp 8 percent ; 8% of 25% = 2% Item2
|
||||||
ld a, [wBaseItems]
|
ld a, [wBaseItem1]
|
||||||
jr nc, .UpdateItem
|
jr nc, .UpdateItem
|
||||||
ld a, [wBaseItems+1]
|
ld a, [wBaseItem2]
|
||||||
|
|
||||||
.UpdateItem:
|
.UpdateItem:
|
||||||
ld [wEnemyMonItem], a
|
ld [wEnemyMonItem], a
|
||||||
@@ -6375,7 +6375,7 @@ LoadEnemyMon:
|
|||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
ld a, [wTempEnemyMonSpecies]
|
ld a, [wTempEnemyMonSpecies]
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
|
|
||||||
call GetPokemonName
|
call GetPokemonName
|
||||||
|
|
||||||
@@ -6661,14 +6661,14 @@ ApplyStatLevelMultiplierOnAllStats:
|
|||||||
call ApplyStatLevelMultiplier
|
call ApplyStatLevelMultiplier
|
||||||
inc c
|
inc c
|
||||||
ld a, c
|
ld a, c
|
||||||
cp 5
|
cp NUM_BATTLE_STATS
|
||||||
jr nz, .stat_loop
|
jr nz, .stat_loop
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ApplyStatLevelMultiplier:
|
ApplyStatLevelMultiplier:
|
||||||
push bc
|
push bc
|
||||||
push bc
|
push bc
|
||||||
ld a, [wd265]
|
ld a, [wApplyStatLevelMultipliersToEnemy]
|
||||||
and a
|
and a
|
||||||
ld a, c
|
ld a, c
|
||||||
ld hl, wBattleMonAttack
|
ld hl, wBattleMonAttack
|
||||||
@@ -6718,7 +6718,7 @@ ApplyStatLevelMultiplier:
|
|||||||
call Multiply
|
call Multiply
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [hDivisor], a
|
ld [hDivisor], a
|
||||||
ld b, $4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
pop hl
|
pop hl
|
||||||
|
|
||||||
@@ -7192,7 +7192,7 @@ GiveExperiencePoints:
|
|||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wCurSpecies], a
|
ld [wCurSpecies], a
|
||||||
ld [wd265], a
|
ld [wTempSpecies], a ; unused?
|
||||||
call GetBaseData
|
call GetBaseData
|
||||||
ld hl, MON_MAXHP + 1
|
ld hl, MON_MAXHP + 1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@@ -7256,8 +7256,8 @@ GiveExperiencePoints:
|
|||||||
call CopyBytes
|
call CopyBytes
|
||||||
|
|
||||||
.transformed
|
.transformed
|
||||||
xor a
|
xor a ; FALSE
|
||||||
ld [wd265], a
|
ld [wApplyStatLevelMultipliersToEnemy], a
|
||||||
call ApplyStatLevelMultiplierOnAllStats
|
call ApplyStatLevelMultiplierOnAllStats
|
||||||
callfar ApplyStatusEffectOnPlayerStats
|
callfar ApplyStatusEffectOnPlayerStats
|
||||||
callfar BadgeStatBoosts
|
callfar BadgeStatBoosts
|
||||||
@@ -7299,7 +7299,7 @@ GiveExperiencePoints:
|
|||||||
xor a ; PARTYMON
|
xor a ; PARTYMON
|
||||||
ld [wMonType], a
|
ld [wMonType], a
|
||||||
ld a, [wCurSpecies]
|
ld a, [wCurSpecies]
|
||||||
ld [wd265], a
|
ld [wTempSpecies], a ; unused?
|
||||||
ld a, [wCurPartyLevel]
|
ld a, [wCurPartyLevel]
|
||||||
push af
|
push af
|
||||||
ld c, a
|
ld c, a
|
||||||
@@ -7359,7 +7359,7 @@ GiveExperiencePoints:
|
|||||||
cp 2
|
cp 2
|
||||||
ret c
|
ret c
|
||||||
|
|
||||||
ld [wd265], a
|
ld [wTempByteValue], a
|
||||||
ld hl, wEnemyMonBaseStats
|
ld hl, wEnemyMonBaseStats
|
||||||
ld c, wEnemyMonEnd - wEnemyMonBaseStats
|
ld c, wEnemyMonEnd - wEnemyMonBaseStats
|
||||||
.count_loop2
|
.count_loop2
|
||||||
@@ -7367,7 +7367,7 @@ GiveExperiencePoints:
|
|||||||
ld [hDividend + 0], a
|
ld [hDividend + 0], a
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [hDividend + 1], a
|
ld [hDividend + 1], a
|
||||||
ld a, [wd265]
|
ld a, [wTempByteValue]
|
||||||
ld [hDivisor], a
|
ld [hDivisor], a
|
||||||
ld b, 2
|
ld b, 2
|
||||||
call Divide
|
call Divide
|
||||||
|
@@ -2,7 +2,7 @@ DoPlayerTurn:
|
|||||||
call SetPlayerTurn
|
call SetPlayerTurn
|
||||||
|
|
||||||
ld a, [wBattlePlayerAction]
|
ld a, [wBattlePlayerAction]
|
||||||
and a
|
and a ; BATTLEPLAYERACTION_USEMOVE?
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
jr DoTurn
|
jr DoTurn
|
||||||
@@ -1248,7 +1248,7 @@ BattleCommand_Stab:
|
|||||||
.go
|
.go
|
||||||
ld a, BATTLE_VARS_MOVE_TYPE
|
ld a, BATTLE_VARS_MOVE_TYPE
|
||||||
call GetBattleVarAddr
|
call GetBattleVarAddr
|
||||||
ld [wTypeMatchup], a
|
ld [wCurType], a
|
||||||
|
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
@@ -1264,7 +1264,7 @@ BattleCommand_Stab:
|
|||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
|
|
||||||
ld a, [wTypeMatchup]
|
ld a, [wCurType]
|
||||||
cp b
|
cp b
|
||||||
jr z, .stab
|
jr z, .stab
|
||||||
cp c
|
cp c
|
||||||
@@ -3583,7 +3583,7 @@ UpdateMoveData:
|
|||||||
|
|
||||||
ld a, BATTLE_VARS_MOVE
|
ld a, BATTLE_VARS_MOVE
|
||||||
call GetBattleVar
|
call GetBattleVar
|
||||||
ld [wCurMove], a
|
ld [wCurSpecies], a
|
||||||
ld [wNamedObjectIndexBuffer], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
|
|
||||||
dec a
|
dec a
|
||||||
|
@@ -53,13 +53,13 @@ DoWeatherModifiers:
|
|||||||
ld de, WeatherTypeModifiers
|
ld de, WeatherTypeModifiers
|
||||||
ld a, [wBattleWeather]
|
ld a, [wBattleWeather]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [wd265] ; move type
|
ld a, [wCurType]
|
||||||
ld c, a
|
ld c, a
|
||||||
|
|
||||||
.CheckWeatherType:
|
.CheckWeatherType:
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
inc de
|
inc de
|
||||||
cp $ff
|
cp -1
|
||||||
jr z, .done_weather_types
|
jr z, .done_weather_types
|
||||||
|
|
||||||
cp b
|
cp b
|
||||||
@@ -84,7 +84,7 @@ DoWeatherModifiers:
|
|||||||
.CheckWeatherMove:
|
.CheckWeatherMove:
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
inc de
|
inc de
|
||||||
cp $ff
|
cp -1
|
||||||
jr z, .done
|
jr z, .done
|
||||||
|
|
||||||
cp b
|
cp b
|
||||||
@@ -116,7 +116,7 @@ DoWeatherModifiers:
|
|||||||
|
|
||||||
ld a, 10
|
ld a, 10
|
||||||
ld [hDivisor], a
|
ld [hDivisor], a
|
||||||
ld b, $4
|
ld b, 4
|
||||||
call Divide
|
call Divide
|
||||||
|
|
||||||
ld a, [hQuotient + 0]
|
ld a, [hQuotient + 0]
|
||||||
@@ -176,7 +176,7 @@ DoBadgeTypeBoosts:
|
|||||||
rr c
|
rr c
|
||||||
jr nc, .NextBadge
|
jr nc, .NextBadge
|
||||||
|
|
||||||
ld a, [wd265] ; move type
|
ld a, [wCurType]
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr z, .ApplyBoost
|
jr z, .ApplyBoost
|
||||||
|
|
||||||
|
@@ -68,8 +68,8 @@ BattleCommand_BatonPass:
|
|||||||
call CallBattleCore
|
call CallBattleCore
|
||||||
ld hl, ResetBattleParticipants
|
ld hl, ResetBattleParticipants
|
||||||
call CallBattleCore
|
call CallBattleCore
|
||||||
ld a, 1
|
ld a, TRUE
|
||||||
ld [wTypeMatchup], a
|
ld [wApplyStatLevelMultipliersToEnemy], a
|
||||||
ld hl, ApplyStatLevelMultiplierOnAllStats
|
ld hl, ApplyStatLevelMultiplierOnAllStats
|
||||||
call CallBattleCore
|
call CallBattleCore
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ BatonPass_LinkPlayerSwitch:
|
|||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
ld a, 1
|
ld a, BATTLEPLAYERACTION_USEITEM
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
|
|
||||||
call LoadStandardMenuHeader
|
call LoadStandardMenuHeader
|
||||||
@@ -91,7 +91,7 @@ BatonPass_LinkPlayerSwitch:
|
|||||||
call CallBattleCore
|
call CallBattleCore
|
||||||
call CloseWindow
|
call CloseWindow
|
||||||
|
|
||||||
xor a
|
xor a ; BATTLEPLAYERACTION_USEMOVE
|
||||||
ld [wBattlePlayerAction], a
|
ld [wBattlePlayerAction], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ BattleCommand_GetMagnitude:
|
|||||||
push de
|
push de
|
||||||
inc hl
|
inc hl
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld [wTypeMatchup], a
|
ld [wDeciramBuffer], a
|
||||||
call BattleCommand_MoveDelay
|
call BattleCommand_MoveDelay
|
||||||
ld hl, MagnitudeText
|
ld hl, MagnitudeText
|
||||||
call StdBattleTextBox
|
call StdBattleTextBox
|
||||||
|
@@ -24,7 +24,7 @@ BattleCommand_MirrorMove:
|
|||||||
.use
|
.use
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
|
|
||||||
push af
|
push af
|
||||||
ld a, BATTLE_VARS_MOVE_ANIM
|
ld a, BATTLE_VARS_MOVE_ANIM
|
||||||
|
@@ -34,7 +34,7 @@ BattleCommand_Sketch:
|
|||||||
.get_last_move
|
.get_last_move
|
||||||
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
||||||
call GetBattleVar
|
call GetBattleVar
|
||||||
ld [wTypeMatchup], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
ld b, a
|
ld b, a
|
||||||
; Fail if move is invalid or is Struggle.
|
; Fail if move is invalid or is Struggle.
|
||||||
and a
|
and a
|
||||||
|
@@ -24,7 +24,7 @@ BattleCommand_Spite:
|
|||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
cp b
|
cp b
|
||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
ld [wTypeMatchup], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
dec hl
|
dec hl
|
||||||
ld b, 0
|
ld b, 0
|
||||||
push bc
|
push bc
|
||||||
@@ -78,7 +78,7 @@ BattleCommand_Spite:
|
|||||||
call AnimateCurrentMove
|
call AnimateCurrentMove
|
||||||
pop de
|
pop de
|
||||||
ld a, d
|
ld a, d
|
||||||
ld [wTypeMatchup], a
|
ld [wDeciramBuffer], a
|
||||||
ld hl, SpiteEffectText
|
ld hl, SpiteEffectText
|
||||||
jp StdBattleTextBox
|
jp StdBattleTextBox
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ BattleCommand_Thief:
|
|||||||
|
|
||||||
; Can't steal mail.
|
; Can't steal mail.
|
||||||
|
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
ld d, a
|
ld d, a
|
||||||
farcall ItemIsMail
|
farcall ItemIsMail
|
||||||
ret c
|
ret c
|
||||||
@@ -45,7 +45,7 @@ BattleCommand_Thief:
|
|||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
call .playeritem
|
call .playeritem
|
||||||
ld a, [wd265]
|
ld a, [wNamedObjectIndexBuffer]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
jr .stole
|
jr .stole
|
||||||
@@ -68,7 +68,7 @@ BattleCommand_Thief:
|
|||||||
|
|
||||||
; Can't steal mail!
|
; Can't steal mail!
|
||||||
|
|
||||||
ld [wd265], a
|
ld [wNamedObjectIndexBuffer], a
|
||||||
ld d, a
|
ld d, a
|
||||||
farcall ItemIsMail
|
farcall ItemIsMail
|
||||||
ret c
|
ret c
|
||||||
@@ -86,7 +86,7 @@ BattleCommand_Thief:
|
|||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
call .enemyitem
|
call .enemyitem
|
||||||
ld a, [wd265]
|
ld a, [wNamedObjectIndexBuffer]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ StageBallTilesData:
|
|||||||
DrawPlayerHUDBorder:
|
DrawPlayerHUDBorder:
|
||||||
ld hl, .tiles
|
ld hl, .tiles
|
||||||
ld de, wTrainerHUDTiles
|
ld de, wTrainerHUDTiles
|
||||||
ld bc, 4
|
ld bc, .tiles_end - .tiles
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
hlcoord 18, 10
|
hlcoord 18, 10
|
||||||
ld de, -1 ; start on right
|
ld de, -1 ; start on right
|
||||||
@@ -112,11 +112,12 @@ DrawPlayerHUDBorder:
|
|||||||
db $77 ; bottom right
|
db $77 ; bottom right
|
||||||
db $6f ; bottom left
|
db $6f ; bottom left
|
||||||
db $76 ; bottom side
|
db $76 ; bottom side
|
||||||
|
.tiles_end
|
||||||
|
|
||||||
DrawPlayerPartyIconHUDBorder:
|
DrawPlayerPartyIconHUDBorder:
|
||||||
ld hl, .tiles
|
ld hl, .tiles
|
||||||
ld de, wTrainerHUDTiles
|
ld de, wTrainerHUDTiles
|
||||||
ld bc, 4
|
ld bc, .tiles_end - .tiles
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
hlcoord 18, 10
|
hlcoord 18, 10
|
||||||
ld de, -1 ; start on right
|
ld de, -1 ; start on right
|
||||||
@@ -127,11 +128,12 @@ DrawPlayerPartyIconHUDBorder:
|
|||||||
db $5c ; bottom right
|
db $5c ; bottom right
|
||||||
db $6f ; bottom left
|
db $6f ; bottom left
|
||||||
db $76 ; bottom side
|
db $76 ; bottom side
|
||||||
|
.tiles_end
|
||||||
|
|
||||||
DrawEnemyHUDBorder:
|
DrawEnemyHUDBorder:
|
||||||
ld hl, .tiles
|
ld hl, .tiles
|
||||||
ld de, wTrainerHUDTiles
|
ld de, wTrainerHUDTiles
|
||||||
ld bc, 4
|
ld bc, .tiles_end - .tiles
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
hlcoord 1, 2
|
hlcoord 1, 2
|
||||||
ld de, 1 ; start on left
|
ld de, 1 ; start on left
|
||||||
@@ -152,23 +154,24 @@ DrawEnemyHUDBorder:
|
|||||||
db $74 ; bottom left
|
db $74 ; bottom left
|
||||||
db $78 ; bottom right
|
db $78 ; bottom right
|
||||||
db $76 ; bottom side
|
db $76 ; bottom side
|
||||||
|
.tiles_end
|
||||||
|
|
||||||
PlaceHUDBorderTiles:
|
PlaceHUDBorderTiles:
|
||||||
ld a, [wTrainerHUDTiles]
|
ld a, [wTrainerHUDTiles + 0]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld bc, SCREEN_WIDTH
|
ld bc, SCREEN_WIDTH
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [wStartFlypoint]
|
ld a, [wTrainerHUDTiles + 1]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld b, $8
|
ld b, 8
|
||||||
.loop
|
.loop
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [wMovementBuffer]
|
ld a, [wTrainerHUDTiles + 3]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
dec b
|
dec b
|
||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [wEndFlypoint]
|
ld a, [wTrainerHUDTiles + 2]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -181,7 +184,7 @@ LinkBattle_TrainerHuds:
|
|||||||
ld a, 10 * 8
|
ld a, 10 * 8
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hl], 8 * 8
|
ld [hl], 8 * 8
|
||||||
ld a, $8
|
ld a, 8
|
||||||
ld [wPlaceBallsDirection], a
|
ld [wPlaceBallsDirection], a
|
||||||
ld hl, wVirtualOAMSprite00
|
ld hl, wVirtualOAMSprite00
|
||||||
call LoadTrainerHudOAM
|
call LoadTrainerHudOAM
|
||||||
|
@@ -26,7 +26,7 @@ UsedMoveText:
|
|||||||
|
|
||||||
ld a, BATTLE_VARS_MOVE_ANIM
|
ld a, BATTLE_VARS_MOVE_ANIM
|
||||||
call GetBattleVar
|
call GetBattleVar
|
||||||
ld [wd265], a
|
ld [wMoveGrammar], a
|
||||||
|
|
||||||
push hl
|
push hl
|
||||||
farcall CheckUserIsCharging
|
farcall CheckUserIsCharging
|
||||||
@@ -34,13 +34,12 @@ UsedMoveText:
|
|||||||
jr nz, .grammar
|
jr nz, .grammar
|
||||||
|
|
||||||
; update last move
|
; update last move
|
||||||
ld a, [wd265]
|
ld a, [wMoveGrammar]
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
|
||||||
.grammar
|
.grammar
|
||||||
call GetMoveGrammar
|
call GetMoveGrammar ; convert move id to grammar index
|
||||||
; wd265 now contains MoveGrammar
|
|
||||||
|
|
||||||
; everything except 'instead' made redundant in localization
|
; everything except 'instead' made redundant in localization
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ UsedMoveText:
|
|||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
; check move grammar
|
; check move grammar
|
||||||
ld a, [wd265]
|
ld a, [wMoveGrammar]
|
||||||
cp $3
|
cp $3
|
||||||
ld hl, UsedMove2Text
|
ld hl, UsedMove2Text
|
||||||
ret c
|
ret c
|
||||||
@@ -89,14 +88,14 @@ MoveNameText:
|
|||||||
ld hl, .endusedmovetexts
|
ld hl, .endusedmovetexts
|
||||||
|
|
||||||
; get move id
|
; get move id
|
||||||
ld a, [wd265]
|
ld a, [wMoveGrammar]
|
||||||
|
|
||||||
; 2-byte pointer
|
; 2-byte pointer
|
||||||
add a
|
add a
|
||||||
|
|
||||||
; seek
|
; seek
|
||||||
push bc
|
push bc
|
||||||
ld b, $0
|
ld b, 0
|
||||||
ld c, a
|
ld c, a
|
||||||
add hl, bc
|
add hl, bc
|
||||||
pop bc
|
pop bc
|
||||||
@@ -132,13 +131,13 @@ EndUsedMove5Text:
|
|||||||
db "@"
|
db "@"
|
||||||
|
|
||||||
GetMoveGrammar:
|
GetMoveGrammar:
|
||||||
; store move grammar type in wd265
|
; store move grammar type in wMoveGrammar
|
||||||
|
|
||||||
push bc
|
push bc
|
||||||
; c = move id
|
; wMoveGrammar contains move id
|
||||||
ld a, [wd265]
|
ld a, [wMoveGrammar]
|
||||||
ld c, a
|
ld c, a ; move id
|
||||||
ld b, $0
|
ld b, 0 ; grammar index
|
||||||
|
|
||||||
; read grammar table
|
; read grammar table
|
||||||
ld hl, MoveGrammar
|
ld hl, MoveGrammar
|
||||||
@@ -158,9 +157,9 @@ GetMoveGrammar:
|
|||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
.end
|
.end
|
||||||
; wd265 now contains move grammar
|
; wMoveGrammar now contains move grammar
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [wd265], a
|
ld [wMoveGrammar], a
|
||||||
|
|
||||||
; we're done
|
; we're done
|
||||||
pop bc
|
pop bc
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user