So, I wrote up some code to grant Annie Phazon resistance and decided to try it out. It's not working quite like I'd hoped...
//Hard to Kill - Phazon (the Phazon in ACZ4 of Metroid Vanguard is coded differently from other instant kill floors)
addHook("PlayerThink", function(player)
if player.mo and player.mo.valid then
if player.mo.skin ~= "annie_belnades" then
return
end
if player.mo.pzpaintime == nil then --player.mo.pzpaintime gets defined in Metroid Vanguard's source code, but it makes sense to define it here as well so that it doesn't return errors if Metroid Vanguard isn't loaded.
player.mo.pzpaintime = 0
end
if player.mo.pzpaintime ~= 0
and player.mo.pzpaintime <= 4
and player.mo.energy >= 20*FRACUNIT then
player.mo.pzpaintime = $ + 44
player.mo.energy = $ - 20*FRACUNIT
player.mo.deathdefiance = 2
end
end
end)
For whatever reason, if Annie so much as
touches Phazon, her energy ends up ticking down to 0 over the next several seconds, no matter how quickly she gets out. Also, she still dies instantly, regardless of her energy, if one of Dark Samus's attacks launches her directly into the Phazon. In fact, she ends up losing 10 Rings upon first touching Phazon before the resistance kicks in… I did look at the Metroid Vanguard source code to try to figure out how the
pzpaintime
thing works, but I must have misinterpreted something.
And now that I think about this again, my code as written just assumes that
pzpaintime
resets back to 0 upon exiting Phazon, like how
pw_underwater
and
pw_spacetime
work, and keeps it above 1 as long as sufficient energy remains, which would explain why Annie's energy inevitably drains to 0 upon touching Phazon. (I based the Phazon resistance code on the drowning/suffocation resistance code I wrote on Zarosguth's suggestion. And I also completely neglected to create a "Phazon delay" variable like I did for drowning and suffocation, which may explain the initial Ring loss.)