From d0b7d56e5ed6d20acaa779a4a4ab7e5eb7a16f90 Mon Sep 17 00:00:00 2001 From: Llinos Evans <36418502+PlagueVonKarma@users.noreply.github.com> Date: Mon, 5 Jun 2023 13:37:43 +0100 Subject: [PATCH] Zero damage text In RBY, there are extremely minor situations where zero damage can be dealt. These usually involve quad resists and profound level differences. To quote the disassembly: ; this only occurs if a move that would do 2 or 3 damage is 0.25x effective against the target However, Psywave is also capable of this. Thus, a new case has been added for when this occurs, which is triggered through a new WRAM entry. Easiest way to do it without having to restructure how misses are handled. This is overall minor, but it'll probably make at least one person laugh, and that's all I need. --- README.md | 1 + engine/battle/core.asm | 18 ++++++++++++++++++ engine/debug/debug_menu.asm | 22 ++++++++++++++-------- ram/wram.asm | 7 ++++++- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2733fbe1..978aeb39 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ QoL Enhancements - The blinking animation when hit by moves like Tackle now repeats 4 instead of 6 times, speeding up battles by a bit while not sacrificing impact. - The Rock in the Safari Zone now only raises the flee chance by 1.5x, rather than 2x, opening up new strategies. - PP symbol is displayed in the battle menu. PP displayed before, it just looks nicer now. Done by changing a straggler Japanese character. +- When dealing 0 damage, there'll now be a special text box, making it less misleading. - Lorelei, Bruno, and Agatha now play the Gym Leader Battle theme. - Trainer DVs are perfect-15s. - The protagonist is referred to in a gender neutral manner. diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 83fbbe24..0017cd60 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -3949,6 +3949,17 @@ PrintMoveFailureText: and $7f jr z, .gotTextToPrint ld hl, AttackMissedText + + ; New text for when moves deal zero damage. + ; This gives players a nice little dopamine rush. + ld a, [wDidZeroDamage] ; Grab the variable. + cp 1 ; Alright, is it set? + jr nz, .skip ; No? Skip these instructions. + ld hl, ZeroDamageText ; Load the zero damage text in. + ld a, 0 ; Now shut the address off. + ld [wDidZeroDamage], a ; Bink! + +.skip ld a, [wCriticalHitOrOHKO] cp $ff jr nz, .gotTextToPrint @@ -3998,6 +4009,12 @@ AttackMissedText: text_far _AttackMissedText text_end +ZeroDamageText: + text "It didn't leave" + line "a scratch!" + prompt + text_end + KeptGoingAndCrashedText: text_far _KeptGoingAndCrashedText text_end @@ -5403,6 +5420,7 @@ AdjustDamageForMoveType: ; this only occurs if a move that would do 2 or 3 damage is 0.25x effective against the target inc a ld [wMoveMissed], a + ld [wDidZeroDamage], a .skipTypeImmunity pop bc pop hl diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index d63218de..02ca2886 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -91,21 +91,27 @@ TestBattle: dec a ld [hl], a - ; Give the player a - ; level 20 Rhydon. - ld a, EEVEE + ; Player's Pokemon. + ld a, NIDOREIGN ld [wcf91], a - ld a, 10 + ld a, 100 ld [wCurEnemyLVL], a xor a ld [wMonDataLocation], a ld [wCurMap], a call AddPartyMon - - ; Fight against a - ; level 20 Rhydon. - ld a, CROAKOZUNA + + ; This function gives you a way to waste a turn, never know when you'll need it. + ; Alternatively, add a move to test. + ld hl, wPartyMon1Moves + ld a, SPLASH + ld [hli], a + + ; Opponent's Pokemon. + ld a, WEEDLE ld [wCurOpponent], a + ld a, 100 ; Set the level you want here. + ld [wCurEnemyLVL], a predef InitOpponent diff --git a/ram/wram.asm b/ram/wram.asm index 550e1af2..e9d1dd97 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2201,7 +2201,12 @@ wWhichDungeonWarp:: db ; bit 7: set by ItemUseCardKey, which is leftover code from a previous implementation of the Card Key wd728:: db - ds 1 +; This is a new bit for cases where zero damage is dealt. +; Usually, it's defined as a miss, but it's a bit misleading. +; To give players a feel of power, I've added new text for it. +; $00 - False +; $01 - True +wDidZeroDamage:: db ; redundant because it matches wObtainedBadges ; used to determine whether to show name on statue and in two NPC text scripts