pokered/engine/battle/common_text.asm

244 lines
4.1 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
PrintBeginningBattleText:
2015-08-31 02:38:41 +00:00
ld a, [wIsInBattle]
2014-05-22 22:13:20 +00:00
dec a
jr nz, .trainerBattle
2015-08-31 02:38:41 +00:00
ld a, [wCurMap]
cp POKEMON_TOWER_3F
2014-05-22 22:13:20 +00:00
jr c, .notPokemonTower
cp POKEMON_TOWER_7F + 1
2014-05-22 22:13:20 +00:00
jr c, .pokemonTower
.notPokemonTower
ld a, [wEnemyMonSpecies2]
2014-05-22 22:13:20 +00:00
call PlayCry
ld hl, WildMonAppearedText
2015-08-31 02:38:41 +00:00
ld a, [wMoveMissed]
2014-05-22 22:13:20 +00:00
and a
jr z, .notFishing
ld hl, HookedMonAttackedText
.notFishing
jr .wildBattle
.trainerBattle
call .playSFX
ld c, 20
2014-05-22 22:13:20 +00:00
call DelayFrames
ld hl, TrainerWantsToFightText
.wildBattle
push hl
callab DrawAllPokeballs
pop hl
call PrintText
jr .done
.pokemonTower
ld b, SILPH_SCOPE
call IsItemInBag
ld a, [wEnemyMonSpecies2]
ld [wcf91], a
2014-05-22 22:13:20 +00:00
cp MAROWAK
jr z, .isMarowak
ld a, b
and a
jr z, .noSilphScope
2014-08-09 05:39:13 +00:00
callab LoadEnemyMonData
2014-05-22 22:13:20 +00:00
jr .notPokemonTower
.noSilphScope
ld hl, EnemyAppearedText
call PrintText
ld hl, GhostCantBeIDdText
call PrintText
jr .done
.isMarowak
ld a, b
and a
jr z, .noSilphScope
ld hl, EnemyAppearedText
call PrintText
ld hl, UnveiledGhostText
call PrintText
2014-08-09 05:39:13 +00:00
callab LoadEnemyMonData
2015-02-09 02:40:08 +00:00
callab MarowakAnim
2014-05-22 22:13:20 +00:00
ld hl, WildMonAppearedText
call PrintText
.playSFX
xor a
2015-08-09 05:32:44 +00:00
ld [wFrequencyModifier], a
2014-05-22 22:13:20 +00:00
ld a, $80
2015-08-09 05:32:44 +00:00
ld [wTempoModifier], a
2015-07-22 01:58:19 +00:00
ld a, SFX_SILPH_SCOPE
2014-05-22 22:13:20 +00:00
call PlaySound
jp WaitForSoundToFinish
.done
ret
2016-06-12 00:24:04 +00:00
WildMonAppearedText:
text_far _WildMonAppearedText
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
HookedMonAttackedText:
text_far _HookedMonAttackedText
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
EnemyAppearedText:
text_far _EnemyAppearedText
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
TrainerWantsToFightText:
text_far _TrainerWantsToFightText
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
UnveiledGhostText:
text_far _UnveiledGhostText
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
GhostCantBeIDdText:
text_far _GhostCantBeIDdText
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
PrintSendOutMonMessage:
2014-08-09 05:39:13 +00:00
ld hl, wEnemyMonHP
2014-05-22 22:13:20 +00:00
ld a, [hli]
or [hl]
ld hl, GoText
jr z, .printText
xor a
2020-07-03 23:59:41 +00:00
ld [hMultiplicand], a
2014-08-09 05:39:13 +00:00
ld hl, wEnemyMonHP
2014-05-22 22:13:20 +00:00
ld a, [hli]
2015-07-24 03:48:35 +00:00
ld [wLastSwitchInEnemyMonHP], a
2020-07-03 23:59:41 +00:00
ld [hMultiplicand + 1], a
2014-05-22 22:13:20 +00:00
ld a, [hl]
2015-07-24 03:48:35 +00:00
ld [wLastSwitchInEnemyMonHP + 1], a
2020-07-03 23:59:41 +00:00
ld [hMultiplicand + 2], a
2014-08-09 05:39:13 +00:00
ld a, 25
2020-07-03 23:59:41 +00:00
ld [hMultiplier], a
2014-05-22 22:13:20 +00:00
call Multiply
2014-08-09 05:39:13 +00:00
ld hl, wEnemyMonMaxHP
2014-05-22 22:13:20 +00:00
ld a, [hli]
ld b, [hl]
srl a
rr b
srl a
rr b
ld a, b
2015-07-24 03:48:35 +00:00
ld b, 4
2020-07-03 23:59:41 +00:00
ld [hDivisor], a ; enemy mon max HP divided by 4
2014-05-22 22:13:20 +00:00
call Divide
2020-07-03 23:59:41 +00:00
ld a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
2014-08-09 05:39:13 +00:00
ld hl, GoText ; 70% or greater
cp 70
2014-05-22 22:13:20 +00:00
jr nc, .printText
2014-08-09 05:39:13 +00:00
ld hl, DoItText ; 40% - 69%
cp 40
2014-05-22 22:13:20 +00:00
jr nc, .printText
2014-08-09 05:39:13 +00:00
ld hl, GetmText ; 10% - 39%
cp 10
2014-05-22 22:13:20 +00:00
jr nc, .printText
2014-08-09 05:39:13 +00:00
ld hl, EnemysWeakText ; 0% - 9%
2014-05-22 22:13:20 +00:00
.printText
jp PrintText
2016-06-12 00:24:04 +00:00
GoText:
text_far _GoText
text_asm
2014-05-22 22:13:20 +00:00
jr PrintPlayerMon1Text
2016-06-12 00:24:04 +00:00
DoItText:
text_far _DoItText
text_asm
2014-05-22 22:13:20 +00:00
jr PrintPlayerMon1Text
2016-06-12 00:24:04 +00:00
GetmText:
text_far _GetmText
text_asm
2014-05-22 22:13:20 +00:00
jr PrintPlayerMon1Text
2016-06-12 00:24:04 +00:00
EnemysWeakText:
text_far _EnemysWeakText
text_asm
2014-05-22 22:13:20 +00:00
PrintPlayerMon1Text:
ld hl, PlayerMon1Text
ret
2016-06-12 00:24:04 +00:00
PlayerMon1Text:
text_far _PlayerMon1Text
text_end
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
RetreatMon:
2014-05-22 22:13:20 +00:00
ld hl, PlayerMon2Text
jp PrintText
2016-06-12 00:24:04 +00:00
PlayerMon2Text:
text_far _PlayerMon2Text
text_asm
2014-05-22 22:13:20 +00:00
push de
push bc
ld hl, wEnemyMonHP + 1
2015-07-24 03:48:35 +00:00
ld de, wLastSwitchInEnemyMonHP + 1
2014-05-22 22:13:20 +00:00
ld b, [hl]
dec hl
ld a, [de]
sub b
2020-07-03 23:59:41 +00:00
ld [hMultiplicand + 2], a
2014-05-22 22:13:20 +00:00
dec de
ld b, [hl]
ld a, [de]
sbc b
2020-07-03 23:59:41 +00:00
ld [hMultiplicand + 1], a
2015-07-24 03:48:35 +00:00
ld a, 25
2020-07-03 23:59:41 +00:00
ld [hMultiplier], a
2014-05-22 22:13:20 +00:00
call Multiply
ld hl, wEnemyMonMaxHP
2014-05-22 22:13:20 +00:00
ld a, [hli]
ld b, [hl]
srl a
rr b
srl a
rr b
ld a, b
2015-07-24 03:48:35 +00:00
ld b, 4
2020-07-03 23:59:41 +00:00
ld [hDivisor], a
2014-05-22 22:13:20 +00:00
call Divide
pop bc
pop de
2020-07-03 23:59:41 +00:00
ld a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
2015-07-24 03:48:35 +00:00
; Assuming that the enemy mon hasn't gained HP since the last switch in,
; a approximates the percentage that the enemy mon's total HP has decreased
; since the last switch in.
; If the enemy mon has gained HP, then a is garbage due to wrap-around and
; can fall in any of the ranges below.
ld hl, EnoughText ; HP stayed the same
2014-05-22 22:13:20 +00:00
and a
ret z
2015-07-24 03:48:35 +00:00
ld hl, ComeBackText ; HP went down 1% - 29%
cp 30
2014-05-22 22:13:20 +00:00
ret c
2015-07-24 03:48:35 +00:00
ld hl, OKExclamationText ; HP went down 30% - 69%
cp 70
2014-05-22 22:13:20 +00:00
ret c
2015-07-24 03:48:35 +00:00
ld hl, GoodText ; HP went down 70% or more
2014-05-22 22:13:20 +00:00
ret
2016-06-12 00:24:04 +00:00
EnoughText:
text_far _EnoughText
text_asm
2014-05-22 22:13:20 +00:00
jr PrintComeBackText
2016-06-12 00:24:04 +00:00
OKExclamationText:
text_far _OKExclamationText
text_asm
2014-05-22 22:13:20 +00:00
jr PrintComeBackText
2016-06-12 00:24:04 +00:00
GoodText:
text_far _GoodText
text_asm
2014-05-22 22:13:20 +00:00
jr PrintComeBackText
2016-06-12 00:24:04 +00:00
PrintComeBackText:
2014-05-22 22:13:20 +00:00
ld hl, ComeBackText
ret
2016-06-12 00:24:04 +00:00
ComeBackText:
text_far _ComeBackText
text_end