diff options
author | Vendily <vendily1001@gmail.com> | 2021-11-21 18:31:25 -0500 |
---|---|---|
committer | Vendily <vendily1001@gmail.com> | 2021-11-21 18:31:25 -0500 |
commit | 2c99b3211dda3f77e6de13d4689c63839645c5f8 (patch) | |
tree | f9448f8bbd2ea69cd7b0e5a7511d06823697a2c9 | |
parent | 166aa0af1793783491e3f4607319abc02bcd77dc (diff) |
Created tutorial for Friendship Endure from SWSH
-rw-r--r-- | SWSH-Friendship-Endure.md | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/SWSH-Friendship-Endure.md b/SWSH-Friendship-Endure.md new file mode 100644 index 0000000..b373d7e --- /dev/null +++ b/SWSH-Friendship-Endure.md @@ -0,0 +1,102 @@ +Pokémon Sword and Shield merged friendship and affection, and as a result, merged the affection effects as well. +This tutorial implements the chance to endure an attack that would otherwise cause the Pokémon to faint. This effect does not occur for enemy trainers or during link battles. + +## Contents +1. [Add the Friendship Endure text](#1-add-the-friendship-endure-text) +2. [Update the ApplyDamage battle command](#2-update-the-applydamage-battle-command) + +## 1. Add the Friendship Endure text +In [data/text/battle.asm](../blob/master/data/text/battle.asm), we add in a new text string for when an attack is endured through friendship. +```diff +EnduredText: + text "<TARGET>" + line "ENDURED the hit!" + prompt + ++EnduredFriendshipText: ++ text "<TARGET>" ++ line "held on for you!" ++ prompt +``` + +## 2. Update the ApplyDamage battle command +Next, in [engine/battle/effect_commands.asm](../blob/master/engine/battle/effect_commands.asm), we need to find `BattleCommand_ApplyDamage` label. +there are several changes to be made in this section +```diff +BattleCommand_ApplyDamage: + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call GetBattleVar + bit SUBSTATUS_ENDURE, a +- jr z, .focus_band ++ jr z, .friendship_endure + + call BattleCommand_FalseSwipe + ld b, 0 + jr nc, .damage + ld b, 1 + jr .damage + ++.friendship_endure ++ ld a, [wLinkMode] ++ cp LINK_COLOSSEUM ++ jr z, .focus_band ++ ++ ld hl, wBattleMonHappiness ++ ldh a, [hBattleTurn] ++ and a ++ jr z, .focus_band ++ ++ ld a, [hl] ++ cp 255 ++ jr z, .endure_64 ++ cp 220-1 ++ jr nc, .endure_48 ++ cp 180-1 ++ jr c, .focus_band ++; 12.5% of 256 ++ ld b, 32 ++ jp .friendship_endure_checks ++.endure_64 ; 25% of 256 ++ ld b, 64 ++ jp .friendship_endure_checks ++.endure_48 ; 18.75% of 256 ++ ld b, 48 ++ jp .friendship_endure_checks ++ ++.friendship_endure_checks ++ call BattleRandom ++ cp b ++ jr c, .focus_band ++ ++ call BattleCommand_FalseSwipe ++ ld b, 0 ++ jr nc, .damage ++ ld b, 3 ++ jr .damage ++ +.focus_band + ... + +.done_damage + pop bc + ld a, b + and a + ret z + +- dec a +- jr nz, .focus_band_text +- ld hl, EnduredText ++ dec a ++ jr z,.endured_text ++ dec a ++ jr z, .focus_band_text ++ ld hl, EnduredFriendshipText ++ jp StdBattleTextbox ++ ++.endured_text ++ ld hl, EnduredText + jp StdBattleTextbox + + .focus_band_text + ... +```
\ No newline at end of file |