summaryrefslogtreecommitdiff
path: root/engine/battle/ai/move.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-02-03 18:21:53 -0500
committerRangi <remy.oukaour+rangi42@gmail.com>2018-02-03 19:42:56 -0500
commit32ed487a476e01759d3d9dbc818d8566ae2c9cb7 (patch)
tree669e90b56d36f17efff5f673235193f5298c0ceb /engine/battle/ai/move.asm
parent6ff2cb20e67db2054486fc5dc48eb9263298d4ad (diff)
parentb35eb72290b964b98844afbe741bb7ede34b9ef3 (diff)
Merge branch 'master' of https://github.com/pret/pokecrystal
# Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
Diffstat (limited to 'engine/battle/ai/move.asm')
-rwxr-xr-xengine/battle/ai/move.asm38
1 files changed, 19 insertions, 19 deletions
diff --git a/engine/battle/ai/move.asm b/engine/battle/ai/move.asm
index cee2037e3..dd4357fe2 100755
--- a/engine/battle/ai/move.asm
+++ b/engine/battle/ai/move.asm
@@ -1,5 +1,5 @@
AIChooseMove: ; 440ce
-; Score each move in EnemyMonMoves starting from Buffer1. Lower is better.
+; Score each move in wEnemyMonMoves starting from wBuffer1. Lower is better.
; Pick the move with the lowest score.
; Wildmons attack at random.
@@ -18,18 +18,18 @@ AIChooseMove: ; 440ce
; The default score is 20. Unusable moves are given a score of 80.
ld a, 20
- ld hl, Buffer1
+ ld hl, wBuffer1
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
; Don't pick disabled moves.
- ld a, [EnemyDisabledMove]
+ ld a, [wEnemyDisabledMove]
and a
jr z, .CheckPP
- ld hl, EnemyMonMoves
+ ld hl, wEnemyMonMoves
ld c, 0
.CheckDisabledMove:
cp [hl]
@@ -38,20 +38,20 @@ AIChooseMove: ; 440ce
inc hl
jr .CheckDisabledMove
.ScoreDisabledMove:
- ld hl, Buffer1
+ ld hl, wBuffer1
ld b, 0
add hl, bc
ld [hl], 80
; Don't pick moves with 0 PP.
.CheckPP:
- ld hl, Buffer1 - 1
- ld de, EnemyMonPP
+ ld hl, wBuffer1 - 1
+ ld de, wEnemyMonPP
ld b, 0
.CheckMovePP:
inc b
ld a, b
- cp EnemyMonMovesEnd - EnemyMonMoves + 1
+ cp wEnemyMonMovesEnd - wEnemyMonMoves + 1
jr z, .ApplyLayers
inc hl
ld a, [de]
@@ -66,13 +66,13 @@ AIChooseMove: ; 440ce
.ApplyLayers:
ld hl, TrainerClassAttributes + TRNATTR_AI_MOVE_WEIGHTS
- ; If we have a battle in BattleTower just load the Attributes of the first TrainerClass (Falkner)
+ ; If we have a battle in BattleTower just load the Attributes of the first trainer class in wTrainerClass (Falkner)
; so we have always the same AI, regardless of the loaded class of trainer
- ld a, [InBattleTowerBattle]
+ ld a, [wInBattleTowerBattle]
bit 0, a
jr nz, .battle_tower_skip
- ld a, [TrainerClass]
+ ld a, [wTrainerClass]
dec a
ld bc, 7 ; Trainer2AI - Trainer1AI
call AddNTimes
@@ -119,9 +119,9 @@ AIChooseMove: ; 440ce
; Decrement the scores of all moves one by one until one reaches 0.
.DecrementScores:
- ld hl, Buffer1
- ld de, EnemyMonMoves
- ld c, EnemyMonMovesEnd - EnemyMonMoves
+ ld hl, wBuffer1
+ ld de, wEnemyMonMoves
+ ld c, wEnemyMonMovesEnd - wEnemyMonMoves
.DecrementNextScore:
; If the enemy has no moves, this will infinite.
@@ -154,8 +154,8 @@ AIChooseMove: ; 440ce
cp NUM_MOVES + 1
jr nz, .move_loop
- ld hl, Buffer1
- ld de, EnemyMonMoves
+ ld hl, wBuffer1
+ ld de, wEnemyMonMoves
ld c, NUM_MOVES
; Give a score of 0 to a blank move
@@ -184,7 +184,7 @@ AIChooseMove: ; 440ce
; Randomly choose one of the moves with a score of 1
.ChooseMove:
- ld hl, Buffer1
+ ld hl, wBuffer1
call Random
maskbits NUM_MOVES
ld c, a
@@ -194,9 +194,9 @@ AIChooseMove: ; 440ce
and a
jr z, .ChooseMove
- ld [CurEnemyMove], a
+ ld [wCurEnemyMove], a
ld a, c
- ld [CurEnemyMoveNum], a
+ ld [wCurEnemyMoveNum], a
ret
; 441af