refactor(fight): 移除能力操作类型枚举并简化属性设置方法 移除了 info.EnumAbilityOpType 枚举类型及其相关常量定义, 重构了 SetProp 方法调用,不再传递操作类型参数, 通过检查等级正负值来判断是增加还是减少属性, 减少了代码复杂度并统一了属性变更的处理逻辑。 ```
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -36,7 +35,7 @@ type NewSel1 struct {
|
||||
NewSel0
|
||||
}
|
||||
|
||||
func (e *NewSel1) PropBefer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool {
|
||||
func (e *NewSel1) PropBefer(in *input.Input, prop int8, level int8) bool {
|
||||
|
||||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||||
if !e.IsOwner() {
|
||||
@@ -47,7 +46,7 @@ func (e *NewSel1) PropBefer(in *input.Input, prop int8, level int8, ptype info.E
|
||||
}
|
||||
|
||||
//能力下降类
|
||||
if ptype == info.AbilityOpType.SUB {
|
||||
if level < 0 {
|
||||
|
||||
return false
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ func (e *NewSel112) DamageDivEx(t *info.DamageZone) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1)
|
||||
e.count++
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func (e *NewSel12) DamageDivEx(t *info.DamageZone) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1)
|
||||
e.count++
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
)
|
||||
|
||||
@@ -27,7 +26,7 @@ func (e *NewSel144) Action_end_ex() bool {
|
||||
e.Ctx().Our.CurrentPet.Info.Hp = e.Ctx().Our.CurrentPet.Info.MaxHp
|
||||
e.Ctx().Our.HealPP(-1)
|
||||
for i := 0; i < 6; i++ {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 6, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 6)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
@@ -34,7 +33,7 @@ func (e *NewSel16) TurnStart(fattack *action.SelectSkillAction, sattack *action.
|
||||
}
|
||||
if e.curhp.Sub(e.Ctx().Our.CurrentPet.GetHP()).Cmp(maxHP.Div(alpacadecimal.NewFromInt(8))) == 1 {
|
||||
e.curhp = e.Ctx().Our.CurrentPet.GetHP()
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
)
|
||||
|
||||
@@ -20,7 +19,7 @@ func (e *NewSel283) SkillUseed() bool {
|
||||
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 {
|
||||
|
||||
for i := 0; i < 6; i++ {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(e.Args()[1].IntPart()), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(e.Args()[1].IntPart()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ func (e *NewSel34) DamageDivEx(t *info.DamageZone) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), -1, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), -1)
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
|
||||
@@ -29,7 +29,7 @@ func (e *NewSel35) DamageDivEx(t *info.DamageZone) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1)
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
)
|
||||
|
||||
@@ -19,7 +18,7 @@ func (e *NewSel408) Action_end_ex() bool {
|
||||
|
||||
// TODO: 需要判断是否是PVP战斗
|
||||
for i := 0; i < 6; i++ {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 1, info.AbilityOpType.RESET)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
|
||||
}
|
||||
|
||||
// 消除对手的能力强化效果
|
||||
|
||||
@@ -23,9 +23,9 @@ func (e *Effect137) OnSkill() bool {
|
||||
Damage: halfHp,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 2, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 2)
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, 2, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, 2)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -12,9 +11,9 @@ type Effect150 struct {
|
||||
}
|
||||
|
||||
func (e *Effect150) Skill_Use() bool {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]))
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]))
|
||||
return true
|
||||
}
|
||||
func (e *Effect150) SetArgs(t *input.Input, a ...int) {
|
||||
|
||||
@@ -20,7 +20,7 @@ func (e *Effect155) OnSkill() bool {
|
||||
// 消除所有能力下降
|
||||
|
||||
for i := 0; i < 6; i++ {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -1, info.AbilityOpType.RESET)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
|
||||
}
|
||||
// 使自己进入睡眠n回合
|
||||
sleepEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Sleep))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -15,9 +14,9 @@ func (e *Effect157) Skill_Use_ex() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 1, -1, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 3, -1, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 5, -1, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 1, -1)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 3, -1)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 5, -1)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ func (e *Effect166) Skill_Use_ex() bool {
|
||||
if success {
|
||||
effectType := int8(e.Args()[1].IntPart()) // XX类型
|
||||
effectValue := int8(e.Args()[2].IntPart()) // 等级k
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -18,7 +17,7 @@ func (e *Effect190) Skill_Use_ex() bool {
|
||||
|
||||
// 消除对手所有能力强化状态
|
||||
for i, _ := range e.Ctx().Opp.Prop[:] {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 1, info.AbilityOpType.RESET)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -17,14 +16,14 @@ func (e *Effect196) OnSkill() bool {
|
||||
effectValue := e.Args()[5].IntPart() // 等级-k
|
||||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||||
if success {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[3].IntPart()), int8(effectValue), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[3].IntPart()), int8(effectValue))
|
||||
}
|
||||
} else { // 后出手
|
||||
chance := e.Args()[1].IntPart() // j%
|
||||
effectValue := e.Args()[2].IntPart() // 等级-k
|
||||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||||
if success {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), int8(effectValue), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), int8(effectValue))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
@@ -14,12 +13,12 @@ type Effect198 struct {
|
||||
}
|
||||
|
||||
func (e *Effect198) OnSkill() bool {
|
||||
numStats := int(e.Args()[0].IntPart()) // n种能力
|
||||
numStats := int(e.Args()[0].IntPart()) // n种能力
|
||||
reduction := int8(e.Args()[1].IntPart()) // 等级-m
|
||||
|
||||
// 随机选择n种能力
|
||||
for i := 0; i < numStats; i++ {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(grand.Intn(5)), reduction, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(grand.Intn(5)), reduction)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -22,8 +21,8 @@ func (e *Effect403) OnSkill() bool {
|
||||
boostValue *= 2
|
||||
}
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, boostValue, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 2, boostValue, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, boostValue)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 2, boostValue)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -14,7 +13,7 @@ type Effect418 struct {
|
||||
func (e *Effect418) OnSkill() bool {
|
||||
for _, v := range e.Ctx().Opp.Prop[:] {
|
||||
if v > 0 {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]))
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -12,7 +11,7 @@ type Effect424 struct {
|
||||
}
|
||||
|
||||
func (e *Effect424) Skill_Use() bool {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(e.Args()[1].IntPart()), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(e.Args()[1].IntPart()))
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ func (e *Effect427) Skill_Use() bool {
|
||||
}
|
||||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||||
// 降低对手防御
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]))
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]))
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -16,7 +15,7 @@ func (e *Effect437) OnSkill() bool {
|
||||
for _, v := range e.Ctx().Opp.Prop[:] {
|
||||
if v > 0 {
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]))
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -18,7 +17,7 @@ func (e *Effect473) Skill_Use() bool {
|
||||
if damageDone.IntPart() < int64(damageThreshold) {
|
||||
effectType := int(e.Args()[1].IntPart()) // XX类型
|
||||
effectValue := int(e.Args()[2].IntPart()) // 等级+n
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(effectType), int8(effectValue), info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(effectType), int8(effectValue))
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -17,7 +16,7 @@ func (e *Effect477) Skill_Use_ex() bool {
|
||||
}
|
||||
|
||||
for i, effectId := range e.SideEffectArgs[1:] {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId))
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -23,7 +23,7 @@ func (e *Effect504) OnSkill() bool {
|
||||
}
|
||||
} else {
|
||||
for i, effectId := range e.SideEffectArgs[1:] {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ func (e *EffectDefeatTrigger) triggerLevelUpOnDefeat(_ model.AttackValue) {
|
||||
}
|
||||
|
||||
// 3. 提升对应等级
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[2]), info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[2]))
|
||||
}
|
||||
|
||||
// triggerNextEnemyStatusOnDefeat:击败指定类型对手后,下一个出场对手进入指定状态(对应Effect185)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -47,9 +46,9 @@ func (e *Effect122) OnSkill() bool {
|
||||
|
||||
if e.rev {
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
|
||||
} else {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
@@ -28,7 +27,7 @@ func (e *Effect107) Skill_Use() bool {
|
||||
//说明伤害小于N
|
||||
if d == -1 {
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -32,7 +31,7 @@ func (e *Effect110) Skill_Use_ex() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[2]), 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.SideEffectArgs[2]), 1)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func (e *Effect119) DamageLock(damageValue *info.DamageZone) bool {
|
||||
// 偶数:30%速度+1
|
||||
ok, _, _ := e.Input.Player.Roll(30, 100)
|
||||
if ok {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1)
|
||||
}
|
||||
}
|
||||
e.can = false
|
||||
@@ -144,7 +144,7 @@ func (e *Effect123) Be_Damage(at, _ alpacadecimal.Decimal) {
|
||||
if e.can {
|
||||
propIndex := int(e.Args()[1].IntPart())
|
||||
changeAmount := int(e.Args()[2].IntPart())
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
|
||||
e.can = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -27,12 +26,7 @@ func (e *Effect124) OnSkill() bool {
|
||||
// 随机选择一个属性(0-5,包含攻击、防御、特攻、特防、速度、命中)
|
||||
propIndex := int(e.Input.FightC.GetRand().Int31n(6))
|
||||
|
||||
opType := info.AbilityOpType.ADD
|
||||
if changeAmount < 0 {
|
||||
opType = info.AbilityOpType.SUB
|
||||
}
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -53,10 +47,10 @@ func (e *Effect126) TurnStart(_, _ *action.SelectSkillAction) {
|
||||
changeAmount := int(e.Args()[1].IntPart())
|
||||
|
||||
// 攻击等级+1 (属性索引0)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount), info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount))
|
||||
|
||||
// 速度等级+1 (属性索引4)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount), info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount))
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -54,11 +53,8 @@ func (e *Effect148) OnSkill() bool {
|
||||
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if ok {
|
||||
opType := info.AbilityOpType.ADD
|
||||
if changeAmount < 0 {
|
||||
opType = info.AbilityOpType.SUB
|
||||
}
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType)
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -28,7 +28,7 @@ func (e *Effect182) OnSkill() bool {
|
||||
if !success {
|
||||
return true
|
||||
}
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), int8(e.Args()[3].IntPart()), info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), int8(e.Args()[3].IntPart()))
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -16,8 +15,8 @@ func (e *Effect189) Skill_Use_ex() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 0, -1, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 2, -1, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 0, -1)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 2, -1)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -17,7 +16,7 @@ func (e *Effect409) SetArgs(t *input.Input, a ...int) {
|
||||
}
|
||||
func (e *Effect409) Skill_Use() bool {
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(int(e.Args()[1].IntPart())), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, 4, int8(int(e.Args()[1].IntPart())))
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
|
||||
@@ -18,9 +18,9 @@ type Effect414 struct {
|
||||
// 使用技能时,不可被继承,继承Miss和Hit就行
|
||||
func (e *Effect414) OnSkill() bool {
|
||||
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[2].IntPart())) {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), int8(e.Args()[1].IntPart())*2, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), int8(e.Args()[1].IntPart())*2)
|
||||
} else {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), int8(e.Args()[1].IntPart()), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), int8(e.Args()[1].IntPart()))
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -15,7 +14,7 @@ func (e *Effect416) Skill_Use_ex() bool {
|
||||
effectType := int8(e.Args()[1].IntPart()) // XX类型
|
||||
effectValue := int8(e.Args()[2].IntPart()) // 降低m个等级
|
||||
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue, info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -19,9 +18,9 @@ func (e *Effect448) OnSkill() bool {
|
||||
|
||||
for i, v := range e.SideEffectArgs[1:] {
|
||||
if e.rev {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v), info.AbilityOpType.SUB)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||||
} else {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v), info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -14,8 +13,8 @@ type Effect47 struct {
|
||||
conut int
|
||||
}
|
||||
|
||||
func (e *Effect47) PropBefer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool {
|
||||
if in == e.Ctx().Opp && ptype == info.AbilityOpType.SUB {
|
||||
func (e *Effect47) PropBefer(in *input.Input, prop int8, level int8) bool {
|
||||
if in == e.Ctx().Opp && level < 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
@@ -18,7 +17,7 @@ func (e *Effect487) OnSkill() bool {
|
||||
|
||||
if opponentHp.Cmp(alpacadecimal.NewFromInt(400)) > 0 {
|
||||
// 提升自身攻击等级
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, 1)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
@@ -19,7 +18,7 @@ func (e *Effect490) Skill_Use_ex() bool {
|
||||
|
||||
if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(damageThreshold))) > 0 {
|
||||
// 提升自身速度等级
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 5, speedBoost, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 5, speedBoost)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -61,19 +60,13 @@ func (e *EffectStat) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// 判断加减类型
|
||||
opType := info.AbilityOpType.ADD
|
||||
if level < 0 {
|
||||
opType = info.AbilityOpType.SUB
|
||||
}
|
||||
|
||||
// 执行属性变化
|
||||
if e.Etype {
|
||||
// 对方属性变化
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(statIndex), int8(level))
|
||||
} else {
|
||||
// 自身属性变化
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(statIndex), int8(level))
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -25,9 +25,9 @@ func init() {
|
||||
// 特攻+2速度+1命中+1,
|
||||
func (e *Effect79) OnSkill() bool {
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 2, 2, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 5, 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 2, 2)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 5, 1)
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)).Div(alpacadecimal.NewFromInt(2)),
|
||||
|
||||
@@ -11,7 +11,6 @@ type Effect3 struct {
|
||||
node.EffectNode
|
||||
Reverse bool
|
||||
Level int8
|
||||
OpType info.EnumAbilityOpType
|
||||
}
|
||||
|
||||
// ----------------------
|
||||
@@ -23,10 +22,10 @@ func (e *Effect3) OnSkill() bool {
|
||||
for i := 0; i < 6; i++ {
|
||||
if e.Reverse {
|
||||
// 对对手生效
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), e.Level, e.OpType)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), e.Level)
|
||||
} else {
|
||||
// 对自己生效
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), e.Level, e.OpType)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), e.Level)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +35,10 @@ func (e *Effect3) OnSkill() bool {
|
||||
// ----------------------
|
||||
// 工厂函数
|
||||
// ----------------------
|
||||
func newEffect3(reverse bool, level int8, opType info.EnumAbilityOpType) *Effect3 {
|
||||
func newEffect3(reverse bool, level int) *Effect3 {
|
||||
return &Effect3{
|
||||
Reverse: reverse,
|
||||
Level: level,
|
||||
OpType: opType,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ func (e *Effect59) TurnStart(fattack *action.SelectSkillAction, sattack *action.
|
||||
if !e.can {
|
||||
return
|
||||
}
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1)
|
||||
e.Alive(false)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -99,17 +99,17 @@ type Playerinvite struct { //挂载到[]Playerinvite上? 被邀请者->邀请
|
||||
InviteTime uint32 //游戏模式
|
||||
}
|
||||
|
||||
// 能力操作类型枚举
|
||||
type EnumAbilityOpType string
|
||||
// // 能力操作类型枚举
|
||||
// type EnumAbilityOpType string
|
||||
|
||||
var AbilityOpType = enum.New[struct {
|
||||
ADD EnumAbilityOpType `enum:"1"` // 能力增加(强化)
|
||||
SUB EnumAbilityOpType `enum:"2"` // 能力减少(弱化)
|
||||
COPY EnumAbilityOpType `enum:"3"` // 复制强化/弱化
|
||||
RESET EnumAbilityOpType `enum:"4"` // 能力重置
|
||||
// var AbilityOpType = enum.New[struct {
|
||||
// ADD EnumAbilityOpType `enum:"1"` // 能力增加(强化)
|
||||
// SUB EnumAbilityOpType `enum:"2"` // 能力减少(弱化)
|
||||
// COPY EnumAbilityOpType `enum:"3"` // 复制强化/弱化
|
||||
// RESET EnumAbilityOpType `enum:"4"` // 能力重置
|
||||
|
||||
StealStrengthen EnumAbilityOpType `enum:"6"` // 吸取强化
|
||||
Reverse EnumAbilityOpType `enum:"7"` // 反转强化/弱化
|
||||
// StealStrengthen EnumAbilityOpType `enum:"6"` // 吸取强化
|
||||
// Reverse EnumAbilityOpType `enum:"7"` // 反转强化/弱化
|
||||
|
||||
BounceWeaken EnumAbilityOpType `enum:"10"` // 弹弱(反弹弱化效果)
|
||||
}]()
|
||||
// BounceWeaken EnumAbilityOpType `enum:"10"` // 弹弱(反弹弱化效果)
|
||||
// }]()
|
||||
|
||||
@@ -51,8 +51,8 @@ type Effect interface {
|
||||
TurnEnd() //回合结束计算
|
||||
HookAction() bool //出手前的hook参数,返回false阻止继续出手
|
||||
//PreBattleEnd() bool //战斗结束前
|
||||
OnBattleEnd() bool //战斗结束
|
||||
PropBefer(in *Input, prop, level int8, ptype info.EnumAbilityOpType) bool //锁定属性
|
||||
OnBattleEnd() bool //战斗结束
|
||||
PropBefer(in *Input, prop, level int8) bool //锁定属性
|
||||
//效果添加时候应该区分主动方和被动方来确认是主动添加的还是受击添加的
|
||||
//boss是进入防守方才被添加抵御异常状态效果的,boss免疫的实质是给挑战者挂载一个阻止添加给对手的debuff
|
||||
EFFect_Befer(in *Input, effEffect Effect) bool //属性免疫
|
||||
|
||||
@@ -1,157 +1,196 @@
|
||||
package input
|
||||
|
||||
import (
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight/info"
|
||||
)
|
||||
|
||||
// 攻击,防御,特攻,特防,速度,命中
|
||||
// 施加方(source),属性类型(prop),等级(level),操作类别(opType),返回是否成功
|
||||
func (target *Input) SetProp(source *Input, prop, level int8, opType info.EnumAbilityOpType) bool {
|
||||
func (target *Input) SetProp(source *Input, index, level int8) bool {
|
||||
// 前置状态结算:判断是否允许执行属性操作
|
||||
canExecute := target.Exec(func(effect Effect) bool {
|
||||
// 执行前置效果,返回true表示可以继续操作
|
||||
return effect.PropBefer(source, prop, level, opType)
|
||||
return effect.PropBefer(source, index, level)
|
||||
})
|
||||
if !canExecute {
|
||||
return false
|
||||
}
|
||||
|
||||
var newValue int8
|
||||
// 计算新属性值并判断操作是否有效(属性是否会发生变化)
|
||||
calcNewValue := func(p, l int8, t info.EnumAbilityOpType) bool {
|
||||
switch t {
|
||||
case info.AbilityOpType.ADD:
|
||||
// 属性提升,上限为6
|
||||
if l < 0 {
|
||||
l = -l
|
||||
}
|
||||
newValue = utils.Min(target.AttackValue.Prop[p]+l, 6)
|
||||
if newValue > target.AttackValue.Prop[p] {
|
||||
//fmt.Println("属性值会增加")
|
||||
return true
|
||||
}
|
||||
//fmt.Println("属性值不会增加")
|
||||
return false
|
||||
|
||||
case info.AbilityOpType.SUB:
|
||||
if l > 0 {
|
||||
l = -l
|
||||
}
|
||||
// 属性降低,下限为-6
|
||||
newValue = utils.Max(target.AttackValue.Prop[p]+l, -6)
|
||||
if newValue < target.AttackValue.Prop[p] {
|
||||
//fmt.Println("属性值会减少")
|
||||
return true
|
||||
}
|
||||
//fmt.Println("属性值不会减少")
|
||||
return false
|
||||
|
||||
case info.AbilityOpType.RESET:
|
||||
// 重置属性:level>0时清除强化(属性>0则置0),level<0时清除弱化(属性<0则置0)
|
||||
if (level > 0 && target.AttackValue.Prop[p] > 0) ||
|
||||
(level < 0 && target.AttackValue.Prop[p] < 0) {
|
||||
newValue = 0
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
switch opType {
|
||||
case info.AbilityOpType.StealStrengthen:
|
||||
// 窃取强化:获取对手的强化属性并转移到自身
|
||||
oppProp := target.Opp.AttackValue.Prop[prop]
|
||||
if oppProp <= 0 { // 对手无强化,无法窃取
|
||||
return false
|
||||
}
|
||||
// 尝试添加对手的强化值到自身
|
||||
if calcNewValue(prop, oppProp, info.AbilityOpType.ADD) {
|
||||
target.AttackValue.Prop[prop] = newValue
|
||||
// 窃取后清除对手的强化
|
||||
target.Opp.SetProp(source, prop, 1, info.AbilityOpType.RESET)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
case info.AbilityOpType.Reverse:
|
||||
currentProp := target.AttackValue.Prop[prop]
|
||||
if level > 0 { // 反转强化(仅当有强化时生效:+N → -N,需扣除2*N)
|
||||
if currentProp <= 0 {
|
||||
return false
|
||||
}
|
||||
// 强化反转:调整量为-2*currentProp(从+N到-N需要减少2N),用SUB操作
|
||||
adjustLevel := -2 * currentProp
|
||||
if calcNewValue(prop, adjustLevel, info.AbilityOpType.SUB) {
|
||||
target.AttackValue.Prop[prop] = newValue
|
||||
return true
|
||||
}
|
||||
return false
|
||||
} else { // 反转弱化(仅当有弱化时生效:-N → +N,需增加2*N)
|
||||
if currentProp >= 0 {
|
||||
return false
|
||||
}
|
||||
// 弱化反转:调整量为-2*currentProp(从-N到+N需要增加2N),用ADD操作
|
||||
adjustLevel := -2 * currentProp
|
||||
if calcNewValue(prop, adjustLevel, info.AbilityOpType.ADD) {
|
||||
target.AttackValue.Prop[prop] = newValue
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
case info.AbilityOpType.BounceWeaken:
|
||||
// 反弹弱化:将自身弱化转移给对手并清除自身弱化
|
||||
currentProp := target.AttackValue.Prop[prop]
|
||||
if currentProp >= 0 { // 无弱化可反弹
|
||||
return false
|
||||
}
|
||||
// 向对手施加同等弱化
|
||||
if target.Opp.SetProp(source, prop, currentProp, info.AbilityOpType.SUB) {
|
||||
// 清除自身弱化
|
||||
target.SetProp(source, prop, -1, info.AbilityOpType.RESET)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
case info.AbilityOpType.COPY:
|
||||
// 复制对手属性:将对手的强化/弱化值叠加到自身(遵守上下限)
|
||||
oppProp := target.Opp.AttackValue.Prop[prop] // 对手的属性值(可正可负)
|
||||
currentProp := target.AttackValue.Prop[prop] // 自身当前属性值
|
||||
|
||||
// 1. 计算叠加后的目标值(自身+对手)
|
||||
targetProp := currentProp + oppProp
|
||||
|
||||
// 2. 限制目标值在 [-6, 6] 范围内
|
||||
if targetProp > 6 {
|
||||
targetProp = 6
|
||||
} else if targetProp < -6 {
|
||||
targetProp = -6
|
||||
}
|
||||
|
||||
// 3. 若目标值与当前值一致,无需操作
|
||||
if targetProp == currentProp {
|
||||
return false
|
||||
}
|
||||
|
||||
// 4. 根据目标值与当前值的差异,选择 ADD 或 SUB 操作叠加
|
||||
if targetProp > currentProp {
|
||||
// 目标值更高:用 ADD 操作提升(调整量为差值)
|
||||
adjustLevel := targetProp - currentProp
|
||||
return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.ADD)
|
||||
switch {
|
||||
case level < 0:
|
||||
if target.AttackValue.Prop[index] > -6 {
|
||||
target.AttackValue.Prop[index] -= level
|
||||
} else {
|
||||
// 目标值更低:用 SUB 操作降低(调整量为差值的绝对值)
|
||||
adjustLevel := currentProp - targetProp
|
||||
return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.SUB)
|
||||
return false
|
||||
}
|
||||
|
||||
default:
|
||||
// 处理常规操作(ADD/SUB/RESET)
|
||||
if calcNewValue(prop, level, opType) {
|
||||
target.AttackValue.Prop[prop] = newValue
|
||||
return true
|
||||
case level > 0:
|
||||
if target.AttackValue.Prop[index] < 6 {
|
||||
target.AttackValue.Prop[index] += level
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
|
||||
case level == 0:
|
||||
|
||||
if target.AttackValue.Prop[index] != 0 {
|
||||
target.AttackValue.Prop[index] = 0
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
// // 重置属性:level>0时清除强化(属性>0则置0),level<0时清除弱化(属性<0则置0)
|
||||
// if (level > 0 && target.AttackValue.Prop[p] > 0) ||
|
||||
// (level < 0 && target.AttackValue.Prop[p] < 0) {
|
||||
// newValue = 0
|
||||
// return true
|
||||
// }
|
||||
//return true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// // 攻击,防御,特攻,特防,速度,命中
|
||||
// // 施加方(source),属性类型(prop),等级(level), 返回是否成功
|
||||
// func (target *Input) SetProp(source *Input, prop, level int8) bool {
|
||||
// // 前置状态结算:判断是否允许执行属性操作
|
||||
// canExecute := target.Exec(func(effect Effect) bool {
|
||||
// // 执行前置效果,返回true表示可以继续操作
|
||||
// return effect.PropBefer(source, prop, level)
|
||||
// })
|
||||
// if !canExecute {
|
||||
// return false
|
||||
// }
|
||||
|
||||
// var newValue int8
|
||||
// // 计算新属性值并判断操作是否有效(属性是否会发生变化)
|
||||
// calcNewValue := func(p, l int8, t info.EnumAbilityOpType) bool {
|
||||
// switch t {
|
||||
// case info.AbilityOpType.ADD:
|
||||
// // 属性提升,上限为6
|
||||
// if l < 0 {
|
||||
// l = -l
|
||||
// }
|
||||
// newValue = utils.Min(target.AttackValue.Prop[p]+l, 6)
|
||||
// if newValue > target.AttackValue.Prop[p] {
|
||||
// //fmt.Println("属性值会增加")
|
||||
// return true
|
||||
// }
|
||||
// //fmt.Println("属性值不会增加")
|
||||
// return false
|
||||
|
||||
// case info.AbilityOpType.SUB:
|
||||
// if l > 0 {
|
||||
// l = -l
|
||||
// }
|
||||
// // 属性降低,下限为-6
|
||||
// newValue = utils.Max(target.AttackValue.Prop[p]+l, -6)
|
||||
// if newValue < target.AttackValue.Prop[p] {
|
||||
// //fmt.Println("属性值会减少")
|
||||
// return true
|
||||
// }
|
||||
// //fmt.Println("属性值不会减少")
|
||||
// return false
|
||||
|
||||
// case info.AbilityOpType.RESET:
|
||||
// // 重置属性:level>0时清除强化(属性>0则置0),level<0时清除弱化(属性<0则置0)
|
||||
// if (level > 0 && target.AttackValue.Prop[p] > 0) ||
|
||||
// (level < 0 && target.AttackValue.Prop[p] < 0) {
|
||||
// newValue = 0
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
|
||||
// switch opType {
|
||||
// case info.AbilityOpType.StealStrengthen:
|
||||
// // 窃取强化:获取对手的强化属性并转移到自身
|
||||
// oppProp := target.Opp.AttackValue.Prop[prop]
|
||||
// if oppProp <= 0 { // 对手无强化,无法窃取
|
||||
// return false
|
||||
// }
|
||||
// // 尝试添加对手的强化值到自身
|
||||
// if calcNewValue(prop, oppProp, info.AbilityOpType.ADD) {
|
||||
// target.AttackValue.Prop[prop] = newValue
|
||||
// // 窃取后清除对手的强化
|
||||
// target.Opp.SetProp(source, prop, 1, info.AbilityOpType.RESET)
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
|
||||
// case info.AbilityOpType.Reverse:
|
||||
// currentProp := target.AttackValue.Prop[prop]
|
||||
// if level > 0 { // 反转强化(仅当有强化时生效:+N → -N,需扣除2*N)
|
||||
// if currentProp <= 0 {
|
||||
// return false
|
||||
// }
|
||||
// // 强化反转:调整量为-2*currentProp(从+N到-N需要减少2N),用SUB操作
|
||||
// adjustLevel := -2 * currentProp
|
||||
// if calcNewValue(prop, adjustLevel, info.AbilityOpType.SUB) {
|
||||
// target.AttackValue.Prop[prop] = newValue
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// } else { // 反转弱化(仅当有弱化时生效:-N → +N,需增加2*N)
|
||||
// if currentProp >= 0 {
|
||||
// return false
|
||||
// }
|
||||
// // 弱化反转:调整量为-2*currentProp(从-N到+N需要增加2N),用ADD操作
|
||||
// adjustLevel := -2 * currentProp
|
||||
// if calcNewValue(prop, adjustLevel, info.AbilityOpType.ADD) {
|
||||
// target.AttackValue.Prop[prop] = newValue
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
|
||||
// case info.AbilityOpType.BounceWeaken:
|
||||
// // 反弹弱化:将自身弱化转移给对手并清除自身弱化
|
||||
// currentProp := target.AttackValue.Prop[prop]
|
||||
// if currentProp >= 0 { // 无弱化可反弹
|
||||
// return false
|
||||
// }
|
||||
// // 向对手施加同等弱化
|
||||
// if target.Opp.SetProp(source, prop, currentProp, info.AbilityOpType.SUB) {
|
||||
// // 清除自身弱化
|
||||
// target.SetProp(source, prop, -1, info.AbilityOpType.RESET)
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
|
||||
// case info.AbilityOpType.COPY:
|
||||
// // 复制对手属性:将对手的强化/弱化值叠加到自身(遵守上下限)
|
||||
// oppProp := target.Opp.AttackValue.Prop[prop] // 对手的属性值(可正可负)
|
||||
// currentProp := target.AttackValue.Prop[prop] // 自身当前属性值
|
||||
|
||||
// // 1. 计算叠加后的目标值(自身+对手)
|
||||
// targetProp := currentProp + oppProp
|
||||
|
||||
// // 2. 限制目标值在 [-6, 6] 范围内
|
||||
// if targetProp > 6 {
|
||||
// targetProp = 6
|
||||
// } else if targetProp < -6 {
|
||||
// targetProp = -6
|
||||
// }
|
||||
|
||||
// // 3. 若目标值与当前值一致,无需操作
|
||||
// if targetProp == currentProp {
|
||||
// return false
|
||||
// }
|
||||
|
||||
// // 4. 根据目标值与当前值的差异,选择 ADD 或 SUB 操作叠加
|
||||
// if targetProp > currentProp {
|
||||
// // 目标值更高:用 ADD 操作提升(调整量为差值)
|
||||
// adjustLevel := targetProp - currentProp
|
||||
// return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.ADD)
|
||||
// } else {
|
||||
// // 目标值更低:用 SUB 操作降低(调整量为差值的绝对值)
|
||||
// adjustLevel := currentProp - targetProp
|
||||
// return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.SUB)
|
||||
// }
|
||||
|
||||
// default:
|
||||
// // 处理常规操作(ADD/SUB/RESET)
|
||||
// if calcNewValue(prop, level, opType) {
|
||||
// target.AttackValue.Prop[prop] = newValue
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -2,7 +2,6 @@ package node
|
||||
|
||||
import (
|
||||
element "blazing/common/data/Element"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"sync"
|
||||
|
||||
@@ -121,7 +120,7 @@ func (e *EffectNode) AttackTime(*input.Input, *input.Input) bool {
|
||||
return true
|
||||
|
||||
}
|
||||
func (e *EffectNode) PropBefer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool {
|
||||
func (e *EffectNode) PropBefer(in *input.Input, prop int8, level int8) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user