Users browsing this thread: 1 Guest(s)
Having the option to use Vigor in some spells
Seibaby code is a really nice tweak but I'm posting a different though more basic tweak. It's not a contest between both codes because they aren't doing the same thing. Basically I use bit 7 of the special byte 3 ($11A7) of the spell data to implement vigor in magic damage calculation (see image). There two possible scenarios:
1) "Physical Damage" and "Special byte 3 bit 7" are checked: Spell use the magic damage formula and replace magic power with vigor. The spell is treated as physical for the rest (damage reduction, relic effects, etc...).
2) "Physical Damage" is unchecked and "Special byte 3 bit 7" is checked: Spell use the magic damage formula and replace magic power with vigor. The spell is treated as magical for the rest (damage reduction, relic effects, etc...).
For a "regular" magical or physical damage, simply ignore Special byte 3 bit 7.
The following is a bank $C2 implementation. If you plan on using this and want it in another bank, the code need modification. I had to include a decent chunk of vanilla code in the file because there was no moment I could call my first JSR properly.
1) "Physical Damage" and "Special byte 3 bit 7" are checked: Spell use the magic damage formula and replace magic power with vigor. The spell is treated as physical for the rest (damage reduction, relic effects, etc...).
2) "Physical Damage" is unchecked and "Special byte 3 bit 7" is checked: Spell use the magic damage formula and replace magic power with vigor. The spell is treated as magical for the rest (damage reduction, relic effects, etc...).
For a "regular" magical or physical damage, simply ignore Special byte 3 bit 7.
The following is a bank $C2 implementation. If you plan on using this and want it in another bank, the code need modification. I had to include a decent chunk of vanilla code in the file because there was no moment I could call my first JSR properly.
Code:
hirom ;do not touch this
;header ;uncomment if ROM has a header
org $C22B9D
LDA $11A7 ;load special byte 3 of spell data
BMI spcPhy ;if bit 7 set, jump to magic damage calculation
LDA $11A2 ;load regular physical attack byte
LSR
BCS regPhy ;branch if regular physical attack
spcPhy:
JMP $2B69 ;magic damage calculation
regPhy:
PHP
LDA $11AF
PHA
JSR sbrA ;we need room
org $C22B7F
JSR sbrB ;hijack magic damage formula
org $C26469 ;Change this to a spot you got room in bank $C2
sbrA: ;Original code that needed to be moved because lack of space.
STA $E8
TDC
LDA $11A6
REP #$20
RTS
sbrB:
LDA $11A7 ;load special byte 3 of spell data
BMI useVig ;if bit 7 is set, use Stamina
LDA $11AE ;magic power
RTS
useVig:
LDA $3B2C,X ;It seems X and Y already contain battle position * 2.
;Getting then character vigor is easy. Tested with Terra, Vicks, Wedge.
CPX #$08
BCS mons
LSR ;$3B2C hold vigor * 2 for characters
mons:
RTS
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)