Skip to content

Instantly share code, notes, and snippets.

@HS39
Created November 17, 2018 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HS39/e481cae645e801a1e95c1b4c7ae7ed09 to your computer and use it in GitHub Desktop.
Save HS39/e481cae645e801a1e95c1b4c7ae7ed09 to your computer and use it in GitHub Desktop.
import asm65816
import ASMRef
Healing_Alpha: {
REP (0x31)
PHD
TDC
ADC_i (0xFFEE)
TCD
LDA_a (0xA972) //Loads Current target to Accumulator
CLC
ADC_i (0x001D) //Checks byte 0x1D of combatant table (permanent status)
TAX
LDA_x (0x0000)
AND_i (0x00FF)
CMP_i (0x0007)
BEQ_a (Healing_Cold) //Branch if permanent status byte is 7 (cold)
CMP_i (0x0006)
BEQ_a (Healing_Sunstroke) //Branch if permanent status byte is 6 (sunstroke)
BRA_a (Healing_Sleep)
Healing_Cold:
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
REP (0x20)
BText (0xEF6EBC)
BRA_a (HealingA_Return)
Healing_Sunstroke:
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
REP (0x20)
BText (0xEF6F38)
BRA_a (HealingA_Return)
Healing_Sleep:
LDA_a (0xA972) //Loads Current target to Accumulator
CLC
ADC_i (0x001F) //Checks byte 0x1F of combatant table (battle status)
TAX
LDA_x (0x0000)
AND_i (0x00FF)
CMP_i (0x0001)
BNE_a (HealingA_Nothing) //Branch if battle status byte is not 1 (sleep)
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
REP (0x20)
BText (0xEF6F54)
BRA_a (HealingA_Return)
HealingA_Nothing:
BText (0xEF7696)
HealingA_Return:
PLD
RTL
}
Healing_Beta: {
REP (0x31)
PHD
TDC
ADC_i (0xFFEE)
TCD
LDA_a (0xA972) //Loads Current target to Accumulator
CLC
ADC_i (0x001D) //Checks byte 0x1D of combatant table (permanent status)
TAX
LDA_x (0x0000)
AND_i (0x00FF)
CMP_i (0x0005)
BEQ_a (Healing_Poison) //Branch if permanent status byte is 5 (poison)
CMP_i (0x0004)
BEQ_a (Healing_Nauseous) //Branch if permanent status byte is 4 (nauseous)
BRA_a (Healing_Crying)
Healing_Poison:
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
BText (0xEF6E97)
BRA_a (HealingB_Return)
Healing_Nauseous:
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
REP (0x20)
BText (0xEF6E81)
BRA_a (HealingB_Return)
Healing_Crying:
LDA_a (0xA972) //Loads Current target to Accumulator
CLC
ADC_i (0x001F) //Checks byte 0x1F of combatant table (battle status)
TAX
LDA_x (0x0000)
AND_i (0x00FF)
CMP_i (0x0002)
BNE_a (Healing_FeelStrange) //Branch if battle status byte is not 2 (crying)
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
REP (0x20)
BText (0xEF6ED1)
BRA_a (HealingB_Return)
Healing_FeelStrange:
LDA_a (0xA972) //Loads Current target to Accumulator
CLC
ADC_i (0x0020) //Checks byte 0x20 of combatant table (feeling strange)
TAX
LDA_x (0x0000)
AND_i (0x00FF)
CMP_i (0x0001)
BNE_a (Jump_HealingA) //Branch if feeling strange status byte is not 1
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
REP (0x20)
BText (0xEF6F1E)
BRA_a (HealingB_Return)
Jump_HealingA:
JSL (Healing_Alpha) //Checks status effects cure by Healing Alpha
HealingB_Return:
PLD
RTL
}
Healing_Gamma: {
REP (0x31)
PHD
TDC
ADC_i (0xFFEE)
TCD
LDA_a (0xA972) //Loads Current target to Accumulator
CLC
ADC_i (0x001D) //Checks byte 0x1D of combatant table (permanent status)
TAX
LDA_x (0x0000)
AND_i (0x00FF)
CMP_i (0x0003)
BEQ_a (Healing_Paralysis) //Branch if permanent status byte is 3 (paralysis)
CMP_i (0x0002)
BEQ_a (Healing_Diamond) //Branch if permanent status byte is 2 (diamondization)
CMP_i (0x0001)
BEQ_a (Healing_Unconscious) //Branch if permanent status byte is 1 (unconscious)
BRA_a (Jump_HealingB) //Otherwise, branch here
Healing_Paralysis:
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
REP (0x20)
BText (0xEF6E67)
BRA_a (HealingG_Return)
Healing_Diamond:
SEP (0x20)
LDA_8 (0x00)
STA_x (0x0000) //Removes status
REP (0x20)
BText (0xEF6E4A)
BRA_a (HealingG_Return)
Healing_Unconscious:
SEP (0x20)
LDA_8 (0xC0)
JSL (Success_256) //75% chance of success
BEQ_a (Healing_G_Fail)
LDX_a (0xA972) //Loads Current target to X register
LDA_x (0x0015) //Checks bytes 0x15-16 of combatant table (max PP), loads value to Accumulator from X register
LSR //1/2 of max
LSR //1/4 of max
TAX
LDA_a (0xA972) //Loads Current target to Accumulator
JSL (Revive_Target) //Revives target, heals to 1/4 max HP
BRA_a (HealingG_Return)
Healing_G_Fail:
BText (0xEF6F8E)
BRA_a (HealingG_Return)
Jump_HealingB:
JSL (Healing_Beta) //Checks status effects cure by Healing Beta
HealingG_Return:
PLD
RTL
}
Healing_Omega: {
REP (0x31)
LDX_a (0xA972) //Loads Current target to X register
LDA_x (0x001D) //Checks byte 0x1D of combatant table (permanent status)
AND_i (0x00FF)
CMP_i (0x0001)
BNE_a (Jump_HealingG) //Branch if permanent status byte is not 1 (unconscious)
LDX_a (0xA972) //Loads Current target to X register
LDA_x (0x0015) //Checks bytes 0x15-16 of combatant table (max PP), loads value to Accumulator from X register
TAX
LDA_a (0xA972) //Loads Current target to Accumulator
JSL (Revive_Target) //Revives target, heals to full HP
BRA_a (HealingO_Return)
Jump_HealingG:
JSL (Healing_Gamma) //Checks status effects cure by Healing Gamma
HealingO_Return:
RTL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment