summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2018-02-07 21:13:52 +0100
committerxCrystal <rgr.crystal@gmail.com>2018-02-07 21:13:52 +0100
commitbfeeb34666e8a9d91317f285e078c73d498351f7 (patch)
tree20c22f2520d1fc26e5979f0f23a7d97bc004a0d3 /src/engine
parentb9f2f4ee8e9218436b7ce36804bf404901f87d0f (diff)
More accurate card type constants
Diffstat (limited to 'src/engine')
-rwxr-xr-xsrc/engine/bank1.asm6
-rwxr-xr-xsrc/engine/bank5.asm2
-rwxr-xr-xsrc/engine/boosters.asm29
-rwxr-xr-xsrc/engine/home.asm2
4 files changed, 20 insertions, 19 deletions
diff --git a/src/engine/bank1.asm b/src/engine/bank1.asm
index a48f0d7..b1a879d 100755
--- a/src/engine/bank1.asm
+++ b/src/engine/bank1.asm
@@ -472,7 +472,7 @@ Func_4436: ; 4436 (1:4436)
; c contains the energy card being played
PlayerUseEnergyCard: ; 4477 (1:4477)
ld a, c
- cp WATER_ENERGY_CARD ; XXX why treat water energy card differently?
+ cp TYPE_ENERGY_WATER ; XXX why treat water energy card differently?
jr nz, .notWaterEnergy
call $3615
jr c, .waterEnergy
@@ -1285,14 +1285,14 @@ AIUseEnergyCard: ; 69a5 (1:69a5)
ConvertTrainerCardToPokemon:
ld c, a
ld a, [hl]
- cp TRAINER_CARD
+ cp TYPE_TRAINER
ret nz
push hl
ldh a, [hWhoseTurn]
ld h, a
ld l, c
ld a, [hl]
- and TRAINER_CARD
+ and TYPE_TRAINER
pop hl
ret z
ld a, e
diff --git a/src/engine/bank5.asm b/src/engine/bank5.asm
index 0b373d3..3f0e5a2 100755
--- a/src/engine/bank5.asm
+++ b/src/engine/bank5.asm
@@ -66,7 +66,7 @@ Func_14226: ; 14226 (5:4226)
ret z
call LoadDeckCardToBuffer1
ld a, [wLoadedCard1Type]
- cp FIRE_ENERGY_CARD
+ cp TYPE_ENERGY_FIRE
jr nc, .checkForNextPokemon
ld a, [wLoadedCard1Stage]
or a
diff --git a/src/engine/boosters.asm b/src/engine/boosters.asm
index d292183..a0968c6 100755
--- a/src/engine/boosters.asm
+++ b/src/engine/boosters.asm
@@ -17,9 +17,9 @@ GenerateBoosterPack: ; 1e1c4 (7:61c4)
GenerateBoosterCard: ; 1e1df (7:61df)
ld a, STAR
- ld [wBoosterCurrRarity], a
+ ld [wBoosterCurRarity], a
.generateCardLoop
- call FindCurrRarityChance
+ call FindCurRarityChance
ld a, [hl]
or a
jr z, .noMoreOfCurrentRarity
@@ -32,14 +32,14 @@ GenerateBoosterCard: ; 1e1df (7:61df)
call FindBoosterCard
call UpdateBoosterCardTypesChanceByte
call AddCardToBoosterList
- call FindCurrRarityChance
+ call FindCurRarityChance
dec [hl]
jr .generateCardLoop
.noMoreOfCurrentRarity
- ld a, [wBoosterCurrRarity]
+ ld a, [wBoosterCurRarity]
dec a
- ld [wBoosterCurrRarity], a
- bit 7, a
+ ld [wBoosterCurRarity], a
+ bit 7, a ; any rarity left to check?
jr z, .generateCardLoop
or a
ret
@@ -48,10 +48,10 @@ GenerateBoosterCard: ; 1e1df (7:61df)
scf
ret
-FindCurrRarityChance: ; 1e219 (7:6219)
+FindCurRarityChance: ; 1e219 (7:6219)
push bc
ld hl, wBoosterDataCommonAmount
- ld a, [wBoosterCurrRarity]
+ ld a, [wBoosterCurRarity]
ld c, a
ld b, $0
add hl, bc
@@ -113,7 +113,7 @@ CheckCardViable: ; 1e268 (7:6268)
ld [wBoosterCurrentCardSet], a
ld a, [wBoosterCurrentCardRarity]
ld c, a
- ld a, [wBoosterCurrRarity]
+ ld a, [wBoosterCurRarity]
cp c
jr nz, .invalidCard
ld a, [wBoosterCurrentCardType]
@@ -124,7 +124,7 @@ CheckCardViable: ; 1e268 (7:6268)
swap a
and $0f
ld c, a
- ld a, [wBoosterDataCurrSet]
+ ld a, [wBoosterDataCurSet]
cp c
jr nz, .invalidCard
.returnValidCard
@@ -136,16 +136,17 @@ CheckCardViable: ; 1e268 (7:6268)
pop bc
ret
+; Map a card's TYPE_* constant given in a to its BOOSTER_CARD_TYPE_* constant
GetCardType: ; 1e2a0 (7:62a0)
push hl
push bc
ld hl, CardTypeTable
cp $11
- jr nc, .skipToTypeLoad
+ jr nc, .loadType
ld c, a
ld b, $00
add hl, bc
-.skipToTypeLoad
+.loadType
ld a, [hl]
pop bc
pop hl
@@ -464,7 +465,7 @@ InitBoosterData: ; 1e430 (7:6430)
dec c
jr nz, .clearTempCardCollectionLoop
call FindBoosterDataPointer
- ld de, wBoosterDataCurrSet
+ ld de, wBoosterDataCurSet
ld bc, $c
call CopyDataHLtoDE
call LoadRarityAmountsToWram
@@ -533,7 +534,7 @@ BoosterDataJumptable: ; 1e480 (7:6480)
dw PackRandomEnergies
LoadRarityAmountsToWram: ; 1e4ba (7:64ba)
- ld a, [wBoosterDataCurrSet]
+ ld a, [wBoosterDataCurSet]
add a
add a
ld c, a
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 01a66d0..16927de 100755
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -2926,7 +2926,7 @@ GetAttachedEnergies: ; 159f (0:159f)
ld a, l
call LoadDeckCardToBuffer2
ld a, [wLoadedCard2Type]
- bit ENERGY_CARD_F, a
+ bit TYPE_ENERGY_F, a
jr z, .not_an_energy_card
and $7 ; zero bit 3 to extract the type
ld e, a