2018-06-24 07:09:41 -07:00
|
|
|
_DoItemEffect::
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2013-12-24 22:42:41 -08:00
|
|
|
call GetItemName
|
|
|
|
call CopyName1
|
|
|
|
ld a, 1
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2013-12-24 22:42:41 -08:00
|
|
|
dec a
|
|
|
|
ld hl, ItemEffects
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ItemEffects:
|
2021-03-03 19:22:41 -08:00
|
|
|
; entries correspond to item ids (see constants/item_constants.asm)
|
|
|
|
table_width 2, ItemEffects
|
2018-02-05 10:07:22 -08:00
|
|
|
dw PokeBallEffect ; MASTER_BALL
|
|
|
|
dw PokeBallEffect ; ULTRA_BALL
|
|
|
|
dw NoEffect ; BRIGHTPOWDER
|
|
|
|
dw PokeBallEffect ; GREAT_BALL
|
|
|
|
dw PokeBallEffect ; POKE_BALL
|
|
|
|
dw TownMapEffect ; TOWN_MAP
|
|
|
|
dw BicycleEffect ; BICYCLE
|
|
|
|
dw EvoStoneEffect ; MOON_STONE
|
|
|
|
dw StatusHealingEffect ; ANTIDOTE
|
|
|
|
dw StatusHealingEffect ; BURN_HEAL
|
|
|
|
dw StatusHealingEffect ; ICE_HEAL
|
|
|
|
dw StatusHealingEffect ; AWAKENING
|
|
|
|
dw StatusHealingEffect ; PARLYZ_HEAL
|
|
|
|
dw FullRestoreEffect ; FULL_RESTORE
|
|
|
|
dw RestoreHPEffect ; MAX_POTION
|
|
|
|
dw RestoreHPEffect ; HYPER_POTION
|
|
|
|
dw RestoreHPEffect ; SUPER_POTION
|
|
|
|
dw RestoreHPEffect ; POTION
|
|
|
|
dw EscapeRopeEffect ; ESCAPE_ROPE
|
|
|
|
dw RepelEffect ; REPEL
|
|
|
|
dw RestorePPEffect ; MAX_ELIXER
|
|
|
|
dw EvoStoneEffect ; FIRE_STONE
|
|
|
|
dw EvoStoneEffect ; THUNDERSTONE
|
|
|
|
dw EvoStoneEffect ; WATER_STONE
|
|
|
|
dw NoEffect ; ITEM_19
|
|
|
|
dw VitaminEffect ; HP_UP
|
|
|
|
dw VitaminEffect ; PROTEIN
|
|
|
|
dw VitaminEffect ; IRON
|
|
|
|
dw VitaminEffect ; CARBOS
|
|
|
|
dw NoEffect ; LUCKY_PUNCH
|
|
|
|
dw VitaminEffect ; CALCIUM
|
|
|
|
dw RareCandyEffect ; RARE_CANDY
|
|
|
|
dw XAccuracyEffect ; X_ACCURACY
|
|
|
|
dw EvoStoneEffect ; LEAF_STONE
|
|
|
|
dw NoEffect ; METAL_POWDER
|
|
|
|
dw NoEffect ; NUGGET
|
|
|
|
dw PokeDollEffect ; POKE_DOLL
|
|
|
|
dw StatusHealingEffect ; FULL_HEAL
|
|
|
|
dw ReviveEffect ; REVIVE
|
|
|
|
dw ReviveEffect ; MAX_REVIVE
|
|
|
|
dw GuardSpecEffect ; GUARD_SPEC
|
|
|
|
dw SuperRepelEffect ; SUPER_REPEL
|
|
|
|
dw MaxRepelEffect ; MAX_REPEL
|
|
|
|
dw DireHitEffect ; DIRE_HIT
|
|
|
|
dw NoEffect ; ITEM_2D
|
|
|
|
dw RestoreHPEffect ; FRESH_WATER
|
|
|
|
dw RestoreHPEffect ; SODA_POP
|
|
|
|
dw RestoreHPEffect ; LEMONADE
|
|
|
|
dw XItemEffect ; X_ATTACK
|
|
|
|
dw NoEffect ; ITEM_32
|
|
|
|
dw XItemEffect ; X_DEFEND
|
|
|
|
dw XItemEffect ; X_SPEED
|
|
|
|
dw XItemEffect ; X_SPECIAL
|
|
|
|
dw CoinCaseEffect ; COIN_CASE
|
|
|
|
dw ItemfinderEffect ; ITEMFINDER
|
|
|
|
dw PokeFluteEffect ; POKE_FLUTE
|
|
|
|
dw NoEffect ; EXP_SHARE
|
|
|
|
dw OldRodEffect ; OLD_ROD
|
|
|
|
dw GoodRodEffect ; GOOD_ROD
|
|
|
|
dw NoEffect ; SILVER_LEAF
|
|
|
|
dw SuperRodEffect ; SUPER_ROD
|
|
|
|
dw RestorePPEffect ; PP_UP
|
|
|
|
dw RestorePPEffect ; ETHER
|
|
|
|
dw RestorePPEffect ; MAX_ETHER
|
|
|
|
dw RestorePPEffect ; ELIXER
|
|
|
|
dw NoEffect ; RED_SCALE
|
|
|
|
dw NoEffect ; SECRETPOTION
|
|
|
|
dw NoEffect ; S_S_TICKET
|
|
|
|
dw NoEffect ; MYSTERY_EGG
|
|
|
|
dw NoEffect ; CLEAR_BELL
|
|
|
|
dw NoEffect ; SILVER_WING
|
|
|
|
dw RestoreHPEffect ; MOOMOO_MILK
|
|
|
|
dw NoEffect ; QUICK_CLAW
|
|
|
|
dw StatusHealingEffect ; PSNCUREBERRY
|
|
|
|
dw NoEffect ; GOLD_LEAF
|
|
|
|
dw NoEffect ; SOFT_SAND
|
|
|
|
dw NoEffect ; SHARP_BEAK
|
|
|
|
dw StatusHealingEffect ; PRZCUREBERRY
|
|
|
|
dw StatusHealingEffect ; BURNT_BERRY
|
|
|
|
dw StatusHealingEffect ; ICE_BERRY
|
|
|
|
dw NoEffect ; POISON_BARB
|
|
|
|
dw NoEffect ; KINGS_ROCK
|
|
|
|
dw BitterBerryEffect ; BITTER_BERRY
|
|
|
|
dw StatusHealingEffect ; MINT_BERRY
|
|
|
|
dw NoEffect ; RED_APRICORN
|
|
|
|
dw NoEffect ; TINYMUSHROOM
|
|
|
|
dw NoEffect ; BIG_MUSHROOM
|
|
|
|
dw NoEffect ; SILVERPOWDER
|
|
|
|
dw NoEffect ; BLU_APRICORN
|
|
|
|
dw NoEffect ; ITEM_5A
|
|
|
|
dw NoEffect ; AMULET_COIN
|
|
|
|
dw NoEffect ; YLW_APRICORN
|
|
|
|
dw NoEffect ; GRN_APRICORN
|
|
|
|
dw NoEffect ; CLEANSE_TAG
|
|
|
|
dw NoEffect ; MYSTIC_WATER
|
|
|
|
dw NoEffect ; TWISTEDSPOON
|
|
|
|
dw NoEffect ; WHT_APRICORN
|
2020-03-21 14:50:44 -07:00
|
|
|
dw NoEffect ; BLACKBELT_I
|
2018-02-05 10:07:22 -08:00
|
|
|
dw NoEffect ; BLK_APRICORN
|
|
|
|
dw NoEffect ; ITEM_64
|
|
|
|
dw NoEffect ; PNK_APRICORN
|
|
|
|
dw NoEffect ; BLACKGLASSES
|
|
|
|
dw NoEffect ; SLOWPOKETAIL
|
|
|
|
dw NoEffect ; PINK_BOW
|
|
|
|
dw NoEffect ; STICK
|
|
|
|
dw NoEffect ; SMOKE_BALL
|
|
|
|
dw NoEffect ; NEVERMELTICE
|
|
|
|
dw NoEffect ; MAGNET
|
|
|
|
dw StatusHealingEffect ; MIRACLEBERRY
|
|
|
|
dw NoEffect ; PEARL
|
|
|
|
dw NoEffect ; BIG_PEARL
|
|
|
|
dw NoEffect ; EVERSTONE
|
|
|
|
dw NoEffect ; SPELL_TAG
|
|
|
|
dw RestoreHPEffect ; RAGECANDYBAR
|
|
|
|
dw NoEffect ; GS_BALL
|
|
|
|
dw BlueCardEffect ; BLUE_CARD
|
|
|
|
dw NoEffect ; MIRACLE_SEED
|
|
|
|
dw NoEffect ; THICK_CLUB
|
|
|
|
dw NoEffect ; FOCUS_BAND
|
|
|
|
dw NoEffect ; ITEM_78
|
|
|
|
dw EnergypowderEffect ; ENERGYPOWDER
|
|
|
|
dw EnergyRootEffect ; ENERGY_ROOT
|
|
|
|
dw HealPowderEffect ; HEAL_POWDER
|
|
|
|
dw RevivalHerbEffect ; REVIVAL_HERB
|
|
|
|
dw NoEffect ; HARD_STONE
|
|
|
|
dw NoEffect ; LUCKY_EGG
|
|
|
|
dw CardKeyEffect ; CARD_KEY
|
|
|
|
dw NoEffect ; MACHINE_PART
|
|
|
|
dw NoEffect ; EGG_TICKET
|
|
|
|
dw NoEffect ; LOST_ITEM
|
|
|
|
dw NoEffect ; STARDUST
|
|
|
|
dw NoEffect ; STAR_PIECE
|
|
|
|
dw BasementKeyEffect ; BASEMENT_KEY
|
|
|
|
dw NoEffect ; PASS
|
|
|
|
dw NoEffect ; ITEM_87
|
|
|
|
dw NoEffect ; ITEM_88
|
|
|
|
dw NoEffect ; ITEM_89
|
|
|
|
dw NoEffect ; CHARCOAL
|
|
|
|
dw RestoreHPEffect ; BERRY_JUICE
|
|
|
|
dw NoEffect ; SCOPE_LENS
|
|
|
|
dw NoEffect ; ITEM_8D
|
|
|
|
dw NoEffect ; ITEM_8E
|
|
|
|
dw NoEffect ; METAL_COAT
|
|
|
|
dw NoEffect ; DRAGON_FANG
|
|
|
|
dw NoEffect ; ITEM_91
|
|
|
|
dw NoEffect ; LEFTOVERS
|
|
|
|
dw NoEffect ; ITEM_93
|
|
|
|
dw NoEffect ; ITEM_94
|
|
|
|
dw NoEffect ; ITEM_95
|
|
|
|
dw RestorePPEffect ; MYSTERYBERRY
|
|
|
|
dw NoEffect ; DRAGON_SCALE
|
|
|
|
dw NoEffect ; BERSERK_GENE
|
|
|
|
dw NoEffect ; ITEM_99
|
|
|
|
dw NoEffect ; ITEM_9A
|
|
|
|
dw NoEffect ; ITEM_9B
|
|
|
|
dw SacredAshEffect ; SACRED_ASH
|
|
|
|
dw PokeBallEffect ; HEAVY_BALL
|
|
|
|
dw NoEffect ; FLOWER_MAIL
|
|
|
|
dw PokeBallEffect ; LEVEL_BALL
|
|
|
|
dw PokeBallEffect ; LURE_BALL
|
|
|
|
dw PokeBallEffect ; FAST_BALL
|
|
|
|
dw NoEffect ; ITEM_A2
|
|
|
|
dw NoEffect ; LIGHT_BALL
|
|
|
|
dw PokeBallEffect ; FRIEND_BALL
|
|
|
|
dw PokeBallEffect ; MOON_BALL
|
|
|
|
dw PokeBallEffect ; LOVE_BALL
|
|
|
|
dw NormalBoxEffect ; NORMAL_BOX
|
|
|
|
dw GorgeousBoxEffect ; GORGEOUS_BOX
|
|
|
|
dw EvoStoneEffect ; SUN_STONE
|
|
|
|
dw NoEffect ; POLKADOT_BOW
|
|
|
|
dw NoEffect ; ITEM_AB
|
|
|
|
dw NoEffect ; UP_GRADE
|
|
|
|
dw RestoreHPEffect ; BERRY
|
|
|
|
dw RestoreHPEffect ; GOLD_BERRY
|
|
|
|
dw SquirtbottleEffect ; SQUIRTBOTTLE
|
|
|
|
dw NoEffect ; ITEM_B0
|
|
|
|
dw PokeBallEffect ; PARK_BALL
|
|
|
|
dw NoEffect ; RAINBOW_WING
|
|
|
|
dw NoEffect ; ITEM_B3
|
2021-03-03 19:22:41 -08:00
|
|
|
assert_table_length ITEM_B3
|
|
|
|
; The items past ITEM_B3 do not have effect entries:
|
|
|
|
; BRICK_PIECE
|
|
|
|
; SURF_MAIL
|
|
|
|
; LITEBLUEMAIL
|
|
|
|
; PORTRAITMAIL
|
|
|
|
; LOVELY_MAIL
|
|
|
|
; EON_MAIL
|
|
|
|
; MORPH_MAIL
|
|
|
|
; BLUESKY_MAIL
|
|
|
|
; MUSIC_MAIL
|
|
|
|
; MIRAGE_MAIL
|
|
|
|
; ITEM_BE
|
|
|
|
; They all have the ITEMMENU_NOUSE attribute so they can't be used anyway.
|
|
|
|
; NoEffect would be appropriate, with the table then being NUM_ITEMS long.
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PokeBallEffect:
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: The Dude's catching tutorial may crash if his Poké Ball can't be used (see docs/bugs_and_glitches.md)
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-05-07 23:02:15 -07:00
|
|
|
dec a
|
2015-11-06 11:45:10 -08:00
|
|
|
jp nz, UseBallInTrainerBattle
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2014-08-13 19:42:58 -07:00
|
|
|
cp PARTY_LENGTH
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .room_in_party
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2015-08-20 23:03:05 -07:00
|
|
|
ld a, BANK(sBoxCount)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2015-08-20 23:03:05 -07:00
|
|
|
ld a, [sBoxCount]
|
|
|
|
cp MONS_PER_BOX
|
2013-05-07 23:02:15 -07:00
|
|
|
call CloseSRAM
|
2013-12-24 22:42:41 -08:00
|
|
|
jp z, Ball_BoxIsFullMessage
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.room_in_party
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: Using a Park Ball in non-Contest battles has a corrupt animation (see docs/bugs_and_glitches.md)
|
2013-05-07 23:02:15 -07:00
|
|
|
xor a
|
2015-11-09 13:41:09 -08:00
|
|
|
ld [wWildMon], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2013-12-24 22:42:41 -08:00
|
|
|
cp PARK_BALL
|
2015-11-18 15:35:44 -08:00
|
|
|
call nz, ReturnToBattle_UseBall
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOptions
|
2014-08-13 19:42:58 -07:00
|
|
|
res NO_TEXT_SCROLL, [hl]
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemUsedText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonCatchRate]
|
2013-05-07 23:02:15 -07:00
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleType]
|
2014-06-13 22:53:20 -07:00
|
|
|
cp BATTLETYPE_TUTORIAL
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .catch_without_fail
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2014-06-13 22:53:20 -07:00
|
|
|
cp MASTER_BALL
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .catch_without_fail
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2013-05-07 23:02:15 -07:00
|
|
|
ld c, a
|
2014-10-23 23:18:48 -07:00
|
|
|
ld hl, BallMultiplierFunctionTable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.get_multiplier_loop
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hli]
|
|
|
|
cp $ff
|
2015-11-06 11:45:10 -08:00
|
|
|
jr z, .skip_or_return_from_ball_fn
|
2013-05-07 23:02:15 -07:00
|
|
|
cp c
|
2015-11-06 11:45:10 -08:00
|
|
|
jr z, .call_ball_function
|
2013-05-07 23:02:15 -07:00
|
|
|
inc hl
|
2016-05-04 08:46:23 -07:00
|
|
|
inc hl
|
2015-11-06 11:45:10 -08:00
|
|
|
jr .get_multiplier_loop
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.call_ball_function
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-11-06 11:45:10 -08:00
|
|
|
ld de, .skip_or_return_from_ball_fn
|
2013-05-07 23:02:15 -07:00
|
|
|
push de
|
2017-06-09 14:01:10 -07:00
|
|
|
jp hl
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.skip_or_return_from_ball_fn
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp LEVEL_BALL
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, b
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .skip_hp_calc
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, b
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMultiplicand + 2], a
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEnemyMonHP
|
2013-05-07 23:02:15 -07:00
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld c, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
inc hl
|
|
|
|
ld e, [hl]
|
|
|
|
sla c
|
|
|
|
rl b
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2013-05-07 23:02:15 -07:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld a, d
|
|
|
|
and a
|
2015-11-06 11:45:10 -08:00
|
|
|
jr z, .okay_1
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
srl d
|
|
|
|
rr e
|
|
|
|
srl d
|
|
|
|
rr e
|
|
|
|
srl b
|
|
|
|
rr c
|
|
|
|
srl b
|
|
|
|
rr c
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, c
|
|
|
|
and a
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .okay_1
|
2013-05-07 23:02:15 -07:00
|
|
|
ld c, $1
|
2015-11-06 11:45:10 -08:00
|
|
|
.okay_1
|
2013-05-07 23:02:15 -07:00
|
|
|
ld b, e
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
push bc
|
|
|
|
ld a, b
|
|
|
|
sub c
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMultiplier], a
|
2013-05-07 23:02:15 -07:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDividend + 0], a
|
|
|
|
ldh [hMultiplicand + 0], a
|
|
|
|
ldh [hMultiplicand + 1], a
|
2013-05-07 23:02:15 -07:00
|
|
|
call Multiply
|
|
|
|
pop bc
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, b
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDivisor], a
|
2018-08-26 10:49:38 -07:00
|
|
|
ld b, 4
|
2013-05-07 23:02:15 -07:00
|
|
|
call Divide
|
|
|
|
|
2018-08-26 10:49:38 -07:00
|
|
|
ldh a, [hQuotient + 3]
|
2013-05-07 23:02:15 -07:00
|
|
|
and a
|
2014-10-23 23:18:48 -07:00
|
|
|
jr nz, .statuscheck
|
2014-08-13 19:42:58 -07:00
|
|
|
ld a, 1
|
2014-10-23 23:18:48 -07:00
|
|
|
.statuscheck
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: BRN/PSN/PAR do not affect catch rate (see docs/bugs_and_glitches.md)
|
2013-05-07 23:02:15 -07:00
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonStatus]
|
2022-06-17 19:25:56 -07:00
|
|
|
and 1 << FRZ | SLP_MASK
|
2013-12-24 14:11:52 -08:00
|
|
|
ld c, 10
|
2014-10-23 23:18:48 -07:00
|
|
|
jr nz, .addstatus
|
2013-05-07 23:02:15 -07:00
|
|
|
and a
|
2013-12-24 14:11:52 -08:00
|
|
|
ld c, 5
|
2014-10-23 23:18:48 -07:00
|
|
|
jr nz, .addstatus
|
2013-12-24 14:11:52 -08:00
|
|
|
ld c, 0
|
2014-10-23 23:18:48 -07:00
|
|
|
.addstatus
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, b
|
|
|
|
add c
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nc, .max_1
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, $ff
|
2015-11-06 11:45:10 -08:00
|
|
|
.max_1
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: HELD_CATCH_CHANCE has no effect (see docs/bugs_and_glitches.md)
|
2013-05-07 23:02:15 -07:00
|
|
|
ld d, a
|
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleMonItem]
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall GetItemHeldEffect
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, b
|
2014-08-13 19:42:58 -07:00
|
|
|
cp HELD_CATCH_CHANCE
|
2013-05-07 23:02:15 -07:00
|
|
|
pop de
|
|
|
|
ld a, d
|
2018-02-02 09:29:42 -08:00
|
|
|
jr nz, .max_2
|
2013-05-07 23:02:15 -07:00
|
|
|
add c
|
2018-02-02 09:29:42 -08:00
|
|
|
jr nc, .max_2
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, $ff
|
2018-02-02 09:29:42 -08:00
|
|
|
.max_2
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2018-02-02 09:29:42 -08:00
|
|
|
.skip_hp_calc
|
2013-05-07 23:02:15 -07:00
|
|
|
ld b, a
|
2020-11-03 19:45:12 -08:00
|
|
|
ld [wFinalCatchRate], a
|
2013-08-30 19:59:40 -07:00
|
|
|
call Random
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
cp b
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, 0
|
2015-11-06 11:45:10 -08:00
|
|
|
jr z, .catch_without_fail
|
|
|
|
jr nc, .fail_to_catch
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.catch_without_fail
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonSpecies]
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.fail_to_catch
|
2015-11-09 13:41:09 -08:00
|
|
|
ld [wWildMon], a
|
2013-12-24 14:11:52 -08:00
|
|
|
ld c, 20
|
2013-05-07 23:02:15 -07:00
|
|
|
call DelayFrames
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2014-08-13 19:42:58 -07:00
|
|
|
cp POKE_BALL + 1 ; Assumes Master/Ultra/Great come before
|
2015-11-06 11:45:10 -08:00
|
|
|
jr c, .not_kurt_ball
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, POKE_BALL
|
2015-11-06 11:45:10 -08:00
|
|
|
.not_kurt_ball
|
2016-01-27 09:25:12 -08:00
|
|
|
ld [wBattleAnimParam], a
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2013-12-24 14:11:52 -08:00
|
|
|
ld de, ANIM_THROW_POKE_BALL
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, e
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wFXAnimID], a
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, d
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wFXAnimID + 1], a
|
2013-05-07 23:02:15 -07:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBattleTurn], a
|
2020-11-03 19:45:12 -08:00
|
|
|
ld [wThrownBallWobbleCount], a
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wNumHits], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PlayBattleAnim
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
ld a, [wWildMon]
|
2013-05-07 23:02:15 -07:00
|
|
|
and a
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .caught
|
2020-11-03 19:45:12 -08:00
|
|
|
ld a, [wThrownBallWobbleCount]
|
|
|
|
cp 1
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BallBrokeFreeText
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .shake_and_break_free
|
2020-11-03 19:45:12 -08:00
|
|
|
cp 2
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BallAppearedCaughtText
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .shake_and_break_free
|
2020-11-03 19:45:12 -08:00
|
|
|
cp 3
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BallAlmostHadItText
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .shake_and_break_free
|
2020-11-03 19:45:12 -08:00
|
|
|
cp 4
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BallSoCloseText
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .shake_and_break_free
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2020-11-03 19:45:12 -08:00
|
|
|
.caught
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEnemyMonStatus
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hli]
|
|
|
|
push af
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
push af
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEnemyMonItem
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEnemySubStatus5
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
2014-08-13 19:42:58 -07:00
|
|
|
set SUBSTATUS_TRANSFORMED, [hl]
|
2017-12-19 16:04:56 -08:00
|
|
|
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: Catching a Transformed Pokémon always catches a Ditto (see docs/bugs_and_glitches.md)
|
2014-08-13 19:42:58 -07:00
|
|
|
bit SUBSTATUS_TRANSFORMED, a
|
2016-01-10 14:44:09 -08:00
|
|
|
jr nz, .ditto
|
|
|
|
jr .not_ditto
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-01-10 14:44:09 -08:00
|
|
|
.ditto
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, DITTO
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempEnemyMonSpecies], a
|
2016-01-10 14:44:09 -08:00
|
|
|
jr .load_data
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-01-10 14:44:09 -08:00
|
|
|
.not_ditto
|
|
|
|
set SUBSTATUS_TRANSFORMED, [hl]
|
|
|
|
ld hl, wEnemyBackupDVs
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonDVs]
|
2013-05-07 23:02:15 -07:00
|
|
|
ld [hli], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonDVs + 1]
|
2013-05-07 23:02:15 -07:00
|
|
|
ld [hl], a
|
|
|
|
|
2016-01-10 14:44:09 -08:00
|
|
|
.load_data
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempEnemyMonSpecies]
|
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld a, [wEnemyMonLevel]
|
|
|
|
ld [wCurPartyLevel], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall LoadEnemyMon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wEnemySubStatus5], a
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
pop hl
|
|
|
|
pop af
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
pop af
|
|
|
|
ld [hld], a
|
|
|
|
pop af
|
|
|
|
ld [hld], a
|
|
|
|
dec hl
|
|
|
|
pop af
|
|
|
|
ld [hl], a
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEnemySubStatus5
|
2014-08-13 19:42:58 -07:00
|
|
|
bit SUBSTATUS_TRANSFORMED, [hl]
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .Transformed
|
2015-11-09 13:41:09 -08:00
|
|
|
ld hl, wWildMonMoves
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wEnemyMonMoves
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, NUM_MOVES
|
2013-05-07 23:02:15 -07:00
|
|
|
call CopyBytes
|
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
ld hl, wWildMonPP
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wEnemyMonPP
|
2014-06-10 23:08:07 -07:00
|
|
|
ld bc, NUM_MOVES
|
2013-05-07 23:02:15 -07:00
|
|
|
call CopyBytes
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2018-06-25 09:24:18 -07:00
|
|
|
.Transformed:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonSpecies]
|
2015-11-09 13:41:09 -08:00
|
|
|
ld [wWildMon], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wTempSpecies], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleType]
|
2014-08-13 19:42:58 -07:00
|
|
|
cp BATTLETYPE_TUTORIAL
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .FinishTutorial
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
ld hl, Text_GotchaMonWasCaught
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
call ClearSprites
|
|
|
|
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wTempSpecies]
|
2013-05-07 23:02:15 -07:00
|
|
|
dec a
|
2013-12-24 14:11:52 -08:00
|
|
|
call CheckCaughtMon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
ld a, c
|
|
|
|
push af
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wTempSpecies]
|
2013-05-07 23:02:15 -07:00
|
|
|
dec a
|
2013-12-24 14:11:52 -08:00
|
|
|
call SetSeenAndCaughtMon
|
2013-05-07 23:02:15 -07:00
|
|
|
pop af
|
|
|
|
and a
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .skip_pokedex
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
call CheckReceivedDex
|
|
|
|
jr z, .skip_pokedex
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, NewDexDataText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
call ClearSprites
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonSpecies]
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wTempSpecies], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef NewPokedexEntry
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.skip_pokedex
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleType]
|
2014-08-13 19:42:58 -07:00
|
|
|
cp BATTLETYPE_CONTEST
|
2015-11-06 11:45:10 -08:00
|
|
|
jp z, .catch_bug_contest_mon
|
2014-08-13 19:42:58 -07:00
|
|
|
cp BATTLETYPE_CELEBI
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .not_celebi
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, wBattleResult
|
2018-04-05 08:44:02 -07:00
|
|
|
set BATTLERESULT_CAUGHT_CELEBI, [hl]
|
2015-11-06 11:45:10 -08:00
|
|
|
.not_celebi
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2014-08-13 19:42:58 -07:00
|
|
|
cp PARTY_LENGTH
|
2015-11-06 11:45:10 -08:00
|
|
|
jr z, .SendToPC
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2013-05-07 23:02:15 -07:00
|
|
|
call ClearSprites
|
|
|
|
|
2018-01-16 11:30:10 -08:00
|
|
|
predef TryAddMonToParty
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall SetCaughtData
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp FRIEND_BALL
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .SkipPartyMonFriendBall
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2013-05-07 23:02:15 -07:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Happiness
|
2015-11-04 08:19:58 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2013-05-07 23:02:15 -07:00
|
|
|
call AddNTimes
|
|
|
|
|
2014-08-13 19:42:58 -07:00
|
|
|
ld a, FRIEND_BALL_HAPPINESS
|
2013-05-07 23:02:15 -07:00
|
|
|
ld [hl], a
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2018-06-25 09:24:18 -07:00
|
|
|
.SkipPartyMonFriendBall:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, AskGiveNicknameText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2013-12-24 14:11:52 -08:00
|
|
|
call GetPokemonName
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2013-12-03 23:49:12 -08:00
|
|
|
call YesNoBox
|
2015-11-06 11:45:10 -08:00
|
|
|
jp c, .return_from_capture
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2013-05-07 23:02:15 -07:00
|
|
|
dec a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
|
|
|
ld hl, wPartyMonNicknames
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2013-05-07 23:02:15 -07:00
|
|
|
call AddNTimes
|
|
|
|
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
push de
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-09-16 13:02:58 -07:00
|
|
|
ld b, NAME_MON
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall NamingScreen
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateThreePalettesRight
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-04 13:14:27 -08:00
|
|
|
call LoadStandardFont
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
pop hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer1
|
2013-07-29 20:58:02 -07:00
|
|
|
call InitName
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
jp .return_from_capture
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.SendToPC:
|
2013-05-07 23:02:15 -07:00
|
|
|
call ClearSprites
|
|
|
|
|
2018-02-22 08:13:29 -08:00
|
|
|
predef SendMonIntoBox
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall SetBoxMonCaughtData
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-08-20 23:03:05 -07:00
|
|
|
ld a, BANK(sBoxCount)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-08-20 23:03:05 -07:00
|
|
|
ld a, [sBoxCount]
|
2014-08-13 19:42:58 -07:00
|
|
|
cp MONS_PER_BOX
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .BoxNotFullYet
|
2015-10-24 07:34:19 -07:00
|
|
|
ld hl, wBattleResult
|
2018-04-05 08:44:02 -07:00
|
|
|
set BATTLERESULT_BOX_FULL, [hl]
|
2016-04-10 11:42:14 -07:00
|
|
|
.BoxNotFullYet:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp FRIEND_BALL
|
2015-11-06 11:45:10 -08:00
|
|
|
jr nz, .SkipBoxMonFriendBall
|
2017-12-14 11:18:33 -08:00
|
|
|
; The captured mon is now first in the box
|
2014-08-13 19:42:58 -07:00
|
|
|
ld a, FRIEND_BALL_HAPPINESS
|
2015-08-20 23:03:05 -07:00
|
|
|
ld [sBoxMon1Happiness], a
|
2016-04-10 11:42:14 -07:00
|
|
|
.SkipBoxMonFriendBall:
|
2013-05-07 23:02:15 -07:00
|
|
|
call CloseSRAM
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, AskGiveNicknameText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2013-12-24 14:11:52 -08:00
|
|
|
call GetPokemonName
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2013-12-03 23:49:12 -08:00
|
|
|
call YesNoBox
|
2015-11-06 11:45:10 -08:00
|
|
|
jr c, .SkipBoxMonNickname
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2013-07-02 11:10:49 -07:00
|
|
|
ld a, BOXMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2015-12-18 17:07:09 -08:00
|
|
|
ld de, wMonOrItemNameBuffer
|
2018-09-16 13:02:58 -07:00
|
|
|
ld b, NAME_MON
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall NamingScreen
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-04 11:14:51 -07:00
|
|
|
ld a, BANK(sBoxMonNicknames)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, wMonOrItemNameBuffer
|
2015-10-04 11:14:51 -07:00
|
|
|
ld de, sBoxMonNicknames
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2013-05-07 23:02:15 -07:00
|
|
|
call CopyBytes
|
|
|
|
|
2015-10-04 11:14:51 -07:00
|
|
|
ld hl, sBoxMonNicknames
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer1
|
2013-07-29 20:58:02 -07:00
|
|
|
call InitName
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.SkipBoxMonNickname:
|
2015-10-04 11:14:51 -07:00
|
|
|
ld a, BANK(sBoxMonNicknames)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-04 11:14:51 -07:00
|
|
|
ld hl, sBoxMonNicknames
|
2015-12-18 17:07:09 -08:00
|
|
|
ld de, wMonOrItemNameBuffer
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2013-05-07 23:02:15 -07:00
|
|
|
call CopyBytes
|
|
|
|
|
|
|
|
call CloseSRAM
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BallSentToPCText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateThreePalettesRight
|
2015-11-04 13:14:27 -08:00
|
|
|
call LoadStandardFont
|
2015-11-06 11:45:10 -08:00
|
|
|
jr .return_from_capture
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.catch_bug_contest_mon
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall BugContest_SetCaughtContestMon
|
2015-11-06 11:45:10 -08:00
|
|
|
jr .return_from_capture
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.FinishTutorial:
|
2015-11-06 11:45:10 -08:00
|
|
|
ld hl, Text_GotchaMonWasCaught
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.shake_and_break_free
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
call ClearSprites
|
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
.return_from_capture
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleType]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp BATTLETYPE_TUTORIAL
|
2013-05-07 23:02:15 -07:00
|
|
|
ret z
|
2015-09-09 16:27:07 -07:00
|
|
|
cp BATTLETYPE_DEBUG
|
2013-05-07 23:02:15 -07:00
|
|
|
ret z
|
2014-08-13 19:42:58 -07:00
|
|
|
cp BATTLETYPE_CONTEST
|
|
|
|
jr z, .used_park_ball
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-11-09 13:41:09 -08:00
|
|
|
ld a, [wWildMon]
|
2013-05-07 23:02:15 -07:00
|
|
|
and a
|
2014-08-13 19:42:58 -07:00
|
|
|
jr z, .toss
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearBGPalettes
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2014-08-13 19:42:58 -07:00
|
|
|
.toss
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumItems
|
2013-05-07 23:02:15 -07:00
|
|
|
inc a
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wItemQuantityChange], a
|
2013-12-24 14:11:52 -08:00
|
|
|
jp TossItem
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2014-08-13 19:42:58 -07:00
|
|
|
.used_park_ball
|
2015-11-08 10:27:26 -08:00
|
|
|
ld hl, wParkBallsRemaining
|
2013-05-07 23:02:15 -07:00
|
|
|
dec [hl]
|
|
|
|
ret
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
BallMultiplierFunctionTable:
|
|
|
|
; table of routines that increase or decrease the catch rate based on
|
|
|
|
; which ball is used in a certain situation.
|
2015-11-06 11:45:10 -08:00
|
|
|
dbw ULTRA_BALL, UltraBallMultiplier
|
|
|
|
dbw GREAT_BALL, GreatBallMultiplier
|
|
|
|
dbw SAFARI_BALL, SafariBallMultiplier ; Safari Ball, leftover from RBY
|
|
|
|
dbw HEAVY_BALL, HeavyBallMultiplier
|
|
|
|
dbw LEVEL_BALL, LevelBallMultiplier
|
|
|
|
dbw LURE_BALL, LureBallMultiplier
|
|
|
|
dbw FAST_BALL, FastBallMultiplier
|
|
|
|
dbw MOON_BALL, MoonBallMultiplier
|
|
|
|
dbw LOVE_BALL, LoveBallMultiplier
|
|
|
|
dbw PARK_BALL, ParkBallMultiplier
|
2018-01-10 19:53:42 -08:00
|
|
|
db -1 ; end
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
UltraBallMultiplier:
|
|
|
|
; multiply catch rate by 2
|
2013-05-08 00:27:46 -07:00
|
|
|
sla b
|
|
|
|
ret nc
|
|
|
|
ld b, $ff
|
|
|
|
ret
|
|
|
|
|
2014-10-23 23:43:50 -07:00
|
|
|
SafariBallMultiplier:
|
2014-10-23 23:18:48 -07:00
|
|
|
GreatBallMultiplier:
|
2014-10-23 23:43:50 -07:00
|
|
|
ParkBallMultiplier:
|
2014-10-23 23:18:48 -07:00
|
|
|
; multiply catch rate by 1.5
|
2013-05-08 00:27:46 -07:00
|
|
|
ld a, b
|
|
|
|
srl a
|
|
|
|
add b
|
|
|
|
ld b, a
|
|
|
|
ret nc
|
|
|
|
ld b, $ff
|
|
|
|
ret
|
|
|
|
|
2022-02-22 14:11:33 -08:00
|
|
|
HeavyBall_GetDexEntryBank:
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: Heavy Ball uses wrong weight value for three Pokémon (see docs/bugs_and_glitches.md)
|
2013-05-27 20:28:21 -07:00
|
|
|
push hl
|
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonSpecies]
|
2013-05-27 20:28:21 -07:00
|
|
|
rlca
|
|
|
|
rlca
|
2018-01-16 14:27:50 -08:00
|
|
|
maskbits NUM_DEX_ENTRY_BANKS
|
2013-05-27 20:28:21 -07:00
|
|
|
ld hl, .PokedexEntryBanks
|
|
|
|
ld d, 0
|
|
|
|
ld e, a
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.PokedexEntryBanks:
|
2018-06-12 20:29:15 -07:00
|
|
|
db BANK("Pokedex Entries 001-064")
|
|
|
|
db BANK("Pokedex Entries 065-128")
|
|
|
|
db BANK("Pokedex Entries 129-192")
|
|
|
|
db BANK("Pokedex Entries 193-251")
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
HeavyBallMultiplier:
|
|
|
|
; subtract 20 from catch rate if weight < 102.4 kg
|
|
|
|
; else add 0 to catch rate if weight < 204.8 kg
|
|
|
|
; else add 20 to catch rate if weight < 307.2 kg
|
|
|
|
; else add 30 to catch rate if weight < 409.6 kg
|
2022-05-25 09:05:15 -07:00
|
|
|
; else add 40 to catch rate
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonSpecies]
|
2013-05-27 20:28:21 -07:00
|
|
|
ld hl, PokedexDataPointerTable
|
2013-05-08 00:27:46 -07:00
|
|
|
dec a
|
|
|
|
ld e, a
|
2013-05-27 20:28:21 -07:00
|
|
|
ld d, 0
|
2013-05-08 00:27:46 -07:00
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2013-05-27 20:28:21 -07:00
|
|
|
ld a, BANK(PokedexDataPointerTable)
|
2021-01-09 12:16:05 -08:00
|
|
|
call GetFarWord
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.SkipText:
|
2022-02-22 14:11:33 -08:00
|
|
|
call HeavyBall_GetDexEntryBank
|
2013-05-08 00:27:46 -07:00
|
|
|
call GetFarByte
|
|
|
|
inc hl
|
2013-05-27 20:28:21 -07:00
|
|
|
cp "@"
|
|
|
|
jr nz, .SkipText
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2022-02-22 14:11:33 -08:00
|
|
|
call HeavyBall_GetDexEntryBank
|
2013-05-08 00:27:46 -07:00
|
|
|
push bc
|
|
|
|
inc hl
|
2016-05-04 08:46:23 -07:00
|
|
|
inc hl
|
2021-01-09 12:16:05 -08:00
|
|
|
call GetFarWord
|
2013-05-08 00:27:46 -07:00
|
|
|
|
|
|
|
srl h
|
|
|
|
rr l
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2018-05-06 09:16:57 -07:00
|
|
|
rept 4
|
2013-05-08 00:27:46 -07:00
|
|
|
srl b
|
|
|
|
rr c
|
2018-05-06 09:16:57 -07:00
|
|
|
endr
|
2014-10-23 23:18:48 -07:00
|
|
|
call .subbc
|
2013-05-08 00:27:46 -07:00
|
|
|
|
|
|
|
srl b
|
|
|
|
rr c
|
2014-10-23 23:18:48 -07:00
|
|
|
call .subbc
|
2013-05-08 00:27:46 -07:00
|
|
|
|
|
|
|
ld a, h
|
|
|
|
pop bc
|
2014-10-23 23:18:48 -07:00
|
|
|
jr .compare
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
.subbc
|
|
|
|
; subtract bc from hl
|
2013-05-08 00:27:46 -07:00
|
|
|
push bc
|
|
|
|
ld a, b
|
|
|
|
cpl
|
|
|
|
ld b, a
|
|
|
|
ld a, c
|
|
|
|
cpl
|
|
|
|
ld c, a
|
|
|
|
inc bc
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
.compare
|
2013-05-08 00:27:46 -07:00
|
|
|
ld c, a
|
2017-12-25 10:40:10 -08:00
|
|
|
cp HIGH(1024) ; 102.4 kg
|
2014-10-23 23:18:48 -07:00
|
|
|
jr c, .lightmon
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
ld hl, .WeightsTable
|
|
|
|
.lookup
|
2013-05-08 00:27:46 -07:00
|
|
|
ld a, c
|
|
|
|
cp [hl]
|
2014-10-23 23:18:48 -07:00
|
|
|
jr c, .heavymon
|
2013-05-08 00:27:46 -07:00
|
|
|
inc hl
|
2016-05-04 08:46:23 -07:00
|
|
|
inc hl
|
2014-10-23 23:18:48 -07:00
|
|
|
jr .lookup
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
.heavymon
|
2013-05-08 00:27:46 -07:00
|
|
|
inc hl
|
|
|
|
ld a, b
|
|
|
|
add [hl]
|
|
|
|
ld b, a
|
|
|
|
ret nc
|
|
|
|
ld b, $ff
|
|
|
|
ret
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
.lightmon
|
2013-05-08 00:27:46 -07:00
|
|
|
ld a, b
|
2013-05-27 20:28:21 -07:00
|
|
|
sub 20
|
2013-05-08 00:27:46 -07:00
|
|
|
ld b, a
|
|
|
|
ret nc
|
|
|
|
ld b, $1
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.WeightsTable:
|
2014-10-23 23:18:48 -07:00
|
|
|
; weight factor, boost
|
2017-12-25 10:40:10 -08:00
|
|
|
db HIGH(2048), 0
|
|
|
|
db HIGH(3072), 20
|
|
|
|
db HIGH(4096), 30
|
|
|
|
db HIGH(65280), 40
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
LureBallMultiplier:
|
|
|
|
; multiply catch rate by 3 if this is a fishing rod battle
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleType]
|
2014-08-13 19:42:58 -07:00
|
|
|
cp BATTLETYPE_FISH
|
2013-05-08 00:27:46 -07:00
|
|
|
ret nz
|
2014-08-13 19:42:58 -07:00
|
|
|
|
2013-05-08 00:27:46 -07:00
|
|
|
ld a, b
|
|
|
|
add a
|
2014-08-13 19:42:58 -07:00
|
|
|
jr c, .max
|
2013-05-08 00:27:46 -07:00
|
|
|
|
|
|
|
add b
|
2014-08-13 19:42:58 -07:00
|
|
|
jr nc, .done
|
|
|
|
.max
|
2013-05-08 00:27:46 -07:00
|
|
|
ld a, $ff
|
2014-08-13 19:42:58 -07:00
|
|
|
.done
|
2013-05-08 00:27:46 -07:00
|
|
|
ld b, a
|
|
|
|
ret
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
MoonBallMultiplier:
|
2013-05-08 00:27:46 -07:00
|
|
|
push bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempEnemyMonSpecies]
|
2013-05-08 00:27:46 -07:00
|
|
|
dec a
|
|
|
|
ld c, a
|
2013-12-24 15:35:26 -08:00
|
|
|
ld b, 0
|
|
|
|
ld hl, EvosAttacksPointers
|
2013-05-08 00:27:46 -07:00
|
|
|
add hl, bc
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, bc
|
2013-12-24 15:35:26 -08:00
|
|
|
ld a, BANK(EvosAttacksPointers)
|
2021-01-09 12:16:05 -08:00
|
|
|
call GetFarWord
|
2013-05-08 00:27:46 -07:00
|
|
|
pop bc
|
2013-12-24 15:35:26 -08:00
|
|
|
|
2013-05-08 00:27:46 -07:00
|
|
|
push bc
|
2018-06-12 20:29:15 -07:00
|
|
|
ld a, BANK("Evolutions and Attacks")
|
2013-05-08 00:27:46 -07:00
|
|
|
call GetFarByte
|
2013-12-24 15:35:26 -08:00
|
|
|
cp EVOLVE_ITEM
|
2013-05-08 00:27:46 -07:00
|
|
|
pop bc
|
|
|
|
ret nz
|
2013-12-24 15:35:26 -08:00
|
|
|
|
2013-05-08 00:27:46 -07:00
|
|
|
inc hl
|
2016-05-10 09:31:49 -07:00
|
|
|
inc hl
|
|
|
|
inc hl
|
2013-12-24 15:35:26 -08:00
|
|
|
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: Moon Ball does not boost catch rate (see docs/bugs_and_glitches.md)
|
2013-05-08 00:27:46 -07:00
|
|
|
push bc
|
2018-06-12 20:29:15 -07:00
|
|
|
ld a, BANK("Evolutions and Attacks")
|
2013-05-08 00:27:46 -07:00
|
|
|
call GetFarByte
|
2014-10-23 23:43:50 -07:00
|
|
|
cp MOON_STONE_RED ; BURN_HEAL
|
2013-05-08 00:27:46 -07:00
|
|
|
pop bc
|
|
|
|
ret nz
|
|
|
|
|
|
|
|
sla b
|
2013-12-24 15:35:26 -08:00
|
|
|
jr c, .max
|
|
|
|
sla b
|
|
|
|
jr nc, .done
|
|
|
|
.max
|
2013-05-08 00:27:46 -07:00
|
|
|
ld b, $ff
|
2013-12-24 15:35:26 -08:00
|
|
|
.done
|
2013-05-08 00:27:46 -07:00
|
|
|
ret
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
LoveBallMultiplier:
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
; does species match?
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempEnemyMonSpecies]
|
2013-05-08 00:27:46 -07:00
|
|
|
ld c, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempBattleMonSpecies]
|
2013-05-08 00:27:46 -07:00
|
|
|
cp c
|
|
|
|
ret nz
|
2013-08-03 13:19:29 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
; check player mon species
|
2013-05-08 00:27:46 -07:00
|
|
|
push bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempBattleMonSpecies]
|
|
|
|
ld [wCurPartySpecies], a
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
|
|
|
ld a, [wCurBattleMon]
|
|
|
|
ld [wCurPartyMon], a
|
2018-01-16 11:30:10 -08:00
|
|
|
farcall GetGender
|
2014-10-23 23:18:48 -07:00
|
|
|
jr c, .done1 ; no effect on genderless
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
ld d, 0 ; male
|
2022-07-09 14:12:02 -07:00
|
|
|
jr nz, .got_player_gender
|
2014-10-23 23:18:48 -07:00
|
|
|
inc d ; female
|
2022-07-09 14:12:02 -07:00
|
|
|
.got_player_gender
|
2013-08-03 13:19:29 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
; check wild mon species
|
2013-05-08 00:27:46 -07:00
|
|
|
push de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempEnemyMonSpecies]
|
|
|
|
ld [wCurPartySpecies], a
|
2013-07-02 11:10:49 -07:00
|
|
|
ld a, WILDMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-01-16 11:30:10 -08:00
|
|
|
farcall GetGender
|
2014-10-23 23:18:48 -07:00
|
|
|
jr c, .done2 ; no effect on genderless
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
ld d, 0 ; male
|
2022-07-09 14:12:02 -07:00
|
|
|
jr nz, .got_wild_gender
|
2014-10-23 23:18:48 -07:00
|
|
|
inc d ; female
|
2022-07-09 14:12:02 -07:00
|
|
|
.got_wild_gender
|
2013-08-03 13:19:29 -07:00
|
|
|
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: Love Ball boosts catch rate for the wrong gender (see docs/bugs_and_glitches.md)
|
2013-05-08 00:27:46 -07:00
|
|
|
ld a, d
|
|
|
|
pop de
|
|
|
|
cp d
|
|
|
|
pop bc
|
2022-07-09 14:12:02 -07:00
|
|
|
ret nz
|
2013-08-03 13:19:29 -07:00
|
|
|
|
2013-05-08 00:27:46 -07:00
|
|
|
sla b
|
2014-10-23 23:18:48 -07:00
|
|
|
jr c, .max
|
2013-05-08 00:27:46 -07:00
|
|
|
sla b
|
2014-10-23 23:18:48 -07:00
|
|
|
jr c, .max
|
2013-05-08 00:27:46 -07:00
|
|
|
sla b
|
|
|
|
ret nc
|
2014-10-23 23:18:48 -07:00
|
|
|
.max
|
2013-05-08 00:27:46 -07:00
|
|
|
ld b, $ff
|
|
|
|
ret
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
.done2
|
2013-05-08 00:27:46 -07:00
|
|
|
pop de
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
.done1
|
2013-05-08 00:27:46 -07:00
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
FastBallMultiplier:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wTempEnemyMonSpecies]
|
2013-05-08 00:27:46 -07:00
|
|
|
ld c, a
|
2013-12-24 14:19:39 -08:00
|
|
|
ld hl, FleeMons
|
|
|
|
ld d, 3
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2013-12-24 14:19:39 -08:00
|
|
|
.loop
|
2022-07-09 14:12:02 -07:00
|
|
|
; BUG: Fast Ball only boosts catch rate for three Pokémon (see docs/bugs_and_glitches.md)
|
2013-12-24 14:19:39 -08:00
|
|
|
ld a, BANK(FleeMons)
|
2013-05-08 00:27:46 -07:00
|
|
|
call GetFarByte
|
|
|
|
|
|
|
|
inc hl
|
2013-12-24 14:19:39 -08:00
|
|
|
cp -1
|
|
|
|
jr z, .next
|
2013-05-08 00:27:46 -07:00
|
|
|
cp c
|
2022-07-09 14:12:02 -07:00
|
|
|
jr nz, .next
|
2013-05-08 00:27:46 -07:00
|
|
|
sla b
|
2013-12-24 14:19:39 -08:00
|
|
|
jr c, .max
|
2013-05-08 00:27:46 -07:00
|
|
|
|
|
|
|
sla b
|
|
|
|
ret nc
|
|
|
|
|
2013-12-24 14:19:39 -08:00
|
|
|
.max
|
2013-05-08 00:27:46 -07:00
|
|
|
ld b, $ff
|
|
|
|
ret
|
|
|
|
|
2013-12-24 14:19:39 -08:00
|
|
|
.next
|
2013-05-08 00:27:46 -07:00
|
|
|
dec d
|
2013-12-24 14:19:39 -08:00
|
|
|
jr nz, .loop
|
2013-05-08 00:27:46 -07:00
|
|
|
ret
|
|
|
|
|
2014-10-23 23:18:48 -07:00
|
|
|
LevelBallMultiplier:
|
|
|
|
; multiply catch rate by 8 if player mon level / 4 > enemy mon level
|
|
|
|
; multiply catch rate by 4 if player mon level / 2 > enemy mon level
|
|
|
|
; multiply catch rate by 2 if player mon level > enemy mon level
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBattleMonLevel]
|
2013-05-08 00:27:46 -07:00
|
|
|
ld c, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wEnemyMonLevel]
|
2013-05-08 00:27:46 -07:00
|
|
|
cp c
|
2014-10-23 23:18:48 -07:00
|
|
|
ret nc ; if player is lower level, we're done here
|
2013-05-08 00:27:46 -07:00
|
|
|
sla b
|
2014-08-13 19:42:58 -07:00
|
|
|
jr c, .max
|
2013-05-08 00:27:46 -07:00
|
|
|
|
|
|
|
srl c
|
|
|
|
cp c
|
2014-10-23 23:18:48 -07:00
|
|
|
ret nc ; if player/2 is lower level, we're done here
|
2013-05-08 00:27:46 -07:00
|
|
|
sla b
|
2014-08-13 19:42:58 -07:00
|
|
|
jr c, .max
|
2013-05-08 00:27:46 -07:00
|
|
|
|
|
|
|
srl c
|
|
|
|
cp c
|
2014-10-23 23:18:48 -07:00
|
|
|
ret nc ; if player/4 is lower level, we're done here
|
2013-05-08 00:27:46 -07:00
|
|
|
sla b
|
|
|
|
ret nc
|
|
|
|
|
2014-08-13 19:42:58 -07:00
|
|
|
.max
|
2013-05-08 00:27:46 -07:00
|
|
|
ld b, $ff
|
|
|
|
ret
|
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
; BallDodgedText and BallMissedText were used in Gen 1.
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
BallDodgedText: ; unreferenced
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far _BallDodgedText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
BallMissedText: ; unreferenced
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far _BallMissedText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BallBrokeFreeText:
|
|
|
|
text_far _BallBrokeFreeText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BallAppearedCaughtText:
|
|
|
|
text_far _BallAppearedCaughtText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BallAlmostHadItText:
|
|
|
|
text_far _BallAlmostHadItText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BallSoCloseText:
|
|
|
|
text_far _BallSoCloseText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
Text_GotchaMonWasCaught:
|
2013-12-24 14:11:52 -08:00
|
|
|
; Gotcha! @ was caught!@ @
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far Text_BallCaught
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2013-12-24 14:11:52 -08:00
|
|
|
call WaitSFX
|
|
|
|
push bc
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
call DelayFrame
|
|
|
|
ld de, MUSIC_CAPTURE
|
|
|
|
call PlayMusic
|
|
|
|
pop bc
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, WaitButtonText
|
2013-12-24 14:11:52 -08:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
WaitButtonText:
|
|
|
|
text_far _WaitButtonText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BallSentToPCText:
|
|
|
|
text_far _BallSentToPCText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
NewDexDataText:
|
|
|
|
text_far _NewDexDataText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
AskGiveNicknameText:
|
|
|
|
text_far _AskGiveNicknameText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ReturnToBattle_UseBall:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall _ReturnToBattle_UseBall
|
2013-10-01 21:53:35 -07:00
|
|
|
ret
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TownMapEffect:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PokegearMap
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BicycleEffect:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall BikeFunction
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EvoStoneEffect:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_EVO_STONE
|
|
|
|
call UseItem_SelectMon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, .DecidedNotToUse
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_ITEM
|
2013-05-07 23:02:15 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
|
|
|
|
ld a, [hl]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp EVERSTONE
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .NoEffect
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2020-06-20 08:56:18 -07:00
|
|
|
ld a, TRUE
|
2015-11-28 12:13:40 -08:00
|
|
|
ld [wForceEvolution], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall EvolvePokemon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wMonTriedToEvolve]
|
2013-05-07 23:02:15 -07:00
|
|
|
and a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .NoEffect
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
jp UseDisposableItem
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NoEffect:
|
2013-12-24 22:42:41 -08:00
|
|
|
call WontHaveAnyEffectMessage
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.DecidedNotToUse:
|
2013-05-07 23:02:15 -07:00
|
|
|
xor a
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
VitaminEffect:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, RareCandy_StatBooster_ExitMenu
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call RareCandy_StatBooster_GetParameters
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetStatExpRelativePointer
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_STAT_EXP
|
2013-05-07 23:02:15 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp 100
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nc, NoEffectMessage
|
2013-12-24 14:11:52 -08:00
|
|
|
|
|
|
|
add 10
|
2013-05-07 23:02:15 -07:00
|
|
|
ld [hl], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call UpdateStatsAfterItem
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetStatExpRelativePointer
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
ld hl, StatStrings
|
2013-05-07 23:02:15 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer2
|
2015-10-12 09:33:24 -07:00
|
|
|
ld bc, ITEM_NAME_LENGTH
|
2013-05-07 23:02:15 -07:00
|
|
|
call CopyBytes
|
|
|
|
|
2015-10-10 04:45:39 -07:00
|
|
|
call Play_SFX_FULL_HEAL
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemStatRoseText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-12 09:33:24 -07:00
|
|
|
ld c, HAPPINESS_USEDITEM
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ChangeHappiness
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
jp UseDisposableItem
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NoEffectMessage:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemWontHaveEffectText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
jp ClearPalettes
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UpdateStatsAfterItem:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_MAXHP
|
2013-12-24 14:11:52 -08:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-12-21 11:10:16 -08:00
|
|
|
ld a, MON_STAT_EXP - 1
|
2013-12-24 14:11:52 -08:00
|
|
|
call GetPartyParamLocation
|
2018-02-22 09:12:43 -08:00
|
|
|
ld b, TRUE
|
2018-02-22 08:13:29 -08:00
|
|
|
predef_jump CalcMonStats
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RareCandy_StatBooster_ExitMenu:
|
2013-12-24 14:11:52 -08:00
|
|
|
xor a
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2013-12-24 14:11:52 -08:00
|
|
|
jp ClearPalettes
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemStatRoseText:
|
|
|
|
text_far _ItemStatRoseText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StatStrings:
|
2013-12-24 14:11:52 -08:00
|
|
|
dw .health
|
|
|
|
dw .attack
|
|
|
|
dw .defense
|
|
|
|
dw .speed
|
|
|
|
dw .special
|
|
|
|
|
|
|
|
.health db "HEALTH@"
|
|
|
|
.attack db "ATTACK@"
|
|
|
|
.defense db "DEFENSE@"
|
|
|
|
.speed db "SPEED@"
|
|
|
|
.special db "SPECIAL@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetStatExpRelativePointer:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2020-06-22 13:30:13 -07:00
|
|
|
ld hl, StatExpItemPointerOffsets
|
2013-12-24 14:11:52 -08:00
|
|
|
.next
|
|
|
|
cp [hl]
|
|
|
|
inc hl
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .got_it
|
2013-12-24 14:11:52 -08:00
|
|
|
inc hl
|
|
|
|
jr .next
|
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.got_it
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, [hl]
|
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ret
|
|
|
|
|
2020-06-22 13:30:13 -07:00
|
|
|
StatExpItemPointerOffsets:
|
2015-11-07 10:05:58 -08:00
|
|
|
db HP_UP, MON_HP_EXP - MON_STAT_EXP
|
|
|
|
db PROTEIN, MON_ATK_EXP - MON_STAT_EXP
|
|
|
|
db IRON, MON_DEF_EXP - MON_STAT_EXP
|
|
|
|
db CARBOS, MON_SPD_EXP - MON_STAT_EXP
|
|
|
|
db CALCIUM, MON_SPC_EXP - MON_STAT_EXP
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RareCandy_StatBooster_GetParameters:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
|
|
|
ld [wCurSpecies], a
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wTempSpecies], a
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_LEVEL
|
2013-12-24 14:11:52 -08:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyLevel], a
|
2013-12-24 14:11:52 -08:00
|
|
|
call GetBaseData
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMonNicknames
|
2021-03-17 13:16:02 -07:00
|
|
|
call GetNickname
|
2013-12-24 14:11:52 -08:00
|
|
|
ret
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RareCandyEffect:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, RareCandy_StatBooster_ExitMenu
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call RareCandy_StatBooster_GetParameters
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_LEVEL
|
2013-05-07 23:02:15 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
|
|
|
|
ld a, [hl]
|
2014-06-03 14:07:10 -07:00
|
|
|
cp MAX_LEVEL
|
2015-11-18 15:35:44 -08:00
|
|
|
jp nc, NoEffectMessage
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
inc a
|
|
|
|
ld [hl], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyLevel], a
|
2013-05-07 23:02:15 -07:00
|
|
|
push de
|
|
|
|
ld d, a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall CalcExpAtLevel
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
pop de
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_EXP
|
2013-05-07 23:02:15 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
|
2018-08-26 10:49:38 -07:00
|
|
|
ldh a, [hMultiplicand + 0]
|
2013-05-07 23:02:15 -07:00
|
|
|
ld [hli], a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hMultiplicand + 1]
|
2013-05-07 23:02:15 -07:00
|
|
|
ld [hli], a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hMultiplicand + 2]
|
2013-05-07 23:02:15 -07:00
|
|
|
ld [hl], a
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_MAXHP
|
2013-05-07 23:02:15 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
|
|
|
ld c, [hl]
|
|
|
|
push bc
|
2015-11-18 15:35:44 -08:00
|
|
|
call UpdateStatsAfterItem
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_MAXHP + 1
|
2013-05-07 23:02:15 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
|
|
|
|
pop bc
|
|
|
|
ld a, [hld]
|
|
|
|
sub c
|
|
|
|
ld c, a
|
|
|
|
ld a, [hl]
|
|
|
|
sbc b
|
|
|
|
ld b, a
|
|
|
|
dec hl
|
|
|
|
ld a, [hl]
|
|
|
|
add c
|
|
|
|
ld [hld], a
|
|
|
|
ld a, [hl]
|
|
|
|
adc b
|
|
|
|
ld [hl], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall LevelUpHappinessMod
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-08 07:59:28 -08:00
|
|
|
ld a, PARTYMENUTEXT_LEVEL_UP
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemActionText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2018-02-22 08:13:29 -08:00
|
|
|
predef CopyMonToTempMon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 9, 0
|
2013-12-24 15:35:26 -08:00
|
|
|
ld b, 10
|
|
|
|
ld c, 9
|
2019-04-08 05:15:10 -07:00
|
|
|
call Textbox
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 11, 1
|
2018-01-09 12:39:48 -08:00
|
|
|
ld bc, 4
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PrintTempMonStats
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-10 20:23:28 -08:00
|
|
|
call WaitPressAorB_BlinkCursor
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
|
|
|
ld a, [wCurPartySpecies]
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wTempSpecies], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef LearnLevelMoves
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
xor a
|
2015-11-28 12:13:40 -08:00
|
|
|
ld [wForceEvolution], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall EvolvePokemon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
jp UseDisposableItem
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
HealPowderEffect:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, StatusHealer_ExitMenu
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call UseStatusHealer
|
2020-10-04 16:43:28 -07:00
|
|
|
cp FALSE
|
|
|
|
jr nz, .not_used
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-12 09:33:24 -07:00
|
|
|
ld c, HAPPINESS_BITTERPOWDER
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ChangeHappiness
|
2013-12-24 22:42:41 -08:00
|
|
|
call LooksBitterMessage
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
ld a, $0
|
|
|
|
|
2020-10-04 16:43:28 -07:00
|
|
|
.not_used
|
2015-11-18 15:35:44 -08:00
|
|
|
jp StatusHealer_Jumptable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StatusHealingEffect:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, StatusHealer_ExitMenu
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
FullyHealStatus:
|
2015-11-18 15:35:44 -08:00
|
|
|
call UseStatusHealer
|
|
|
|
jp StatusHealer_Jumptable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UseStatusHealer:
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonFainted
|
2020-10-04 16:43:28 -07:00
|
|
|
ld a, TRUE
|
2013-10-01 16:59:16 -07:00
|
|
|
ret z
|
2015-11-08 07:59:28 -08:00
|
|
|
call GetItemHealingAction
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_STATUS
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hl]
|
|
|
|
and c
|
2015-11-08 07:59:28 -08:00
|
|
|
jr nz, .good
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsItemUsedOnConfusedMon
|
2020-10-04 16:43:28 -07:00
|
|
|
ld a, TRUE
|
2013-10-01 16:59:16 -07:00
|
|
|
ret nc
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUTEXT_HEAL_CONFUSION
|
|
|
|
.good
|
2013-10-01 16:59:16 -07:00
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
ld a, b
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPartyMenuActionText], a
|
2015-11-08 07:59:28 -08:00
|
|
|
call HealStatus
|
2015-10-10 04:45:39 -07:00
|
|
|
call Play_SFX_FULL_HEAL
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemActionTextWaitButton
|
2015-11-06 11:45:10 -08:00
|
|
|
call UseDisposableItem
|
2020-10-04 16:43:28 -07:00
|
|
|
ld a, FALSE
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
IsItemUsedOnConfusedMon:
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsItemUsedOnBattleMon
|
2015-11-08 07:59:28 -08:00
|
|
|
jr nc, .nope
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPlayerSubStatus3]
|
2015-11-08 07:59:28 -08:00
|
|
|
bit SUBSTATUS_CONFUSED, a
|
|
|
|
jr z, .nope
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, c
|
|
|
|
cp $ff
|
2015-11-08 07:59:28 -08:00
|
|
|
jr nz, .nope
|
2013-10-01 16:59:16 -07:00
|
|
|
scf
|
|
|
|
ret
|
2015-11-18 15:35:44 -08:00
|
|
|
|
2015-11-08 07:59:28 -08:00
|
|
|
.nope
|
2013-10-01 16:59:16 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattlemonRestoreHealth:
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsItemUsedOnBattleMon
|
2013-10-01 16:59:16 -07:00
|
|
|
ret nc
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_HP
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hli]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBattleMonHP], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, [hld]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBattleMonHP + 1], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
HealStatus:
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsItemUsedOnBattleMon
|
2013-10-01 16:59:16 -07:00
|
|
|
ret nc
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBattleMonStatus], a
|
|
|
|
ld hl, wPlayerSubStatus5
|
2015-11-08 07:59:28 -08:00
|
|
|
res SUBSTATUS_TOXIC, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerSubStatus1
|
2015-11-08 07:59:28 -08:00
|
|
|
res SUBSTATUS_NIGHTMARE, [hl]
|
|
|
|
call GetItemHealingAction
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, c
|
2015-11-08 07:59:28 -08:00
|
|
|
cp %11111111
|
|
|
|
jr nz, .not_full_heal
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerSubStatus3
|
2015-11-08 07:59:28 -08:00
|
|
|
res SUBSTATUS_CONFUSED, [hl]
|
|
|
|
.not_full_heal
|
2013-10-01 16:59:16 -07:00
|
|
|
push bc
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall CalcPlayerStats
|
2013-10-01 16:59:16 -07:00
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetItemHealingAction:
|
2013-10-01 16:59:16 -07:00
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2018-01-10 22:45:27 -08:00
|
|
|
ld hl, StatusHealingActions
|
2013-12-24 14:11:52 -08:00
|
|
|
ld bc, 3
|
|
|
|
.next
|
2013-10-01 16:59:16 -07:00
|
|
|
cp [hl]
|
2015-11-08 07:59:28 -08:00
|
|
|
jr z, .found_it
|
2013-10-01 16:59:16 -07:00
|
|
|
add hl, bc
|
2013-12-24 14:11:52 -08:00
|
|
|
jr .next
|
|
|
|
|
2015-11-08 07:59:28 -08:00
|
|
|
.found_it
|
2013-10-01 16:59:16 -07:00
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
|
|
|
ld c, a
|
2013-12-24 14:11:52 -08:00
|
|
|
cp %11111111
|
2013-10-01 16:59:16 -07:00
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-01-10 22:45:27 -08:00
|
|
|
INCLUDE "data/items/heal_status.asm"
|
2013-10-01 16:59:16 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StatusHealer_Jumptable:
|
2015-12-26 18:59:03 -08:00
|
|
|
ld hl, .dw
|
2013-12-24 14:11:52 -08:00
|
|
|
rst JumpTable
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.dw
|
2015-11-18 15:35:44 -08:00
|
|
|
dw StatusHealer_ClearPalettes
|
|
|
|
dw StatusHealer_NoEffect
|
|
|
|
dw StatusHealer_ExitMenu
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RevivalHerbEffect:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, StatusHealer_ExitMenu
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call RevivePokemon
|
2020-10-04 16:43:28 -07:00
|
|
|
cp FALSE
|
|
|
|
jr nz, .not_used
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-10-12 09:33:24 -07:00
|
|
|
ld c, HAPPINESS_REVIVALHERB
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ChangeHappiness
|
2013-12-24 22:42:41 -08:00
|
|
|
call LooksBitterMessage
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2020-10-04 16:43:28 -07:00
|
|
|
ld a, $0
|
|
|
|
|
|
|
|
.not_used
|
2015-11-18 15:35:44 -08:00
|
|
|
jp StatusHealer_Jumptable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ReviveEffect:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, StatusHealer_ExitMenu
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call RevivePokemon
|
|
|
|
jp StatusHealer_Jumptable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RevivePokemon:
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonFainted
|
2020-10-04 16:43:28 -07:00
|
|
|
ld a, TRUE
|
2013-12-24 14:11:52 -08:00
|
|
|
ret nz
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-12-24 14:11:52 -08:00
|
|
|
and a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .skip_to_revive
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-12-24 14:11:52 -08:00
|
|
|
ld c, a
|
|
|
|
ld d, 0
|
2016-01-12 09:46:18 -08:00
|
|
|
ld hl, wBattleParticipantsIncludingFainted
|
2013-12-24 14:11:52 -08:00
|
|
|
ld b, CHECK_FLAG
|
2018-01-16 11:30:10 -08:00
|
|
|
predef SmallFarFlagAction
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, c
|
|
|
|
and a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .skip_to_revive
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-12-24 14:11:52 -08:00
|
|
|
ld c, a
|
2015-11-07 18:04:54 -08:00
|
|
|
ld hl, wBattleParticipantsNotFainted
|
2013-12-24 14:11:52 -08:00
|
|
|
ld b, SET_FLAG
|
2018-01-16 11:30:10 -08:00
|
|
|
predef SmallFarFlagAction
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.skip_to_revive
|
2013-12-24 14:11:52 -08:00
|
|
|
xor a
|
2018-01-23 13:45:34 -08:00
|
|
|
ld [wLowHealthAlarm], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp REVIVE
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .revive_half_hp
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call ReviveFullHP
|
|
|
|
jr .finish_revive
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.revive_half_hp
|
|
|
|
call ReviveHalfHP
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.finish_revive
|
|
|
|
call HealHP_SFX_GFX
|
2015-11-08 07:59:28 -08:00
|
|
|
ld a, PARTYMENUTEXT_REVIVE
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPartyMenuActionText], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemActionTextWaitButton
|
2015-11-06 11:45:10 -08:00
|
|
|
call UseDisposableItem
|
2020-10-04 16:43:28 -07:00
|
|
|
ld a, FALSE
|
2013-12-24 14:11:52 -08:00
|
|
|
ret
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
FullRestoreEffect:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, StatusHealer_ExitMenu
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonFainted
|
|
|
|
jp z, StatusHealer_NoEffect
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonAtFullHealth
|
|
|
|
jr c, .NotAtFullHealth
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
jp FullyHealStatus
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NotAtFullHealth:
|
2015-11-18 15:35:44 -08:00
|
|
|
call .FullRestore
|
|
|
|
jp StatusHealer_Jumptable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.FullRestore:
|
2013-12-24 14:11:52 -08:00
|
|
|
xor a
|
2018-01-23 13:45:34 -08:00
|
|
|
ld [wLowHealthAlarm], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call ReviveFullHP
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_STATUS
|
2013-12-24 14:11:52 -08:00
|
|
|
call GetPartyParamLocation
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2015-11-08 07:59:28 -08:00
|
|
|
call HealStatus
|
2015-11-18 15:35:44 -08:00
|
|
|
call BattlemonRestoreHealth
|
|
|
|
call HealHP_SFX_GFX
|
2015-11-08 07:59:28 -08:00
|
|
|
ld a, PARTYMENUTEXT_HEAL_HP
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPartyMenuActionText], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemActionTextWaitButton
|
2015-11-06 11:45:10 -08:00
|
|
|
call UseDisposableItem
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, 0
|
|
|
|
ret
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BitterBerryEffect:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerSubStatus3
|
2013-12-24 14:11:52 -08:00
|
|
|
bit SUBSTATUS_CONFUSED, [hl]
|
|
|
|
ld a, 1
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
res SUBSTATUS_CONFUSED, [hl]
|
2013-05-07 23:02:15 -07:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBattleTurn], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call UseItemText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2013-12-24 14:11:52 -08:00
|
|
|
ld hl, ConfusedNoMoreText
|
2019-04-08 05:15:10 -07:00
|
|
|
call StdBattleTextbox
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, 0
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2013-12-24 14:11:52 -08:00
|
|
|
.done
|
2015-11-18 15:35:44 -08:00
|
|
|
jp StatusHealer_Jumptable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RestoreHPEffect:
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemRestoreHP
|
|
|
|
jp StatusHealer_Jumptable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EnergypowderEffect:
|
2015-10-12 09:33:24 -07:00
|
|
|
ld c, HAPPINESS_BITTERPOWDER
|
2015-11-18 15:35:44 -08:00
|
|
|
jr EnergypowderEnergyRootCommon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EnergyRootEffect:
|
2015-10-12 09:33:24 -07:00
|
|
|
ld c, HAPPINESS_ENERGYROOT
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EnergypowderEnergyRootCommon:
|
2013-05-07 23:02:15 -07:00
|
|
|
push bc
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemRestoreHP
|
2013-05-07 23:02:15 -07:00
|
|
|
pop bc
|
2013-12-24 14:11:52 -08:00
|
|
|
cp 0
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .skip_happiness
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ChangeHappiness
|
2013-12-24 22:42:41 -08:00
|
|
|
call LooksBitterMessage
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, 0
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.skip_happiness
|
|
|
|
jp StatusHealer_Jumptable
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ItemRestoreHP:
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, 2
|
2013-10-01 16:59:16 -07:00
|
|
|
ret c
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonFainted
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, 1
|
2013-10-01 16:59:16 -07:00
|
|
|
ret z
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonAtFullHealth
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, 1
|
2013-10-01 16:59:16 -07:00
|
|
|
ret nc
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-10-01 16:59:16 -07:00
|
|
|
xor a
|
2018-01-23 13:45:34 -08:00
|
|
|
ld [wLowHealthAlarm], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetHealingItemAmount
|
|
|
|
call RestoreHealth
|
|
|
|
call BattlemonRestoreHealth
|
|
|
|
call HealHP_SFX_GFX
|
2015-11-08 07:59:28 -08:00
|
|
|
ld a, PARTYMENUTEXT_HEAL_HP
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPartyMenuActionText], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemActionTextWaitButton
|
2015-11-06 11:45:10 -08:00
|
|
|
call UseDisposableItem
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, 0
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
HealHP_SFX_GFX:
|
2013-10-01 16:59:16 -07:00
|
|
|
push de
|
2013-12-24 14:11:52 -08:00
|
|
|
ld de, SFX_POTION
|
2013-10-01 16:59:16 -07:00
|
|
|
call WaitPlaySFX
|
|
|
|
pop de
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2014-06-04 01:10:56 -07:00
|
|
|
hlcoord 11, 0
|
2014-08-13 19:42:58 -07:00
|
|
|
ld bc, SCREEN_WIDTH * 2
|
2013-10-01 16:59:16 -07:00
|
|
|
call AddNTimes
|
|
|
|
ld a, $2
|
2015-12-26 15:11:55 -08:00
|
|
|
ld [wWhichHPBar], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef_jump AnimateHPBar
|
2013-10-01 16:59:16 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UseItem_SelectMon:
|
2015-11-08 07:59:28 -08:00
|
|
|
call .SelectMon
|
2013-10-01 16:59:16 -07:00
|
|
|
ret c
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp EGG
|
2015-11-08 07:59:28 -08:00
|
|
|
jr nz, .not_egg
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-12-24 22:42:41 -08:00
|
|
|
call CantUseOnEggMessage
|
2013-10-01 16:59:16 -07:00
|
|
|
scf
|
|
|
|
ret
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-11-08 07:59:28 -08:00
|
|
|
.not_egg
|
2013-10-01 16:59:16 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.SelectMon:
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, b
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPartyMenuActionText], a
|
2013-10-01 16:59:16 -07:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearBGPalettes
|
2018-02-22 08:13:29 -08:00
|
|
|
call ChooseMonToUseItemOn
|
2013-10-01 16:59:16 -07:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ChooseMonToUseItemOn:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall LoadPartyMenuGFX
|
|
|
|
farcall InitPartyMenuWithCancel
|
|
|
|
farcall InitPartyMenuGFX
|
|
|
|
farcall WritePartyMenuTilemap
|
|
|
|
farcall PrintPartyMenuText
|
2013-10-01 16:59:16 -07:00
|
|
|
call WaitBGMap
|
2015-09-09 16:27:07 -07:00
|
|
|
call SetPalettes
|
2013-10-01 16:59:16 -07:00
|
|
|
call DelayFrame
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PartyMenuSelect
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ItemActionText:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPartyMenuActionText], a
|
|
|
|
ld a, [wCurPartySpecies]
|
2013-10-01 16:59:16 -07:00
|
|
|
push af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-10-01 16:59:16 -07:00
|
|
|
push af
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall WritePartyMenuTilemap
|
|
|
|
farcall PrintPartyMenuActionText
|
2013-10-01 16:59:16 -07:00
|
|
|
call WaitBGMap
|
2015-09-09 16:27:07 -07:00
|
|
|
call SetPalettes
|
2013-10-01 16:59:16 -07:00
|
|
|
call DelayFrame
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2013-10-01 16:59:16 -07:00
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ItemActionTextWaitButton:
|
2013-10-01 16:59:16 -07:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-07-22 12:57:02 -07:00
|
|
|
hlcoord 0, 0
|
2020-02-13 09:30:13 -08:00
|
|
|
ld bc, wTilemapEnd - wTilemap
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, " "
|
2013-10-01 16:59:16 -07:00
|
|
|
call ByteFill
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyMenuActionText]
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemActionText
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, $1
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-18 15:35:44 -08:00
|
|
|
ld c, 50
|
2013-10-01 16:59:16 -07:00
|
|
|
call DelayFrames
|
2015-11-10 20:23:28 -08:00
|
|
|
jp WaitPressAorB_BlinkCursor
|
2013-10-01 16:59:16 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StatusHealer_NoEffect:
|
2013-12-24 22:42:41 -08:00
|
|
|
call WontHaveAnyEffectMessage
|
2015-11-18 15:35:44 -08:00
|
|
|
jr StatusHealer_ClearPalettes
|
2013-10-01 16:59:16 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StatusHealer_ExitMenu:
|
2013-10-01 16:59:16 -07:00
|
|
|
xor a
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2018-06-24 07:09:41 -07:00
|
|
|
StatusHealer_ClearPalettes:
|
2013-10-01 16:59:16 -07:00
|
|
|
call ClearPalettes
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
IsItemUsedOnBattleMon:
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-10-01 16:59:16 -07:00
|
|
|
and a
|
|
|
|
ret z
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-10-01 16:59:16 -07:00
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wCurBattleMon
|
2013-10-01 16:59:16 -07:00
|
|
|
cp [hl]
|
|
|
|
pop hl
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .nope
|
2013-10-01 16:59:16 -07:00
|
|
|
scf
|
|
|
|
ret
|
2015-11-18 15:35:44 -08:00
|
|
|
|
|
|
|
.nope
|
2013-10-01 16:59:16 -07:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ReviveHalfHP:
|
2015-11-18 15:35:44 -08:00
|
|
|
call LoadHPFromBuffer1
|
2013-10-01 16:59:16 -07:00
|
|
|
srl d
|
|
|
|
rr e
|
2015-11-18 15:35:44 -08:00
|
|
|
jr ContinueRevive
|
2013-10-01 16:59:16 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ReviveFullHP:
|
2015-11-18 15:35:44 -08:00
|
|
|
call LoadHPFromBuffer1
|
2018-06-24 07:09:41 -07:00
|
|
|
ContinueRevive:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_HP
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld [hl], d
|
|
|
|
inc hl
|
|
|
|
ld [hl], e
|
2020-11-03 20:25:22 -08:00
|
|
|
jp LoadCurHPIntoBuffer3
|
2013-10-01 16:59:16 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RestoreHealth:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_HP + 1
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hl]
|
|
|
|
add e
|
|
|
|
ld [hld], a
|
|
|
|
ld a, [hl]
|
|
|
|
adc d
|
|
|
|
ld [hl], a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr c, .full_hp
|
2020-11-03 20:25:22 -08:00
|
|
|
call LoadCurHPIntoBuffer3
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_HP + 1
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_MAXHP + 1
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [de]
|
|
|
|
sub [hl]
|
|
|
|
dec de
|
|
|
|
dec hl
|
|
|
|
ld a, [de]
|
|
|
|
sbc [hl]
|
2015-11-18 15:35:44 -08:00
|
|
|
jr c, .finish
|
|
|
|
.full_hp
|
|
|
|
call ReviveFullHP
|
|
|
|
.finish
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RemoveHP:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_HP + 1
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hl]
|
|
|
|
sub e
|
|
|
|
ld [hld], a
|
|
|
|
ld a, [hl]
|
|
|
|
sbc d
|
|
|
|
ld [hl], a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nc, .okay
|
2013-10-01 16:59:16 -07:00
|
|
|
xor a
|
|
|
|
ld [hld], a
|
|
|
|
ld [hl], a
|
2015-11-18 15:35:44 -08:00
|
|
|
.okay
|
2020-11-03 20:25:22 -08:00
|
|
|
call LoadCurHPIntoBuffer3
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
IsMonFainted:
|
2013-10-01 16:59:16 -07:00
|
|
|
push de
|
2020-11-03 20:25:22 -08:00
|
|
|
call LoadMaxHPIntoBuffer1
|
|
|
|
call LoadCurHPIntoBuffer2
|
|
|
|
call LoadHPFromBuffer2
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, d
|
|
|
|
or e
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
IsMonAtFullHealth:
|
2020-11-03 20:25:22 -08:00
|
|
|
call LoadHPFromBuffer2
|
2013-10-01 16:59:16 -07:00
|
|
|
ld h, d
|
|
|
|
ld l, e
|
2015-11-18 15:35:44 -08:00
|
|
|
call LoadHPFromBuffer1
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, l
|
|
|
|
sub e
|
|
|
|
ld a, h
|
|
|
|
sbc d
|
|
|
|
ret
|
|
|
|
|
2020-11-03 20:25:22 -08:00
|
|
|
LoadCurHPIntoBuffer3:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_HP
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hli]
|
2020-11-03 20:25:22 -08:00
|
|
|
ld [wHPBuffer3 + 1], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, [hl]
|
2020-11-03 20:25:22 -08:00
|
|
|
ld [wHPBuffer3], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2020-11-03 20:25:22 -08:00
|
|
|
LoadHPIntoBuffer3: ; unreferenced
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, d
|
2020-11-03 20:25:22 -08:00
|
|
|
ld [wHPBuffer3 + 1], a
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, e
|
2020-11-03 20:25:22 -08:00
|
|
|
ld [wHPBuffer3], a
|
2013-12-24 14:11:52 -08:00
|
|
|
ret
|
|
|
|
|
2020-11-03 20:25:22 -08:00
|
|
|
LoadHPFromBuffer3: ; unreferenced
|
|
|
|
ld a, [wHPBuffer3 + 1]
|
2013-12-24 14:11:52 -08:00
|
|
|
ld d, a
|
2020-11-03 20:25:22 -08:00
|
|
|
ld a, [wHPBuffer3]
|
2013-12-24 14:11:52 -08:00
|
|
|
ld e, a
|
|
|
|
ret
|
2013-10-01 16:59:16 -07:00
|
|
|
|
2020-11-03 20:25:22 -08:00
|
|
|
LoadCurHPIntoBuffer2:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_HP
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hli]
|
2020-11-03 20:25:22 -08:00
|
|
|
ld [wHPBuffer2 + 1], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, [hl]
|
2020-11-03 20:25:22 -08:00
|
|
|
ld [wHPBuffer2], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2020-11-03 20:25:22 -08:00
|
|
|
LoadHPFromBuffer2:
|
|
|
|
ld a, [wHPBuffer2 + 1]
|
2013-10-01 16:59:16 -07:00
|
|
|
ld d, a
|
2020-11-03 20:25:22 -08:00
|
|
|
ld a, [wHPBuffer2]
|
2013-10-01 16:59:16 -07:00
|
|
|
ld e, a
|
|
|
|
ret
|
|
|
|
|
2020-11-03 20:25:22 -08:00
|
|
|
LoadMaxHPIntoBuffer1:
|
2013-10-01 16:59:16 -07:00
|
|
|
push hl
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_MAXHP
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hli]
|
2020-11-03 20:25:22 -08:00
|
|
|
ld [wHPBuffer1 + 1], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, [hl]
|
2020-11-03 20:25:22 -08:00
|
|
|
ld [wHPBuffer1], a
|
2013-10-01 16:59:16 -07:00
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LoadHPFromBuffer1:
|
2020-11-03 20:25:22 -08:00
|
|
|
ld a, [wHPBuffer1 + 1]
|
2013-10-01 16:59:16 -07:00
|
|
|
ld d, a
|
2020-11-03 20:25:22 -08:00
|
|
|
ld a, [wHPBuffer1]
|
2013-10-01 16:59:16 -07:00
|
|
|
ld e, a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetOneFifthMaxHP:
|
2013-10-01 16:59:16 -07:00
|
|
|
push bc
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_MAXHP
|
2013-10-01 16:59:16 -07:00
|
|
|
call GetPartyParamLocation
|
|
|
|
ld a, [hli]
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDividend + 0], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, [hl]
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDividend + 1], a
|
2014-12-28 18:44:23 -08:00
|
|
|
ld a, 5
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDivisor], a
|
2014-12-28 18:44:23 -08:00
|
|
|
ld b, 2
|
2013-10-01 16:59:16 -07:00
|
|
|
call Divide
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hQuotient + 2]
|
2018-08-26 10:49:38 -07:00
|
|
|
ld d, a
|
|
|
|
ldh a, [hQuotient + 3]
|
2013-10-01 16:59:16 -07:00
|
|
|
ld e, a
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetHealingItemAmount:
|
2013-10-01 16:59:16 -07:00
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2018-01-10 22:45:27 -08:00
|
|
|
ld hl, HealingHPAmounts
|
2013-10-01 16:59:16 -07:00
|
|
|
ld d, a
|
2013-12-24 14:11:52 -08:00
|
|
|
.next
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, [hli]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp -1
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .NotFound
|
2013-10-01 16:59:16 -07:00
|
|
|
cp d
|
2013-12-24 14:11:52 -08:00
|
|
|
jr z, .done
|
2013-10-01 16:59:16 -07:00
|
|
|
inc hl
|
2016-05-04 08:46:23 -07:00
|
|
|
inc hl
|
2013-12-24 14:11:52 -08:00
|
|
|
jr .next
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NotFound:
|
2013-10-01 16:59:16 -07:00
|
|
|
scf
|
2013-12-24 14:11:52 -08:00
|
|
|
.done
|
2013-10-01 16:59:16 -07:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2018-01-10 22:45:27 -08:00
|
|
|
INCLUDE "data/items/heal_hp.asm"
|
2013-10-01 16:59:16 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Softboiled_MilkDrinkFunction:
|
2014-12-28 18:44:23 -08:00
|
|
|
; Softboiled/Milk Drink in the field
|
2015-12-23 11:00:29 -08:00
|
|
|
ld a, [wPartyMenuCursor]
|
2013-10-01 16:59:16 -07:00
|
|
|
dec a
|
|
|
|
ld b, a
|
2015-11-18 15:35:44 -08:00
|
|
|
call .SelectMilkDrinkRecipient ; select pokemon
|
|
|
|
jr c, .skip
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, b
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonFainted
|
|
|
|
call GetOneFifthMaxHP
|
|
|
|
call RemoveHP
|
2013-10-01 16:59:16 -07:00
|
|
|
push bc
|
2015-11-18 15:35:44 -08:00
|
|
|
call HealHP_SFX_GFX
|
2013-10-01 16:59:16 -07:00
|
|
|
pop bc
|
2015-11-18 15:35:44 -08:00
|
|
|
call GetOneFifthMaxHP
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, c
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonFainted
|
|
|
|
call RestoreHealth
|
|
|
|
call HealHP_SFX_GFX
|
2015-11-08 07:59:28 -08:00
|
|
|
ld a, PARTYMENUTEXT_HEAL_HP
|
2015-11-18 15:35:44 -08:00
|
|
|
call ItemActionText
|
2015-10-17 09:58:26 -07:00
|
|
|
call JoyWaitAorB
|
2015-11-18 15:35:44 -08:00
|
|
|
.skip
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, b
|
|
|
|
inc a
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wPartyMenuCursor], a
|
2013-10-01 16:59:16 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.SelectMilkDrinkRecipient:
|
2015-11-08 07:59:28 -08:00
|
|
|
.loop
|
2013-10-01 16:59:16 -07:00
|
|
|
push bc
|
2015-11-08 07:59:28 -08:00
|
|
|
ld a, PARTYMENUACTION_HEALING_ITEM
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPartyMenuActionText], a
|
2018-02-22 08:13:29 -08:00
|
|
|
call ChooseMonToUseItemOn
|
2013-10-01 16:59:16 -07:00
|
|
|
pop bc
|
2015-11-08 07:59:28 -08:00
|
|
|
jr c, .set_carry
|
2015-12-23 11:00:29 -08:00
|
|
|
ld a, [wPartyMenuCursor]
|
2013-10-01 16:59:16 -07:00
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
ld a, b
|
|
|
|
cp c
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .cant_use ; chose the same mon as user
|
2013-10-01 16:59:16 -07:00
|
|
|
ld a, c
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartyMon], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call IsMonFainted
|
|
|
|
jr z, .cant_use
|
|
|
|
call IsMonAtFullHealth
|
|
|
|
jr nc, .cant_use
|
2013-10-01 16:59:16 -07:00
|
|
|
xor a
|
|
|
|
ret
|
2015-11-08 07:59:28 -08:00
|
|
|
|
|
|
|
.set_carry
|
2013-10-01 16:59:16 -07:00
|
|
|
scf
|
|
|
|
ret
|
2015-11-08 07:59:28 -08:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.cant_use
|
2013-10-01 16:59:16 -07:00
|
|
|
push bc
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .ItemCantUseOnMonText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2013-10-01 16:59:16 -07:00
|
|
|
pop bc
|
2015-11-08 07:59:28 -08:00
|
|
|
jr .loop
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.ItemCantUseOnMonText:
|
|
|
|
text_far _ItemCantUseOnMonText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
EscapeRopeEffect:
|
2013-05-07 23:02:15 -07:00
|
|
|
xor a
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall EscapeRopeFunction
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-12-13 11:15:16 -08:00
|
|
|
ld a, [wItemEffectSucceeded]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp 1
|
2015-11-06 11:45:10 -08:00
|
|
|
call z, UseDisposableItem
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SuperRepelEffect:
|
2013-12-24 14:11:52 -08:00
|
|
|
ld b, 200
|
2015-11-18 15:35:44 -08:00
|
|
|
jr UseRepel
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MaxRepelEffect:
|
2013-12-24 14:11:52 -08:00
|
|
|
ld b, 250
|
2015-11-18 15:35:44 -08:00
|
|
|
jr UseRepel
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RepelEffect:
|
2013-12-24 14:11:52 -08:00
|
|
|
ld b, 100
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UseRepel:
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wRepelEffect]
|
2013-05-07 23:02:15 -07:00
|
|
|
and a
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, RepelUsedEarlierIsStillInEffectText
|
2013-12-24 14:11:52 -08:00
|
|
|
jp nz, PrintText
|
2015-09-09 16:27:07 -07:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, b
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wRepelEffect], a
|
2015-11-18 15:35:44 -08:00
|
|
|
jp UseItemText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
RepelUsedEarlierIsStillInEffectText:
|
|
|
|
text_far _RepelUsedEarlierIsStillInEffectText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
XAccuracyEffect:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerSubStatus4
|
2014-08-13 19:42:58 -07:00
|
|
|
bit SUBSTATUS_X_ACCURACY, [hl]
|
2013-12-24 22:42:41 -08:00
|
|
|
jp nz, WontHaveAnyEffect_NotUsedMessage
|
2014-08-13 19:42:58 -07:00
|
|
|
set SUBSTATUS_X_ACCURACY, [hl]
|
2015-11-18 15:35:44 -08:00
|
|
|
jp UseItemText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PokeDollEffect:
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2020-06-17 07:39:17 -07:00
|
|
|
dec a ; WILD_BATTLE?
|
|
|
|
jr nz, .not_wild
|
|
|
|
inc a ; TRUE
|
2015-11-08 16:09:36 -08:00
|
|
|
ld [wForcedSwitch], a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wBattleResult]
|
2018-04-05 08:44:02 -07:00
|
|
|
and BATTLERESULT_BITMASK
|
|
|
|
or DRAW
|
2015-10-24 07:34:19 -07:00
|
|
|
ld [wBattleResult], a
|
2015-11-18 15:35:44 -08:00
|
|
|
jp UseItemText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2020-06-17 07:39:17 -07:00
|
|
|
.not_wild
|
2013-05-07 23:02:15 -07:00
|
|
|
xor a
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GuardSpecEffect:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerSubStatus4
|
2015-11-08 07:59:28 -08:00
|
|
|
bit SUBSTATUS_MIST, [hl]
|
2013-12-24 22:42:41 -08:00
|
|
|
jp nz, WontHaveAnyEffect_NotUsedMessage
|
2015-11-08 07:59:28 -08:00
|
|
|
set SUBSTATUS_MIST, [hl]
|
2015-11-18 15:35:44 -08:00
|
|
|
jp UseItemText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DireHitEffect:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerSubStatus4
|
2015-11-08 07:59:28 -08:00
|
|
|
bit SUBSTATUS_FOCUS_ENERGY, [hl]
|
2013-12-24 22:42:41 -08:00
|
|
|
jp nz, WontHaveAnyEffect_NotUsedMessage
|
2015-11-08 07:59:28 -08:00
|
|
|
set SUBSTATUS_FOCUS_ENERGY, [hl]
|
2015-11-18 15:35:44 -08:00
|
|
|
jp UseItemText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
XItemEffect:
|
2015-11-18 15:35:44 -08:00
|
|
|
call UseItemText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2018-01-10 22:45:27 -08:00
|
|
|
ld hl, XItemStats
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-08 07:59:28 -08:00
|
|
|
.loop
|
2013-05-07 23:02:15 -07:00
|
|
|
cp [hl]
|
2015-11-08 07:59:28 -08:00
|
|
|
jr z, .got_it
|
2013-05-07 23:02:15 -07:00
|
|
|
inc hl
|
2016-05-04 08:46:23 -07:00
|
|
|
inc hl
|
2015-11-08 07:59:28 -08:00
|
|
|
jr .loop
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-08 07:59:28 -08:00
|
|
|
.got_it
|
2013-05-07 23:02:15 -07:00
|
|
|
inc hl
|
|
|
|
ld b, [hl]
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBattleTurn], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wAttackMissed], a
|
|
|
|
ld [wEffectFailed], a
|
2018-08-17 08:48:41 -07:00
|
|
|
farcall RaiseStat
|
2013-05-07 23:02:15 -07:00
|
|
|
call WaitSFX
|
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall BattleCommand_StatUpMessage
|
|
|
|
farcall BattleCommand_StatUpFailText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurBattleMon]
|
|
|
|
ld [wCurPartyMon], a
|
2015-10-12 09:33:24 -07:00
|
|
|
ld c, HAPPINESS_USEDXITEM
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ChangeHappiness
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-01-10 22:45:27 -08:00
|
|
|
INCLUDE "data/items/x_stats.asm"
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PokeFluteEffect:
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-05-07 23:02:15 -07:00
|
|
|
and a
|
2020-10-29 11:45:40 -07:00
|
|
|
jr nz, .in_battle
|
|
|
|
; overworld flute code was dummied out here
|
2014-06-23 12:45:30 -07:00
|
|
|
|
2020-10-29 11:45:40 -07:00
|
|
|
.in_battle
|
2013-05-07 23:02:15 -07:00
|
|
|
xor a
|
2020-10-29 11:45:40 -07:00
|
|
|
ld [wPokeFluteCuredSleep], a
|
2014-06-23 12:45:30 -07:00
|
|
|
|
2022-06-17 19:25:56 -07:00
|
|
|
ld b, ~SLP_MASK
|
2014-06-23 12:45:30 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Status
|
2015-11-18 15:35:44 -08:00
|
|
|
call .CureSleep
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2014-06-23 12:45:30 -07:00
|
|
|
cp WILD_BATTLE
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .skip_otrainer
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOTPartyMon1Status
|
2015-11-18 15:35:44 -08:00
|
|
|
call .CureSleep
|
|
|
|
.skip_otrainer
|
2014-06-23 12:45:30 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleMonStatus
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and b
|
|
|
|
ld [hl], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wEnemyMonStatus
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hl]
|
|
|
|
and b
|
|
|
|
ld [hl], a
|
2014-06-23 12:45:30 -07:00
|
|
|
|
2020-10-29 11:45:40 -07:00
|
|
|
ld a, [wPokeFluteCuredSleep]
|
2013-05-07 23:02:15 -07:00
|
|
|
and a
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .PlayedFluteText
|
2013-12-24 14:11:52 -08:00
|
|
|
jp z, PrintText
|
2015-11-18 15:35:44 -08:00
|
|
|
ld hl, .PlayedTheFlute
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 13:45:34 -08:00
|
|
|
ld a, [wLowHealthAlarm]
|
2017-12-15 21:50:03 -08:00
|
|
|
and 1 << DANGER_ON_F
|
2020-10-29 11:45:40 -07:00
|
|
|
jr nz, .dummy
|
|
|
|
; more code was dummied out here
|
|
|
|
.dummy
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .FluteWakeUpText
|
2013-12-24 14:11:52 -08:00
|
|
|
jp PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CureSleep:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld de, PARTYMON_STRUCT_LENGTH
|
2014-06-23 12:45:30 -07:00
|
|
|
ld c, PARTY_LENGTH
|
|
|
|
.loop
|
2013-05-08 00:27:46 -07:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
2022-06-17 19:25:56 -07:00
|
|
|
and SLP_MASK
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .not_asleep
|
2020-10-29 11:45:40 -07:00
|
|
|
ld a, TRUE
|
|
|
|
ld [wPokeFluteCuredSleep], a
|
2015-11-18 15:35:44 -08:00
|
|
|
.not_asleep
|
2013-05-08 00:27:46 -07:00
|
|
|
pop af
|
|
|
|
and b
|
|
|
|
ld [hl], a
|
|
|
|
add hl, de
|
|
|
|
dec c
|
2014-06-23 12:45:30 -07:00
|
|
|
jr nz, .loop
|
2013-05-08 00:27:46 -07:00
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.PlayedFluteText:
|
|
|
|
text_far _PlayedFluteText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.FluteWakeUpText:
|
|
|
|
text_far _FluteWakeUpText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-08 00:27:46 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.PlayedTheFlute:
|
2013-12-24 14:11:52 -08:00
|
|
|
; played the # FLUTE.@ @
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far Text_PlayedPokeFlute
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-05-08 00:27:46 -07:00
|
|
|
and a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .battle
|
2013-05-08 00:27:46 -07:00
|
|
|
|
|
|
|
push de
|
|
|
|
ld de, SFX_POKEFLUTE
|
|
|
|
call WaitPlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
pop de
|
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.battle
|
2020-06-21 16:01:54 -07:00
|
|
|
jp PokeFluteTerminator
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BlueCardEffect:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .BlueCardBalanceText
|
2019-04-08 05:15:10 -07:00
|
|
|
jp MenuTextboxWaitButton
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.BlueCardBalanceText:
|
|
|
|
text_far _BlueCardBalanceText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CoinCaseEffect:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .CoinCaseCountText
|
2019-04-08 05:15:10 -07:00
|
|
|
jp MenuTextboxWaitButton
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.CoinCaseCountText:
|
|
|
|
text_far _CoinCaseCountText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
OldRodEffect:
|
2013-05-07 23:02:15 -07:00
|
|
|
ld e, $0
|
2016-05-14 13:37:12 -07:00
|
|
|
jr UseRod
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GoodRodEffect:
|
2013-05-07 23:02:15 -07:00
|
|
|
ld e, $1
|
2016-05-14 13:37:12 -07:00
|
|
|
jr UseRod
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SuperRodEffect:
|
2013-05-07 23:02:15 -07:00
|
|
|
ld e, $2
|
2016-05-14 13:37:12 -07:00
|
|
|
jr UseRod
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UseRod:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall FishFunction
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ItemfinderEffect:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ItemFinder
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RestorePPEffect:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurItem]
|
2020-10-29 11:45:40 -07:00
|
|
|
ld [wTempRestorePPItem], a
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.loop
|
2018-02-22 08:13:29 -08:00
|
|
|
; Party Screen opens to choose on which mon to use the Item
|
2015-11-08 07:59:28 -08:00
|
|
|
ld b, PARTYMENUACTION_HEALING_ITEM
|
|
|
|
call UseItem_SelectMon
|
2015-11-18 15:35:44 -08:00
|
|
|
jp c, PPRestoreItem_Cancel
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.loop2
|
2020-10-29 11:45:40 -07:00
|
|
|
ld a, [wTempRestorePPItem]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp MAX_ELIXER
|
2015-10-21 07:43:42 -07:00
|
|
|
jp z, Elixer_RestorePPofAllMoves
|
2013-12-24 14:11:52 -08:00
|
|
|
cp ELIXER
|
2015-10-21 07:43:42 -07:00
|
|
|
jp z, Elixer_RestorePPofAllMoves
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, RaiseThePPOfWhichMoveText
|
2020-10-29 11:45:40 -07:00
|
|
|
ld a, [wTempRestorePPItem]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp PP_UP
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .ppup
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, RestoreThePPOfWhichMoveText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.ppup
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurMoveNum]
|
2013-05-07 23:02:15 -07:00
|
|
|
push af
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurMoveNum], a
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, $2
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wMoveSelectionMenuType], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall MoveSelectionScreen
|
2013-05-07 23:02:15 -07:00
|
|
|
pop bc
|
2015-10-11 09:39:00 -07:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, b
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurMoveNum], a
|
2015-10-21 07:43:42 -07:00
|
|
|
jr nz, .loop
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Moves
|
2015-11-04 08:19:58 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-10-21 07:43:42 -07:00
|
|
|
call GetMthMoveOfNthPartymon
|
2013-05-07 23:02:15 -07:00
|
|
|
|
|
|
|
push hl
|
|
|
|
ld a, [hl]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2013-12-24 14:11:52 -08:00
|
|
|
call GetMoveName
|
2013-05-07 23:02:15 -07:00
|
|
|
call CopyName1
|
|
|
|
pop hl
|
2015-10-11 09:39:00 -07:00
|
|
|
|
2020-10-29 11:45:40 -07:00
|
|
|
ld a, [wTempRestorePPItem]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp PP_UP
|
2015-11-18 15:35:44 -08:00
|
|
|
jp nz, Not_PP_Up
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hl]
|
2015-10-21 07:43:42 -07:00
|
|
|
cp SKETCH
|
|
|
|
jr z, .CantUsePPUpOnSketch
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-01-09 12:39:48 -08:00
|
|
|
ld bc, MON_PP - MON_MOVES
|
2013-05-07 23:02:15 -07:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2018-01-09 14:20:47 -08:00
|
|
|
cp PP_UP_MASK
|
2015-10-21 07:43:42 -07:00
|
|
|
jr c, .do_ppup
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.CantUsePPUpOnSketch:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PPIsMaxedOutText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2015-10-21 07:43:42 -07:00
|
|
|
jr .loop2
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.do_ppup
|
2013-05-07 23:02:15 -07:00
|
|
|
ld a, [hl]
|
2018-01-09 14:20:47 -08:00
|
|
|
add PP_UP_ONE
|
2013-05-07 23:02:15 -07:00
|
|
|
ld [hl], a
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, TRUE
|
|
|
|
ld [wUsePPUp], a
|
2015-11-18 15:35:44 -08:00
|
|
|
call ApplyPPUp
|
2015-10-10 04:45:39 -07:00
|
|
|
call Play_SFX_FULL_HEAL
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PPsIncreasedText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
FinishPPRestore:
|
2013-12-24 14:11:52 -08:00
|
|
|
call ClearPalettes
|
2015-11-06 11:45:10 -08:00
|
|
|
jp UseDisposableItem
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BattleRestorePP:
|
2015-10-19 07:23:58 -07:00
|
|
|
ld a, [wBattleMode]
|
2013-12-24 14:11:52 -08:00
|
|
|
and a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .not_in_battle
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-12-24 14:11:52 -08:00
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurBattleMon]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp b
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .not_in_battle
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPlayerSubStatus5]
|
2015-11-08 07:59:28 -08:00
|
|
|
bit SUBSTATUS_TRANSFORMED, a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .not_in_battle
|
|
|
|
call .UpdateBattleMonPP
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.not_in_battle
|
2015-10-10 04:45:39 -07:00
|
|
|
call Play_SFX_FULL_HEAL
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PPRestoredText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2015-11-18 15:35:44 -08:00
|
|
|
jr FinishPPRestore
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.UpdateBattleMonPP:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartyMon1Moves
|
2015-11-04 08:19:58 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2013-12-24 14:11:52 -08:00
|
|
|
call AddNTimes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wBattleMonMoves
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, NUM_MOVES
|
2015-11-18 15:35:44 -08:00
|
|
|
.loop
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, [de]
|
|
|
|
and a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .done
|
2013-12-24 14:11:52 -08:00
|
|
|
cp [hl]
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .next
|
2013-12-24 14:11:52 -08:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2018-05-06 09:16:57 -07:00
|
|
|
rept NUM_MOVES + 2 ; wBattleMonPP - wBattleMonMoves
|
2013-12-24 14:11:52 -08:00
|
|
|
inc de
|
2018-05-06 09:16:57 -07:00
|
|
|
endr
|
2015-11-07 10:05:58 -08:00
|
|
|
ld bc, MON_PP - MON_MOVES
|
2013-12-24 14:11:52 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.next
|
2013-12-24 14:11:52 -08:00
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
dec b
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .loop
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.done
|
2013-12-24 14:11:52 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Not_PP_Up:
|
2015-10-21 07:43:42 -07:00
|
|
|
call RestorePP
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, BattleRestorePP
|
|
|
|
jp PPRestoreItem_NoEffect
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Elixer_RestorePPofAllMoves:
|
2013-12-24 14:11:52 -08:00
|
|
|
xor a
|
2015-12-15 15:59:49 -08:00
|
|
|
ld hl, wMenuCursorY
|
2013-12-24 14:11:52 -08:00
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, NUM_MOVES
|
2015-10-21 07:43:42 -07:00
|
|
|
.moveLoop
|
2013-12-24 14:11:52 -08:00
|
|
|
push bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Moves
|
2015-11-04 08:19:58 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-10-21 07:43:42 -07:00
|
|
|
call GetMthMoveOfNthPartymon
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .next
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
call RestorePP
|
2015-11-18 15:35:44 -08:00
|
|
|
jr z, .next
|
2015-12-15 15:59:49 -08:00
|
|
|
ld hl, wMenuCursorX
|
2013-12-24 14:11:52 -08:00
|
|
|
inc [hl]
|
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.next
|
2015-12-15 15:59:49 -08:00
|
|
|
ld hl, wMenuCursorY
|
2013-12-24 14:11:52 -08:00
|
|
|
inc [hl]
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-10-21 07:43:42 -07:00
|
|
|
jr nz, .moveLoop
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorX]
|
2013-12-24 14:11:52 -08:00
|
|
|
and a
|
2015-11-18 15:35:44 -08:00
|
|
|
jp nz, BattleRestorePP
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PPRestoreItem_NoEffect:
|
2013-12-24 22:42:41 -08:00
|
|
|
call WontHaveAnyEffectMessage
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PPRestoreItem_Cancel:
|
2013-05-07 23:02:15 -07:00
|
|
|
call ClearPalettes
|
2013-12-24 14:11:52 -08:00
|
|
|
xor a
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2013-12-24 14:11:52 -08:00
|
|
|
ret
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RestorePP:
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2015-11-08 07:59:28 -08:00
|
|
|
call GetMaxPPOfMove
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1PP
|
2015-11-04 08:19:58 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-10-21 07:43:42 -07:00
|
|
|
call GetMthMoveOfNthPartymon
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wTempPP]
|
2013-12-24 14:11:52 -08:00
|
|
|
ld b, a
|
|
|
|
ld a, [hl]
|
2018-01-09 14:20:47 -08:00
|
|
|
and PP_MASK
|
2013-12-24 14:11:52 -08:00
|
|
|
cp b
|
2015-10-21 07:43:42 -07:00
|
|
|
jr nc, .dont_restore
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2020-10-29 11:45:40 -07:00
|
|
|
ld a, [wTempRestorePPItem]
|
2013-12-24 14:11:52 -08:00
|
|
|
cp MAX_ELIXER
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .restore_all
|
2013-12-24 14:11:52 -08:00
|
|
|
cp MAX_ETHER
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .restore_all
|
2013-12-24 14:11:52 -08:00
|
|
|
|
|
|
|
ld c, 5
|
|
|
|
cp MYSTERYBERRY
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .restore_some
|
2014-06-10 23:08:07 -07:00
|
|
|
|
2013-12-24 14:11:52 -08:00
|
|
|
ld c, 10
|
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.restore_some
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, [hl]
|
2018-01-09 14:20:47 -08:00
|
|
|
and PP_MASK
|
2013-12-24 14:11:52 -08:00
|
|
|
add c
|
|
|
|
cp b
|
2015-10-21 07:43:42 -07:00
|
|
|
jr nc, .restore_all
|
2013-12-24 14:11:52 -08:00
|
|
|
ld b, a
|
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.restore_all
|
2013-12-24 14:11:52 -08:00
|
|
|
ld a, [hl]
|
2018-01-09 14:20:47 -08:00
|
|
|
and PP_UP_MASK
|
2013-12-24 14:11:52 -08:00
|
|
|
or b
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.dont_restore
|
2013-12-24 14:11:52 -08:00
|
|
|
xor a
|
|
|
|
ret
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
RaiseThePPOfWhichMoveText:
|
|
|
|
text_far _RaiseThePPOfWhichMoveText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
RestoreThePPOfWhichMoveText:
|
|
|
|
text_far _RestoreThePPOfWhichMoveText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PPIsMaxedOutText:
|
|
|
|
text_far _PPIsMaxedOutText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PPsIncreasedText:
|
|
|
|
text_far _PPsIncreasedText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 14:11:52 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PPRestoredText:
|
|
|
|
text_far _PPRestoredText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SquirtbottleEffect:
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CardKeyEffect:
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BasementKeyEffect:
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SacredAshEffect:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall _SacredAsh
|
2015-12-13 11:15:16 -08:00
|
|
|
ld a, [wItemEffectSucceeded]
|
2013-05-07 23:02:15 -07:00
|
|
|
cp $1
|
|
|
|
ret nz
|
2015-11-06 11:45:10 -08:00
|
|
|
call UseDisposableItem
|
2013-05-07 23:02:15 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NormalBoxEffect:
|
2015-12-29 13:44:37 -08:00
|
|
|
ld c, DECOFLAG_SILVER_TROPHY_DOLL
|
|
|
|
jr OpenBox
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GorgeousBoxEffect:
|
2015-12-29 13:44:37 -08:00
|
|
|
ld c, DECOFLAG_GOLD_TROPHY_DOLL
|
2018-06-24 07:09:41 -07:00
|
|
|
OpenBox:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall SetSpecificDecorationFlag
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, .SentTrophyHomeText
|
2013-12-24 14:11:52 -08:00
|
|
|
call PrintText
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2015-11-06 11:45:10 -08:00
|
|
|
jp UseDisposableItem
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
.SentTrophyHomeText:
|
|
|
|
text_far _SentTrophyHomeText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NoEffect:
|
2013-12-24 22:42:41 -08:00
|
|
|
jp IsntTheTimeMessage
|
2013-05-07 23:02:15 -07:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Play_SFX_FULL_HEAL:
|
2013-12-24 22:42:41 -08:00
|
|
|
push de
|
|
|
|
ld de, SFX_FULL_HEAL
|
|
|
|
call WaitPlaySFX
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UseItemText:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemUsedText
|
2013-12-24 22:42:41 -08:00
|
|
|
call PrintText
|
2015-10-10 04:45:39 -07:00
|
|
|
call Play_SFX_FULL_HEAL
|
2015-11-10 20:23:28 -08:00
|
|
|
call WaitPressAorB_BlinkCursor
|
2018-06-24 07:09:41 -07:00
|
|
|
UseDisposableItem:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumItems
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, 1
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wItemQuantityChange], a
|
2013-12-24 22:42:41 -08:00
|
|
|
jp TossItem
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UseBallInTrainerBattle:
|
2015-11-18 15:35:44 -08:00
|
|
|
call ReturnToBattle_UseBall
|
2013-12-24 22:42:41 -08:00
|
|
|
ld de, ANIM_THROW_POKE_BALL
|
|
|
|
ld a, e
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wFXAnimID], a
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, d
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wFXAnimID + 1], a
|
2013-12-24 22:42:41 -08:00
|
|
|
xor a
|
2016-01-27 09:25:12 -08:00
|
|
|
ld [wBattleAnimParam], a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBattleTurn], a
|
2015-12-23 11:00:29 -08:00
|
|
|
ld [wNumHits], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PlayBattleAnim
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BallBlockedText
|
2013-12-24 22:42:41 -08:00
|
|
|
call PrintText
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BallDontBeAThiefText
|
2013-12-24 22:42:41 -08:00
|
|
|
call PrintText
|
2015-11-06 11:45:10 -08:00
|
|
|
jr UseDisposableItem
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
WontHaveAnyEffect_NotUsedMessage:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemWontHaveEffectText
|
2013-12-24 22:42:41 -08:00
|
|
|
call PrintText
|
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
; Item wasn't used.
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, $2
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2013-12-24 22:42:41 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LooksBitterMessage:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemLooksBitterText
|
2013-12-24 22:42:41 -08:00
|
|
|
jp PrintText
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Ball_BoxIsFullMessage:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BallBoxFullText
|
2013-12-24 22:42:41 -08:00
|
|
|
call PrintText
|
|
|
|
|
2014-06-10 23:08:07 -07:00
|
|
|
; Item wasn't used.
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, $2
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2013-12-24 22:42:41 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CantUseOnEggMessage:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemCantUseOnEggText
|
2013-12-24 22:42:41 -08:00
|
|
|
jr CantUseItemMessage
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
IsntTheTimeMessage:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemOakWarningText
|
2013-12-24 22:42:41 -08:00
|
|
|
jr CantUseItemMessage
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
WontHaveAnyEffectMessage:
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemWontHaveEffectText
|
2013-12-24 22:42:41 -08:00
|
|
|
jr CantUseItemMessage
|
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
BelongsToSomeoneElseMessage: ; unreferenced
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemBelongsToSomeoneElseText
|
2013-12-24 22:42:41 -08:00
|
|
|
jr CantUseItemMessage
|
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
CyclingIsntAllowedMessage: ; unreferenced
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, NoCyclingText
|
2013-12-24 22:42:41 -08:00
|
|
|
jr CantUseItemMessage
|
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
CantGetOnYourBikeMessage: ; unreferenced
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, ItemCantGetOnText
|
2020-10-26 12:45:57 -07:00
|
|
|
; fallthrough
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CantUseItemMessage:
|
2013-12-24 22:42:41 -08:00
|
|
|
; Item couldn't be used.
|
|
|
|
xor a
|
2015-12-13 11:15:16 -08:00
|
|
|
ld [wItemEffectSucceeded], a
|
2013-12-24 22:42:41 -08:00
|
|
|
jp PrintText
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemLooksBitterText:
|
|
|
|
text_far _ItemLooksBitterText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemCantUseOnEggText:
|
|
|
|
text_far _ItemCantUseOnEggText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemOakWarningText:
|
|
|
|
text_far _ItemOakWarningText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemBelongsToSomeoneElseText:
|
|
|
|
text_far _ItemBelongsToSomeoneElseText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemWontHaveEffectText:
|
|
|
|
text_far _ItemWontHaveEffectText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BallBlockedText:
|
|
|
|
text_far _BallBlockedText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BallDontBeAThiefText:
|
|
|
|
text_far _BallDontBeAThiefText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
NoCyclingText:
|
|
|
|
text_far _NoCyclingText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemCantGetOnText:
|
|
|
|
text_far _ItemCantGetOnText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BallBoxFullText:
|
|
|
|
text_far _BallBoxFullText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
ItemUsedText:
|
|
|
|
text_far _ItemUsedText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
ItemGotOnText: ; unreferenced
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far _ItemGotOnText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2020-10-26 12:45:57 -07:00
|
|
|
ItemGotOffText: ; unreferenced
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far _ItemGotOffText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ApplyPPUp:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_MOVES
|
2013-12-24 22:42:41 -08:00
|
|
|
call GetPartyParamLocation
|
|
|
|
push hl
|
2020-11-03 19:45:12 -08:00
|
|
|
ld de, wPPUpPPBuffer
|
2018-01-16 11:30:10 -08:00
|
|
|
predef FillPP
|
2013-12-24 22:42:41 -08:00
|
|
|
pop hl
|
2015-11-07 10:05:58 -08:00
|
|
|
ld bc, MON_PP - MON_MOVES
|
2013-12-24 22:42:41 -08:00
|
|
|
add hl, bc
|
2020-11-03 19:45:12 -08:00
|
|
|
ld de, wPPUpPPBuffer
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, 0
|
2015-11-18 15:35:44 -08:00
|
|
|
.loop
|
2013-12-24 22:42:41 -08:00
|
|
|
inc b
|
|
|
|
ld a, b
|
2014-06-10 23:08:07 -07:00
|
|
|
cp NUM_MOVES + 1
|
2013-12-24 22:42:41 -08:00
|
|
|
ret z
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wUsePPUp]
|
|
|
|
dec a ; FALSE?
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .use
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2013-12-24 22:42:41 -08:00
|
|
|
inc a
|
|
|
|
cp b
|
2015-11-18 15:35:44 -08:00
|
|
|
jr nz, .skip
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.use
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, [hl]
|
2018-01-09 14:20:47 -08:00
|
|
|
and PP_UP_MASK
|
2015-10-21 07:43:42 -07:00
|
|
|
ld a, [de] ; wasted cycle
|
|
|
|
call nz, ComputeMaxPP
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2015-11-18 15:35:44 -08:00
|
|
|
.skip
|
2013-12-24 22:42:41 -08:00
|
|
|
inc hl
|
|
|
|
inc de
|
2015-11-18 15:35:44 -08:00
|
|
|
jr .loop
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ComputeMaxPP:
|
2013-12-24 22:42:41 -08:00
|
|
|
push bc
|
2015-10-21 07:43:42 -07:00
|
|
|
; Divide the base PP by 5.
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, [de]
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDividend + 3], a
|
2013-12-24 22:42:41 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDividend], a
|
|
|
|
ldh [hDividend + 1], a
|
|
|
|
ldh [hDividend + 2], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, 5
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hDivisor], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, 4
|
2013-12-24 22:42:41 -08:00
|
|
|
call Divide
|
2015-10-21 07:43:42 -07:00
|
|
|
; Get the number of PP, which are bits 6 and 7 of the PP value stored in RAM.
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, [hl]
|
|
|
|
ld b, a
|
|
|
|
swap a
|
|
|
|
and $f
|
|
|
|
srl a
|
|
|
|
srl a
|
|
|
|
ld c, a
|
2015-10-21 07:43:42 -07:00
|
|
|
; If this value is 0, we are done
|
2013-12-24 22:42:41 -08:00
|
|
|
and a
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .NoPPUp
|
|
|
|
|
|
|
|
.loop
|
|
|
|
; Normally, a move with 40 PP would have 64 PP with three PP Ups.
|
|
|
|
; Since this would overflow into bit 6, we prevent that from happening
|
|
|
|
; by decreasing the extra amount of PP each PP Up provides, resulting
|
|
|
|
; in a maximum of 61.
|
2018-08-26 10:49:38 -07:00
|
|
|
ldh a, [hQuotient + 3]
|
2013-12-24 22:42:41 -08:00
|
|
|
cp $8
|
2015-10-21 07:43:42 -07:00
|
|
|
jr c, .okay
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, $7
|
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.okay
|
2013-12-24 22:42:41 -08:00
|
|
|
add b
|
|
|
|
ld b, a
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wTempPP]
|
2013-12-24 22:42:41 -08:00
|
|
|
dec a
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .NoPPUp
|
2013-12-24 22:42:41 -08:00
|
|
|
dec c
|
2015-10-21 07:43:42 -07:00
|
|
|
jr nz, .loop
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NoPPUp:
|
2013-12-24 22:42:41 -08:00
|
|
|
ld [hl], b
|
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RestoreAllPP:
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_PP
|
2013-12-24 22:42:41 -08:00
|
|
|
call GetPartyParamLocation
|
|
|
|
push hl
|
2015-11-04 08:19:58 -08:00
|
|
|
ld a, MON_MOVES
|
2013-12-24 22:42:41 -08:00
|
|
|
call GetPartyParamLocation
|
|
|
|
pop de
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld c, NUM_MOVES
|
2014-06-16 22:52:59 -07:00
|
|
|
.loop
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
2015-11-08 07:59:28 -08:00
|
|
|
call GetMaxPPOfMove
|
2013-12-24 22:42:41 -08:00
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
ld a, [de]
|
2018-01-09 14:20:47 -08:00
|
|
|
and PP_UP_MASK
|
2013-12-24 22:42:41 -08:00
|
|
|
ld b, a
|
2018-07-28 16:27:34 -07:00
|
|
|
ld a, [wTempPP]
|
2013-12-24 22:42:41 -08:00
|
|
|
add b
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-15 15:59:49 -08:00
|
|
|
ld hl, wMenuCursorY
|
2013-12-24 22:42:41 -08:00
|
|
|
inc [hl]
|
|
|
|
pop hl
|
|
|
|
dec c
|
2014-06-16 22:52:59 -07:00
|
|
|
jr nz, .loop
|
2013-12-24 22:42:41 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMaxPPOfMove:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wStringBuffer1 + 0]
|
2013-12-24 22:42:41 -08:00
|
|
|
push af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wStringBuffer1 + 1]
|
2013-12-24 22:42:41 -08:00
|
|
|
push af
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMonType]
|
2013-12-24 22:42:41 -08:00
|
|
|
and a
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1Moves
|
2015-11-04 08:19:58 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .got_partymon ; PARTYMON
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wOTPartyMon1Moves
|
2013-12-24 22:42:41 -08:00
|
|
|
dec a
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .got_partymon ; OTPARTYMON
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wTempMonMoves
|
2013-12-24 22:42:41 -08:00
|
|
|
dec a
|
2015-10-21 07:43:42 -07:00
|
|
|
jr z, .got_nonpartymon ; BOXMON
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wTempMonMoves ; Wasted cycles
|
2013-12-24 22:42:41 -08:00
|
|
|
dec a
|
2016-05-11 14:16:03 -07:00
|
|
|
jr z, .got_nonpartymon ; TEMPMON
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wBattleMonMoves ; WILDMON
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2016-05-11 14:16:03 -07:00
|
|
|
.got_nonpartymon ; BOXMON, TEMPMON, WILDMON
|
2015-10-21 07:43:42 -07:00
|
|
|
call GetMthMoveOfCurrentMon
|
|
|
|
jr .gotdatmove
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.got_partymon ; PARTYMON, OTPARTYMON
|
|
|
|
call GetMthMoveOfNthPartymon
|
2013-12-24 22:42:41 -08:00
|
|
|
|
2015-10-21 07:43:42 -07:00
|
|
|
.gotdatmove
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, [hl]
|
|
|
|
dec a
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2013-12-24 22:42:41 -08:00
|
|
|
push hl
|
2014-06-10 23:08:07 -07:00
|
|
|
ld hl, Moves + MOVE_PP
|
|
|
|
ld bc, MOVE_LENGTH
|
2013-12-24 22:42:41 -08:00
|
|
|
call AddNTimes
|
2014-06-10 23:08:07 -07:00
|
|
|
ld a, BANK(Moves)
|
2013-12-24 22:42:41 -08:00
|
|
|
call GetFarByte
|
|
|
|
ld b, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer1
|
2013-12-24 22:42:41 -08:00
|
|
|
ld [de], a
|
|
|
|
pop hl
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2013-12-24 22:42:41 -08:00
|
|
|
push bc
|
2015-11-07 10:05:58 -08:00
|
|
|
ld bc, MON_PP - MON_MOVES
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMonType]
|
2013-12-24 22:42:41 -08:00
|
|
|
cp WILDMON
|
2015-10-21 07:43:42 -07:00
|
|
|
jr nz, .notwild
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wEnemyMonPP - wEnemyMonMoves
|
2015-10-21 07:43:42 -07:00
|
|
|
.notwild
|
2013-12-24 22:42:41 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2018-01-09 14:20:47 -08:00
|
|
|
and PP_UP_MASK
|
2013-12-24 22:42:41 -08:00
|
|
|
pop bc
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2013-12-24 22:42:41 -08:00
|
|
|
or b
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wStringBuffer1 + 1
|
2013-12-24 22:42:41 -08:00
|
|
|
ld [hl], a
|
|
|
|
xor a
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wTempPP], a
|
2015-10-21 07:43:42 -07:00
|
|
|
ld a, b ; this gets lost anyway
|
|
|
|
call ComputeMaxPP
|
2013-12-24 22:42:41 -08:00
|
|
|
ld a, [hl]
|
2018-01-09 14:20:47 -08:00
|
|
|
and PP_MASK
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wTempPP], a
|
2014-06-16 22:52:59 -07:00
|
|
|
|
2013-12-24 22:42:41 -08:00
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wStringBuffer1 + 1], a
|
2013-12-24 22:42:41 -08:00
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wStringBuffer1 + 0], a
|
2013-12-24 22:42:41 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMthMoveOfNthPartymon:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-12-24 22:42:41 -08:00
|
|
|
call AddNTimes
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMthMoveOfCurrentMon:
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2013-12-24 22:42:41 -08:00
|
|
|
ld c, a
|
2014-06-10 23:08:07 -07:00
|
|
|
ld b, 0
|
2013-12-24 22:42:41 -08:00
|
|
|
add hl, bc
|
|
|
|
ret
|