summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-08-20 13:42:47 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-08-20 13:42:47 -0400
commit3110d73947366deb44c1b09f31c4cef9ae88946e (patch)
tree587ac304032693a1ad5f926f7e2f06b5475be54c
parentd1b32c69e575f85612d3d88f75839056077c8cb4 (diff)
More Dive
-rw-r--r--Dive.md212
1 files changed, 199 insertions, 13 deletions
diff --git a/Dive.md b/Dive.md
index bea2c28..a150f30 100644
--- a/Dive.md
+++ b/Dive.md
@@ -23,6 +23,8 @@ We still have to implement the move animation, so let's do that next.
## 2. Create the Dive move animation
+Refer to a new tutorial for adding new move animations, including new graphics and objects.
+
- constants/battle_anim_constants.asm
- data/battle_anims/objects.asm
- data/moves/animations.asm
@@ -30,16 +32,200 @@ We still have to implement the move animation, so let's do that next.
## 3. Using Dive hides the Pokémon underwater
-- constants/battle_constants.asm
-- wram.asm
-- engine/battle/core.asm
-- engine/battle/effect_commands.asm
-- engine/battle_anims/bg_effects.asm
-- engine/battle/ai/scoring.asm
+Edit [constants/battle_constants.asm](../blob/master/constants/battle_constants.asm):
+
+```diff
+ ; wPlayerSubStatus4 or wEnemySubStatus4 bit flags
+ enum_start 7, -1
+ enum SUBSTATUS_LEECH_SEED
+ enum SUBSTATUS_RAGE
+ enum SUBSTATUS_RECHARGE
+ enum SUBSTATUS_SUBSTITUTE
+- enum SUBSTATUS_UNKNOWN_1
++ enum SUBSTATUS_UNDERWATER
+ enum SUBSTATUS_FOCUS_ENERGY
+ enum SUBSTATUS_MIST
+ enum SUBSTATUS_X_ACCURACY
+```
+
+Edit [engine/battle/core.asm](../blob/master/engine/battle/core.asm):
+
+```diff
+ ResidualDamage:
+ ; Return z if the user fainted before
+ ; or as a result of residual damage.
+ ; For Sandstorm damage, see HandleWeather.
+
+ ...
+
+ call SwitchTurnCore
+ xor a
+ ld [wNumHits], a
+ ld de, ANIM_SAP
+ ld a, BATTLE_VARS_SUBSTATUS3_OPP
+ call GetBattleVar
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
++ jr nz, .not_flying_or_underground
++ call Call_PlayBattleAnim_OnlyIfVisible
++ jr .called
++.not_flying_or_underground
++ ld a, BATTLE_VARS_SUBSTATUS4_OPP
++ call GetBattleVar
++ and 1 << SUBSTATUS_UNDERWATER
+ call z, Call_PlayBattleAnim_OnlyIfVisible
++.called
+ call SwitchTurnCore
+```
+
+```diff
+ HandleWrap:
+ ...
+
+ ld a, BATTLE_VARS_SUBSTATUS3
+ call GetBattleVar
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
+ jr nz, .skip_anim
++
++ ld a, BATTLE_VARS_SUBSTATUS4
++ call GetBattleVar
++ and 1 << SUBSTATUS_UNDERWATER
++ jr nz, .skip_anim
+
+ call SwitchTurnCore
+ xor a
+ ld [wNumHits], a
+ ld [wFXAnimID + 1], a
+ predef PlayBattleAnim
+ call SwitchTurnCore
+
+ .skip_anim
+ ...
+```
+
+```diff
+ Call_PlayBattleAnim_OnlyIfVisible:
+ ld a, BATTLE_VARS_SUBSTATUS3
+ call GetBattleVar
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
+ ret nz
++
++ ld a, BATTLE_VARS_SUBSTATUS4
++ call GetBattleVar
++ and 1 << SUBSTATUS_UNDERWATER
++ ret nz
+
+ Call_PlayBattleAnim:
+ ld a, e
+ ld [wFXAnimID], a
+ ld a, d
+ ld [wFXAnimID + 1], a
+ call WaitBGMap
+ predef_jump PlayBattleAnim
+```
+
+Edit [engine/battle/effect_commands.asm](../blob/master/engine/battle/effect_commands.asm):
+
+TODO
+
+Edit [engine/battle_anims/bg_effects.asm](../blob/master/engine/battle_anims/bg_effects.asm):
+
+```diff
+ BGEffect_CheckFlyDigStatus:
+ ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
+ add hl, bc
+ ld a, [hBattleTurn]
+ and $1
+ xor [hl]
+ jr nz, .player
+ ld a, [wEnemySubStatus3] ; EnemySubStatus3
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
++ ret nz
++ ld a, [wEnemySubStatus4]
++ and 1 << SUBSTATUS_UNDERWATER
+ ret
+
+ .player
+ ld a, [wPlayerSubStatus3] ; PlayerSubStatus3
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
++ ret nz
++ ld a, [wPlayerSubStatus4]
++ and 1 << SUBSTATUS_UNDERWATER
+ ret
+```
+
+Edit [engine/battle/ai/scoring.asm](../blob/master/engine/battle/ai/scoring.asm):
+
+```diff
+ AI_Smart_Fly:
+-; Fly, Dig
++; Fly, Dig, Dive
+
+ ; Greatly encourage this move if the player is
+-; flying or underground, and slower than the enemy.
++; flying, underground, or underwater, and slower than the enemy.
+
+ ld a, [wPlayerSubStatus3]
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
++ jr nz, .player_hidden
++ ld a, [wPlayerSubStatus4]
++ and 1 << SUBSTATUS_UNDERWATER
+ ret z
+
++.player_hidden
+ call AICompareSpeed
+ ret nc
+
+ dec [hl]
+ dec [hl]
+ dec [hl]
+ ret
+```
+
+```diff
+ AI_Smart_PriorityHit:
+ call AICompareSpeed
+ ret c
+
+-; Dismiss this move if the player is flying or underground.
++; Dismiss this move if the player is flying, underground, or underwater.
+ ld a, [wPlayerSubStatus3]
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
+ jp nz, AIDiscourageMove
++ ld a, [wPlayerSubStatus4]
++ and 1 << SUBSTATUS_UNDERWATER
++ jp nz, AIDiscourageMove
+
+ ; Greatly encourage this move if it will KO the player.
+ ...
+```
+
+```diff
+ AI_Smart_FutureSight:
+ ; Greatly encourage this move if the player is
+-; flying or underground, and slower than the enemy.
++; flying, underground, or underwater, and slower than the enemy.
+
+ call AICompareSpeed
+ ret nc
+
+ ld a, [wPlayerSubStatus3]
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
++ jr nz, .player_hidden
++ ld a, [wPlayerSubStatus4]
++ and 1 << SUBSTATUS_UNDERWATER
+ ret z
+
++.player_hidden
+ dec [hl]
+ dec [hl]
+ ret
+```
## 4. Surf and Whirlpool do double damage to underwater Pokémon
+Refer to [this tutorial](Add-a-new-move-effect).
+
- constants/move_effect_constants.asm
- data/moves/moves.asm (again)
- data/moves/effects_pointers.asm
@@ -164,6 +350,8 @@ Refer to [this tutorial](Add-a-new-tileset).
## 18. Animate underwater seaweed and bubbles
+Refer to a new tutorial for adding new animated tiles.
+
- gfx/tilesets/bubble/1.png
- gfx/tilesets/bubble/2.png
- gfx/tilesets/bubble/3.png
@@ -174,7 +362,9 @@ Refer to [this tutorial](Add-a-new-tileset).
- engine/tilesets/tileset_anims.asm
-## 17. Use special palettes for underwater tiles and sprites
+## 19. Use special palettes for underwater tiles and sprites
+
+Refer to a new tutorial for adding new special palettes, including map (tile) and object (sprite) palettes.
- gfx/tilesets/underwater.pal
- gfx/tilesets/underwater_sprites.pal
@@ -182,14 +372,10 @@ Refer to [this tutorial](Add-a-new-tileset).
- engine/gfx/color.asm
-## 19. Receive HM08 Dive and explain it
-
-- constants/event_flags.asm
-- maps/CeruleanGym.asm
-
-
## 20. Add deep water to an overworld tileset
+Refer to a new tutorial for adding new animated tiles.
+
- gfx/tilesets/johto.png
- gfx/tilesets/johto_palette_map.asm
- data/tilesets/johto_collision.asm