summaryrefslogtreecommitdiff
path: root/battle
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2015-11-23 00:21:21 -0500
committerPikalaxALT <PikalaxALT@gmail.com>2015-11-23 00:21:21 -0500
commit58020fb5f629693e3f90c0a3c6b417f61330802c (patch)
tree531697296dba573ae3fdcd3f138e1bc1786533e8 /battle
parent8740fc6e87f3d0c1099e5755488e61ff3c75ea8c (diff)
trade animation
Diffstat (limited to 'battle')
-rw-r--r--battle/core.asm74
-rwxr-xr-xbattle/used_move_text.asm349
2 files changed, 386 insertions, 37 deletions
diff --git a/battle/core.asm b/battle/core.asm
index 15ee3caa4..f08ca7e10 100644
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -2532,48 +2532,48 @@ WinTrainerBattle: ; 3cfa4
; 3d02b
Function3d02b: ; 3d02b
- ld a, [wc73d]
+ ld a, [wAmuletCoin]
and a
- call nz, Function3d099
- call Function3d0b1
+ call nz, .DoubleReward
+ call .CheckMaxedOutMomMoney
push af
ld a, $0
- jr nc, .asm_3d044
+ jr nc, .okay
ld a, [wMomSavingMoney]
and $7
cp $3
- jr nz, .asm_3d044
+ jr nz, .okay
inc a
-.asm_3d044
+.okay
ld b, a
ld c, $4
-.asm_3d047
+.loop
ld a, b
and a
- jr z, .asm_3d052
- call Function3d081
+ jr z, .loop2
+ call .SendMoneyToMom
dec c
dec b
- jr .asm_3d047
+ jr .loop
-.asm_3d052
+.loop2
ld a, c
and a
- jr z, .asm_3d05c
- call Function3d08d
+ jr z, .done
+ call .AddMoneyToWallet
dec c
- jr .asm_3d052
+ jr .loop2
-.asm_3d05c
- call Function3d099
- call Function3d099
+.done
+ call .DoubleReward
+ call .DoubleReward
pop af
jr nc, .KeepItAll
ld a, [wMomSavingMoney]
and $7
jr z, .KeepItAll
- ld hl, SentToMomTexts
+ ld hl, .SentToMomTexts
dec a
ld c, a
ld b, 0
@@ -2590,26 +2590,26 @@ endr
jp StdBattleTextBox
; 3d081
-Function3d081: ; 3d081
+.SendMoneyToMom: ; 3d081
push bc
- ld hl, wc688
+ ld hl, wBattleReward + 2
ld de, wMomsMoney + 2
- call Function3d0be
+ call AddBattleMoneyToAccount
pop bc
ret
; 3d08d
-Function3d08d: ; 3d08d
+.AddMoneyToWallet: ; 3d08d
push bc
- ld hl, wc688
+ ld hl, wBattleReward + 2
ld de, Money + 2
- call Function3d0be
+ call AddBattleMoneyToAccount
pop bc
ret
; 3d099
-Function3d099: ; 3d099
- ld hl, wc688
+.DoubleReward: ; 3d099
+ ld hl, wBattleReward + 2
sla [hl]
dec hl
rl [hl]
@@ -2624,14 +2624,14 @@ endr
ret
; 3d0ab
-SentToMomTexts: ; 3d0ab
+.SentToMomTexts: ; 3d0ab
dw SentSomeToMomText
dw SentHalfToMomText
dw SentAllToMomText
; 3d0b1
-Function3d0b1: ; 3d0b1
+.CheckMaxedOutMomMoney: ; 3d0b1
ld hl, wMomsMoney + 2
ld a, [hld]
cp 999999 % $100
@@ -2642,7 +2642,7 @@ Function3d0b1: ; 3d0b1
ret
; 3d0be
-Function3d0be: ; 3d0be
+AddBattleMoneyToAccount: ; 3d0be
ld c, $3
and a
push de
@@ -2653,14 +2653,14 @@ Function3d0be: ; 3d0be
callba MobileFn_106008
pop bc
pop hl
-.asm_3d0ce
+.loop
ld a, [de]
adc [hl]
ld [de], a
dec de
dec hl
dec c
- jr nz, .asm_3d0ce
+ jr nz, .loop
pop hl
ld a, [hld]
cp 999999 % $100
@@ -2823,7 +2823,7 @@ PlayerMonFaintHappinessMod: ; 3d1aa
ld a, [CurBattleMon]
ld c, a
ld hl, wBattleParticipantsNotFainted
- ld b, $0
+ ld b, RESET_FLAG
predef FlagPredef
ld hl, EnemySubStatus3
res SUBSTATUS_IN_LOOP, [hl]
@@ -5602,7 +5602,7 @@ CheckAmuletCoin: ; 3e4a8
cp HELD_AMULET_COIN
ret nz
ld a, 1
- ld [wc73d], a
+ ld [wAmuletCoin], a
ret
; 3e4bc
@@ -6716,7 +6716,7 @@ endr
ld a, [TempEnemyMonSpecies]
dec a
ld c, a
- ld b, 1 ; set
+ ld b, SET_FLAG
ld hl, PokedexSeen
predef FlagPredef
@@ -7741,7 +7741,7 @@ endr
ld hl, EvolvableFlags
ld a, [CurPartyMon]
ld c, a
- ld b, $1
+ ld b, SET_FLAG
predef FlagPredef
pop af
ld [CurPartyLevel], a
@@ -8790,7 +8790,7 @@ CheckPayDay: ; 3f71d
inc hl
or [hl]
ret z
- ld a, [wc73d]
+ ld a, [wAmuletCoin]
and a
jr z, .okay
ld hl, wPayDayMoney + 2
@@ -8809,7 +8809,7 @@ endr
.okay
ld hl, wPayDayMoney + 2
ld de, Money + 2
- call Function3d0be
+ call AddBattleMoneyToAccount
ld hl, BattleText_PlayerPickuedUpPayDayMoney
call StdBattleTextBox
ld a, [InBattleTowerBattle]
diff --git a/battle/used_move_text.asm b/battle/used_move_text.asm
new file mode 100755
index 000000000..dac38dbef
--- /dev/null
+++ b/battle/used_move_text.asm
@@ -0,0 +1,349 @@
+DisplayUsedMoveText: ; 105db0
+; battle command 03
+ ld hl, UsedMoveText
+ call BattleTextBox
+ jp WaitBGMap
+; 105db9
+
+
+UsedMoveText: ; 105db9
+; this is a stream of text and asm from 105db9 to 105ef6
+
+ text_jump _ActorNameText
+ start_asm
+
+ ld a, [hBattleTurn]
+ and a
+ jr nz, .start
+
+ ld a, [wPlayerMoveStruct + MOVE_ANIM]
+ call UpdateUsedMoves
+
+.start
+ ld a, BATTLE_VARS_LAST_MOVE
+ call GetBattleVarAddr
+ ld d, h
+ ld e, l
+
+ ld a, BATTLE_VARS_LAST_COUNTER_MOVE
+ call GetBattleVarAddr
+
+ ld a, BATTLE_VARS_MOVE_ANIM
+ call GetBattleVar
+ ld [wd265], a
+
+ push hl
+ callba CheckUserIsCharging
+ pop hl
+ jr nz, .grammar
+
+ ; update last move
+ ld a, [wd265]
+ ld [hl], a
+ ld [de], a
+
+.grammar
+ call GetMoveGrammar
+; wd265 now contains MoveGrammar
+
+
+; everything except 'instead' made redundant in localization
+
+ ; check obedience
+ ld a, [AlreadyDisobeyed]
+ and a
+ ld hl, UsedMove2Text
+ ret nz
+
+ ; check move grammar
+ ld a, [wd265]
+ cp $3
+ ld hl, UsedMove2Text
+ ret c
+ ld hl, UsedMove1Text
+ ret
+; 105e04
+
+UsedMove1Text: ; 105e04
+ text_jump _UsedMove1Text
+ start_asm
+ jr Function105e10
+; 105e0b
+
+UsedMove2Text: ; 105e0b
+ text_jump _UsedMove2Text
+ start_asm
+; 105e10
+
+Function105e10: ; 105e10
+; check obedience
+ ld a, [AlreadyDisobeyed]
+ and a
+ jr z, GetMoveNameText
+; print "instead,"
+ ld hl, UsedInsteadText
+ ret
+; 105e1a
+
+UsedInsteadText: ; 105e1a
+ text_jump _UsedInsteadText
+ start_asm
+; 105e1f
+
+GetMoveNameText: ; 105e1f
+ ld hl, MoveNameText
+ ret
+; 105e23
+
+MoveNameText: ; 105e23
+ text_jump _MoveNameText
+ start_asm
+; 105e28
+
+GetUsedMoveTextEnder: ; 105e28
+; get start address
+ ld hl, .endusedmovetexts
+
+; get move id
+ ld a, [wd265]
+
+; 2-byte pointer
+ add a
+
+; seek
+ push bc
+ ld b, $0
+ ld c, a
+ add hl, bc
+ pop bc
+
+; get pointer to usedmovetext ender
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ret
+; 105e39
+
+.endusedmovetexts ; 105e39
+ dw EndUsedMove1Text
+ dw EndUsedMove2Text
+ dw EndUsedMove3Text
+ dw EndUsedMove4Text
+ dw EndUsedMove5Text
+; 105e43
+
+EndUsedMove1Text: ; 105e43
+ text_jump _EndUsedMove1Text
+ db "@"
+; 105e48
+EndUsedMove2Text: ; 105e48
+ text_jump _EndUsedMove2Text
+ db "@"
+; 105e4d
+EndUsedMove3Text: ; 105e4d
+ text_jump _EndUsedMove3Text
+ db "@"
+; 105e52
+EndUsedMove4Text: ; 105e52
+ text_jump _EndUsedMove4Text
+ db "@"
+; 105e57
+EndUsedMove5Text: ; 105e57
+ text_jump _EndUsedMove5Text
+ db "@"
+; 105e5c
+
+
+GetMoveGrammar: ; 105e5c
+; store move grammar type in wd265
+
+ push bc
+; c = move id
+ ld a, [wd265]
+ ld c, a
+ ld b, $0
+
+; read grammar table
+ ld hl, MoveGrammar
+.loop
+ ld a, [hli]
+; end of table?
+ cp $ff
+ jr z, .end
+; match?
+ cp c
+ jr z, .end
+; advance grammar type at $00
+ and a
+ jr nz, .loop
+; next grammar type
+ inc b
+ jr .loop
+
+.end
+; wd265 now contains move grammar
+ ld a, b
+ ld [wd265], a
+
+; we're done
+ pop bc
+ ret
+; 105e7a
+
+MoveGrammar: ; 105e7a
+; made redundant in localization
+; each move is given an identifier for what usedmovetext to use (0-4):
+
+; 0
+ db SWORDS_DANCE
+ db GROWTH
+ db STRENGTH
+ db HARDEN
+ db MINIMIZE
+ db SMOKESCREEN
+ db WITHDRAW
+ db DEFENSE_CURL
+ db EGG_BOMB
+ db SMOG
+ db BONE_CLUB
+ db FLASH
+ db SPLASH
+ db ACID_ARMOR
+ db BONEMERANG
+ db REST
+ db SHARPEN
+ db SUBSTITUTE
+ db MIND_READER
+ db SNORE
+ db PROTECT
+ db SPIKES
+ db ENDURE
+ db ROLLOUT
+ db SWAGGER
+ db SLEEP_TALK
+ db HIDDEN_POWER
+ db PSYCH_UP
+ db EXTREMESPEED
+ db 0 ; end set
+
+; 1
+ db RECOVER
+ db TELEPORT
+ db BIDE
+ db SELFDESTRUCT
+ db AMNESIA
+ db FLAIL
+ db 0 ; end set
+
+; 2
+ db MEDITATE
+ db AGILITY
+ db MIMIC
+ db DOUBLE_TEAM
+ db BARRAGE
+ db TRANSFORM
+ db STRUGGLE
+ db SCARY_FACE
+ db 0 ; end set
+
+; 3
+ db POUND
+ db SCRATCH
+ db VICEGRIP
+ db WING_ATTACK
+ db FLY
+ db BIND
+ db SLAM
+ db HORN_ATTACK
+ db WRAP
+ db THRASH
+ db TAIL_WHIP
+ db LEER
+ db BITE
+ db GROWL
+ db ROAR
+ db SING
+ db PECK
+ db ABSORB
+ db STRING_SHOT
+ db EARTHQUAKE
+ db FISSURE
+ db DIG
+ db TOXIC
+ db SCREECH
+ db METRONOME
+ db LICK
+ db CLAMP
+ db CONSTRICT
+ db POISON_GAS
+ db BUBBLE
+ db SLASH
+ db SPIDER_WEB
+ db NIGHTMARE
+ db CURSE
+ db FORESIGHT
+ db CHARM
+ db ATTRACT
+ db ROCK_SMASH
+ db 0 ; end set
+
+; all other moves = 4
+ db $ff ; end
+; 105ed0
+
+
+UpdateUsedMoves: ; 105ed0
+; append move a to PlayerUsedMoves unless it has already been used
+
+ push bc
+; start of list
+ ld hl, PlayerUsedMoves
+; get move id
+ ld b, a
+; next count
+ ld c, NUM_MOVES
+
+.loop
+; get move from the list
+ ld a, [hli]
+; not used yet?
+ and a
+ jr z, .add
+; already used?
+ cp b
+ jr z, .quit
+; next byte
+ dec c
+ jr nz, .loop
+
+; if the list is full and the move hasn't already been used
+; shift the list back one byte, deleting the first move used
+; this can occur with struggle or a new learned move
+ ld hl, PlayerUsedMoves + 1
+; 1 = 2
+ ld a, [hld]
+ ld [hli], a
+; 2 = 3
+ inc hl
+ ld a, [hld]
+ ld [hli], a
+; 3 = 4
+ inc hl
+ ld a, [hld]
+ ld [hl], a
+; 4 = new move
+ ld a, b
+ ld [PlayerUsedMoves + 3], a
+ jr .quit
+
+.add
+; go back to the byte we just inced from
+ dec hl
+; add the new move
+ ld [hl], b
+
+.quit
+; list updated
+ pop bc
+ ret
+; 105ef6