class Game_Battler
alias make_damage_value_09112015_drain make_damage_value
def make_damage_value(user, item)
if item.damage.type == 1 && user.actor?
case item.damage.element_id
when -1, 1
@result.drain = user.adr - 1
else
@result.drain = user.apr - 1
end
end
make_damage_value_09112015_drain(user, item)
end
end
class Game_ActionResult
attr_accessor :drain
alias clear_hit_flags_09112015_drain clear_hit_flags
def clear_hit_flags
@drain = 0
clear_hit_flags_09112015_drain
end
alias make_damage_09112015_drain make_damage
def make_damage(value, item)
make_damage_09112015_drain(value, item)
@hp_drain = (@hp_damage * @drain).round
@hp_drain = [@battler.hp, @hp_drain].min
end
def hp_damage_text
if @hp_drain > 0 && @drain == 0
fmt = @battler.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
sprintf(fmt, @battler.name, Vocab::hp, @hp_drain)
elsif @hp_damage > 0
fmt = @battler.actor? ? Vocab::ActorDamage : Vocab::EnemyDamage
fmt2 = @battler.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
return sprintf(fmt, @battler.name, @hp_damage) if @drain == 0
sprintf(fmt, @battler.name, @hp_damage)+"\n"+ sprintf(fmt2, @battler.name, Vocab::hp, @hp_drain)
elsif @hp_damage < 0
fmt = @battler.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
sprintf(fmt, @battler.name, Vocab::hp, -hp_damage)
else
fmt = @battler.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage
sprintf(fmt, @battler.name)
end
end
end