diff --git a/logic/service/fight/effect/effect_damage.go b/logic/service/fight/effect/effect_damage.go index e8f3efe0..9d30d719 100644 --- a/logic/service/fight/effect/effect_damage.go +++ b/logic/service/fight/effect/effect_damage.go @@ -35,23 +35,8 @@ func (e *Effect0) TurnEnd(opp *input.Input) { // 使用技能时 func (e *Effect0) OnSkill(opp *input.Input, skill *info.SkillEntity) { - oldour := deepcopy.Copy(e.Input.CurrentPet).(*info.BattlePetEntity) - oldouo := deepcopy.Copy(opp.CurrentPet).(*info.BattlePetEntity) - e.Input.Exec(func(t input.Effect) bool { //属性获取前 - t.BeferAttr(e.Input.CurrentPet) //使XX为XX - return true - }) - e.Input.Exec(func(t input.Effect) bool { //属性获取后 - - t.AfterAttr(opp.CurrentPet) //视为xx - return true - }) - - //威力+区 - //威力*区 - //todo 待修复input输入 - spower := skill.CalculatePower(opp.CurrentPet) + spower := e.Input.CalculatePower(opp.CurrentPet,skill) e.Input.AttackValue.LostHp = uint32(spower.IntPart()) e.Input.Exec(func(t input.Effect) bool { //计算暴击率加成 @@ -70,8 +55,7 @@ func (e *Effect0) OnSkill(opp *input.Input, skill *info.SkillEntity) { // } else { // opp.CurrentPet.Info.Hp = opp.CurrentPet.Info.Hp - e.Input.AttackValue.LostHp // } - e.Input.CurrentPet = oldour //恢复 - opp.CurrentPet = oldouo //恢复 + } func (this *Effect0) IsCrit(opp *input.Input, skill *info.SkillEntity) { skill.Crit = 0 diff --git a/logic/service/fight/input/attr.go b/logic/service/fight/input/attr.go index 2647a935..d10b94d2 100644 --- a/logic/service/fight/input/attr.go +++ b/logic/service/fight/input/attr.go @@ -3,7 +3,9 @@ package input import ( element "blazing/common/data/Element" "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "github.com/mohae/deepcopy" "github.com/shopspring/decimal" ) @@ -35,9 +37,30 @@ func (i *Input) GetAction(opp *Input) { } +// todo获取属性,待实现获取后改回原属性 +func (i *Input) GetProp(opp *Input) { + oldour := deepcopy.Copy(e.Input.CurrentPet).(*info.BattlePetEntity) + oldouo := deepcopy.Copy(opp.CurrentPet).(*info.BattlePetEntity) + e.Input.Exec(func(t input.Effect) bool { //属性获取前 + + t.BeferAttr(e.Input.CurrentPet) //使XX为XX + return true + }) + e.Input.Exec(func(t input.Effect) bool { //属性获取后 + + t.AfterAttr(opp.CurrentPet) //视为xx + return true + }) + e.Input.CurrentPet = oldour //恢复 + opp.CurrentPet = oldouo //恢复 +} + // 计算技能威力 func (i *Input) CalculatePower(deftype *info.BattlePetEntity, skill *info.SkillEntity) decimal.Decimal { + //威力+区 + //威力*区 + //todo 待修复input输入 // 1. 计算等级因子 (level * 0.4 + 2) levelFactor := decimal.NewFromInt(int64(i.CurrentPet.Info.Level)). Mul(decimal.NewFromFloat(0.4)).Add(decimal.NewFromInt(2))