I'm designing a state in which the affected battler converts his damage into heal for the lowest HP ally. For example: if he causes 100 HP damage, his lowest ally will heal 10 HP. Something like that.
Overall, my design works, except for one thing: the healing is delayed one action. For example:
1. affected battler causes damage; recovery sound plays and a recover pop up appears on the lowest hp ally
2.a enemy makes an action; lowest hp ally heals
As you can see from above, healing should be happening on action 1, but it's happening on action 2. If action 2 is an attack from the enemy on the lowest hp ally, the healing will work as mitigation.
So, mechanically, my design works. If healing is delayed or not does not matter mechanically because the result is technically working as intended. But aesthetically, it doesn't work. The player may get confused and think it is a bug and that the state isn't working.
This is how I designed the state
Just for you to know, I use Yanfly's scripts. Namely: Ace Battle Engine and Lunatic Damage. My state method "altruist" is called on Lunatic Damage in the "Finalization" section, among other methods I designed.
Overall, my design works, except for one thing: the healing is delayed one action. For example:
1. affected battler causes damage; recovery sound plays and a recover pop up appears on the lowest hp ally
2.a enemy makes an action; lowest hp ally heals
As you can see from above, healing should be happening on action 1, but it's happening on action 2. If action 2 is an attack from the enemy on the lowest hp ally, the healing will work as mitigation.
So, mechanically, my design works. If healing is delayed or not does not matter mechanically because the result is technically working as intended. But aesthetically, it doesn't work. The player may get confused and think it is a bug and that the state isn't working.
This is how I designed the state
Ruby:
class Game_Battler < Game_BattlerBase
def altruist(a,b,item,damage)
if a.actor? && !b.actor? && !item.damage.recover? \
&& a.state?(93)
allies = $game_party.battle_members.select { |member| member.hp > 0 \
&& member.hp < member.mhp}
allies = allies - [$game_actors[6]]
return if allies.empty?
lowest = allies.min_by { |ally| ally.hp_rate }
altruist_conversion_rate = ((a.mat * 1.9) + 10)/100
altruist_heal = (damage * altruist_conversion_rate).to_i
lowest.hp += altruist_heal
lowest.hp = [lowest.hp, lowest.mhp].min
Sound.play_recovery
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:hp_heal], altruist_heal.group)
lowest.create_popup(text, "HP_HEAL")
end
end
end
Just for you to know, I use Yanfly's scripts. Namely: Ace Battle Engine and Lunatic Damage. My state method "altruist" is called on Lunatic Damage in the "Finalization" section, among other methods I designed.