Users browsing this thread: 1 Guest(s)
Having the option to use Vigor in some spells

#13
Posts: 3,971
Threads: 279
Thanks Received: 237
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
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.

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
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Gi Nattak (05-03-2016)



Messages In This Thread
RE: Having the option to use Vigor in some spells - by madsiur - 05-01-2016, 05:53 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite