Skip to content

Instantly share code, notes, and snippets.

@HS39
Created November 17, 2018 01:08
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/2f28a1b1144464f2444069881bd13622 to your computer and use it in GitHub Desktop.
Save HS39/2f28a1b1144464f2444069881bd13622 to your computer and use it in GitHub Desktop.
import asm65816
import ASMRef
Flash_Alpha: {
REP (0x31)
JSL (NPC_Check) //Checks if target is an NPC
CMP_i (0x0000)
BNE_a (FlashA_Return) //Attack fails if target is an NPC
JSL (Flash_Immunity_Test)
CMP_i (0x0000)
BEQ_a (FlashA_Shield)
JSL (Rand) //Generate a random number, 0-7
AND_i (0x0007) //If rolls 7, inflict feeling strange
BNE_a (FlashA_Crying) //Otherwise, inflicts crying
JSL (Flash_Strange)
BRA_a (FlashA_Shield)
FlashA_Crying:
JSL (Flash_Crying)
FlashA_Shield:
JSL (Weaken_Shield)
FlashA_Return:
RTL
}
Flash_Beta: {
REP (0x31)
JSL (NPC_Check) //Checks if target is an NPC
CMP_i (0x0000)
BNE_a (FlashB_Return) //Attack fails if target is an NPC
JSL (Flash_Immunity_Test)
CMP_i (0x0000)
BEQ_a (FlashB_Shield)
JSL (Rand) //Generate a random number, 0-7
AND_i (0x0007) //If rolls 7
BEQ_a (FlashB_Kill) //Kills target
CMP_i (0x0001) //If rolls 1
BEQ_a (FlashB_Paralysis) //Inflicts paralysis
CMP_i (0x0002) //If rolls 2
BEQ_a (FlashB_Strange) //Inflicts feeling strange
BRA_a (FlashB_Crying) //Otherwise, inflicts crying
FlashB_Kill:
LDA_a (0xA972)
JSL (KO_Target)
BRA_a (FlashB_Shield)
FlashB_Paralysis:
JSL (Flash_Paralysis)
BRA_a (FlashB_Shield)
FlashB_Strange:
JSL (Flash_Strange)
BRA_a (FlashB_Shield)
FlashB_Crying:
JSL (Flash_Crying)
FlashB_Shield:
JSL (Weaken_Shield)
FlashB_Return:
RTL
}
Flash_Gamma: {
REP (0x31)
JSL (NPC_Check) //Checks if target is an NPC
CMP_i (0x0000)
BNE_a (FlashG_Return) //Attack fails if target is an NPC
JSL (Flash_Immunity_Test)
CMP_i (0x0000)
BEQ_a (FlashG_Shield)
JSL (Rand) //Generate a random number, 0-7
AND_i (0x0007) //If rolls 7
BEQ_a (FlashG_Kill) //Kills target
CMP_i (0x0001) //If rolls 1
BEQ_a (FlashG_Kill) //Kills target
CMP_i (0x0002) //If rolls 2
BEQ_a (FlashG_Paralysis) //Inflicts paralysis
CMP_i (0x0003) //If rolls 3
BEQ_a (FlashG_Strange) //Inflicts feeling strange
BRA_a (FlashG_Crying) //Otherwise, inflicts crying
FlashG_Kill:
LDA_a (0xA972)
JSL (KO_Target)
BRA_a (FlashG_Shield)
FlashG_Paralysis:
JSL (Flash_Paralysis)
BRA_a (FlashG_Shield)
FlashG_Strange:
JSL (Flash_Strange)
BRA_a (FlashG_Shield)
FlashG_Crying:
JSL (Flash_Crying)
FlashG_Shield:
JSL (Weaken_Shield)
FlashG_Return:
RTL
}
Flash_Omega: {
REP (0x31)
JSL (NPC_Check) //Checks if target is an NPC
CMP_i (0x0000)
BNE_a (FlashO_Return) //Attack fails if target is an NPC
JSL (Flash_Immunity_Test)
CMP_i (0x0000)
BEQ_a (FlashO_Shield)
JSL (Rand) //Generate a random number, 0-7
AND_i (0x0007) //If rolls 7
BEQ_a (FlashO_Kill) //Kills target
CMP_i (0x0001) //If rolls 1
BEQ_a (FlashO_Kill) //Kills target
CMP_i (0x0002) //If rolls 2
BEQ_a (FlashO_Kill) //Kills target
CMP_i (0x0003) //If rolls 3
BEQ_a (FlashO_Paralysis) //Inflicts paralysis
CMP_i (0x0004) //If rolls 4
BEQ_a (FlashO_Strange) //Inflicts feeling strange
BRA_a (FlashO_Crying) //Otherwise, inflicts crying
FlashO_Kill:
LDA_a (0xA972) //Current target
JSL (KO_Target)
BRA_a (FlashO_Shield)
FlashO_Paralysis:
JSL (Flash_Paralysis)
BRA_a (FlashO_Shield)
FlashO_Strange:
JSL (Flash_Strange)
BRA_a (FlashO_Shield)
FlashO_Crying:
JSL (Flash_Crying)
FlashO_Shield:
JSL (Weaken_Shield)
FlashO_Return:
RTL
}
Flash_Immunity_Test: {
REP (0x31)
PHD
TDC
ADC_i (0xFFEE)
TCD
JSL (PSI_Shield_Nullify) //Checks for PSI Shield
CMP_i (0x0000)
BEQ_a (Flash_Resist_Check)
LDA_i (0x0000)
BRA_a (Flash_Immunity_Return)
Flash_Resist_Check:
LDX_a (0xA972) //Current target
SEP (0x20)
LDA_x (0x0039) //Checks byte 0x39 of combatant table (flash resistance)
JSL (Success_256)
CMP_i (0x0000)
BEQ_a (Flash_Immunity_Fail)
LDA_i (0x0001)
BRA_a (Flash_Immunity_Return)
Flash_Immunity_Fail:
BText (0xEF766E) //Displays the following text if it fails
LDA_i (0x0000) //"It did not work on <target>!"
Flash_Immunity_Return:
PLD
RTL
}
//PSI Flash helper function: Inflict feeling strange
Flash_Strange: {
REP (0X31)
PHD
TDC
ADC_i (0xFFEE)
TCD
LDY_i (0x0001) //Inflict Feeling Strange
LDX_i (0x0003)
LDA_a (0xA972) //Current target
JSL (Inflict_Status)
CMP_i (0x0000)
BEQ_a (Flash_Strange_Fail)
BText (0xEF6C3A)
BRA_a (Flash_Strange_Return)
Flash_Strange_Fail:
BText (0xEF766E)
Flash_Strange_Return:
PLD
RTL
}
//PSI Flash helper function: Inflict paralysis
Flash_Paralysis: {
REP (0X31)
PHD
TDC
ADC_i (0xFFEE)
TCD
LDY_i (0x0003) //Inflict permanent status 3, Paralysis
LDX_i (0x0000)
LDA_a (0xA972) //Current target
JSL (Inflict_Status)
CMP_i (0x0000)
BEQ_a (Flash_Para_Fail)
BText (0xEF6AE0)
BRA_a (Flash_Para_Return)
Flash_Para_Fail:
BText (0xEF766E)
Flash_Para_Return:
PLD
RTL
}
//PSI Flash helper function: Inflict crying
Flash_Crying: {
REP (0X31)
PHD
TDC
ADC_i (0xFFEE)
TCD
LDY_i (0x0002) //Inflict battle status 2, Crying
LDX_i (0x0002)
LDA_a (0xA972) //Current target
JSL (Inflict_Status)
CMP_i (0x0000)
BEQ_a (Flash_Crying_Fail)
BText (0xEF6BBB)
BRA_a (Flash_Crying_Return)
Flash_Crying_Fail:
BText (0xEF766E)
Flash_Crying_Return:
PLD
RTL
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment