After the rejection of my Boss HP meter generator/uberasm code
, the user who removed it recommends me to do a patch instead:
Originally posted by Von Fahrenheit
My suggestion is to turn it into a patch that automatically checks for certain boss sprites or something.
This gets me an idea on creating an HP meter for other enemies too, much like Kirby & the Amazing Mirror
. During development and testing, I ran to a big fat error Nintendo programmed smw:
Any bosses and enemies that can take damage (not necessary kill) by fireball and stomping are "inconsistent". No, I'm not talking that "they count up starting at 0, and dies a specific value is weird". It is that they take the same amount of damage from both, and that they die when the damage counter reaches either of the two values that kills them depending on what type of damage. This applies to Chargin chuck (all types) and Morton, Ludwig and Roy. They all have a value 3 that kills them when stomped. Chargin chuck have a value of 5 for fireballs (within the fireball routine $02A0AC, labeled as "ProcessFireball" in smwdisc), and for Morton, Ludwig and Roy, it is 12 (code at $01D3FE).
This means that the quickest way to kill an enemy as fireball mario is to first shoot 2 fireballs, and then stomp on them. As enemies do not get "stunned" from fireball damage.
So This patch fixes it by having it set up so that there are only one value needed to kill the enemy:
Chargin Chuck: >= 15 to kill, Stomp deals 5, fireball deals 3.
3 Koopalings: >= 12 to kill, stomp deals 4, fireball deals 1.
After fixing Nintendo's mistakes, I notice various bosses such as Morton, Lemmy, Ludwig, Wendy, and the Big Boo boss have a "delay" damage, as in, when dealing damage, the damage counter does not change until they change sprite state, which a few seconds later. My patch hijacks that and moves the "update hit counter" to where in the code plays SFX when the boss is taking stomp hits (Big Boo Boss' SFX located at $038233, damage when changing state: $03819B, Wendy/Lemmy's SFX is at $03CECB, their damage is at $03CE13, and Morton/Ludwig/Roy's sfx is at $01D3AB, damage is at $01CFC6).
Do note that the patch does not reverse the damage counter to count down each hit, it subtracts the "hits killing value" by "damage taken" to get "remaining hits left", which is HP before writing it to FreeRAM.
About the patch/uberasm code:
This is useful if you are going to use Enemies that most of the time takes more hits than 1 to kill. It is also useful if you are using a "dual boss" in a 1 vs 2 arena like the two hands boss from again, Kirby & the Amazing Mirror
, as the HP meter can switch between the two.
Do note that only these enemies show their HP meter:
All bosses except Iggy and Larry, Bowser.
Give thanks to RPG hacker for working on Asar.