34 lines
967 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LifeStealBehavior : RuntimeBehavior
{
public float lifeStealPercent = 0.15f; // 15% life steal
public LifeStealBehavior()
{
Trigger = BehaviorTrigger.OnHit;
BehaviorName = "Life Steal";
}
public override void Execute(RuntimeAbilityInstance ability, Taggable user, Transform target, Vector3 point)
{
// This would need to track the damage dealt to calculate life steal
// For now, just heal a fixed amount
var userHealth = user.GetComponent<Health>();
if (userHealth != null)
{
float healAmount = 20f * lifeStealPercent; // Placeholder calculation
userHealth.ChangeValue(healAmount);
}
}
public override RuntimeBehavior Clone()
{
return new LifeStealBehavior
{
lifeStealPercent = this.lifeStealPercent
};
}
}