package fight
import (
"go_dreamfactory/modules/battle/fight/attribute"
"go_dreamfactory/modules/battle/fight/core"
cfg "go_dreamfactory/sys/configure/structs"
)
type FightRole struct {
///
/// 战斗实例
///
fight core.IFight
///
/// 角色数据
///
data core.FightRoleData
CurrentHealth attribute.HealthPoint
}
///
/// 接收伤害
///
func (this *FightRole) ReceiveDamage(DamageValue float32) {
this.CurrentHealth.Minus(DamageValue)
// FightDebug.Log($"========接收伤害:{Data.UniqueId} 变化值={DamageValue} 当前血量={CurrentHealth.Value}");
if this.IsDead() {
//有不死buff生命值设置为1
for _, v := range this.data.BuffStore.HasBuffTypes {
if v == cfg.GameBuffType_UNDEAD {
this.CurrentHealth.Hp.Set(1)
break
}
}
this.Dead()
}
}
func (this *FightRole) IsDead() bool {
return this.CurrentHealth.Value() <= 0
}
func (this *FightRole) Dead() {
this.data.ALive = false
}