Users browsing this thread: 1 Guest(s)
Stamina in HP Growth Calculation

#1
Posts: 3,964
Threads: 279
Thanks Received: 233
Thanks Given: 55
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
author: madsiur
version: 1.0
date: 2016/05/05
Apply to: FF3us 1.0
Download


Files
hpC2.asm: For implementation in bank $C2
hpEE.asm: For implementation in bank $EE or any other bank

Apply with xkas 0.06
Command example: xkas hpEE.asm romname.smc

Space used

hpC2.asm: 36 bytes in bank $C2
hpEE.asm: 46 bytes in bank $EE (or the bank of your choice)

Description

This tweak implement character stamina consideration in HP growth at level up.

As it stands by default it implement the following formula:

HP growth = Character stamina * level HP growth table value / 32

This mean for the following case scenarios, given stamina values of 32, 48, 64 and table values of 10 and 60, HP growth will be:

32 * 10 / 32 = 10 HP
48 * 10 / 32 = 15 HP
64 * 10 / 32 = 20 HP

32 * 60 / 32 = 60 HP
48 * 60 / 32 = 90 HP
64 * 60 / 32 = 120 HP

By adding a LSR in the ASM file (where the 5 LSR are toward the end), you can make the divisor 64 instead of 32. By removing one, you make it 16.

Note that this hack require HP growth table modifications / tweaking in FF3usME to achieve balance.

Bank $EE implementation
Code:
hirom       ;do not touch this
;header     ;uncomment if ROM has a header

;Implement the following HP growth formula:
;stamina * level HP growth table value / 32

org $C260CA
JSL formula
BRA sbr60DD

org $C260DD
sbr60DD:

org $EEAF01     ;Change this accordingly to you empty spot of choice in a bank other than $C2
formula:
PHX             ;save stat block index
TDC             ;Clear 16-bit A
LDA $1608,X     ;get level
TAX
LDA $E6F500,X   ;normal MP gain for level
STA $FE
LDA $E6F49E,X   ;normal HP gain for level
PLX             ;get stat block index
XBA            
LDA $161C,X     ;get stamina
REP #$20
STA $004202     ;stamina * HP gain
NOP
NOP
NOP
NOP
LDA $004216     ;load multiplication result
LSR
LSR
LSR
LSR
LSR             ;divide by 32
SEP #$20        ;8-bit A
STA $FC
RTL
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Kugawattan (05-05-2016)

#2
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
I take credit for asking this to be made in the first place, but also and more importantly to be the first hack that uses this :>

Thank you so much Mad :)


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  

#3
Posts: 3,964
Threads: 279
Thanks Received: 233
Thanks Given: 55
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Don't worry, there's also some hack involving a saucerer and staring Mario as a boss that might use it but I had crossover crisis in mind when making it. If you need something else I'm there.
  Find
Quote  

#4
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
I call it "Return of the Plumbing Saucerer"


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  

#5
Posts: 281
Threads: 18
Thanks Received: 12
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
I've been mulling over making something like this for years, and while hooking Stamina into the HP growth code works well enough, I would like to try and make it state-based, to avoid the following problem: it very strongly incentivizes the player to focus exclusively on raising Stamina during early levels, to the detriment of other stats, because if you don't you're basically throwing HP away.
  Find
Quote  

#6
Posts: 3,964
Threads: 279
Thanks Received: 233
Thanks Given: 55
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(05-06-2016, 08:33 PM)seibaby Wrote: I would like to try and make it state-based, to avoid the following problem: it very strongly incentivizes the player to focus exclusively on raising Stamina during early levels, to the detriment of other stats, because if you don't you're basically throwing HP away.

I thought about that and came with two "solutions": Either it become part of the game and you plan your hack accordingly (to some extent) or you limit very much stamina boosts in early game. Another thing could be modifying the formula based on the level (like 3 formulas: lvl 0-30, 31-60 and 61-99). It's something I could look into but requires a lot more divisions and additions manipulations.

I'm not sure what you mean by state-based...
  Find
Quote  

#7
Posts: 826
Threads: 11
Thanks Received: 22
Thanks Given: 13
Joined: Nov 2011
Reputation: 16
Status
Double
I assume that by "state based" he means that for having a specific Stamina stat, your HP is increased statically by a certain amount, rather than your HP increasing more upon level-ups.


Confused Moogles FTW
Quote  

#8
Posts: 3,964
Threads: 279
Thanks Received: 233
Thanks Given: 55
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(05-06-2016, 10:03 PM)Lockirby2 Wrote: I assume that by "state based" he means that for having a specific Stamina stat, your HP is increased statically by a certain amount, rather than your HP increasing more upon level-ups.

Yeah, you could maybe do like:

HP addition = level * stamina / 16 (or / 8)

For a level 10, 30 and 60 with 40, 55 and 70 stamina:

10 * 40 / 16 = 25 HP
10 * 55 / 16 = 34 HP
10 * 70 / 16 = 43 HP

30 * 40 / 16 = 75 HP
30 * 55 / 16 = 103 HP
30 * 70 / 16 = 131 HP

60 * 40 / 16 = 150 HP
60 * 55 / 16 = 206 HP
60 * 70 / 16 = 262 HP

Double everything up if you divide by 8 instead. However this seems to less beneficial for characters with high stamina, maybe to the point of reducing it to a neglectable stat. This is valid whether you use the level of a table number which would also be not really variable for characters in the same level range.
  Find
Quote  

#9
Posts: 281
Threads: 18
Thanks Received: 12
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
(05-06-2016, 10:03 PM)Lockirby2 Wrote: I assume that by "state based" he means that for having a specific Stamina stat, your HP is increased statically by a certain amount, rather than your HP increasing more upon level-ups.

You are correct. To elaborate, I'll just paraphrase what BTB wrote about a similar mod for Morrowind:

BTB Wrote:State-Based Hit Points makes a small, but very important adjustment to how the game calculates your maximum health. Rather than being based on your Stamina at the time of leveling up, your maximum health gains per level will be applied retroactively based on your current Stamina values. In other words, your Stamina can be raised at your convenience for exactly the same effect as if you had rushed it, where previously it would have resulted in a much lower maximum health.

I was thinking something like (Stamina *  Level / 4). That'd give you about one third of maximum possible HP at level 99 with 128 Stamina. Of course the base HP curve would have to cap out at about 2/3 of maximum possbible HP.

A different method is to use Stamina as a modifier to base HP, for example (HP * (Stamina + 128) / 128) would double your base HP if you had 128 Stamina. Base HP could be easily calculated whenever needed by adding up the HP given each level plus your starting HP.

The only problem I see with implementing this is that HP has to be re-calculated every time your HP or Stamina would change. I think that can only happen on level up or equipment change, but it would have to include changing equipment in battle.
Luckily the percentage HP bonuses of Green Beret/Muscle Belt/etc. don't actually change your base HP, they are expressed as bit toggles on the top two bits of 16-bit HP, so that makes things easier to account for.
  Find
Quote  

#10
Posts: 378
Threads: 94
Thanks Received: 17
Thanks Given: 26
Joined: Jul 2013
Reputation: 11
Status
Charmed
To make (Stamina * Level / 4), couldn't you just take Madsiur's patch and make the HP growth table value match the level the character has?

If the HP table is 10 at level 10, is it just like making Stamina * Level / 4?

Or is there something I'm missing (which wouldn't surprise me)?


Step forward, spriters! We are also responsible to make hacks look new and fresh, we are no less important than code or ASM hackers! CHARGE!!
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite