Created
November 17, 2018 01:04
-
-
Save HS39/a4edfc73508d09d46776cbd538fd8e5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asm65816 | |
import ASMRef | |
define Thunder_A_Damage = 120 | |
define Thunder_B_Damage = 120 | |
define Thunder_G_Damage = 200 | |
define Thunder_O_Damage = 200 | |
define Thunder_A_Hits = 1 | |
define Thunder_B_Hits = 2 | |
define Thunder_G_Hits = 3 | |
define Thunder_O_Hits = 4 | |
Thunder_General: { | |
REP (0x31) | |
PHD | |
PHA | |
TDC | |
ADC_i (0xFFE4) | |
TCD | |
PLA | |
STX_d (0x1A) | |
STA_d (0x04) | |
LDY_i (0x0000) | |
STY_d (0x18) | |
TYX | |
STX_d (0x16) | |
BRA_a (Thunder_3) | |
Thunder_1: | |
TXA | |
JSL (Is_Char_Targetted) | |
CMP_i (0x0000) | |
BEQ_a (Thunder_2) | |
LDY_d (0x18) | |
INY | |
STY_d (0x18) | |
Thunder_2: | |
LDX_d (0x16) | |
INX | |
STX_d (0x16) | |
Thunder_3: | |
CPX_i (0x0020) | |
BCC_a (Thunder_1) | |
LDY_d (0x18) //Number of available targets | |
TYA | |
ASL | |
ASL | |
ASL | |
ASL | |
ASL | |
ASL //Number of targets * 64 | |
STA_d (0x02) | |
CMP_i (0x0100) //Divide by 256 to get chance to hit | |
BCC_a (Thunder_4) | |
LDA_i (0x00FF) | |
STA_d (0x02) | |
Thunder_4: | |
LDA_a (0xA96C) | |
STA_d (0x06) | |
LDA_a (0xA96E) | |
STA_d (0x08) | |
LDA_d (0x06) | |
STA_d (0x12) | |
LDA_d (0x08) | |
STA_d (0x14) | |
LDY_i (0x0000) | |
STY_d (0x18) | |
JMP_l (Thunder_21) | |
Thunder_5: | |
LDA_d (0x12) | |
STA_d (0x06) | |
LDA_d (0x14) | |
STA_d (0x08) | |
LDA_d (0x06) | |
STA_a (0xA96C) | |
LDA_d (0x08) | |
STA_a (0xA96E) | |
JSL (0xC2416F) | |
LDA_i (0x0000) | |
STA_d (0x06) | |
LDA_i (0x0000) | |
STA_d (0x08) | |
LDA_a (0xA96C) | |
STA_d (0x0A) | |
LDA_a (0xA96E) | |
STA_d (0x0C) | |
CMP_d (0x08) | |
BNE_a (Thunder_6) | |
LDA_d (0x0A) | |
CMP_d (0x06) | |
Thunder_6: | |
BNE_a (Thunder_7) | |
JMP_l (Thunder_Return) | |
Thunder_7: | |
LDA_a (0xA96C) | |
STA_d (0x06) | |
LDA_a (0xA96E) | |
STA_d (0x08) | |
LDA_d (0x06) | |
STA_d (0x0E) | |
LDA_d (0x08) | |
STA_d (0x10) | |
JSL (Random_Targetting) | |
LDA_d (0x06) | |
STA_d (0x0A) | |
LDA_d (0x08) | |
STA_d (0x0C) | |
LDA_d (0x0A) | |
STA_d (0x06) | |
LDA_d (0x0C) | |
STA_d (0x08) | |
LDA_d (0x06) | |
STA_a (0xA96C) | |
LDA_d (0x08) | |
STA_a (0xA96E) | |
LDX_i (0x0000) | |
STX_d (0x16) | |
BRA_a (Thunder_9) | |
Thunder_8: | |
TXA | |
JSL (Is_Char_Targetted) | |
CMP_i (0x0000) | |
BNE_a (Thunder_10) | |
LDX_d (0x16) | |
INX | |
STX_d (0x16) //Increments hit counter by 1? | |
Thunder_9: | |
CPX_i (0x0020) | |
BCC_a (Thunder_8) | |
Thunder_10: | |
LDX_d (0x16) | |
TXA | |
LDY_i (0x4E) | |
JSL (Eight_Bit_Mult_YxA) | |
CLC | |
ADC_i (0x9FAC) | |
STA_a (0xA972) //Current target | |
JSL (Adjust_Target_Name) | |
LDA_d (0x02) | |
SEP (0x20) | |
JSL (Success_256) | |
CMP_i (0x0000) | |
BNE_a (Thunder_Hit) //Thunder hits | |
JMP_l (Thunder_Miss) //Thunder misses | |
Thunder_Hit: | |
LDA_d (0x04) | |
CMP_i (0x0078) //Checks if base damage is 120 | |
BNE_a (Thunder_Animation_2) //If not, branch to Thunder_Animation_2 | |
Thunder_Animation_1: | |
BText (0xEF8814) //Thunder alpha/beta animation | |
BRA_a (Thunder_14) | |
Thunder_Animation_2: | |
BText (0xEF8823) //Thunder gamma/omega animation | |
BRA_a (Thunder_14) | |
Thunder_13: | |
JSL (0xC12DD5) | |
Thunder_14: | |
JSL (0xC2EACF) | |
CMP_i (0x0000) | |
BNE_a (Thunder_13) | |
LDX_a (0xA972) //Current target | |
SEP (0x20) | |
STZ_x (0x004B) | |
LDX_a (0xA972) //Current target | |
REP (0x20) | |
LDA_x (0x000E) //Checks byte 0x0E of combatant table (enemy) | |
AND_i (0x00FF) | |
BNE_a (Thunder_No_Badge) //If target is an enemy, skips the Franklin Badge check | |
LDX_i (0x0001) //Loads item #1, Franklin Badge | |
STX_d (0x16) | |
LDX_a (0xA972) //Current target | |
LDA_x (0x0010) //Checks byte 0x10 of combatant table (character number) | |
AND_i (0x00FF) | |
INC | |
LDX_d (0x16) | |
JSL (Check_For_Item) | |
CMP_i (0x0000) | |
BEQ_a (Thunder_No_Badge) | |
Thunder_Badge: | |
BText (0xEF7160) | |
LDA_i (0x0001) | |
STA_a (0xAA96) | |
JSL (Swap_Attack) //Redirects the attack back at the attacker | |
Thunder_No_Badge: | |
LDX_a (0xA972) //Current target | |
LDA_x (0x0023) //Checks byte 0x23 of combatant table (shield type) | |
AND_i (0x00FF) | |
TAX | |
CPX_i (0x0001) | |
BEQ_a (Thunder_Shield_Beta) //Branch if shield type 1 (PSI Shield beta) | |
CPX_i (0x0002) | |
BNE_a (Thunder_Shield_Alpha) //Branch if not shield type 2 (PSI Shield alpha) | |
Thunder_Shield_Beta: | |
SEP (0x20) | |
LDA_8 (0x01) | |
LDX_a (0xA972) //Current target | |
STA_x (0x0025) //Sets combatant table byte 0x25 (shield charges remaining) to 1 | |
Thunder_Shield_Alpha: | |
JSL (PSI_Shield_Nullify) //Swaps attacker and target if PSI Shield beta is in place. Returns a value of 1 if the incoming PSI attack should be canceled | |
CMP_i (0x0000) | |
BNE_a (Thunder_18) //If shield is in place, skips damage | |
Thunder_Damage: | |
LDA_d (0x04) | |
JSL (Mult_A_x_Rand_050_150) | |
LDX_i (0x00FF) | |
JSL (Calc_Resist_Damage) | |
Thunder_18: | |
JSL (Weaken_Shield) | |
BRA_a (Thunder_20) | |
Thunder_Miss: | |
BText (0xEF8837) //Thunder miss sound | |
BText (0xC8FAF6) //Thunder miss text | |
Thunder_20: | |
LDA_i (0x0000) | |
JSL (Count_Characters) | |
CMP_i (0x0000) | |
BEQ_a (Thunder_Return) | |
LDA_i (0x0001) | |
JSL (Count_Characters) | |
CMP_i (0x0000) | |
BEQ_a (Thunder_Return) | |
LDY_d (0x18) | |
INY | |
STY_d (0x18) | |
Thunder_21: | |
CPY_d (0x1A) //Compare Index Register Y with Memory | |
//0x1A stores the number of strikes remaining, | |
//This checks to see if there's any more strikes left | |
BCS_a (Thunder_Return) | |
BEQ_a (Thunder_Return) | |
JMP_l (Thunder_5) //Branch if there's still strikes left | |
Thunder_Return: | |
LDA_i (0x0000) | |
STA_a (0xA96C) | |
LDA_i (0x0000) | |
STA_a (0xA96E) | |
PLD | |
RTL | |
} | |
Thunder_Alpha: { | |
REP (0x31) | |
LDX_i (Thunder_A_Hits) | |
LDA_i (Thunder_A_Damage) | |
JSL (Thunder_General) | |
RTL | |
} | |
Thunder_Beta: { | |
REP (0x31) | |
LDX_i (Thunder_B_Hits) | |
LDA_i (Thunder_B_Damage) | |
JSL (Thunder_General) | |
RTL | |
} | |
Thunder_Gamma: { | |
REP (0x31) | |
LDX_i (Thunder_G_Hits) | |
LDA_i (Thunder_G_Damage) | |
JSL (Thunder_General) | |
RTL | |
} | |
Thunder_Omega: { | |
REP (0x31) | |
LDX_i (Thunder_O_Hits) | |
LDA_i (Thunder_O_Damage) | |
JSL (Thunder_General) | |
RTL | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment