twanvl / sts-mad-science-mod

Mad Scientist character for Slay the Spire
MIT License
14 stars 2 forks source link

Buffered with zero damage triggers BandageBotPower #14

Closed Jazzepi closed 6 years ago

Jazzepi commented 6 years ago

If you have buffer up, and get hit, buffer reduces the damage to 0, but onAttacked still triggers and the damage must be > 0 at that point. Maybe the buffer trigger is lower in the call order.

There is a "atDamageFinalRecieve" which contains both damage, and damage type. Perhaps the buffer will have applied by then?

twanvl commented 6 years ago

Buffer applies in onLoseHP, which is unfortunately way too late. I could make BandageBot explicitly check for the buffer power.

Jazzepi commented 6 years ago

How would you check for buffer? If the buffer is used up before coming to the call how would you know they had one?

twanvl commented 6 years ago

BufferPower.onLoseHp always happens after BandageBotPower.onAttacked. So there I can check if the player has BufferPower, and in that case don't trigger.

Jazzepi commented 6 years ago

Dumb question, how do you know the ordering?

twanvl commented 6 years ago

From looking at AbstractPlayer.damage. There p.onAttacked is called before p.onLoseHp.

Jazzepi commented 6 years ago

Oh sorry I got confused. Somehow I thought you were referencing the same callback method (onLoseHp) for both.