diff --git a/logic/service/fight/effect/effect_4_5.go b/logic/service/fight/effect/effect_4_5.go index 93b30f4e0..460ac2b90 100644 --- a/logic/service/fight/effect/effect_4_5.go +++ b/logic/service/fight/effect/effect_4_5.go @@ -39,10 +39,10 @@ type EffectStat struct { // addrA := unsafe.Pointer(baseAddr + 4) //根据攻击算其他字段 // *(*uint32)(addrA) = 100 // } -func (e *EffectStat) AfterSkill(opp *input.Input, skill *info.SkillEntity) { +func (e *EffectStat) OnHit(opp *input.Input, skill *info.SkillEntity) { t, _, _ := e.Input.Player.Roll(e.EffectNode.SideEffectArgs[1], 100) - if !t { + if !t { //没触发 return } ptype := info.AbilityOpType.AbilityOpIncrease @@ -50,10 +50,10 @@ func (e *EffectStat) AfterSkill(opp *input.Input, skill *info.SkillEntity) { ptype = info.AbilityOpType.AbilityOpDecrease } if !e.Etype { //自身 - e.Input.SetProp(e.Input, e.EffectNode.SideEffectArgs[0], e.EffectNode.SideEffectArgs[2], ptype) + e.Input.SetProp(e.Input, int8(e.EffectNode.SideEffectArgs[0]), int8(e.EffectNode.SideEffectArgs[2]), ptype) } else { //对方 - opp.SetProp(e.Input, e.EffectNode.SideEffectArgs[0], e.EffectNode.SideEffectArgs[2], ptype) + opp.SetProp(e.Input, int8(e.EffectNode.SideEffectArgs[0]), int8(e.EffectNode.SideEffectArgs[2]), ptype) } } diff --git a/logic/service/fight/effect/effect_62.go b/logic/service/fight/effect/effect_62.go index b425cfffb..2b50ed365 100644 --- a/logic/service/fight/effect/effect_62.go +++ b/logic/service/fight/effect/effect_62.go @@ -24,14 +24,14 @@ func init() { } -func (e *Effect62) AfterSkill(*input.Input, *info.SkillEntity) { +func (e *Effect62) OnHit(*input.Input, *info.SkillEntity) { if e.Duration() != 1 { //说明还没到生效节点 e.Hide = true //隐藏效果 } else { e.Hide = false } - if !e.Hide && e.Hit() { //说明是自身回合//如果还在隐藏,就直接返回 + if !e.Hide { //说明是自身回合//如果还在隐藏,就直接返回 //defer e.EffectNode.NotALive() //失效 //应该是对方固定伤害等于自身血量 diff --git a/logic/service/fight/effect/effect_85.go b/logic/service/fight/effect/effect_85.go new file mode 100644 index 000000000..a206116e6 --- /dev/null +++ b/logic/service/fight/effect/effect_85.go @@ -0,0 +1,28 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +/** + * 使对手的能力提升效果转化到自己身上 + */ +type Effect85 struct { + node.EffectNode +} + +func init() { + input.InitEffect(input.EffectType.Skill, 85, &Effect85{ + EffectNode: node.EffectNode{}, + }) + +} + +func (e *Effect85) OnHit(opp *input.Input, skill *info.SkillEntity) { + for i := 0; i < 6; i++ { + e.Input.SetProp(opp, int8(i), 1, info.AbilityOpType.AbilityOpStealStrengthen) + } + +} diff --git a/logic/service/fight/input/attr.go b/logic/service/fight/input/attr.go index 2662ab9eb..677d21d5a 100644 --- a/logic/service/fight/input/attr.go +++ b/logic/service/fight/input/attr.go @@ -2,7 +2,9 @@ package input import ( element "blazing/common/data/Element" + "blazing/common/utils" "blazing/logic/service/fight/info" + "fmt" "github.com/mohae/deepcopy" "github.com/shopspring/decimal" @@ -16,17 +18,56 @@ func (u *Input) Death() { } -// 1是添加,-1是减少,0是清除 -func (u *Input) SetProp(in *Input, prop, level int, ptype info.EnumAbilityOpType) { +// 施加方,类型,等级,操作类别,是否成功 +func (u *Input) SetProp(in *Input, prop, level int8, ptype info.EnumAbilityOpType) (ret bool) { canuseskill := u.Exec(func(t Effect) bool { //这个是能否使用技能 //结算状态 return t.BeferProp(in, prop, level, ptype) //返回本身结算,如果false,说明不能使用技能了 }) if canuseskill { - u.AttackValue.Prop[prop] = u.AttackValue.Prop[prop] + int8(level) - } + switch ptype { + case info.AbilityOpType.AbilityOpIncrease: + newValue := utils.Min(u.AttackValue.Prop[prop]+int8(level), 6) + if newValue > u.AttackValue.Prop[prop] { + fmt.Println("属性值会增加") + ret = true + } else { + fmt.Println("属性值不会增加") + ret = false + } + + // 执行赋值 + u.AttackValue.Prop[prop] = newValue + + case info.AbilityOpType.AbilityOpDecrease: + u.AttackValue.Prop[prop] = utils.Max(u.AttackValue.Prop[prop]+int8(level), -6) + case info.AbilityOpType.AbilityOpClearWeaken: + u.AttackValue.Prop[prop] = utils.Max(u.AttackValue.Prop[prop], 0) + case info.AbilityOpType.AbilityOpClearStrengthen: + u.AttackValue.Prop[prop] = utils.Min(u.AttackValue.Prop[prop], 0) + case info.AbilityOpType.AbilityOpStealStrengthen: + + if in.AttackValue.Prop[prop] > 0 { + u.SetProp(u, prop, in.AttackValue.Prop[prop], info.AbilityOpType.AbilityOpClearStrengthen) + + in.SetProp(u, prop, 0, info.AbilityOpType.AbilityOpClearStrengthen) //消除对面 + } + case info.AbilityOpType.AbilityOpReverse: + if level > 0 && u.AttackValue.Prop[prop] > 0 { //反转强化,实际上是附带2倍的反转强化 + + u.SetProp(u, prop, u.AttackValue.Prop[prop]*2, info.AbilityOpType.AbilityOpDecrease) + + } + if level < 0 && u.AttackValue.Prop[prop] < 0 { + u.SetProp(u, prop, -u.AttackValue.Prop[prop]*2, info.AbilityOpType.AbilityOpIncrease) + } + + } + + } + return } func (i *Input) GetAction(opp *Input) { //使用1#技能,实际上要按照四个技能权重去使用 diff --git a/logic/service/fight/input/effecti.go b/logic/service/fight/input/effecti.go index acd1d7c6e..cf8224367 100644 --- a/logic/service/fight/input/effecti.go +++ b/logic/service/fight/input/effecti.go @@ -17,7 +17,7 @@ type Effect interface { // OnSkillPP() bool //技能PP减少节点 AfterProp(t *Input) - BeferProp(in *Input, prop, level int, ptype info.EnumAbilityOpType) bool + BeferProp(in *Input, prop, level int8, ptype info.EnumAbilityOpType) bool AfterAttr(t *info.BattlePetEntity) //在获取属性前,比如重写对方属性AfterAttr BeferAttr(t *info.BattlePetEntity) //在获取属性后,比如视为对方属性 SetArgs(input *Input, param ...int) diff --git a/logic/service/fight/node/attr.go b/logic/service/fight/node/attr.go index 93ee1484b..2e31e1dea 100644 --- a/logic/service/fight/node/attr.go +++ b/logic/service/fight/node/attr.go @@ -52,6 +52,6 @@ func (this *EffectNode) OnDefeat() bool { func (this *EffectNode) AfterProp(t *input.Input) { } -func (this *EffectNode) BeferProp(in *input.Input, prop, level int, ptype info.EnumAbilityOpType) bool { +func (this *EffectNode) BeferProp(in *input.Input, prop, level int8, ptype info.EnumAbilityOpType) bool { return true } diff --git a/logic/service/fight/node/skill.go b/logic/service/fight/node/skill.go index 68da2fdbd..8de3dd259 100644 --- a/logic/service/fight/node/skill.go +++ b/logic/service/fight/node/skill.go @@ -27,6 +27,24 @@ func (e *EffectNode) BeforeSkill(opp *input.Input, skill *info.SkillEntity) { // 使用技能时 func (e *EffectNode) OnSkill(opp *input.Input, skill *info.SkillEntity) { + if e.Hit() { //没命中 + e.OnHit(opp,skill) + }else{ + e.OnMiss(opp,skill) + } + +} +// miss +func (e *EffectNode) OnMiss(opp *input.Input, skill *info.SkillEntity) { + + + +} +// 命中 +func (e *EffectNode) OnHit(opp *input.Input, skill *info.SkillEntity) { + + + } func (e *EffectNode) AfterSkill(opp *input.Input, skill *info.SkillEntity) {