diff options
author | YamaArashi <shadow962@live.com> | 2016-06-11 17:30:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-11 17:30:20 -0700 |
commit | 7e12ca56a8d04d33f3945bb5b981c311fcdd44ef (patch) | |
tree | 8a61aee33d6b47e960dc71dbb89c096622bbdc95 /engine/battle/trainer_ai.asm | |
parent | d8dae96f35222ababb9688ce2aed3292515f8ca2 (diff) | |
parent | 7f34e28f242ee4d0caba0bd96b040811dcb86c50 (diff) |
Merge pull request #133 from YamaArashi/master
Remove address comments
Diffstat (limited to 'engine/battle/trainer_ai.asm')
-rw-r--r-- | engine/battle/trainer_ai.asm | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index bab4c253..385cdd1b 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -1,6 +1,6 @@ ; creates a set of moves that may be used and returns its address in hl ; unused slots are filled with 0, all used slots may be chosen with equal probability -AIEnemyTrainerChooseMoves: ; 39719 (e:5719) +AIEnemyTrainerChooseMoves: ld a, $a ld hl, wBuffer ; init temporary move selection array. Only the moves with the lowest numbers are chosen in the end ld [hli], a ; move 1 @@ -103,14 +103,14 @@ AIEnemyTrainerChooseMoves: ; 39719 (e:5719) ld hl, wEnemyMonMoves ; use original move set ret -AIMoveChoiceModificationFunctionPointers: ; 397a3 (e:57a3) +AIMoveChoiceModificationFunctionPointers: dw AIMoveChoiceModification1 dw AIMoveChoiceModification2 dw AIMoveChoiceModification3 dw AIMoveChoiceModification4 ; unused, does nothing ; discourages moves that cause no damage but only a status ailment if player's mon already has one -AIMoveChoiceModification1: ; 397ab (e:57ab) +AIMoveChoiceModification1: ld a, [wBattleMonStatus] and a ret z ; return if no status ailment on player's mon @@ -155,7 +155,7 @@ StatusAilmentMoveEffects: ; 57e2 ; slightly encourage moves with specific effects. ; in particular, stat-modifying moves and other move effects ; that fall in-bewteen -AIMoveChoiceModification2: ; 397e7 (e:57e7) +AIMoveChoiceModification2: ld a, [wAILayer2Encouragement] cp $1 ret nz @@ -188,7 +188,7 @@ AIMoveChoiceModification2: ; 397e7 (e:57e7) ; encourages moves that are effective against the player's mon (even if non-damaging). ; discourage damaging moves that are ineffective or not very effective against the player's mon, ; unless there's no damaging move that deals at least neutral damage -AIMoveChoiceModification3: ; 39817 (e:5817) +AIMoveChoiceModification3: ld hl, wBuffer - 1 ; temp move selection array (-1 byte offset) ld de, wEnemyMonMoves ; enemy moves ld b, NUM_MOVES + 1 @@ -255,10 +255,10 @@ AIMoveChoiceModification3: ; 39817 (e:5817) jr z, .nextMove inc [hl] ; sligthly discourage this move jr .nextMove -AIMoveChoiceModification4: ; 39883 (e:5883) +AIMoveChoiceModification4: ret -ReadMove: ; 39884 (e:5884) +ReadMove: push hl push de push bc @@ -275,7 +275,7 @@ ReadMove: ; 39884 (e:5884) ; move choice modification methods that are applied for each trainer class ; 0 is sentinel value -TrainerClassMoveChoiceModifications: ; 3989b (e:589b) +TrainerClassMoveChoiceModifications: db 0 ; YOUNGSTER db 1,0 ; BUG CATCHER db 1,0 ; LASS @@ -336,7 +336,7 @@ INCLUDE "data/trainer_moves.asm" INCLUDE "data/trainer_parties.asm" -TrainerAI: ; 3a52e (e:652e) +TrainerAI: and a ld a,[wIsInBattle] dec a @@ -368,7 +368,7 @@ TrainerAI: ; 3a52e (e:652e) call Random jp [hl] -TrainerAIPointers: ; 3a55c (e:655c) +TrainerAIPointers: ; one entry per trainer class ; first byte, number of times (per Pokémon) it can occur ; next two bytes, pointer to AI subroutine for trainer class @@ -420,27 +420,27 @@ TrainerAIPointers: ; 3a55c (e:655c) dbw 2,AgathaAI ; agatha dbw 1,LanceAI ; lance -JugglerAI: ; 3a5e9 (e:65e9) +JugglerAI: cp $40 ret nc jp AISwitchIfEnoughMons -BlackbeltAI: ; 3a5ef (e:65ef) +BlackbeltAI: cp $20 ret nc jp AIUseXAttack -GiovanniAI: ; 3a5f5 (e:65f5) +GiovanniAI: cp $40 ret nc jp AIUseGuardSpec -CooltrainerMAI: ; 3a5fb (e:65fb) +CooltrainerMAI: cp $40 ret nc jp AIUseXAttack -CooltrainerFAI: ; 3a601 (e:6601) +CooltrainerFAI: cp $40 ld a,$A call AICheckIfHPBelowFraction @@ -450,24 +450,24 @@ CooltrainerFAI: ; 3a601 (e:6601) ret nc jp AISwitchIfEnoughMons -BrockAI: ; 3a614 (e:6614) +BrockAI: ; if his active monster has a status condition, use a full heal ld a,[wEnemyMonStatus] and a ret z jp AIUseFullHeal -MistyAI: ; 3a61c (e:661c) +MistyAI: cp $40 ret nc jp AIUseXDefend -LtSurgeAI: ; 3a622 (e:6622) +LtSurgeAI: cp $40 ret nc jp AIUseXSpeed -ErikaAI: ; 3a628 (e:6628) +ErikaAI: cp $80 ret nc ld a,$A @@ -475,17 +475,17 @@ ErikaAI: ; 3a628 (e:6628) ret nc jp AIUseSuperPotion -KogaAI: ; 3a634 (e:6634) +KogaAI: cp $40 ret nc jp AIUseXAttack -BlaineAI: ; 3a63a (e:663a) +BlaineAI: cp $40 ret nc jp AIUseSuperPotion -SabrinaAI: ; 3a640 (e:6640) +SabrinaAI: cp $40 ret nc ld a,$A @@ -493,7 +493,7 @@ SabrinaAI: ; 3a640 (e:6640) ret nc jp AIUseHyperPotion -Sony2AI: ; 3a64c (e:664c) +Sony2AI: cp $20 ret nc ld a,5 @@ -501,7 +501,7 @@ Sony2AI: ; 3a64c (e:664c) ret nc jp AIUsePotion -Sony3AI: ; 3a658 (e:6658) +Sony3AI: cp $20 ret nc ld a,5 @@ -509,7 +509,7 @@ Sony3AI: ; 3a658 (e:6658) ret nc jp AIUseFullRestore -LoreleiAI: ; 3a664 (e:6664) +LoreleiAI: cp $80 ret nc ld a,5 @@ -517,12 +517,12 @@ LoreleiAI: ; 3a664 (e:6664) ret nc jp AIUseSuperPotion -BrunoAI: ; 3a670 (e:6670) +BrunoAI: cp $40 ret nc jp AIUseXDefend -AgathaAI: ; 3a676 (e:6676) +AgathaAI: cp $14 jp c,AISwitchIfEnoughMons cp $80 @@ -532,7 +532,7 @@ AgathaAI: ; 3a676 (e:6676) ret nc jp AIUseSuperPotion -LanceAI: ; 3a687 (e:6687) +LanceAI: cp $80 ret nc ld a,5 @@ -540,23 +540,23 @@ LanceAI: ; 3a687 (e:6687) ret nc jp AIUseHyperPotion -GenericAI: ; 3a693 (e:6693) +GenericAI: and a ; clear carry ret ; end of individual trainer AI routines -DecrementAICount: ; 3a695 (e:6695) +DecrementAICount: ld hl,wAICount dec [hl] scf ret -AIPlayRestoringSFX: ; 3a69b (e:669b) +AIPlayRestoringSFX: ld a,SFX_HEAL_AILMENT jp PlaySoundWaitForCurrent -AIUseFullRestore: ; 3a6a0 (e:66a0) +AIUseFullRestore: call AICureStatus ld a,FULL_RESTORE ld [wAIItem],a @@ -580,25 +580,25 @@ AIUseFullRestore: ; 3a6a0 (e:66a0) ld [wEnemyMonHP],a jr AIPrintItemUseAndUpdateHPBar -AIUsePotion: ; 3a6ca (e:66ca) +AIUsePotion: ; enemy trainer heals his monster with a potion ld a,POTION ld b,20 jr AIRecoverHP -AIUseSuperPotion: ; 3a6d0 (e:66d0) +AIUseSuperPotion: ; enemy trainer heals his monster with a super potion ld a,SUPER_POTION ld b,50 jr AIRecoverHP -AIUseHyperPotion: ; 3a6d6 (e:66d6) +AIUseHyperPotion: ; enemy trainer heals his monster with a hyper potion ld a,HYPER_POTION ld b,200 ; fallthrough -AIRecoverHP: ; 3a6da (e:66da) +AIRecoverHP: ; heal b HP and print "trainer used $(a) on pokemon!" ld [wAIItem],a ld hl,wEnemyMonHP + 1 @@ -639,7 +639,7 @@ AIRecoverHP: ; 3a6da (e:66da) ld [wHPBarNewHP+1],a ; fallthrough -AIPrintItemUseAndUpdateHPBar: ; 3a718 (e:6718) +AIPrintItemUseAndUpdateHPBar: call AIPrintItemUse_ coord hl, 2, 2 xor a @@ -647,7 +647,7 @@ AIPrintItemUseAndUpdateHPBar: ; 3a718 (e:6718) predef UpdateHPBar2 jp DecrementAICount -AISwitchIfEnoughMons: ; 3a72a (e:672a) +AISwitchIfEnoughMons: ; enemy trainer switches if there are 3 or more unfainted mons in party ld a,[wEnemyPartyCount] ld c,a @@ -677,7 +677,7 @@ AISwitchIfEnoughMons: ; 3a72a (e:672a) and a ret -SwitchEnemyMon: ; 3a74b (e:674b) +SwitchEnemyMon: ; prepare to withdraw the active monster: copy hp, number, and status to roster @@ -708,17 +708,17 @@ SwitchEnemyMon: ; 3a74b (e:674b) scf ret -AIBattleWithdrawText: ; 3a781 (e:6781) +AIBattleWithdrawText: TX_FAR _AIBattleWithdrawText db "@" -AIUseFullHeal: ; 3a786 (e:6786) +AIUseFullHeal: call AIPlayRestoringSFX call AICureStatus ld a,FULL_HEAL jp AIPrintItemUse -AICureStatus: ; 3a791 (e:6791) +AICureStatus: ; cures the status of enemy's active pokemon ld a,[wEnemyMonPartyPos] ld hl,wEnemyMon1Status @@ -738,7 +738,7 @@ AIUseXAccuracy: ; 0x3a7a8 unused ld a,X_ACCURACY jp AIPrintItemUse -AIUseGuardSpec: ; 3a7b5 (e:67b5) +AIUseGuardSpec: call AIPlayRestoringSFX ld hl,wEnemyBattleStatus2 set 1,[hl] @@ -752,7 +752,7 @@ AIUseDireHit: ; 0x3a7c2 unused ld a,DIRE_HIT jp AIPrintItemUse -AICheckIfHPBelowFraction: ; 3a7cf (e:67cf) +AICheckIfHPBelowFraction: ; return carry if enemy trainer's current HP is below 1 / a of the maximum ld [H_DIVISOR],a ld hl,wEnemyMonMaxHP @@ -778,27 +778,27 @@ AICheckIfHPBelowFraction: ; 3a7cf (e:67cf) sub c ret -AIUseXAttack: ; 3a7f2 (e:67f2) +AIUseXAttack: ld b,$A ld a,X_ATTACK jr AIIncreaseStat -AIUseXDefend: ; 3a7f8 (e:67f8) +AIUseXDefend: ld b,$B ld a,X_DEFEND jr AIIncreaseStat -AIUseXSpeed: ; 3a7fe (e:67fe) +AIUseXSpeed: ld b,$C ld a,X_SPEED jr AIIncreaseStat -AIUseXSpecial: ; 3a804 (e:6804) +AIUseXSpecial: ld b,$D ld a,X_SPECIAL ; fallthrough -AIIncreaseStat: ; 3a808 (e:6808) +AIIncreaseStat: ld [wAIItem],a push bc call AIPrintItemUse_ @@ -820,12 +820,12 @@ AIIncreaseStat: ; 3a808 (e:6808) ld [hl],a jp DecrementAICount -AIPrintItemUse: ; 3a82c (e:682c) +AIPrintItemUse: ld [wAIItem],a call AIPrintItemUse_ jp DecrementAICount -AIPrintItemUse_: ; 3a835 (e:6835) +AIPrintItemUse_: ; print "x used [wAIItem] on z!" ld a,[wAIItem] ld [wd11e],a @@ -833,6 +833,6 @@ AIPrintItemUse_: ; 3a835 (e:6835) ld hl, AIBattleUseItemText jp PrintText -AIBattleUseItemText: ; 3a844 (e:6844) +AIBattleUseItemText: TX_FAR _AIBattleUseItemText db "@" |