diff options
Diffstat (limited to 'engine/evos_moves.asm')
-rwxr-xr-x | engine/evos_moves.asm | 224 |
1 files changed, 190 insertions, 34 deletions
diff --git a/engine/evos_moves.asm b/engine/evos_moves.asm index f50f8081..78ead030 100755 --- a/engine/evos_moves.asm +++ b/engine/evos_moves.asm @@ -1,5 +1,6 @@ ; try to evolve the mon in [wWhichPokemon] TryEvolvingMon: +EvolveTradeMon: ld hl, wCanEvolveFlags xor a ld [hl], a @@ -23,7 +24,8 @@ EvolutionAfterBattle: ld hl, wPartyCount push hl -Evolution_PartyMonLoop: ; loop over party mons +Evolution_PartyMonLoop: +; loop over party mons ld hl, wWhichPokemon inc [hl] pop hl @@ -93,9 +95,13 @@ Evolution_PartyMonLoop: ; loop over party mons jp c, Evolution_PartyMonLoop ; if so, go the next mon jr .doEvolution .checkItemEvo + ld a, [wIsInBattle] ; are we in battle? + and a ld a, [hli] + jp nz, .nextEvoEntry1 ; don't evolve if we're in a battle as wcf91 could be holding the last mon sent out + ld b, a ; evolution item - ld a, [wcf91] ; this is supposed to be the last item used, but it is also used to hold species numbers + ld a, [wcf91] ; last item used cp b ; was the evolution item in this entry used? jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry .checkLevel @@ -140,7 +146,7 @@ Evolution_PartyMonLoop: ; loop over party mons ld [wEvoNewSpecies], a ld a, MONSTER_NAME ld [wNameListType], a - ld a, BANK(TrainerNames) ; bank is not used for monster names + ld a, BANK(MonsterNames) ; bank is not used for monster names ld [wPredefBank], a call GetName push hl @@ -307,7 +313,7 @@ StoppedEvolvingText: TX_FAR _StoppedEvolvingText db "@" -IsEvolvingText: +IsEvolvingText: ; 3affe (e:6ffes) TX_FAR _IsEvolvingText db "@" @@ -318,23 +324,9 @@ Evolution_ReloadTilesetTilePatterns: jp ReloadTilesetTilePatterns LearnMoveFromLevelUp: - ld hl, EvosMovesPointerTable ld a, [wd11e] ; species ld [wcf91], a - dec a - ld bc, 0 - ld hl, EvosMovesPointerTable - add a - rl b - ld c, a - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a -.skipEvolutionDataLoop ; loop to skip past the evolution data, which comes before the move data - ld a, [hli] - and a ; have we reached the end of the evolution data? - jr nz, .skipEvolutionDataLoop ; if not, jump back up + call GetMonLearnset .learnSetLoop ; loop over the learn set until we reach a move that is learnt at the current level or the end of the list ld a, [hli] and a ; have we reached the end of the learn set? @@ -370,33 +362,180 @@ LearnMoveFromLevelUp: call GetMoveName call CopyStringToCF4B predef LearnMove + ld a, b + and a + jr z, .done + callab IsThisPartymonStarterPikachu_Party + jr nc, .done + ld a, [wMoveNum] + cp THUNDERBOLT + jr z, .foundThunderOrThunderbolt + cp THUNDER + jr nz, .done +.foundThunderOrThunderbolt + ld a, $5 + ld [wd49c], a + ld a, $85 + ld [wPikachuMood], a .done ld a, [wcf91] ld [wd11e], a ret -; writes the moves a mon has at level [wCurEnemyLVL] to [de] -; move slots are being filled up sequentially and shifted if all slots are full -WriteMonMoves: - call GetPredefRegisters - push hl - push de - push bc +Func_3b079: + ld a, [wcf91] + push af + call Func_3b0a2 + jr c, .asm_3b09c + + call Func_3b10f + jr nc, .asm_3b096 + + call Func_3b0a2 + jr c, .asm_3b09c + + call Func_3b10f + jr nc, .asm_3b096 + + call Func_3b0a2 + jr c, .asm_3b09c +.asm_3b096 + pop af + ld [wcf91], a + and a + ret +.asm_3b09c + pop af + ld [wcf91], a + scf + ret + +Func_3b0a2: +; XXX what is wcf91 entering this function? + ld a, [wd11e] + ld [wMoveNum], a + predef CanLearnTM + ld a, c + and a + jr nz, .asm_3b0ec + ld hl, Pointer_3b0ee + ld a, [wcf91] + ld de, $1 + call IsInArray + jr c, .asm_3b0d2 + ld a, $ff + ld [wMonHGrowthRate], a + ld a, [wd11e] + ld hl, wMonHMoves + ld de, $1 + call IsInArray + jr c, .asm_3b0ec +.asm_3b0d2 + ld a, [wd11e] + ld d, a + call GetMonLearnset +.loop + ld a, [hli] + and a + jr z, .asm_3b0ea + ld b, a + ld a, [wCurEnemyLVL] + cp b + jr c, .asm_3b0ea + ld a, [hli] + cp d + jr z, .asm_3b0ec + jr .loop +.asm_3b0ea + and a + ret +.asm_3b0ec + scf + ret + +Pointer_3b0ee: + db NIDOKING + db IVYSAUR + db EXEGGUTOR + db GENGAR + db NIDOQUEEN + db ARCANINE + db GYARADOS + db BLASTOISE + db GOLEM + db DRAGONITE + db NINETALES + db DRAGONAIR + db KABUTOPS + db OMASTAR + db JIGGLYPUFF + db FLAREON + db JOLTEON + db VAPOREON + db BEEDRILL + db BUTTERFREE + db MACHAMP + db CLOYSTER + db CLEFABLE + db ALAKAZAM + db STARMIE + db VENUSAUR + db TENTACRUEL + db CHARMELEON + db WARTORTLE + db CHARIZARD + db VILEPLUME + db VICTREEBEL + db $ff + +Func_3b10f: + ld c, $0 +.asm_3b111 ld hl, EvosMovesPointerTable - ld b, 0 - ld a, [wcf91] ; cur mon ID - dec a - add a - rl b - ld c, a + ld b, $0 + add hl, bc add hl, bc ld a, [hli] ld h, [hl] ld l, a -.skipEvoEntriesLoop +.asm_3b11b ld a, [hli] and a - jr nz, .skipEvoEntriesLoop + jr z, .asm_3b130 + cp $2 + jr nz, .asm_3b124 + inc hl +.asm_3b124 + inc hl + ld a, [wcf91] + cp [hl] + jr z, .asm_3b138 + inc hl + ld a, [hl] + and a + jr nz, .asm_3b11b +.asm_3b130 + inc c + ld a, c + cp VICTREEBEL + jr c, .asm_3b111 + and a + ret +.asm_3b138 + inc c + ld a, c + ld [wcf91], a + scf + ret + +; writes the moves a mon has at level [wCurEnemyLVL] to [de] +; move slots are being filled up sequentially and shifted if all slots are full +WriteMonMoves: + call GetPredefRegisters + push hl + push de + push bc + call GetMonLearnset jr .firstMove .nextMove pop de @@ -510,4 +649,21 @@ WriteMonMoves_ShiftMoveData: Evolution_FlagAction: predef_jump FlagActionPredef +GetMonLearnset: + ld hl, EvosMovesPointerTable + ld b, 0 + ld a, [wcf91] + dec a + ld c, a + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a +.skipEvolutionDataLoop ; loop to skip past the evolution data, which comes before the move data + ld a, [hli] + and a ; have we reached the end of the evolution data? + jr nz, .skipEvolutionDataLoop ; if not, jump back up + ret + INCLUDE "data/evos_moves.asm" |