29 lines
912 B
C#
29 lines
912 B
C#
using Continentis.MainGame.Character;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.MainGame.Card
|
|
{
|
|
public class CardLogicComponent_LifeSteal : CardLogicComponentBase
|
|
{
|
|
protected override void TargetingEffect(CharacterBase target)
|
|
{
|
|
card.SetAttribute("Display_LifeStealPercent", GetLifeStealPercent());
|
|
}
|
|
|
|
protected override void UntargetingEffect()
|
|
{
|
|
card.SetAttribute("Display_LifeStealPercent", card.GetRawAttribute("LifeStealPercent"));
|
|
}
|
|
|
|
public float GetLifeStealPercent()
|
|
{
|
|
return card.GetRawAttribute("LifeStealPercent") * (user.GetRawAttribute("LifeStealMultiplier", 1));
|
|
}
|
|
|
|
public void LifeSteal(float damageDealtOnHealth)
|
|
{
|
|
int heal = Mathf.RoundToInt(damageDealtOnHealth * GetLifeStealPercent());
|
|
user.Heal(heal);
|
|
}
|
|
}
|
|
} |