summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/constants/gfx_constants.asm5
-rw-r--r--src/data/booster_packs.asm720
-rw-r--r--src/engine/booster_packs.asm183
-rw-r--r--src/engine/home.asm12
-rw-r--r--src/wram.asm21
5 files changed, 497 insertions, 444 deletions
diff --git a/src/constants/gfx_constants.asm b/src/constants/gfx_constants.asm
index 2ddb8ae..2f5ca4a 100644
--- a/src/constants/gfx_constants.asm
+++ b/src/constants/gfx_constants.asm
@@ -12,6 +12,11 @@ CGB_PAL_SIZE EQU 8 ; bytes
; tile size
TILE_SIZE EQU 16 ; bytes
+; wFlushPaletteFlags constants
+FLUSH_ONE EQU %10000000
+FLUSH_ALL EQU %11000000
+FLUSH_ALL_F EQU 6
+
; wSpriteAnimBuffer
SPRITE_ANIM_BUFFER_CAPACITY EQU 16 ; sprites
diff --git a/src/data/booster_packs.asm b/src/data/booster_packs.asm
index 8f8d8c2..03b64ee 100644
--- a/src/data/booster_packs.asm
+++ b/src/data/booster_packs.asm
@@ -1,448 +1,456 @@
-BoosterSetRarityAmountTable: ; 1e4d4 (7::64d4)
+BoosterSetRarityAmountsTable: ; 1e4d4 (7::64d4)
; energies, commons, uncommons, rares
; commons + uncommons + rares needs to be equal to 10 minus the number of energy cards
; defined in the pack's data below; otherwise, the number of cards in the pack won't be 10.
- db $01, $05, $03, $01 ; COLOSSEUM >> 4
- db $01, $05, $03, $01 ; EVOLUTION >> 4
- db $00, $06, $03, $01 ; MYSTERY >> 4
- db $00, $06, $03, $01 ; LABORATORY >> 4
+ db 1, 5, 3, 1 ; COLOSSEUM
+ db 1, 5, 3, 1 ; EVOLUTION
+ db 0, 6, 3, 1 ; MYSTERY
+ db 0, 6, 3, 1 ; LABORATORY
+
+booster_set: MACRO
+ db \1 >> 4
+ENDM
; For the energy or energy generation function, there are three options:
; - Ponter to a function that generates energies (some generate one, some generate a full pack)
; - A single energy of a specific type
; - $0000 if no card in the pack is an energy
-PackColosseumNeutral:: ; 1e4e4 (7:64e4)
- db COLOSSEUM >> 4 ; booster pack set
- dw GenerateEndingEnergy ; energy or energy generation function
+; As for Card Type Chances, note that whenever one card of the 10 is drawn, the chances of
+; the type of that card are reduced by the original average of all 8 types (capping the result at 1).
+; This average always outputs 17 (except for the energy-only packs).
+
+BoosterPack_ColosseumNeutral:: ; 1e4e4 (7:64e4)
+ booster_set COLOSSEUM ; booster pack set
+ dw GenerateRandomEnergy ; energy or energy generation function
; Card Type Chances
- db $14 ; Grass Type Chance
- db $14 ; Fire Type Chance
- db $14 ; Water Type Chance
- db $14 ; Lightning Type Chance
- db $14 ; Fighting Type Chance
- db $14 ; Psychic Type Chance
- db $14 ; Colorless Type Chance
- db $14 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackColosseumGrass:: ; 1e4f0 (7:64f0)
- db COLOSSEUM >> 4 ; booster pack set
+ db 20 ; Grass Type Chance
+ db 20 ; Fire Type Chance
+ db 20 ; Water Type Chance
+ db 20 ; Lightning Type Chance
+ db 20 ; Fighting Type Chance
+ db 20 ; Psychic Type Chance
+ db 20 ; Colorless Type Chance
+ db 20 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_ColosseumGrass:: ; 1e4f0 (7:64f0)
+ booster_set COLOSSEUM ; booster pack set
dw GRASS_ENERGY ; energy or energy generation function
; Card Type Chances
- db $30 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackColosseumFire:: ; 1e4fc (7:64fc)
- db COLOSSEUM >> 4 ; booster pack set
+ db 48 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_ColosseumFire:: ; 1e4fc (7:64fc)
+ booster_set COLOSSEUM ; booster pack set
dw FIRE_ENERGY ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $30 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackColosseumWater:: ; 1e508 (7:6508)
- db COLOSSEUM >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 48 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_ColosseumWater:: ; 1e508 (7:6508)
+ booster_set COLOSSEUM ; booster pack set
dw WATER_ENERGY ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $30 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackColosseumLightning:: ; 1e514 (7:6514)
- db COLOSSEUM >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 48 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_ColosseumLightning:: ; 1e514 (7:6514)
+ booster_set COLOSSEUM ; booster pack set
dw LIGHTNING_ENERGY ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $30 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackColosseumFighting:: ; 1e520 (7:6520)
- db COLOSSEUM >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 48 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_ColosseumFighting:: ; 1e520 (7:6520)
+ booster_set COLOSSEUM ; booster pack set
dw FIGHTING_ENERGY ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $30 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackColosseumTrainer:: ; 1e52c (7:652c)
- db COLOSSEUM >> 4 ; booster pack set
- dw GenerateEndingEnergy ; energy or energy generation function
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 48 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_ColosseumTrainer:: ; 1e52c (7:652c)
+ booster_set COLOSSEUM ; booster pack set
+ dw GenerateRandomEnergy ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $30 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEvolutionNeutral:: ; 1e538 (7:6538)
- db EVOLUTION >> 4 ; booster pack set
- dw GenerateEndingEnergy ; energy or energy generation function
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 48 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EvolutionNeutral:: ; 1e538 (7:6538)
+ booster_set EVOLUTION ; booster pack set
+ dw GenerateRandomEnergy ; energy or energy generation function
; Card Type Chances
- db $14 ; Grass Type Chance
- db $14 ; Fire Type Chance
- db $14 ; Water Type Chance
- db $14 ; Lightning Type Chance
- db $14 ; Fighting Type Chance
- db $14 ; Psychic Type Chance
- db $14 ; Colorless Type Chance
- db $14 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEvolutionGrass:: ; 1e544 (7:6544)
- db EVOLUTION >> 4 ; booster pack set
+ db 20 ; Grass Type Chance
+ db 20 ; Fire Type Chance
+ db 20 ; Water Type Chance
+ db 20 ; Lightning Type Chance
+ db 20 ; Fighting Type Chance
+ db 20 ; Psychic Type Chance
+ db 20 ; Colorless Type Chance
+ db 20 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EvolutionGrass:: ; 1e544 (7:6544)
+ booster_set EVOLUTION ; booster pack set
dw GRASS_ENERGY ; energy or energy generation function
; Card Type Chances
- db $30 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEvolutionNeutralFireEnergy:: ; 1e550 (7:6550)
- db EVOLUTION >> 4 ; booster pack set
+ db 48 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EvolutionNeutralFireEnergy:: ; 1e550 (7:6550)
+ booster_set EVOLUTION ; booster pack set
dw FIRE_ENERGY ; energy or energy generation function
; Card Type Chances
- db $14 ; Grass Type Chance
- db $14 ; Fire Type Chance
- db $14 ; Water Type Chance
- db $14 ; Lightning Type Chance
- db $14 ; Fighting Type Chance
- db $14 ; Psychic Type Chance
- db $14 ; Colorless Type Chance
- db $14 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEvolutionWater:: ; 1e55c (7:655c)
- db EVOLUTION >> 4 ; booster pack set
+ db 20 ; Grass Type Chance
+ db 20 ; Fire Type Chance
+ db 20 ; Water Type Chance
+ db 20 ; Lightning Type Chance
+ db 20 ; Fighting Type Chance
+ db 20 ; Psychic Type Chance
+ db 20 ; Colorless Type Chance
+ db 20 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EvolutionWater:: ; 1e55c (7:655c)
+ booster_set EVOLUTION ; booster pack set
dw WATER_ENERGY ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $30 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEvolutionFighting:: ; 1e568 (7:6568)
- db EVOLUTION >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 48 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EvolutionFighting:: ; 1e568 (7:6568)
+ booster_set EVOLUTION ; booster pack set
dw FIGHTING_ENERGY ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $30 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEvolutionPsychic:: ; 1e574 (7:6574)
- db EVOLUTION >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 48 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EvolutionPsychic:: ; 1e574 (7:6574)
+ booster_set EVOLUTION ; booster pack set
dw PSYCHIC_ENERGY ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $30 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEvolutionTrainer:: ; 1e580 (7:6580)
- db EVOLUTION >> 4 ; booster pack set
- dw GenerateEndingEnergy ; energy or energy generation function
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 48 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EvolutionTrainer:: ; 1e580 (7:6580)
+ booster_set EVOLUTION ; booster pack set
+ dw GenerateRandomEnergy ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $30 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackMysteryNeutral:: ; 1e58c (7:658c)
- db MYSTERY >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 48 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_MysteryNeutral:: ; 1e58c (7:658c)
+ booster_set MYSTERY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $11 ; Grass Type Chance
- db $11 ; Fire Type Chance
- db $11 ; Water Type Chance
- db $11 ; Lightning Type Chance
- db $11 ; Fighting Type Chance
- db $11 ; Psychic Type Chance
- db $11 ; Colorless Type Chance
- db $11 ; Trainer Card Chance
- db $11 ; Energy Card Chance
-
-PackMysteryGrassColorless:: ; 1e598 (7:6598)
- db MYSTERY >> 4 ; booster pack set
+ db 17 ; Grass Type Chance
+ db 17 ; Fire Type Chance
+ db 17 ; Water Type Chance
+ db 17 ; Lightning Type Chance
+ db 17 ; Fighting Type Chance
+ db 17 ; Psychic Type Chance
+ db 17 ; Colorless Type Chance
+ db 17 ; Trainer Card Chance
+ db 17 ; Energy Card Chance
+
+BoosterPack_MysteryGrassColorless:: ; 1e598 (7:6598)
+ booster_set MYSTERY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $30 ; Grass Type Chance
- db $0C ; Fire Type Chance
- db $0C ; Water Type Chance
- db $0C ; Lightning Type Chance
- db $0C ; Fighting Type Chance
- db $0C ; Psychic Type Chance
- db $16 ; Colorless Type Chance
- db $0C ; Trainer Card Chance
- db $0C ; Energy Card Chance
-
-PackMysteryWaterColorless:: ; 1e5a4 (7:65a4)
- db MYSTERY >> 4 ; booster pack set
+ db 48 ; Grass Type Chance
+ db 12 ; Fire Type Chance
+ db 12 ; Water Type Chance
+ db 12 ; Lightning Type Chance
+ db 12 ; Fighting Type Chance
+ db 12 ; Psychic Type Chance
+ db 22 ; Colorless Type Chance
+ db 12 ; Trainer Card Chance
+ db 12 ; Energy Card Chance
+
+BoosterPack_MysteryWaterColorless:: ; 1e5a4 (7:65a4)
+ booster_set MYSTERY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $0C ; Grass Type Chance
- db $0C ; Fire Type Chance
- db $30 ; Water Type Chance
- db $0C ; Lightning Type Chance
- db $0C ; Fighting Type Chance
- db $0C ; Psychic Type Chance
- db $16 ; Colorless Type Chance
- db $0C ; Trainer Card Chance
- db $0C ; Energy Card Chance
-
-PackMysteryLightningColorless:: ; 1e5b0 (7:65b0)
- db MYSTERY >> 4 ; booster pack set
+ db 12 ; Grass Type Chance
+ db 12 ; Fire Type Chance
+ db 48 ; Water Type Chance
+ db 12 ; Lightning Type Chance
+ db 12 ; Fighting Type Chance
+ db 12 ; Psychic Type Chance
+ db 22 ; Colorless Type Chance
+ db 12 ; Trainer Card Chance
+ db 12 ; Energy Card Chance
+
+BoosterPack_MysteryLightningColorless:: ; 1e5b0 (7:65b0)
+ booster_set MYSTERY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $0C ; Grass Type Chance
- db $0C ; Fire Type Chance
- db $0C ; Water Type Chance
- db $30 ; Lightning Type Chance
- db $0C ; Fighting Type Chance
- db $0C ; Psychic Type Chance
- db $16 ; Colorless Type Chance
- db $0C ; Trainer Card Chance
- db $0C ; Energy Card Chance
-
-PackMysteryFightingColorless:: ; 1e5bc (7:65bc)
- db MYSTERY >> 4 ; booster pack set
+ db 12 ; Grass Type Chance
+ db 12 ; Fire Type Chance
+ db 12 ; Water Type Chance
+ db 48 ; Lightning Type Chance
+ db 12 ; Fighting Type Chance
+ db 12 ; Psychic Type Chance
+ db 22 ; Colorless Type Chance
+ db 12 ; Trainer Card Chance
+ db 12 ; Energy Card Chance
+
+BoosterPack_MysteryFightingColorless:: ; 1e5bc (7:65bc)
+ booster_set MYSTERY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $0C ; Grass Type Chance
- db $0C ; Fire Type Chance
- db $0C ; Water Type Chance
- db $0C ; Lightning Type Chance
- db $30 ; Fighting Type Chance
- db $0C ; Psychic Type Chance
- db $16 ; Colorless Type Chance
- db $0C ; Trainer Card Chance
- db $0C ; Energy Card Chance
-
-PackMysteryTrainerColorless:: ; 1e5c8 (7:65c8)
- db MYSTERY >> 4 ; booster pack set
+ db 12 ; Grass Type Chance
+ db 12 ; Fire Type Chance
+ db 12 ; Water Type Chance
+ db 12 ; Lightning Type Chance
+ db 48 ; Fighting Type Chance
+ db 12 ; Psychic Type Chance
+ db 22 ; Colorless Type Chance
+ db 12 ; Trainer Card Chance
+ db 12 ; Energy Card Chance
+
+BoosterPack_MysteryTrainerColorless:: ; 1e5c8 (7:65c8)
+ booster_set MYSTERY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $0C ; Grass Type Chance
- db $0C ; Fire Type Chance
- db $0C ; Water Type Chance
- db $0C ; Lightning Type Chance
- db $0C ; Fighting Type Chance
- db $0C ; Psychic Type Chance
- db $16 ; Colorless Type Chance
- db $30 ; Trainer Card Chance
- db $0C ; Energy Card Chance
-
-PackLaboratoryMostlyNeutral:: ; 1e5d4 (7:65d4)
- db LABORATORY >> 4 ; booster pack set
+ db 12 ; Grass Type Chance
+ db 12 ; Fire Type Chance
+ db 12 ; Water Type Chance
+ db 12 ; Lightning Type Chance
+ db 12 ; Fighting Type Chance
+ db 12 ; Psychic Type Chance
+ db 22 ; Colorless Type Chance
+ db 48 ; Trainer Card Chance
+ db 12 ; Energy Card Chance
+
+BoosterPack_LaboratoryMostlyNeutral:: ; 1e5d4 (7:65d4)
+ booster_set LABORATORY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $14 ; Grass Type Chance
- db $14 ; Fire Type Chance
- db $14 ; Water Type Chance
- db $14 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $14 ; Psychic Type Chance
- db $14 ; Colorless Type Chance
- db $18 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackLaboratoryGrass:: ; 1e5e0 (7:65e0)
- db LABORATORY >> 4 ; booster pack set
+ db 20 ; Grass Type Chance
+ db 20 ; Fire Type Chance
+ db 20 ; Water Type Chance
+ db 20 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 20 ; Psychic Type Chance
+ db 20 ; Colorless Type Chance
+ db 24 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_LaboratoryGrass:: ; 1e5e0 (7:65e0)
+ booster_set LABORATORY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $30 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackLaboratoryWater:: ; 1e5ec (7:65ec)
- db LABORATORY >> 4 ; booster pack set
+ db 48 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_LaboratoryWater:: ; 1e5ec (7:65ec)
+ booster_set LABORATORY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $30 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackLaboratoryPsychic:: ; 1e5f8 (7:65f8)
- db LABORATORY >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 48 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_LaboratoryPsychic:: ; 1e5f8 (7:65f8)
+ booster_set LABORATORY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $30 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $10 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackLaboratoryTrainer:: ; 1e604 (7:6604)
- db LABORATORY >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 48 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 16 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_LaboratoryTrainer:: ; 1e604 (7:6604)
+ booster_set LABORATORY ; booster pack set
dw $0000 ; energy or energy generation function
; Card Type Chances
- db $10 ; Grass Type Chance
- db $10 ; Fire Type Chance
- db $10 ; Water Type Chance
- db $10 ; Lightning Type Chance
- db $10 ; Fighting Type Chance
- db $10 ; Psychic Type Chance
- db $10 ; Colorless Type Chance
- db $30 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEnergyLightningFire:: ; 1e610 (7:6610)
- db COLOSSEUM >> 4 ; booster pack set
+ db 16 ; Grass Type Chance
+ db 16 ; Fire Type Chance
+ db 16 ; Water Type Chance
+ db 16 ; Lightning Type Chance
+ db 16 ; Fighting Type Chance
+ db 16 ; Psychic Type Chance
+ db 16 ; Colorless Type Chance
+ db 48 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EnergyLightningFire:: ; 1e610 (7:6610)
+ booster_set COLOSSEUM ; booster pack set
dw GenerateEnergyBoosterLightningFire ; energy or energy generation function
; Card Type Chances
- db $00 ; Grass Type Chance
- db $00 ; Fire Type Chance
- db $00 ; Water Type Chance
- db $00 ; Lightning Type Chance
- db $00 ; Fighting Type Chance
- db $00 ; Psychic Type Chance
- db $00 ; Colorless Type Chance
- db $00 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEnergyWaterFighting:: ; 1e61c (7:661c)
- db COLOSSEUM >> 4 ; booster pack set
+ db 0 ; Grass Type Chance
+ db 0 ; Fire Type Chance
+ db 0 ; Water Type Chance
+ db 0 ; Lightning Type Chance
+ db 0 ; Fighting Type Chance
+ db 0 ; Psychic Type Chance
+ db 0 ; Colorless Type Chance
+ db 0 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EnergyWaterFighting:: ; 1e61c (7:661c)
+ booster_set COLOSSEUM ; booster pack set
dw GenerateEnergyBoosterWaterFighting ; energy or energy generation function
; Card Type Chances
- db $00 ; Grass Type Chance
- db $00 ; Fire Type Chance
- db $00 ; Water Type Chance
- db $00 ; Lightning Type Chance
- db $00 ; Fighting Type Chance
- db $00 ; Psychic Type Chance
- db $00 ; Colorless Type Chance
- db $00 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackEnergyGrassPsychic:: ; 1e628 (7:6628)
- db COLOSSEUM >> 4 ; booster pack set
+ db 0 ; Grass Type Chance
+ db 0 ; Fire Type Chance
+ db 0 ; Water Type Chance
+ db 0 ; Lightning Type Chance
+ db 0 ; Fighting Type Chance
+ db 0 ; Psychic Type Chance
+ db 0 ; Colorless Type Chance
+ db 0 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_EnergyGrassPsychic:: ; 1e628 (7:6628)
+ booster_set COLOSSEUM ; booster pack set
dw GenerateEnergyBoosterGrassPsychic ; energy or energy generation function
; Card Type Chances
- db $00 ; Grass Type Chance
- db $00 ; Fire Type Chance
- db $00 ; Water Type Chance
- db $00 ; Lightning Type Chance
- db $00 ; Fighting Type Chance
- db $00 ; Psychic Type Chance
- db $00 ; Colorless Type Chance
- db $00 ; Trainer Card Chance
- db $00 ; Energy Card Chance
-
-PackRandomEnergies:: ; 1e634 (7:6634)
- db COLOSSEUM >> 4 ; booster pack set
+ db 0 ; Grass Type Chance
+ db 0 ; Fire Type Chance
+ db 0 ; Water Type Chance
+ db 0 ; Lightning Type Chance
+ db 0 ; Fighting Type Chance
+ db 0 ; Psychic Type Chance
+ db 0 ; Colorless Type Chance
+ db 0 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
+
+BoosterPack_RandomEnergies:: ; 1e634 (7:6634)
+ booster_set COLOSSEUM ; booster pack set
dw GenerateRandomEnergyBooster ; energy or energy generation function
; Card Type Chances
- db $00 ; Grass Type Chance
- db $00 ; Fire Type Chance
- db $00 ; Water Type Chance
- db $00 ; Lightning Type Chance
- db $00 ; Fighting Type Chance
- db $00 ; Psychic Type Chance
- db $00 ; Colorless Type Chance
- db $00 ; Trainer Card Chance
- db $00 ; Energy Card Chance
+ db 0 ; Grass Type Chance
+ db 0 ; Fire Type Chance
+ db 0 ; Water Type Chance
+ db 0 ; Lightning Type Chance
+ db 0 ; Fighting Type Chance
+ db 0 ; Psychic Type Chance
+ db 0 ; Colorless Type Chance
+ db 0 ; Trainer Card Chance
+ db 0 ; Energy Card Chance
diff --git a/src/engine/booster_packs.asm b/src/engine/booster_packs.asm
index c24f80a..99dde3f 100644
--- a/src/engine/booster_packs.asm
+++ b/src/engine/booster_packs.asm
@@ -1,3 +1,5 @@
+; generate a booster pack identified by a,
+; and add the drawn cards to the player's collection (sCardCollection).
GenerateBoosterPack: ; 1e1c4 (7:61c4)
push hl
push bc
@@ -18,28 +20,28 @@ GenerateBoosterPack: ; 1e1c4 (7:61c4)
; generate all Pokemon or Trainer cards (if any) for the current booster pack
GenerateBoosterNonEnergies: ; 1e1df (7:61df)
ld a, STAR
- ld [wBoosterCurRarity], a
+ ld [wBoosterCurrentRarity], a
.generate_card_loop
- call FindCurRarityChance
+ call FindCurrentRarityChance
ld a, [hl]
or a
jr z, .no_more_of_current_rarity
call FindCardsInSetAndRarity
- call FindTotalTypeChances
+ call CalculateTypeChances
or a
jr z, .no_valid_cards
call Random
call DetermineBoosterCardType
- call FindBoosterCard
+ call DetermineBoosterCard
call UpdateBoosterCardTypesChanceByte
call AddBoosterCardToDrawnNonEnergies
- call FindCurRarityChance
+ call FindCurrentRarityChance
dec [hl]
jr .generate_card_loop
.no_more_of_current_rarity
- ld a, [wBoosterCurRarity]
+ ld a, [wBoosterCurrentRarity]
dec a
- ld [wBoosterCurRarity], a
+ ld [wBoosterCurrentRarity], a
bit 7, a ; any rarity left to check?
jr z, .generate_card_loop
or a
@@ -49,17 +51,21 @@ GenerateBoosterNonEnergies: ; 1e1df (7:61df)
scf
ret
-; return hl pointing to wBoosterData<Rarity>Amount[wBoosterCurRarity]
-FindCurRarityChance: ; 1e219 (7:6219)
+; return hl pointing to wBoosterData<Rarity>Amount[wBoosterCurrentRarity]
+FindCurrentRarityChance: ; 1e219 (7:6219)
push bc
ld hl, wBoosterDataCommonAmount
- ld a, [wBoosterCurRarity]
+ ld a, [wBoosterCurrentRarity]
ld c, a
ld b, $0
add hl, bc
pop bc
ret
+; loop through all existing cards to see which ones belong to the current set and rarity,
+; and add them wBoosterViableCardList. Also fill wBoosterAmountOfCardTypeTable with the amount of
+; available cards of each type, for the current set and rarity.
+; Skip any card already drawn in the current pack.
FindCardsInSetAndRarity: ; 1e226 (7:6226)
ld c, NUM_BOOSTER_CARD_TYPES
ld hl, wBoosterAmountOfCardTypeTable
@@ -71,14 +77,14 @@ FindCardsInSetAndRarity: ; 1e226 (7:6226)
xor a
ld hl, wBoosterViableCardList
ld [hl], a
- ld de, $1
+ ld de, 1 ; GRASS_ENERGY
.check_card_viable_loop
push de
ld a, e
- ld [wBoosterTempCard], a
- call IsByteInTempCardCollectionZero
+ ld [wBoosterCurrentCard], a
+ call CheckCardAlreadyDrawn
jr c, .finished_with_current_card
- call CheckCardViable
+ call CheckCardInSetAndRarity
jr c, .finished_with_current_card
ld a, [wBoosterCurrentCardType]
call GetBoosterCardType
@@ -90,7 +96,7 @@ FindCardsInSetAndRarity: ; 1e226 (7:6226)
add hl, bc
inc [hl]
pop hl
- ld a, [wBoosterTempCard]
+ ld a, [wBoosterCurrentCard]
ld [hli], a
pop af
ld [hli], a
@@ -104,7 +110,8 @@ FindCardsInSetAndRarity: ; 1e226 (7:6226)
jr c, .check_card_viable_loop
ret
-CheckCardViable: ; 1e268 (7:6268)
+; return nc if card e belongs to the current set and rarity
+CheckCardInSetAndRarity: ; 1e268 (7:6268)
push bc
ld a, e
call GetCardTypeRarityAndSet
@@ -115,7 +122,7 @@ CheckCardViable: ; 1e268 (7:6268)
ld [wBoosterCurrentCardSet], a
ld a, [wBoosterCurrentCardRarity]
ld c, a
- ld a, [wBoosterCurRarity]
+ ld a, [wBoosterCurrentRarity]
cp c
jr nz, .invalid_card
ld a, [wBoosterCurrentCardType]
@@ -138,7 +145,7 @@ CheckCardViable: ; 1e268 (7:6268)
pop bc
ret
-; Map a card's TYPE_* constant given in a to its BOOSTER_CARD_TYPE_* constant
+; Return a card's TYPE_* constant given in a to its BOOSTER_CARD_TYPE_* constant
GetBoosterCardType: ; 1e2a0 (7:62a0)
push hl
push bc
@@ -173,10 +180,12 @@ CardTypeTable: ; 1e2b1 (7:62b1)
db BOOSTER_CARD_TYPE_TRAINER ; TYPE_ENERGY_UNUSED
db BOOSTER_CARD_TYPE_TRAINER ; TYPE_TRAINER
-FindTotalTypeChances: ; 1e2c2 (7:62c2)
+; calculate the chance of each type for the next card
+; return [wd4ca] = sum of all chances
+CalculateTypeChances: ; 1e2c2 (7:62c2)
ld c, NUM_BOOSTER_CARD_TYPES
xor a
- ld hl, wBoosterTempTypeChanceTable
+ ld hl, wBoosterTempTypeChancesTable
.delete_temp_type_chance_table_loop
ld [hli], a
dec c
@@ -195,7 +204,7 @@ FindTotalTypeChances: ; 1e2c2 (7:62c2)
ld a, [hl]
or a
jr z, .amount_of_type_or_chance_zero
- ld hl, wBoosterTempTypeChanceTable
+ ld hl, wBoosterTempTypeChancesTable
add hl, bc
ld [hl], a
ld a, [wd4ca]
@@ -210,10 +219,12 @@ FindTotalTypeChances: ; 1e2c2 (7:62c2)
ld a, [wd4ca]
ret
+; input: a = random number (between 0 and the sum of all chances)
+; store the randomly generated booster card type in [wBoosterJustDrawnCardType]
DetermineBoosterCardType: ; 1e2fa (7:62fa)
ld [wd4ca], a
ld c, $00
- ld hl, wBoosterTempTypeChanceTable
+ ld hl, wBoosterTempTypeChancesTable
.loop_through_card_types
ld a, [hl]
or a
@@ -231,11 +242,12 @@ DetermineBoosterCardType: ; 1e2fa (7:62fa)
ld a, BOOSTER_CARD_TYPE_ENERGY
.found_card_type
ld a, c
- ld [wBoosterSelectedCardType], a
+ ld [wBoosterJustDrawnCardType], a
ret
-FindBoosterCard: ; 1e31d (7:631d)
- ld a, [wBoosterSelectedCardType]
+; generate a random available card of the booster card type at [wBoosterJustDrawnCardType]
+DetermineBoosterCard: ; 1e31d (7:631d)
+ ld a, [wBoosterJustDrawnCardType]
ld c, a
ld b, $00
ld hl, wBoosterAmountOfCardTypeTable
@@ -248,8 +260,8 @@ FindBoosterCard: ; 1e31d (7:631d)
ld a, [hli]
or a
jr z, .no_valid_card_found
- ld [wBoosterTempCard], a
- ld a, [wBoosterSelectedCardType]
+ ld [wBoosterCurrentCard], a
+ ld a, [wBoosterJustDrawnCardType]
cp [hl]
jr nz, .card_incorrect_type
ld a, [wd4ca]
@@ -268,13 +280,13 @@ FindBoosterCard: ; 1e31d (7:631d)
scf
ret
-; lowers the chance of getting the same type multiple times.
+; lowers the chance of getting the same type of card multiple times.
; more specifically, when a card of type T is drawn, T's new chances become
-; min (1, wBoosterDataTypeChances[T] - wBoosterAveragedTypeChances).
+; min (1, [wBoosterDataTypeChances[T]] - [wBoosterAveragedTypeChances]).
UpdateBoosterCardTypesChanceByte: ; 1e350 (7:6350)
push hl
push bc
- ld a, [wBoosterSelectedCardType]
+ ld a, [wBoosterJustDrawnCardType]
ld c, a
ld b, $00
ld hl, wBoosterDataTypeChances
@@ -287,7 +299,7 @@ UpdateBoosterCardTypesChanceByte: ; 1e350 (7:6350)
jr z, .chance_less_than_one
jr nc, .still_some_chance_left
.chance_less_than_one
- ld a, $01
+ ld a, 1
ld [hl], a
.still_some_chance_left
pop bc
@@ -313,13 +325,14 @@ GenerateBoosterEnergies: ; 1e3db (7:63db)
pop af
ret
+; add the (energy) card at a to wBoosterTempNonEnergiesDrawn and wTempCardCollection
AddBoosterEnergyToDrawnEnergies: ; 1e380 (7:6380)
- ld [wBoosterTempCard], a
+ ld [wBoosterCurrentCard], a
call AddBoosterCardToDrawnEnergies
ret
; generates a random energy card
-GenerateEndingEnergy: ; 1e387 (7:6387)
+GenerateRandomEnergy: ; 1e387 (7:6387)
ld a, NUM_COLORED_TYPES
call Random
add $01
@@ -330,20 +343,23 @@ GenerateRandomEnergyBooster: ; 1e390 (7:6390)
ld a, NUM_CARDS_IN_BOOSTER
.generate_energy_loop
push af
- call GenerateEndingEnergy
+ call GenerateRandomEnergy
pop af
dec a
jr nz, .generate_energy_loop
jr ZeroBoosterRarityData
+; generates a booster with 5 Lightning energies and 5 Fire energies
GenerateEnergyBoosterLightningFire: ; 1e39c (7:639c)
ld hl, EnergyBoosterLightningFireData
jr GenerateTwoTypesEnergyBooster
+; generates a booster with 5 Water energies and 5 Fighting energies
GenerateEnergyBoosterWaterFighting: ; 1e3a1 (7:63a1)
ld hl, EnergyBoosterWaterFightingData
jr GenerateTwoTypesEnergyBooster
+; generates a booster with 5 Grass energies and 5 Psychic energies
GenerateEnergyBoosterGrassPsychic: ; 1e3a6 (7:63a6)
ld hl, EnergyBoosterGrassPsychicData
jr GenerateTwoTypesEnergyBooster
@@ -365,6 +381,8 @@ GenerateTwoTypesEnergyBooster: ; 1e3ab (7:63ab)
inc hl
dec b
jr nz, .add_two_energies_to_booster_loop
+; fallthrough
+
ZeroBoosterRarityData:
xor a
ld [wBoosterDataCommonAmount], a
@@ -374,33 +392,37 @@ ZeroBoosterRarityData:
EnergyBoosterLightningFireData:
db LIGHTNING_ENERGY, FIRE_ENERGY
+
EnergyBoosterWaterFightingData:
db WATER_ENERGY, FIGHTING_ENERGY
+
EnergyBoosterGrassPsychicData:
db GRASS_ENERGY, PSYCHIC_ENERGY
+; add the (energy) card at [wBoosterCurrentCard] to wBoosterTempNonEnergiesDrawn and wTempCardCollection
AddBoosterCardToDrawnEnergies: ; 1e3cf (7:63cf)
push hl
ld hl, wBoosterTempEnergiesDrawn
- call CopyToFirstEmptyByte
+ call AppendCardToHL
call AddBoosterCardToTempCardCollection
pop hl
ret
+; add the (non-energy) card at [wBoosterCurrentCard] to wBoosterTempNonEnergiesDrawn and wTempCardCollection
AddBoosterCardToDrawnNonEnergies: ; 1e3db (7:63db)
push hl
ld hl, wBoosterTempNonEnergiesDrawn
- call CopyToFirstEmptyByte
+ call AppendCardToHL
call AddBoosterCardToTempCardCollection
pop hl
ret
-CopyToFirstEmptyByte: ; 1e3e7 (7:63e7)
+AppendCardToHL: ; 1e3e7 (7:63e7)
ld a, [hli]
or a
- jr nz, CopyToFirstEmptyByte
+ jr nz, AppendCardToHL
dec hl
- ld a, [wBoosterTempCard]
+ ld a, [wBoosterCurrentCard]
ld [hli], a
xor a
ld [hl], a
@@ -414,16 +436,17 @@ PutEnergiesAndNonEnergiesTogether: ; 1e3f3 (7:63f3)
ld a, [hli]
or a
jr z, .end_of_cards
- ld [wBoosterTempCard], a
+ ld [wBoosterCurrentCard], a
push hl
ld hl, wBoosterTempNonEnergiesDrawn
- call CopyToFirstEmptyByte
+ call AppendCardToHL
pop hl
jr .loop_through_extra_cards
.end_of_cards
pop hl
ret
+; add the final cards drawn from the booster pack to the player's colection (sCardCollection)
AddBoosterCardsToCollection:; 1e40a (7:640a)
push hl
ld hl, wBoosterCardsDrawn
@@ -437,19 +460,21 @@ AddBoosterCardsToCollection:; 1e40a (7:640a)
pop hl
ret
+; add the card at [wBoosterCurrentCard] to wTempCardCollection
AddBoosterCardToTempCardCollection: ; 1e419 (7:6419)
push hl
ld h, HIGH(wTempCardCollection)
- ld a, [wBoosterTempCard]
+ ld a, [wBoosterCurrentCard]
ld l, a
inc [hl]
pop hl
ret
-IsByteInTempCardCollectionZero: ; 1e423 (7:6423)
+; check if the card at [wBoosterCurrentCard] has already been added to wTempCardCollection
+CheckCardAlreadyDrawn: ; 1e423 (7:6423)
push hl
ld h, HIGH(wTempCardCollection)
- ld a, [wBoosterTempCard]
+ ld a, [wBoosterCurrentCard]
ld l, a
ld a, [hl]
pop hl
@@ -457,9 +482,9 @@ IsByteInTempCardCollectionZero: ; 1e423 (7:6423)
ccf
ret
-; clears wBoosterCardsDrawn and wTempCardCollection
-; copies booster data to wBoosterData* *CurSet, *EnergyFunctionPointer, and *TypeChances
-; copies rarity amounts to wBoosterData*Amount and averages them into wBoosterAveragedTypeChances
+; clears wBoosterCardsDrawn and wTempCardCollection.
+; copies booster data to wBoosterDataCurSet, wBoosterDataEnergyFunctionPointer, and wBoosterDataTypeChances.
+; copies rarity amounts to wBoosterData*Amount and averages them into wBoosterAveragedTypeChances.
InitBoosterData: ; 1e430 (7:6430)
ld c, wBoosterCardsDrawnEnd - wBoosterCardsDrawn
ld hl, wBoosterCardsDrawn
@@ -499,6 +524,7 @@ InitBoosterData: ; 1e430 (7:6430)
ld [wBoosterAveragedTypeChances], a
ret
+; get the pointer to the data of the booster pack at [wBoosterIndex]
FindBoosterDataPointer: ; 1e46f (7:646f)
push bc
ld a, [wBoosterIndex]
@@ -514,43 +540,44 @@ FindBoosterDataPointer: ; 1e46f (7:646f)
ret
BoosterDataJumptable: ; 1e480 (7:6480)
- dw PackColosseumNeutral
- dw PackColosseumGrass
- dw PackColosseumFire
- dw PackColosseumWater
- dw PackColosseumLightning
- dw PackColosseumFighting
- dw PackColosseumTrainer
- dw PackEvolutionNeutral
- dw PackEvolutionGrass
- dw PackEvolutionNeutralFireEnergy
- dw PackEvolutionWater
- dw PackEvolutionFighting
- dw PackEvolutionPsychic
- dw PackEvolutionTrainer
- dw PackMysteryNeutral
- dw PackMysteryGrassColorless
- dw PackMysteryWaterColorless
- dw PackMysteryLightningColorless
- dw PackMysteryFightingColorless
- dw PackMysteryTrainerColorless
- dw PackLaboratoryMostlyNeutral
- dw PackLaboratoryGrass
- dw PackLaboratoryWater
- dw PackLaboratoryPsychic
- dw PackLaboratoryTrainer
- dw PackEnergyLightningFire
- dw PackEnergyWaterFighting
- dw PackEnergyGrassPsychic
- dw PackRandomEnergies
-
+ dw BoosterPack_ColosseumNeutral
+ dw BoosterPack_ColosseumGrass
+ dw BoosterPack_ColosseumFire
+ dw BoosterPack_ColosseumWater
+ dw BoosterPack_ColosseumLightning
+ dw BoosterPack_ColosseumFighting
+ dw BoosterPack_ColosseumTrainer
+ dw BoosterPack_EvolutionNeutral
+ dw BoosterPack_EvolutionGrass
+ dw BoosterPack_EvolutionNeutralFireEnergy
+ dw BoosterPack_EvolutionWater
+ dw BoosterPack_EvolutionFighting
+ dw BoosterPack_EvolutionPsychic
+ dw BoosterPack_EvolutionTrainer
+ dw BoosterPack_MysteryNeutral
+ dw BoosterPack_MysteryGrassColorless
+ dw BoosterPack_MysteryWaterColorless
+ dw BoosterPack_MysteryLightningColorless
+ dw BoosterPack_MysteryFightingColorless
+ dw BoosterPack_MysteryTrainerColorless
+ dw BoosterPack_LaboratoryMostlyNeutral
+ dw BoosterPack_LaboratoryGrass
+ dw BoosterPack_LaboratoryWater
+ dw BoosterPack_LaboratoryPsychic
+ dw BoosterPack_LaboratoryTrainer
+ dw BoosterPack_EnergyLightningFire
+ dw BoosterPack_EnergyWaterFighting
+ dw BoosterPack_EnergyGrassPsychic
+ dw BoosterPack_RandomEnergies
+
+; load rarity amounts of the booster pack set at [wBoosterDataSet] to wBoosterData*Amount
LoadRarityAmountsToWram: ; 1e4ba (7:64ba)
ld a, [wBoosterDataSet]
add a
add a
ld c, a
ld b, $00
- ld hl, BoosterSetRarityAmountTable
+ ld hl, BoosterSetRarityAmountsTable
add hl, bc
inc hl
ld a, [hli]
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 86bf865..05da41c 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -230,7 +230,7 @@ EnableLCD: ; 0277 (0:0277)
or rLCDC_ENABLE_MASK ;
ld [wLCDC], a ;
ld [rLCDC], a ; turn LCD on
- ld a, %11000000
+ ld a, FLUSH_ALL
ld [wFlushPaletteFlags], a
ret
@@ -481,13 +481,13 @@ ZeroRAM: ; 03ec (0:03ec)
; Flush all non-CGB and CGB palettes
SetFlushAllPalettes: ; 0404 (0:0404)
- ld a, $c0
+ ld a, FLUSH_ALL
jr SetFlushPalettes
; Flush non-CGB palettes and a single CGB palette,
; provided in a as an index between 0-7 (BGP) or 8-15 (OBP)
SetFlushPalette: ; 0408 (0:0408)
- or $80
+ or FLUSH_ONE
jr SetFlushPalettes
; Set wBGP to the specified value, flush non-CGB palettes, and the first CGB palette.
@@ -495,7 +495,7 @@ SetBGP: ; 040c (0:040c)
ld [wBGP], a
SetFlushPalette0:
- ld a, $80
+ ld a, FLUSH_ONE
SetFlushPalettes:
ld [wFlushPaletteFlags], a
@@ -547,9 +547,9 @@ FlushPalettes: ; 042d (0:042d)
ret
.CGB
; flush a single CGB BG or OB palette
- ; if bit6 of [wFlushPaletteFlags] is set, flush all 16 of them
+ ; if bit6 (FLUSH_ALL_F) of [wFlushPaletteFlags] is set, flush all 16 of them
ld a, [wFlushPaletteFlags]
- bit 6, a
+ bit FLUSH_ALL_F, a
jr nz, FlushAllCGBPalettes
ld b, CGB_PAL_SIZE
call CopyCGBPalettes
diff --git a/src/wram.asm b/src/wram.asm
index 56ade23..3802967 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1687,21 +1687,28 @@ wd636:: ; d635
ds $32
+; which BoosterPack_* corresponds to the booster pack that the player is opening
wBoosterIndex:: ; d669
ds $1
-wBoosterTempCard:: ; d66a
+; card being currently processed by the booster pack engine functions
+wBoosterCurrentCard:: ; d66a
ds $1
-wBoosterSelectedCardType:: ; d66b
+; booster card type of the card that has just been drawn from the pack
+wBoosterJustDrawnCardType:: ; d66b
ds $1
-wBoosterCurRarity:: ; d66c
+; rarity of the cards being currently generated (non-energy cards are generated ordered by rarity)
+wBoosterCurrentRarity:: ; d66c
ds $1
+; the averaged value of all values in wBoosterDataTypeChances
+; used to recalculate the chances of a booster card type when a card of said type is drawn from the pack
wBoosterAveragedTypeChances:: ; d66d
ds $1
+; data of the booster pack copied from the corresponding BoosterSetRarityAmountsTable entry
wBoosterDataCommonAmount:: ; d66e
ds $1
@@ -1711,12 +1718,16 @@ wBoosterDataUncommonAmount:: ; d66f
wBoosterDataRareAmount:: ; d670
ds $1
+; how many cards of each type are available of a certain rarity in the booster pack's set
wBoosterAmountOfCardTypeTable:: ; d671
ds NUM_BOOSTER_CARD_TYPES
-wBoosterTempTypeChanceTable:: ; d67a
+; holds information similar to wBoosterDataTypeChances, except that it contains 00 on any type
+; of which there are no cards remaining in the set for the current rarity
+wBoosterTempTypeChancesTable:: ; d67a
ds NUM_BOOSTER_CARD_TYPES
+; properties of the card being currently processed by the booster pack engine functions
wBoosterCurrentCardType:: ; d683
ds $1
@@ -1726,6 +1737,8 @@ wBoosterCurrentCardRarity:: ; d684
wBoosterCurrentCardSet:: ; d685
ds $1
+; data of the booster pack copied from the corresponding BoosterPack_* structure.
+; wBoosterDataTypeChances is updated after each card is drawn, to re-balance the type chances.
wBoosterDataSet:: ; d686
ds $1