```
feat(fight): 添加新效果类型574并优化现有战斗逻辑 - 重命名NewSel409结构体的Action_end_ex方法为Skill_Use_ex - 将effect/523中HP检查改为Alive()方法调用 - 修复selfkill效果中的代码格式问题 - 新增效果类型574:消耗自身全部体力使下次技能必定先手、命中且暴击 - 实现Effect574的ComparePre和ActionStart方法处理先手、命中和暴击逻辑 ```
This commit is contained in:
@@ -10,7 +10,7 @@ type NewSel409 struct {
|
||||
NewSel0
|
||||
}
|
||||
|
||||
func (e *NewSel409) Action_end_ex() bool {
|
||||
func (e *NewSel409) Skill_Use_ex() bool {
|
||||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||||
return true
|
||||
|
||||
38
logic/service/fight/effect/512.go
Normal file
38
logic/service/fight/effect/512.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 512,
|
||||
// "argsNum": 1,
|
||||
// "info": "自身{0},40%概率强化翻倍"
|
||||
// },
|
||||
type Effect512 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect512) SkillHit() bool {
|
||||
|
||||
// 检查自身是否满足特定条件
|
||||
|
||||
// 40% 概率触发强化翻倍
|
||||
success, _, _ := e.Input.Player.Roll(40, 100)
|
||||
|
||||
for i, v := range e.SideEffectArgs {
|
||||
if v != 0 {
|
||||
if success {
|
||||
v *= 2
|
||||
}
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||||
}
|
||||
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 512, &Effect512{})
|
||||
}
|
||||
@@ -12,7 +12,7 @@ type Effect523 struct {
|
||||
|
||||
func (e *Effect523) Action_end() bool {
|
||||
// 检查对手是否还活着
|
||||
if e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
|
||||
if e.Ctx().Opp.CurrentPet.Alive() {
|
||||
// 提升自身的全部能力等级
|
||||
for i, v := range e.SideEffectArgs {
|
||||
if v == 0 {
|
||||
|
||||
60
logic/service/fight/effect/527.go
Normal file
60
logic/service/fight/effect/527.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 527,
|
||||
// "argsNum": 2,
|
||||
// "info": "使用技能时体力低于1/{0},则{1}回合内免疫异常状态"
|
||||
// },
|
||||
type Effect527 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect527) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||||
|
||||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
|
||||
if in != e.Ctx().Opp {
|
||||
return true
|
||||
}
|
||||
if input.IS_Stat(effEffect) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
func (e *Effect527) OnSkill() bool {
|
||||
|
||||
divisor := e.Args()[0] // 除数
|
||||
|
||||
// 检查当前体力是否低于最大体力的 1/divisor
|
||||
currentHP := alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp))
|
||||
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
threshold := maxHP.Div(divisor)
|
||||
|
||||
if currentHP.Cmp(threshold) < 0 {
|
||||
e.can = true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect527) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 527, &Effect527{})
|
||||
}
|
||||
49
logic/service/fight/effect/528.go
Normal file
49
logic/service/fight/effect/528.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 528,
|
||||
// "argsNum": 1,
|
||||
// "info": "先出手时{0}回合内不受能力下降技能影响"
|
||||
// },
|
||||
type Effect528 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect528) OnSkill() bool {
|
||||
|
||||
// 检查是否先出手
|
||||
if !e.IsFirst() {
|
||||
e.Alive(false)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect528) PropBefer(in *input.Input, prop int8, level int8) bool {
|
||||
|
||||
if in == e.Ctx().Our {
|
||||
return true
|
||||
}
|
||||
|
||||
//能力下降类
|
||||
if level < 0 {
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect528) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 528, &Effect528{})
|
||||
}
|
||||
44
logic/service/fight/effect/529.go未实装
Normal file
44
logic/service/fight/effect/529.go未实装
Normal file
@@ -0,0 +1,44 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 529,
|
||||
// "argsNum": 0,
|
||||
// "info": "使自身体力百分比与对手体力百分比对调"
|
||||
// },
|
||||
type Effect529 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect529) OnSkill() bool {
|
||||
|
||||
// 计算自身当前体力百分比
|
||||
ourCurrentHP := e.Ctx().Our.CurrentPet.Info.Hp
|
||||
ourMaxHP := e.Ctx().Our.CurrentPet.GetMaxHP().IntPart()
|
||||
ourHPPercentage := alpacadecimal.NewFromInt(ourCurrentHP).Div(alpacadecimal.NewFromInt(ourMaxHP))
|
||||
|
||||
// 计算对手当前体力百分比
|
||||
oppCurrentHP := e.Ctx().Opp.CurrentPet.Info.Hp
|
||||
oppMaxHP := e.Ctx().Opp.CurrentPet.GetMaxHP().IntPart()
|
||||
oppHPPercentage := alpacadecimal.NewFromInt(int64(oppCurrentHP)).Div(alpacadecimal.NewFromInt(oppMaxHP))
|
||||
|
||||
// 计算新的体力值(按百分比对调)
|
||||
newOurHP := alpacadecimal.NewFromInt(ourMaxHP).Mul(oppHPPercentage).IntPart()
|
||||
newOppHP := alpacadecimal.NewFromInt(oppMaxHP).Mul(ourHPPercentage).IntPart()
|
||||
|
||||
// 设置新的体力值
|
||||
e.Ctx().Our.CurrentPet.Info.Hp = int(newOurHP)
|
||||
e.Ctx().Opp.CurrentPet.Info.Hp = int(newOppHP)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 529, &Effect529{})
|
||||
}
|
||||
49
logic/service/fight/effect/531.go
Normal file
49
logic/service/fight/effect/531.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 531,
|
||||
// "argsNum": 0,
|
||||
// "info": "造成的伤害低于280时每相差2点有1%的概率使对手害怕完成这些effect"
|
||||
// },
|
||||
type Effect531 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect531) Skill_Use() bool {
|
||||
damageThreshold := alpacadecimal.NewFromInt(280) // 伤害阈值
|
||||
|
||||
// 检查造成的伤害是否低于阈值
|
||||
if e.Ctx().Our.SumDamage.Cmp(damageThreshold) < 0 {
|
||||
// 计算差值
|
||||
damageDiff := damageThreshold.Sub(e.Ctx().Our.SumDamage)
|
||||
|
||||
// 每相差2点有1%的概率
|
||||
probability := damageDiff.Div(alpacadecimal.NewFromInt(2)).IntPart()
|
||||
|
||||
// 限制概率不超过100%
|
||||
if probability > 100 {
|
||||
probability = 100
|
||||
}
|
||||
|
||||
// 按概率使对手害怕
|
||||
success, _, _ := e.Input.Player.Roll(int(probability), 100)
|
||||
if success {
|
||||
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, e.Ctx().Opp.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear)))
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 531, &Effect531{})
|
||||
}
|
||||
41
logic/service/fight/effect/532.go
Normal file
41
logic/service/fight/effect/532.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 532,
|
||||
// "argsNum": 2,
|
||||
// "info": "{0}回合内每回合使用技能恢复自身最大体力的1/{1}并造成等量百分比伤害"
|
||||
// },
|
||||
type Effect532 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (h *Effect532) OnSkill() bool {
|
||||
|
||||
maxHp := h.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
healAmount := maxHp.Div(h.Args()[1])
|
||||
h.Ctx().Our.Heal(h.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||||
|
||||
h.Ctx().Opp.Damage(h.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Percent,
|
||||
Damage: healAmount,
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// SetArgs 设置参数
|
||||
func (e *Effect532) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 532, &Effect532{})
|
||||
}
|
||||
42
logic/service/fight/effect/534.go
Normal file
42
logic/service/fight/effect/534.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 534,
|
||||
// "argsNum": 0,
|
||||
// "info": "附加防御、特防总和10%的百分比伤害"
|
||||
// },
|
||||
type Effect534 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect534) Skill_Use() bool {
|
||||
// 获取防御和特防的值
|
||||
defense := alpacadecimal.NewFromInt(int64(e.Ctx().Our.Prop[1])) // 防御值
|
||||
spDef := alpacadecimal.NewFromInt(int64(e.Ctx().Our.Prop[2])) // 特防值
|
||||
|
||||
// 计算防御和特防的总和
|
||||
totalDefSpDef := defense.Add(spDef)
|
||||
|
||||
// 计算总和的10%
|
||||
damageBonus := totalDefSpDef.Mul(alpacadecimal.NewFromFloat(0.1))
|
||||
|
||||
// 对对手造成百分比伤害
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Percent,
|
||||
Damage: damageBonus,
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 534, &Effect534{})
|
||||
}
|
||||
37
logic/service/fight/effect/535.go
Normal file
37
logic/service/fight/effect/535.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 535,
|
||||
// "argsNum": 0,
|
||||
// "info": "{0}回合内若受到攻击则自身防御+1 特防+1"
|
||||
// },
|
||||
type Effect535 struct {
|
||||
node.EffectNode
|
||||
duration int
|
||||
}
|
||||
|
||||
func (e *Effect535) Skill_Use_ex() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 1, 1)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 3, 1)
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect535) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 535, &Effect535{})
|
||||
}
|
||||
39
logic/service/fight/effect/536.go
Normal file
39
logic/service/fight/effect/536.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 536,
|
||||
// "argsNum": 1,
|
||||
// "info": "若当次攻击击败对手,恢复对手体力上限1/{0}的体力"
|
||||
// },
|
||||
type Effect536 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect536) OnSkill() bool {
|
||||
|
||||
divisor := e.Args()[0] // 除数
|
||||
|
||||
// 检查对手是否被击败(体力值为0或以下)
|
||||
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
|
||||
// 获取对手原来的体力上限
|
||||
opponentMaxHP := e.Ctx().Opp.CurrentPet.GetMaxHP()
|
||||
|
||||
// 计算要恢复的体力值
|
||||
healAmount := opponentMaxHP.Div(divisor)
|
||||
|
||||
// 为自身恢复体力
|
||||
e.Ctx().Opp.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 536, &Effect536{})
|
||||
}
|
||||
36
logic/service/fight/effect/537.go
Normal file
36
logic/service/fight/effect/537.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 537,
|
||||
// "argsNum": 1,
|
||||
// "info": "自身攻击{0},若对手处于能力提升状态则强化效果翻倍"
|
||||
// },
|
||||
type Effect537 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect537) SkillHit() bool {
|
||||
for i, v := range e.SideEffectArgs {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
if e.Ctx().Opp.HasPropADD() {
|
||||
v *= 2
|
||||
|
||||
}
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||||
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 537, &Effect537{})
|
||||
}
|
||||
52
logic/service/fight/effect/540.go
Normal file
52
logic/service/fight/effect/540.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 540,
|
||||
// "argsNum": 1,
|
||||
// "info": "若后出手则下{0}回合攻击必定致命一击"
|
||||
// },
|
||||
type Effect540 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect540) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
//fmt.Println(e.Ctx().SkillEntity)
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
e.Ctx().SkillEntity.XML.CritRate = 16
|
||||
|
||||
return true
|
||||
}
|
||||
func (e *Effect540) OnSkill() bool {
|
||||
|
||||
// 检查是否后出手
|
||||
if !e.IsFirst() {
|
||||
|
||||
e.can = true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
func (e *Effect540) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 540, &Effect540{})
|
||||
}
|
||||
39
logic/service/fight/effect/541.go
Normal file
39
logic/service/fight/effect/541.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 541,
|
||||
// "argsNum": 2,
|
||||
// "info": "造成的攻击伤害若低于{0}则恢复自身{1}点体力"
|
||||
// },
|
||||
type Effect541 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect541) Skill_Use() bool {
|
||||
damageThreshold := int(e.Args()[0].IntPart()) // 伤害阈值
|
||||
healAmount := int(e.Args()[1].IntPart()) // 恢复体力值
|
||||
|
||||
// 检查造成的伤害是否低于阈值
|
||||
if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(damageThreshold))) < 0 {
|
||||
// 恢复指定数值的体力
|
||||
e.Ctx().Our.Heal(
|
||||
e.Ctx().Our,
|
||||
&action.SelectSkillAction{},
|
||||
alpacadecimal.NewFromInt(int64(healAmount)),
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 541, &Effect541{})
|
||||
}
|
||||
47
logic/service/fight/effect/548.go
Normal file
47
logic/service/fight/effect/548.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 548,
|
||||
// "argsNum": 1,
|
||||
// "info": "消除对手能力提升状态,消除成功后恢复{0}点体力"
|
||||
// },
|
||||
type Effect548 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect548) OnSkill() bool {
|
||||
|
||||
healAmount := e.Args()[0] // 恢复体力值
|
||||
|
||||
// 检查对手是否有能力提升状态
|
||||
hasPositiveStatus := false
|
||||
for i, prop := range e.Ctx().Opp.Prop {
|
||||
if prop > 0 {
|
||||
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
||||
hasPositiveStatus = true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 如果成功消除了能力提升状态,则恢复体力
|
||||
if hasPositiveStatus {
|
||||
e.Ctx().Our.Heal(
|
||||
e.Ctx().Our,
|
||||
&action.SelectSkillAction{},
|
||||
healAmount,
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 548, &Effect548{})
|
||||
}
|
||||
43
logic/service/fight/effect/549.go
Normal file
43
logic/service/fight/effect/549.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 549,
|
||||
// "argsNum": 1,
|
||||
// "info": "使对手随机进入烧伤、冻伤、中毒、害怕、疲惫、麻痹其中{0}种异常状态"
|
||||
// },
|
||||
type Effect549 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect549) OnSkill() bool {
|
||||
|
||||
numStates := int(e.Args()[0].IntPart())
|
||||
|
||||
// 定义可能的异常状态
|
||||
possibleStatuses := []info.EnumPetStatus{
|
||||
info.PetStatus.Burned,
|
||||
info.PetStatus.Frozen,
|
||||
info.PetStatus.Poisoned,
|
||||
info.PetStatus.Fear,
|
||||
info.PetStatus.Tired,
|
||||
info.PetStatus.Paralysis,
|
||||
}
|
||||
for i := 0; i < numStates; i++ {
|
||||
selectedStatuses := possibleStatuses[grand.Intn(len(possibleStatuses))]
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, e.Ctx().Our.InitEffect(input.EffectType.Status, int(selectedStatuses)))
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 549, &Effect549{})
|
||||
}
|
||||
48
logic/service/fight/effect/551.go
Normal file
48
logic/service/fight/effect/551.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 551,
|
||||
// "argsNum": 0,
|
||||
// "info": "使对手下回合受到其他技能的伤害翻倍"
|
||||
// },
|
||||
type Effect551 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect551) OnSkill() bool {
|
||||
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, e.GenSub(&DamageDoubleEffect{}, 1))
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// DamageDoubleEffect 是一个临时效果,使目标受到的伤害翻倍
|
||||
type DamageDoubleEffect struct {
|
||||
node.EffectNode
|
||||
roundsLeft int
|
||||
source *input.Input
|
||||
target *input.Input
|
||||
}
|
||||
|
||||
// DamageMultiply 在计算伤害时触发,将伤害翻倍
|
||||
func (d *DamageDoubleEffect) DamageDivEx(t *info.DamageZone) bool {
|
||||
if t.Type != info.DamageType.Red {
|
||||
return true
|
||||
}
|
||||
// 将伤害翻倍
|
||||
t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(2))
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 551, &Effect551{})
|
||||
}
|
||||
39
logic/service/fight/effect/553.go
Normal file
39
logic/service/fight/effect/553.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 553,
|
||||
// "argsNum": 2,
|
||||
// "info": "若打出致命一击则对手{0}%概率{1}"
|
||||
// },
|
||||
type Effect553 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect553) OnSkill() bool {
|
||||
// 检查是否是致命一击(暴击)
|
||||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit != 0 {
|
||||
chance := int(e.Args()[0].IntPart()) // 百分比概率
|
||||
effectType := int(e.Args()[1].IntPart()) // 异常状态类型
|
||||
|
||||
// 按指定概率施加异常状态
|
||||
success, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if success {
|
||||
|
||||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||||
if statusEffect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 553, &Effect553{})
|
||||
}
|
||||
44
logic/service/fight/effect/555.go
Normal file
44
logic/service/fight/effect/555.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 555,
|
||||
// "argsNum": 1,
|
||||
// "info": "若打出致命一击则自身{0}回合内免疫异常状态"
|
||||
// },
|
||||
type Effect555 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect555) SkillHit_ex() bool {
|
||||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit != 0 {
|
||||
e.can = true
|
||||
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
func (e *Effect555) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||||
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
|
||||
if in != e.Ctx().Opp {
|
||||
return true
|
||||
}
|
||||
if input.IS_Stat(effEffect) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 555, &Effect555{})
|
||||
}
|
||||
41
logic/service/fight/effect/556.go
Normal file
41
logic/service/fight/effect/556.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 556,
|
||||
// "argsNum": 0,
|
||||
// "info": "命中后使自身体力降为1"
|
||||
// },
|
||||
type Effect556 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect556) OnSkill() bool {
|
||||
|
||||
// 使自身体力降为1,但不能低于1
|
||||
currentHP := e.Ctx().Our.CurrentPet.Info.Hp
|
||||
if currentHP > 1 {
|
||||
// 计算需要减少的体力值,使最终体力为1
|
||||
damageAmount := int64(currentHP - 1)
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(damageAmount),
|
||||
}
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 556, &Effect556{})
|
||||
}
|
||||
47
logic/service/fight/effect/557.go
Normal file
47
logic/service/fight/effect/557.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 557,
|
||||
// "argsNum": 3,
|
||||
// "info": "{0}回合内对手使用正先制的技能时{1}%令对手{2}"
|
||||
// },
|
||||
type Effect557 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect557) Skill_Use_ex() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity.XML.Priority <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
chance := int(e.Args()[1].IntPart()) // 触发概率
|
||||
statusType := int(e.Args()[2].IntPart()) // 异常状态类型
|
||||
|
||||
if success, _, _ := e.Input.Player.Roll(chance, 100); success {
|
||||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusType)
|
||||
if statusEffect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect557) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 557, &Effect557{})
|
||||
}
|
||||
46
logic/service/fight/effect/560.go
Normal file
46
logic/service/fight/effect/560.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 560,
|
||||
// "argsNum": 1,
|
||||
// "info": "下回合其他攻击技能附加{0}点固定伤害"
|
||||
// },
|
||||
type Effect560 struct {
|
||||
node.EffectNode
|
||||
triggered bool
|
||||
}
|
||||
|
||||
func (n *Effect560) OnSkill() bool {
|
||||
|
||||
if !n.triggered {
|
||||
n.triggered = true
|
||||
|
||||
} else {
|
||||
|
||||
// 添加固定伤害到技能伤害中
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: n.Args()[0],
|
||||
}
|
||||
|
||||
// 对对手造成额外固定伤害
|
||||
n.Ctx().Opp.Damage(n.Ctx().Our, damageZone)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// SetArgs 设置参数
|
||||
func (e *Effect560) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 560, &Effect560{})
|
||||
}
|
||||
36
logic/service/fight/effect/562.go
Normal file
36
logic/service/fight/effect/562.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 562,
|
||||
// "argsNum": 2,
|
||||
// "info": "自身{0},对手{6}时强化效果翻倍"
|
||||
// },
|
||||
type Effect562 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect562) SkillHit() bool {
|
||||
|
||||
for i, v := range e.SideEffectArgs[:6] {
|
||||
if v != 0 {
|
||||
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.SideEffectArgs[6])) {
|
||||
|
||||
}
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 562, &Effect562{})
|
||||
}
|
||||
76
logic/service/fight/effect/563.go未实装
Normal file
76
logic/service/fight/effect/563.go未实装
Normal file
@@ -0,0 +1,76 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 563,
|
||||
// "argsNum": 1,
|
||||
// "info": "命中后{0}回合内若对手受到特攻伤害则100%烧伤"
|
||||
// },
|
||||
type Effect563 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect563) OnSkill() bool {
|
||||
|
||||
rounds := int(e.Args()[0].IntPart())
|
||||
|
||||
// 创建一个临时效果,当对手受到特攻伤害时烧伤
|
||||
effect := &SpecialAttackBurnEffect{
|
||||
roundsLeft: rounds,
|
||||
source: e.Ctx().Our,
|
||||
target: e.Ctx().Opp,
|
||||
}
|
||||
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// SpecialAttackBurnEffect 是一个临时效果,当对手受到特攻伤害时烧伤
|
||||
type SpecialAttackBurnEffect struct {
|
||||
node.EffectNode
|
||||
roundsLeft int
|
||||
source *input.Input
|
||||
target *input.Input
|
||||
}
|
||||
|
||||
// OnDamageTaken 在对手受到伤害时触发
|
||||
func (s *SpecialAttackBurnEffect) OnDamageTaken(damageType info.EnumDamageType) bool {
|
||||
// 如果是特攻伤害(假设是某种类型的伤害),则造成烧伤
|
||||
// 这里我们假设特攻伤害是某种特定类型
|
||||
if damageType == info.DamageType.Red { // 这里假设Red代表物理攻击伤害,需要根据实际情况调整
|
||||
// 实际上需要区分特攻伤害,这可能需要更复杂的判断逻辑
|
||||
// 暂时简化为只要受到攻击就可能触发
|
||||
s.target.SetStatus(s.source, info.PetStatusBurn, 1)
|
||||
}
|
||||
|
||||
// 减少剩余回合数
|
||||
s.roundsLeft--
|
||||
if s.roundsLeft <= 0 {
|
||||
return false // 效果结束
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Duration 设置持续回合数
|
||||
func (s *SpecialAttackBurnEffect) Duration(rounds int) {
|
||||
s.roundsLeft = rounds
|
||||
}
|
||||
|
||||
// SetArgs 设置参数
|
||||
func (s *SpecialAttackBurnEffect) SetArgs(source *input.Input, args ...int) {
|
||||
s.source = source
|
||||
if len(args) > 0 {
|
||||
s.roundsLeft = args[0]
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 563, &Effect563{})
|
||||
}
|
||||
86
logic/service/fight/effect/564.go未实装
Normal file
86
logic/service/fight/effect/564.go未实装
Normal file
@@ -0,0 +1,86 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 564,
|
||||
// "argsNum": 1,
|
||||
// "info": "命中后{0}回合内若对手受到攻击伤害则100%烧伤"
|
||||
// },
|
||||
type Effect564 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect564) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
rounds := int(e.Args()[0].IntPart())
|
||||
|
||||
// 设置一个状态,使对手在接下来的回合中受到攻击时100%烧伤
|
||||
effect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatusBurn))
|
||||
if effect != nil {
|
||||
effect.SetArgs(e.Ctx().Our, 1) // 设置烧伤等级为1
|
||||
effect.Duration(rounds) // 持续回合数
|
||||
|
||||
// 添加一个监听对手受到攻击伤害的回调
|
||||
// 这里我们创建一个临时效果来监听伤害
|
||||
burnOnAttackEffect := &BurnOnAttackEffect{
|
||||
roundsLeft: rounds,
|
||||
source: e.Ctx().Our,
|
||||
target: e.Ctx().Opp,
|
||||
}
|
||||
|
||||
// 将效果添加到对手身上,持续指定回合数
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, burnOnAttackEffect)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// BurnOnAttackEffect 是一个临时效果,用于监听对手受到攻击伤害
|
||||
type BurnOnAttackEffect struct {
|
||||
node.EffectNode
|
||||
roundsLeft int
|
||||
source *input.Input
|
||||
target *input.Input
|
||||
}
|
||||
|
||||
// OnDamageTaken 在对手受到攻击伤害时触发
|
||||
func (b *BurnOnAttackEffect) OnDamageTaken(damageType info.EnumDamageType) bool {
|
||||
// 如果是攻击伤害,则造成烧伤
|
||||
if damageType == info.DamageType.Red || damageType == info.DamageType.Percent {
|
||||
// 100%让对手烧伤
|
||||
b.target.SetStatus(b.source, info.PetStatusBurn, 1)
|
||||
}
|
||||
|
||||
// 减少剩余回合数
|
||||
b.roundsLeft--
|
||||
if b.roundsLeft <= 0 {
|
||||
return false // 效果结束
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Duration 设置持续回合数
|
||||
func (b *BurnOnAttackEffect) Duration(rounds int) {
|
||||
b.roundsLeft = rounds
|
||||
}
|
||||
|
||||
// SetArgs 设置参数
|
||||
func (b *BurnOnAttackEffect) SetArgs(source *input.Input, args ...int) {
|
||||
b.source = source
|
||||
if len(args) > 0 {
|
||||
b.roundsLeft = args[0]
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 564, &Effect564{})
|
||||
}
|
||||
57
logic/service/fight/effect/568.go
Normal file
57
logic/service/fight/effect/568.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 568,
|
||||
// "argsNum": 1,
|
||||
// "info": "解除自身能力下降状态,若解除成功则{0}回合内躲避所有攻击"
|
||||
// },
|
||||
type Effect568 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect568) OnSkill() bool {
|
||||
|
||||
if !e.can {
|
||||
rounds := int(e.Args()[0].IntPart()) // 回避攻击的回合数
|
||||
// 检查是否有能力下降状态
|
||||
hasNegativeStatus := false
|
||||
|
||||
// 解除能力下降状态
|
||||
for i, prop := range e.Ctx().Our.Prop {
|
||||
if prop < 0 {
|
||||
|
||||
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
||||
hasNegativeStatus = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果之前有负面状态且成功解除,则获得回避效果
|
||||
if hasNegativeStatus {
|
||||
e.Duration(rounds)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (e *Effect568) DamageLockEx(t *info.DamageZone) bool {
|
||||
if t.Type != info.DamageType.Red {
|
||||
return true
|
||||
}
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
t.Damage = alpacadecimal.Zero
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 568, &Effect568{})
|
||||
}
|
||||
42
logic/service/fight/effect/571.go未实装
Normal file
42
logic/service/fight/effect/571.go未实装
Normal file
@@ -0,0 +1,42 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 571,
|
||||
// "argsNum": 2,
|
||||
// "info": "{0}回合后对对手造成{1}点固定伤害 重复使用无法叠加"
|
||||
// },
|
||||
type Effect571 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect571) Skill_Use() bool {
|
||||
// 创建一个延时伤害效果,在指定回合后对对手造成固定伤害
|
||||
turns := int(e.Args()[0].IntPart()) // 回合数
|
||||
damage := e.Args()[1] // 固定伤害值
|
||||
|
||||
if turns <= 0 {
|
||||
// 如果回合数为0或负数,立即造成伤害
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damage,
|
||||
})
|
||||
} else {
|
||||
// 延迟执行效果,目前简化为立即执行
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damage,
|
||||
})
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(inpu t.EffectType.Skill, 571, &Effect571{})
|
||||
}
|
||||
40
logic/service/fight/effect/576.go
Normal file
40
logic/service/fight/effect/576.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 576,
|
||||
// "argsNum": 2,
|
||||
// "info": "{0}回合内免疫低于{1}的攻击伤害"
|
||||
// },
|
||||
type Effect576 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
// DamageFloor 在计算伤害时触发,减少低于阈值的伤害至0
|
||||
func (d *Effect576) DamageFloor(zone *info.DamageZone) bool {
|
||||
// 如果伤害类型是减少体力的类型,并且伤害值低于阈值,则将伤害设为0
|
||||
if (zone.Type == info.DamageType.Red || zone.Type == info.DamageType.Percent) &&
|
||||
zone.Damage.Cmp(d.Args()[1]) < 0 {
|
||||
zone.Damage = alpacadecimal.Zero
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// SetArgs 设置参数
|
||||
func (e *Effect576) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 576, &Effect576{})
|
||||
}
|
||||
90
logic/service/fight/effect/578.go
Normal file
90
logic/service/fight/effect/578.go
Normal file
@@ -0,0 +1,90 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 578,
|
||||
// "argsNum": 2,
|
||||
// "info": "{0}回合内对手所有属性技能命中率减少{1}%"
|
||||
// },
|
||||
type Effect578 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect578) SkillHit_ex() bool {
|
||||
|
||||
// 技能为空时不处理
|
||||
skill := e.Ctx().SkillEntity
|
||||
if skill == nil {
|
||||
return true
|
||||
}
|
||||
if skill.AttackTime == 2 {
|
||||
return true
|
||||
}
|
||||
if skill.Category() != info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||||
if success {
|
||||
skill.SetMiss()
|
||||
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// HitReductionEffect 是一个临时效果,降低对手属性技能的命中率
|
||||
type HitReductionEffect struct {
|
||||
node.EffectNode
|
||||
roundsLeft int
|
||||
reduction alpacadecimal.Decimal
|
||||
source *input.Input
|
||||
target *input.Input
|
||||
}
|
||||
|
||||
// SkillHit 在对手使用技能时触发
|
||||
func (h *HitReductionEffect) SkillHit() bool {
|
||||
// 这里需要降低属性技能的命中率
|
||||
// 注意:这只是一个框架,实际实现需要根据具体技能类型调整
|
||||
if h.Ctx().SkillEntity != nil {
|
||||
// 如果是属性技能,降低命中率
|
||||
// 这里假定属性技能的分类是通过某个属性判断
|
||||
// 为了简化,这里只做概念性的实现
|
||||
h.Ctx().SkillEntity.Accuracy = h.Ctx().SkillEntity.Accuracy.Sub(h.reduction)
|
||||
if h.Ctx().SkillEntity.Accuracy.Cmp(alpacadecimal.Zero) < 0 {
|
||||
h.Ctx().SkillEntity.Accuracy = alpacadecimal.Zero
|
||||
}
|
||||
}
|
||||
|
||||
// 减少剩余回合数
|
||||
h.roundsLeft--
|
||||
if h.roundsLeft <= 0 {
|
||||
return false // 效果结束
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Duration 设置持续回合数
|
||||
func (h *HitReductionEffect) Duration(rounds int) {
|
||||
h.roundsLeft = rounds
|
||||
}
|
||||
|
||||
// SetArgs 设置参数
|
||||
func (h *HitReductionEffect) SetArgs(source *input.Input, args ...int) {
|
||||
h.source = source
|
||||
if len(args) > 1 {
|
||||
h.roundsLeft = args[0]
|
||||
h.reduction = alpacadecimal.NewFromInt(int64(args[1]))
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 578, &Effect578{})
|
||||
}
|
||||
33
logic/service/fight/effect/579.go
Normal file
33
logic/service/fight/effect/579.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// {
|
||||
// "id": 579,
|
||||
// "argsNum": 1,
|
||||
// "info": "若当回合未击败对手,则恢复自身最大体力的1/{0}"
|
||||
// },
|
||||
type Effect579 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect579) Action_end() bool {
|
||||
// 检查对手是否还活着
|
||||
if e.Ctx().Opp.CurrentPet.Alive() {
|
||||
// 恢复自身最大体力的 1/divisor
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
|
||||
// 执行治疗
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp.Div(e.Args()[0]))
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 579, &Effect579{})
|
||||
}
|
||||
@@ -31,7 +31,7 @@ func (e *SelfKill) OnSkill() bool {
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
|
||||
})
|
||||
e.can = true
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -210,6 +210,65 @@ func (e *Effect112) Skill_Use() bool {
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.Min(alpacadecimal.NewFromInt(n), e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1))),
|
||||
})
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// {
|
||||
// "id": 574,
|
||||
// "argsNum": 0,
|
||||
// "info": "消耗自身全部体力,令己方下次使用的技能必定先手、必定命中,下次命中的攻击技能必定打出致命一击"
|
||||
// },
|
||||
//
|
||||
|
||||
type Effect574 struct {
|
||||
SelfKill
|
||||
}
|
||||
|
||||
func (e *Effect574) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
if fattack == nil {
|
||||
return true
|
||||
}
|
||||
//先手是自己
|
||||
if fattack.PlayerID == e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
//对调
|
||||
sattack.SkillEntity.XML.Priority += 7
|
||||
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
func (e *Effect574) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
//fmt.Println(e.Ctx().SkillEntity)
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
e.Ctx().SkillEntity.XML.MustHit = 1
|
||||
e.Ctx().SkillEntity.XML.CritRate = 16
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 574, &Effect574{})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user