This commit is contained in:
1
2025-11-17 19:31:51 +00:00
parent 27de997f92
commit c6d3b4788d
8 changed files with 79 additions and 88 deletions

View File

@@ -54,14 +54,11 @@ type Effect38_sub struct {
}
func (e *Effect38_sub) Alive(t ...bool) bool {
defer func() {
if len(t) > 0 {
if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.Info.MaxHp = e.oldtype
}
}
}()
if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.Info.MaxHp = e.oldtype
}
return e.EffectNode.Alive(t...)
}

View File

@@ -40,15 +40,13 @@ func (e *Effect45) SetArgs(t *input.Input, a ...int) {
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect45) Alive(t ...bool) bool {
defer func() {
if len(t) > 0 {
if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.Info.Prop[1] = e.oldtype
}
}
}()
if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.Info.Prop[1] = e.oldtype
}
return e.EffectNode.Alive(t...)
}

View File

@@ -14,17 +14,8 @@ type Effect51 struct {
oldtype uint32
}
func (e *Effect51) OnSkill() bool {
if !e.Hit() {
return true
}
return true
}
func (e *Effect51) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
if !e.Hit() {
return
}
e.oldtype = e.Ctx().Opp.CurrentPet.Info.Prop[0]
e.Ctx().Our.CurrentPet.Info.Prop[0] = e.Ctx().Opp.CurrentPet.Info.Prop[0]
}
@@ -40,16 +31,13 @@ func (e *Effect51) SetArgs(t *input.Input, a ...int) {
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect51) Alive(t ...bool) bool {
if !e.Hit() {
return e.EffectNode.Alive()
if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.Info.Prop[0] = e.oldtype
}
e.EffectNode.Alive(t...)
if len(t) > 0 {
if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.Info.Prop[0] = e.oldtype
}
}
return e.EffectNode.Alive()
return e.EffectNode.Alive(t...)
}

View File

@@ -13,17 +13,8 @@ type Effect55 struct {
node.EffectNode
}
func (e *Effect55) OnSkill() bool {
if !e.Hit() {
return true
}
return true
}
func (e *Effect55) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
if !e.Hit() {
return
}
e.Ctx().Our.CurrentPet.PetInfo.Type, e.Ctx().Opp.CurrentPet.PetInfo.Type = e.Ctx().Opp.CurrentPet.PetInfo.Type, e.Ctx().Our.CurrentPet.PetInfo.Type
}
func init() {
@@ -38,15 +29,13 @@ func (e *Effect55) SetArgs(t *input.Input, a ...int) {
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect55) Alive(t ...bool) bool {
if !e.Hit() {
return e.EffectNode.Alive()
if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.PetInfo.Type, e.Ctx().Opp.CurrentPet.PetInfo.Type = e.Ctx().Opp.CurrentPet.PetInfo.Type, e.Ctx().Our.CurrentPet.PetInfo.Type
}
e.EffectNode.Alive(t...)
if len(t) > 0 {
if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
e.Ctx().Our.CurrentPet.PetInfo.Type, e.Ctx().Opp.CurrentPet.PetInfo.Type = e.Ctx().Opp.CurrentPet.PetInfo.Type, e.Ctx().Our.CurrentPet.PetInfo.Type
}
}
return e.EffectNode.Alive()
return e.EffectNode.Alive(t...)
}

View File

@@ -14,17 +14,8 @@ type Effect56 struct {
oldtype int
}
func (e *Effect56) OnSkill() bool {
if !e.Hit() {
return true
}
return true
}
func (e *Effect56) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
if !e.Hit() {
return
}
e.oldtype = e.Ctx().Opp.CurrentPet.PetInfo.Type
e.Ctx().Our.CurrentPet.PetInfo.Type = e.Ctx().Opp.CurrentPet.PetInfo.Type
}
@@ -40,16 +31,13 @@ func (e *Effect56) SetArgs(t *input.Input, a ...int) {
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect56) Alive(t ...bool) bool {
if !e.Hit() {
return e.EffectNode.Alive()
if !e.GetBool(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.PetInfo.Type = e.oldtype
}
e.EffectNode.Alive(t...)
if len(t) > 0 {
if !t[0] { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
//还原属性
e.Ctx().Our.CurrentPet.PetInfo.Type = e.oldtype
}
}
return e.EffectNode.Alive()
return e.EffectNode.Alive(t...)
}

View File

@@ -33,9 +33,6 @@ func (e *Effect91) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect91) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
if !e.Hit() {
return
}
for i, v := range e.Ctx().Opp.Prop {

View File

@@ -73,22 +73,24 @@ func (target *Input) SetProp(source *Input, prop, level int8, opType info.EnumAb
case info.AbilityOpType.Reverse:
currentProp := target.AttackValue.Prop[prop]
if level > 0 { // 反转强化(仅当有强化时生效)
if level > 0 { // 反转强化(仅当有强化时生效+N → -N需扣除2*N
if currentProp <= 0 {
return false
}
// 强化反转:当前值currentProp → -currentProp调整量为-2*currentProp
if calcNewValue(prop, -2*currentProp, info.AbilityOpType.ADD) {
// 强化反转:调整量为-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 { // 反转弱化(仅当有弱化时生效)
} else { // 反转弱化(仅当有弱化时生效-N → +N需增加2*N
if currentProp >= 0 {
return false
}
// 弱化反转:当前值currentProp → -currentProp调整量为-2*currentProp
if calcNewValue(prop, -2*currentProp, info.AbilityOpType.ADD) {
// 弱化反转:调整量为-2*currentProp从-N到+N需要增加2N用ADD操作
adjustLevel := -2 * currentProp
if calcNewValue(prop, adjustLevel, info.AbilityOpType.ADD) {
target.AttackValue.Prop[prop] = newValue
return true
}
@@ -110,10 +112,35 @@ func (target *Input) SetProp(source *Input, prop, level int8, opType info.EnumAb
return false
case info.AbilityOpType.COPY:
// 复制对手属性:将自身属性调整为与对手一致(在范围内
oppProp := target.Opp.AttackValue.Prop[prop]
adjustLevel := oppProp - target.AttackValue.Prop[prop]
return target.SetProp(source, prop, adjustLevel, info.AbilityOpType.ADD)
// 复制对手属性:将对手的强化/弱化值叠加到自身(遵守上下限
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

View File

@@ -105,3 +105,10 @@ func (e *EffectNode) AttackTime(*input.Input, *input.Input) bool {
func (e *EffectNode) Prop_Befer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool {
return true
}
func (e *EffectNode) GetBool(t ...bool) bool {
if len(t) > 0 {
return t[0]
}
return false
}