战斗修改
This commit is contained in:
@@ -77,7 +77,7 @@ func StartServer() {
|
|||||||
// testjsonrpc()
|
// testjsonrpc()
|
||||||
// })
|
// })
|
||||||
|
|
||||||
err := http.ListenAndServe(rpcport, rpcServer)
|
err := http.ListenAndServe("0.0.0.0"+rpcport, rpcServer)
|
||||||
cool.Loger.Debug(context.Background(), "jsonrpc server fail", err)
|
cool.Loger.Debug(context.Background(), "jsonrpc server fail", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -184,3 +184,22 @@ func (h Controller) SetPetExp(data *pet.PetSetExpInboundInfo, c *player.Player)
|
|||||||
|
|
||||||
return &pet.PetSetExpOutboundInfo{}, 0
|
return &pet.PetSetExpOutboundInfo{}, 0
|
||||||
}
|
}
|
||||||
|
func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (result *pet.ChangeSkillOutInfo, err errorcode.ErrorCode) {
|
||||||
|
_, onpet, ok := FindWithIndex(c.Info.PetList, func(item model.PetInfo) bool {
|
||||||
|
return item.CatchTime == data.CatchTime
|
||||||
|
})
|
||||||
|
if ok {
|
||||||
|
for i := 0; i < 4; i++ {
|
||||||
|
if onpet.SkillList[i].ID == data.HasSkill {
|
||||||
|
onpet.SkillList[i].ID = data.ReplaceSkill
|
||||||
|
onpet.SkillList[i].PP = uint32(xmlres.SkillMap[int(onpet.SkillList[i].ID)].MaxPP)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return &pet.ChangeSkillOutInfo{
|
||||||
|
CatchTime: data.CatchTime,
|
||||||
|
}, 0
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ require (
|
|||||||
github.com/antlabs/stl v0.0.2 // indirect
|
github.com/antlabs/stl v0.0.2 // indirect
|
||||||
github.com/antlabs/timer v0.1.4 // indirect
|
github.com/antlabs/timer v0.1.4 // indirect
|
||||||
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df // indirect
|
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df // indirect
|
||||||
|
github.com/brunoga/deep v1.2.5 // indirect
|
||||||
github.com/butoften/array v1.0.9 // indirect
|
github.com/butoften/array v1.0.9 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||||
@@ -29,6 +30,7 @@ require (
|
|||||||
github.com/panjf2000/ants/v2 v2.11.3 // indirect
|
github.com/panjf2000/ants/v2 v2.11.3 // indirect
|
||||||
github.com/samber/lo v1.51.0 // indirect
|
github.com/samber/lo v1.51.0 // indirect
|
||||||
github.com/shopspring/decimal v1.4.0 // indirect
|
github.com/shopspring/decimal v1.4.0 // indirect
|
||||||
|
github.com/tiendc/go-deepcopy v1.7.1 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
go.uber.org/zap v1.27.0 // indirect
|
go.uber.org/zap v1.27.0 // indirect
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ github.com/badu/bus v1.0.3 h1:MViRRyuFraixfaI2rfAqrkQao7ZilyFz6HacbmPk1aE=
|
|||||||
github.com/badu/bus v1.0.3/go.mod h1:77qc3Fi2qSUoakSR34PIWrTHB6gM2NJKceRsYUbx41Q=
|
github.com/badu/bus v1.0.3/go.mod h1:77qc3Fi2qSUoakSR34PIWrTHB6gM2NJKceRsYUbx41Q=
|
||||||
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0=
|
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0=
|
||||||
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM=
|
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM=
|
||||||
|
github.com/brunoga/deep v1.2.5 h1:bigq4eooqbeJXfvTfZBn3AH3B1iW+rtetxVeh0GiLrg=
|
||||||
|
github.com/brunoga/deep v1.2.5/go.mod h1:GDV6dnXqn80ezsLSZ5Wlv1PdKAWAO4L5PnKYtv2dgaI=
|
||||||
github.com/butoften/array v1.0.9 h1:/kPHAc+fHz72u5B23p2W1RzIoT2eOYvhsY0tKMvsHEc=
|
github.com/butoften/array v1.0.9 h1:/kPHAc+fHz72u5B23p2W1RzIoT2eOYvhsY0tKMvsHEc=
|
||||||
github.com/butoften/array v1.0.9/go.mod h1:RgJ3XIUy/Z2rQllTkXmS4LtfqJeD3mjYJ4XoP3odTqM=
|
github.com/butoften/array v1.0.9/go.mod h1:RgJ3XIUy/Z2rQllTkXmS4LtfqJeD3mjYJ4XoP3odTqM=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
@@ -60,6 +62,8 @@ github.com/samber/lo v1.51.0 h1:kysRYLbHy/MB7kQZf5DSN50JHmMsNEdeY24VzJFu7wI=
|
|||||||
github.com/samber/lo v1.51.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
|
github.com/samber/lo v1.51.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
|
||||||
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
|
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
|
||||||
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
|
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
|
||||||
|
github.com/tiendc/go-deepcopy v1.7.1 h1:LnubftI6nYaaMOcaz0LphzwraqN8jiWTwm416sitff4=
|
||||||
|
github.com/tiendc/go-deepcopy v1.7.1/go.mod h1:4bKjNC2r7boYOkD2IOuZpYjmlDdzjbpTRyCx+goBCJQ=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package effect
|
package effect
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"blazing/logic/service/fight/action"
|
||||||
"blazing/logic/service/fight/info"
|
"blazing/logic/service/fight/info"
|
||||||
"blazing/logic/service/fight/input"
|
"blazing/logic/service/fight/input"
|
||||||
"blazing/logic/service/fight/node"
|
"blazing/logic/service/fight/node"
|
||||||
|
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,6 +26,8 @@ func init() {
|
|||||||
// 命中之后
|
// 命中之后
|
||||||
func (e *Effect1) OnHit(opp *input.Input, skill *info.SkillEntity) {
|
func (e *Effect1) OnHit(opp *input.Input, skill *info.SkillEntity) {
|
||||||
|
|
||||||
e.Input.CurrentPet.Info.Hp += uint32(e.Input.DamageZone.Attack / 2)
|
e.Input.Heal(
|
||||||
|
&action.SelectSkillAction{}, (e.Input.DamageZone.Damage.Div(decimal.NewFromInt(2))),
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ type Effect20 struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 使用技能时,不可被继承,继承Miss和Hit就行
|
// 使用技能时,不可被继承,继承Miss和Hit就行
|
||||||
func (e *Effect20) OnSkill(opp *input.Input, skill *info.SkillEntity) {
|
func (e *Effect20) OnSkill(input.Ctx) {
|
||||||
e.Input.AddEffect(input.Geteffect(input.EffectType.Status, int(info.PetStatus.Tired)))
|
e.Input.AddEffect(input.Geteffect(input.EffectType.Status, int(info.PetStatus.Tired)))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ func (e *Effect62) SetArgs(t *input.Input, a ...int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 因为对方切精灵,这个效果也要无效掉
|
// 因为对方切精灵,这个效果也要无效掉
|
||||||
func (this *Effect62) OnSwitchIn() bool {
|
func (this *Effect62) OnSwitchIn(input.Ctx) bool {
|
||||||
if this.Hide { //如果还在隐藏,就直接返回
|
if this.Hide { //如果还在隐藏,就直接返回
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package effect
|
package effect
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
"blazing/logic/service/fight/input"
|
"blazing/logic/service/fight/input"
|
||||||
"blazing/logic/service/fight/node"
|
"blazing/logic/service/fight/node"
|
||||||
)
|
)
|
||||||
@@ -22,19 +23,19 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 重写死亡,如果击败,就出触发死亡事件,判断是目标精灵
|
// 重写死亡,如果击败,就出触发死亡事件,判断是目标精灵
|
||||||
func (this *Effect67) OnDefeat() bool {
|
func (this *Effect67) OnDefeat(*input.Input, *info.SkillEntity) bool {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 登场是下一只 减少对方下次出战精灵的最大体力1/n
|
// 登场是下一只 减少对方下次出战精灵的最大体力1/n
|
||||||
func (this *Effect67) OnSwitchIn() bool {
|
func (this *Effect67) OnSwitchIn(input.Ctx) bool {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下场不消除buff
|
// 下场不消除buff
|
||||||
func (this *Effect67) OnSwitchOut() bool {
|
func (this *Effect67) OnSwitchOut(input.Ctx) bool {
|
||||||
//下场默认清除effect
|
//下场默认清除effect
|
||||||
panic("not implemented") // TODO: Implement
|
panic("not implemented") // TODO: Implement
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
input.InitEffect(input.EffectType.Skill, 9, &Effect8{
|
input.InitEffect(input.EffectType.Skill, 8, &Effect8{
|
||||||
EffectNode: node.EffectNode{},
|
EffectNode: node.EffectNode{},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -25,12 +25,11 @@ type Effect8 struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 伤害落实前触发,限制最大伤害
|
// 伤害落实前触发,限制最大伤害
|
||||||
func (e *Effect8) Attack(opp *input.Input, v *info.DamageZone) {
|
func (e *Effect8) Damage_Floor(ctx input.Ctx) bool {
|
||||||
|
if ctx.DamageZone.Type == info.DamageType.Red {
|
||||||
if v.Type == info.DamageType.Red {
|
ctx.DamageZone.Damage = decimal.NewFromInt(utils.Min(ctx.DamageZone.Damage.IntPart(), int64(ctx.Input.CurrentPet.Info.Hp)-1))
|
||||||
|
|
||||||
v.Damage = decimal.NewFromInt(utils.Min(v.Damage.IntPart(), int64(opp.CurrentPet.Info.Hp)-1))
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,15 @@ type DrainHP struct {
|
|||||||
|
|
||||||
func (e *DrainHP) OnTurnStart(opp *input.Input) {
|
func (e *DrainHP) OnTurnStart(opp *input.Input) {
|
||||||
|
|
||||||
e.Input.Damage(e.Input, info.DamageZone{
|
e.Input.Damage(input.Ctx{
|
||||||
|
|
||||||
Type: info.DamageType.Red,
|
Input: opp,
|
||||||
Damage: decimal.NewFromUint64(uint64(opp.CurrentPet.Info.MaxHp)).
|
DamageZone: &info.DamageZone{
|
||||||
Div(decimal.NewFromInt(8)),
|
|
||||||
|
Type: info.DamageType.Red,
|
||||||
|
Damage: decimal.NewFromUint64(uint64(opp.CurrentPet.Info.MaxHp)).
|
||||||
|
Div(decimal.NewFromInt(8)),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -390,16 +390,18 @@ func (f *FightC) parseskill(attacker, defender *input.Input, id *action.SelectSk
|
|||||||
t := input.Geteffect(input.EffectType.Skill, v)
|
t := input.Geteffect(input.EffectType.Skill, v)
|
||||||
|
|
||||||
args := xmlres.EffectArgs[v]
|
args := xmlres.EffectArgs[v]
|
||||||
|
if t.ID != 0 {
|
||||||
if t.ID != 0 && t.Effect.GetOwner() { //如果取反,说明是给对方添加的回合效果
|
if t.Effect.GetOwner() { //如果取反,说明是给对方添加的回合效果
|
||||||
//实际上,owner永远为反,说明是对方给我添加的
|
//实际上,owner永远为反,说明是对方给我添加的
|
||||||
t.Effect.SetArgs(attacker, temparg[:args]...) //设置入参,施加方永远是我方
|
t.Effect.SetArgs(attacker, temparg[:args]...) //设置入参,施加方永远是我方
|
||||||
//给双方添加
|
//给双方添加
|
||||||
defender.AddEffect(t)
|
defender.AddEffect(t)
|
||||||
} else {
|
} else {
|
||||||
t.Effect.SetArgs(attacker, temparg[:args]...) //设置入参
|
t.Effect.SetArgs(attacker, temparg[:args]...) //设置入参
|
||||||
attacker.AddEffect(t)
|
attacker.AddEffect(t)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
temparg = temparg[args:]
|
temparg = temparg[args:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,7 +426,7 @@ func (f *FightC) initAttackers(fattack action.BattleActionI) {
|
|||||||
|
|
||||||
// 处理技能攻击逻辑
|
// 处理技能攻击逻辑
|
||||||
func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *action.SelectSkillAction) {
|
func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *action.SelectSkillAction) {
|
||||||
|
f.parseskill(attacker, defender, a) //是否miss都应该施加解析effect
|
||||||
attacker.Exec(func(t input.Effect) bool { //计算命中
|
attacker.Exec(func(t input.Effect) bool { //计算命中
|
||||||
|
|
||||||
t.Skill_Pre(input.Ctx{
|
t.Skill_Pre(input.Ctx{
|
||||||
@@ -445,7 +447,6 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *action.S
|
|||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
f.parseskill(attacker, defender, a) //是否miss都应该施加解析effect
|
|
||||||
// 记录技能信息
|
// 记录技能信息
|
||||||
attacker.AttackValue.SkillID = uint32(a.Skill.ID) //获取技能ID
|
attacker.AttackValue.SkillID = uint32(a.Skill.ID) //获取技能ID
|
||||||
|
|
||||||
@@ -455,13 +456,14 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *action.S
|
|||||||
|
|
||||||
if attacker.AttackValue.AttackTime > 0 { //如果命中
|
if attacker.AttackValue.AttackTime > 0 { //如果命中
|
||||||
|
|
||||||
attacker.DamageZone.Damage = int(attacker.CalculatePower(defender, a.Skill).IntPart())
|
attacker.DamageZone.Damage = attacker.CalculatePower(defender, a.Skill)
|
||||||
|
|
||||||
attacker.AttackValue.IsCritical = a.Skill.Crit
|
attacker.AttackValue.IsCritical = a.Skill.Crit
|
||||||
|
|
||||||
if attacker.AttackValue.IsCritical == 1 {
|
if attacker.AttackValue.IsCritical == 1 {
|
||||||
|
|
||||||
attacker.DamageZone.Attack *= 2
|
//暴击翻倍
|
||||||
|
attacker.DamageZone.Damage = attacker.DamageZone.Damage.Mul(decimal.NewFromInt(2))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,13 +485,23 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *action.S
|
|||||||
|
|
||||||
attacker.Exec(func(t input.Effect) bool {
|
attacker.Exec(func(t input.Effect) bool {
|
||||||
|
|
||||||
t.OnSkill(defender, a.Skill) //调用伤害计算
|
t.OnSkill(input.Ctx{
|
||||||
|
Input: defender,
|
||||||
|
SkillEntity: a.Skill,
|
||||||
|
}) //调用伤害计算
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
defender.Damage(attacker, a.Skill, info.DamageZone{
|
|
||||||
Type: info.DamageType.Red,
|
defender.Damage(input.Ctx{
|
||||||
Damage: decimal.NewFromInt(int64(attacker.DamageZone.Attack)),
|
|
||||||
|
Input: attacker,
|
||||||
|
|
||||||
|
SkillEntity: a.Skill,
|
||||||
|
DamageZone: &info.DamageZone{
|
||||||
|
Type: info.DamageType.Red,
|
||||||
|
Damage: attacker.DamageZone.Damage,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
//这里其实是受到致死伤害
|
//这里其实是受到致死伤害
|
||||||
//然后先触发死亡效果,消除所有buff
|
//然后先触发死亡效果,消除所有buff
|
||||||
@@ -498,7 +510,7 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *action.S
|
|||||||
|
|
||||||
//回合有先手方和后手方,同时有攻击方和被攻击方
|
//回合有先手方和后手方,同时有攻击方和被攻击方
|
||||||
|
|
||||||
func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
func (f *FightC) enterturn(fattack, sattack action.BattleActionI) {
|
||||||
|
|
||||||
if f.closefight { //战斗结束
|
if f.closefight { //战斗结束
|
||||||
return
|
return
|
||||||
@@ -509,7 +521,7 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
|||||||
//开始回合操作
|
//开始回合操作
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
|
|
||||||
var attackeraction BattleActionI
|
var attackeraction action.BattleActionI
|
||||||
if i == 0 { //
|
if i == 0 { //
|
||||||
attacker, defender = f.First, f.Second
|
attacker, defender = f.First, f.Second
|
||||||
attackeraction = fattack
|
attackeraction = fattack
|
||||||
@@ -525,34 +537,47 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
|||||||
attacker.Exec(func(t input.Effect) bool { //回合开始前
|
attacker.Exec(func(t input.Effect) bool { //回合开始前
|
||||||
|
|
||||||
//结算状态
|
//结算状态
|
||||||
t.OnTurnStart(defender)
|
t.Turn_Start(input.Ctx{Input: attacker})
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
skill, ok := attackeraction.(*SelectSkillAction)
|
skill, ok := attackeraction.(*action.SelectSkillAction)
|
||||||
|
canuseskill := true
|
||||||
if !ok || attacker.CurrentPet.Info.Hp <= 0 { //还有系统选择放弃出手的
|
if !ok || attacker.CurrentPet.Info.Hp <= 0 { //还有系统选择放弃出手的
|
||||||
attacker.AttackValue.SkillID = 0
|
attacker.AttackValue.SkillID = 0
|
||||||
canuseskill = false
|
canuseskill = false
|
||||||
|
|
||||||
}
|
}
|
||||||
oldskill, _ := deepcopy.Anything(skill.Skill) //备份技能
|
var oldskill interface{}
|
||||||
|
if ok {
|
||||||
|
oldskill, _ = deepcopy.Anything(skill.Skill) //备份技能
|
||||||
|
canuseskillok := attacker.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
||||||
|
//结算状态
|
||||||
|
//然后这里还可以处理自爆类
|
||||||
|
return t.Skill_Can(input.Ctx{
|
||||||
|
Input: attacker,
|
||||||
|
SkillEntity: skill.Skill,
|
||||||
|
}) //返回本身结算,如果false,说明不能使用技能了
|
||||||
|
|
||||||
canuseskillok := attacker.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
})
|
||||||
//结算状态
|
if canuseskill && canuseskillok { //可以使用技能
|
||||||
//然后这里还可以处理自爆类
|
|
||||||
return t.CanSkill(defender, skill) //返回本身结算,如果false,说明不能使用技能了
|
|
||||||
|
|
||||||
})
|
f.processSkillAttack(attacker, defender, skill)
|
||||||
if !canuseskill || !canuseskillok { //可以使用技能
|
skill.Skill = oldskill.(*info.SkillEntity) //还原技能效果
|
||||||
|
|
||||||
f.processSkillAttack(attacker, defender, skill)
|
|
||||||
skill.Skill = oldskill.(*info.SkillEntity) //还原技能效果
|
|
||||||
|
|
||||||
|
}
|
||||||
skill.Skill.Info.PP-- //减少PP
|
skill.Skill.Info.PP-- //减少PP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//技能使用后
|
||||||
|
defender.Exec(func(t input.Effect) bool {
|
||||||
|
t.Skill_Use(input.Ctx{Input: attacker})
|
||||||
|
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
fmt.Println(i,
|
fmt.Println(i,
|
||||||
"玩家技能伤害:", attacker.DamageZone.Attack,
|
"玩家技能伤害:", attacker.DamageZone.Damage,
|
||||||
"自身剩余血量:", attacker.CurrentPet.Info.Hp,
|
"自身剩余血量:", attacker.CurrentPet.Info.Hp,
|
||||||
"对手剩余血量:", defender.CurrentPet.Info.Hp,
|
"对手剩余血量:", defender.CurrentPet.Info.Hp,
|
||||||
)
|
)
|
||||||
@@ -584,13 +609,17 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
|||||||
|
|
||||||
f.First.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
f.First.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
||||||
//结算状态
|
//结算状态
|
||||||
t.TurnEnd(f.Second) //返回本身结算,如果false,说明不能使用技能了
|
t.Turn_End(input.Ctx{
|
||||||
|
Input: f.Second,
|
||||||
|
}) //返回本身结算,如果false,说明不能使用技能了
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
f.Second.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
f.Second.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
||||||
//结算状态
|
//结算状态
|
||||||
t.TurnEnd(f.First) //返回本身结算,如果false,说明不能使用技能了
|
t.Turn_End(input.Ctx{
|
||||||
|
Input: f.First,
|
||||||
|
})
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
f.First.AttackValue.RemainHp = int32(f.First.CurrentPet.Info.Hp)
|
f.First.AttackValue.RemainHp = int32(f.First.CurrentPet.Info.Hp)
|
||||||
@@ -620,7 +649,7 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
f.Switch = []*ActiveSwitchAction{}
|
f.Switch = []*action.ActiveSwitchAction{}
|
||||||
ff.Player.SendAttackValue(ret)
|
ff.Player.SendAttackValue(ret)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ type SkillEntity struct {
|
|||||||
xmlres.Move
|
xmlres.Move
|
||||||
Info *model.SkillInfo
|
Info *model.SkillInfo
|
||||||
|
|
||||||
DamageValue decimal.Decimal // 伤害值
|
// DamageValue decimal.Decimal // 伤害值
|
||||||
Rand *rand.Rand
|
Rand *rand.Rand
|
||||||
Pet *BattlePetEntity
|
Pet *BattlePetEntity
|
||||||
//MaxValue func(ahp, bhp uint32) decimal.Decimal
|
//MaxValue func(ahp, bhp uint32) decimal.Decimal
|
||||||
Crit uint32
|
Crit uint32
|
||||||
AttackTime uint32
|
AttackTime uint32
|
||||||
|
|||||||
@@ -13,26 +13,26 @@ type Effect interface {
|
|||||||
Skill_PreUse(ctx Ctx) // 技能命中前触发//预处理受击技能 被攻击方效果,比如受击时无效技能这样
|
Skill_PreUse(ctx Ctx) // 技能命中前触发//预处理受击技能 被攻击方效果,比如受击时无效技能这样
|
||||||
OnSkill(ctx Ctx) // 触发on miss onhit
|
OnSkill(ctx Ctx) // 触发on miss onhit
|
||||||
|
|
||||||
CanSkill(ctx Ctx) bool //使用技能 可以取消用技能节点 技能无效节点锁定伤害加上
|
Skill_Can(ctx Ctx) bool //使用技能 可以取消用技能节点 技能无效节点锁定伤害加上
|
||||||
Damage_ADD(ctx Ctx) bool // 攻击前触发 ,这时候就是+区间
|
Damage_ADD(ctx Ctx) bool // 攻击前触发 ,这时候就是+区间
|
||||||
Damage_Mul(ctx Ctx) bool // 攻击触发
|
Damage_Mul(ctx Ctx) bool // 攻击触发
|
||||||
|
|
||||||
Damage_Floor(ctx Ctx) bool // 保底伤害
|
Damage_Floor(ctx Ctx) bool // 保底伤害
|
||||||
Damage_DIV(ctx Ctx) bool //受击前触发 这时候就是百分比减伤区间
|
Damage_DIV(ctx Ctx) bool //受击前触发 这时候就是百分比减伤区间
|
||||||
Damage_SUB(ctx Ctx) bool // 受击触发 这时候就是点数减伤
|
Damage_SUB(ctx Ctx) bool // 受击触发 这时候就是点数减伤
|
||||||
Damage_Lock(ctx Ctx) bool //锁定伤害
|
Damage_Lock(ctx Ctx) bool //锁定伤害
|
||||||
|
Damage_Locked(ctx Ctx) bool //被动方锁定伤害
|
||||||
Damage_Shield(ctx Ctx) bool // 护盾值变化时触发
|
Damage_Shield(ctx Ctx) bool // 护盾值变化时触发
|
||||||
Damage_Use(ctx Ctx) bool // 伤害作用
|
//Damage_Use(ctx Ctx) bool // 伤害作用
|
||||||
Skill_SubPP(ctx Ctx) bool //技能PP减少节点
|
Skill_Use(ctx Ctx) bool //技能PP减少节点
|
||||||
|
Skill_Useed(ctx Ctx) bool //技能PP减少节点
|
||||||
OnDefeat(opp *Input) bool // 精灵被击败时触发
|
//OnDefeat(opp *Input) bool // 精灵被击败时触发
|
||||||
OnSwitchIn(ctx Ctx) bool // 精灵出战 / 上场时触发
|
OnSwitchIn(ctx Ctx) bool // 精灵出战 / 上场时触发
|
||||||
OnSwitchOut(ctx Ctx) bool // 精灵下场时触发
|
OnSwitchOut(ctx Ctx) bool // 精灵下场时触发
|
||||||
OnOwnerSwitchIn(ctx Ctx) bool // 所属玩家精灵出战时触发
|
OnOwnerSwitchIn(ctx Ctx) bool // 所属玩家精灵出战时触发
|
||||||
OnOwnerSwitchOut(ctx Ctx) bool // 所属玩家精灵下场时触发
|
OnOwnerSwitchOut(ctx Ctx) bool // 所属玩家精灵下场时触发
|
||||||
|
|
||||||
TurnEnd(ctx Ctx) //闪避率计算,,实际上是修改命中的判断
|
Turn_End(ctx Ctx) //回合结束计算
|
||||||
PreBattleEnd(ctx Ctx) bool //战斗结束前
|
PreBattleEnd(ctx Ctx) bool //战斗结束前
|
||||||
OnBattleEnd(ctx Ctx) bool //战斗结束
|
OnBattleEnd(ctx Ctx) bool //战斗结束
|
||||||
Prop_Befer(in *Input, prop, level int8, ptype info.EnumAbilityOpType) bool //锁定属性
|
Prop_Befer(in *Input, prop, level int8, ptype info.EnumAbilityOpType) bool //锁定属性
|
||||||
@@ -40,8 +40,8 @@ type Effect interface {
|
|||||||
SetArgs(input *Input, param ...int)
|
SetArgs(input *Input, param ...int)
|
||||||
|
|
||||||
// 治疗相关触发
|
// 治疗相关触发
|
||||||
Heal_Pre(*action.BaseAction) bool // 治疗前触发 回复翻倍效果
|
Heal_Pre(action.BattleActionI) bool // 治疗前触发 回复翻倍效果
|
||||||
Heal(*action.BaseAction) bool // 治疗生效时触发 药剂反噬
|
Heal(action.BattleActionI) bool // 治疗生效时触发 药剂反噬
|
||||||
|
|
||||||
//回合数,然后次数另外维护
|
//回合数,然后次数另外维护
|
||||||
Duration(...int) int
|
Duration(...int) int
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package input
|
|||||||
import (
|
import (
|
||||||
element "blazing/common/data/Element"
|
element "blazing/common/data/Element"
|
||||||
"blazing/common/utils"
|
"blazing/common/utils"
|
||||||
|
"blazing/logic/service/fight/action"
|
||||||
"blazing/logic/service/fight/info"
|
"blazing/logic/service/fight/info"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
@@ -41,12 +42,20 @@ func (u *Input) UseSkill(opp *Input, skill *info.SkillEntity) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 恢复血量
|
||||||
|
func (u *Input) Heal(ac action.BattleActionI, value decimal.Decimal) {
|
||||||
|
|
||||||
|
u.CurrentPet.Info.Hp += uint32(value.IntPart())
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 伤害落实 // 血量扣减节点比如触发回神,反弹也在这里实现
|
// 伤害落实 // 血量扣减节点比如触发回神,反弹也在这里实现
|
||||||
func (u *Input) Damage(ctx Ctx) {
|
func (u *Input) Damage(ctx Ctx) {
|
||||||
ctx.Input.DamageZone.BeforeADD = ctx.DamageZone.Damage
|
ctx.Input.DamageZone.BeforeADD = ctx.DamageZone.Damage
|
||||||
ok := ctx.Input.Exec(func(t Effect) bool {
|
ok := ctx.Input.Exec(func(t Effect) bool {
|
||||||
|
tctx := ctx
|
||||||
t.Damage_ADD(ctx) //红伤落实前,我方增伤
|
tctx.Input = u
|
||||||
|
t.Damage_ADD(tctx) //红伤落实前,我方增伤
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
@@ -54,14 +63,25 @@ func (u *Input) Damage(ctx Ctx) {
|
|||||||
ctx.Input.DamageZone.BeforeMul = ctx.DamageZone.Damage
|
ctx.Input.DamageZone.BeforeMul = ctx.DamageZone.Damage
|
||||||
if ok {
|
if ok {
|
||||||
ok = ctx.Input.Exec(func(t Effect) bool {
|
ok = ctx.Input.Exec(func(t Effect) bool {
|
||||||
|
tctx := ctx
|
||||||
|
tctx.Input = u
|
||||||
|
t.Damage_Mul(tctx) //红伤落实前,我方增伤
|
||||||
|
|
||||||
t.Damage_Mul(ctx) //红伤落实前,我方增伤
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
ctx.Input.DamageZone.BeforeFloor = ctx.DamageZone.Damage
|
||||||
|
if ok {
|
||||||
|
ok = ctx.Exec(func(t Effect) bool {
|
||||||
|
tctx := ctx
|
||||||
|
tctx.Input = u
|
||||||
|
t.Damage_Floor(tctx) //红伤落实,内部有befer
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Input.DamageZone.BeforeMul = ctx.DamageZone.Damage //反弹伤害记录
|
ctx.Input.DamageZone.BeforeMul = ctx.DamageZone.Damage
|
||||||
if ok {
|
if ok {
|
||||||
ok = u.Exec(func(t Effect) bool {
|
ok = u.Exec(func(t Effect) bool {
|
||||||
|
|
||||||
@@ -82,16 +102,27 @@ func (u *Input) Damage(ctx Ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.Input.DamageZone.BeforeLock = ctx.DamageZone.Damage
|
ctx.Input.DamageZone.BeforeLock = ctx.DamageZone.Damage
|
||||||
|
if ok {
|
||||||
|
ok = ctx.Input.Exec(func(t Effect) bool {
|
||||||
|
tctx := ctx
|
||||||
|
tctx.Input = u
|
||||||
|
t.Damage_Lock(tctx)
|
||||||
|
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
ctx.Input.DamageZone.BeforeLocked = ctx.DamageZone.Damage
|
||||||
if ok {
|
if ok {
|
||||||
ok = u.Exec(func(t Effect) bool {
|
ok = u.Exec(func(t Effect) bool {
|
||||||
|
|
||||||
t.Damage_Lock(ctx)
|
t.Damage_Locked(ctx)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.DamageZone.Type == info.DamageType.Red {
|
if ctx.DamageZone.Type == info.DamageType.Red { //红才会产生造成伤害
|
||||||
|
ctx.Input.DamageZone.Damage = ctx.DamageZone.Damage
|
||||||
ctx.AttackValue.LostHp = uint32(ctx.DamageZone.Damage.IntPart()) //红伤落实
|
ctx.AttackValue.LostHp = uint32(ctx.DamageZone.Damage.IntPart()) //红伤落实
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +130,7 @@ func (u *Input) Damage(ctx Ctx) {
|
|||||||
|
|
||||||
u.CurrentPet.Info.Hp = 0
|
u.CurrentPet.Info.Hp = 0
|
||||||
} else {
|
} else {
|
||||||
u.CurrentPet.Info.Hp = u.CurrentPet.Info.Hp - ctx.AttackValue.LostHp
|
u.CurrentPet.Info.Hp = u.CurrentPet.Info.Hp - uint32(ctx.DamageZone.Damage.IntPart())
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo 待实现死亡effet
|
//todo 待实现死亡effet
|
||||||
|
|||||||
@@ -20,12 +20,14 @@ type Input struct {
|
|||||||
// info.BattleActionI
|
// info.BattleActionI
|
||||||
Effects *utils.OrderedMap[int, Effect] //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
Effects *utils.OrderedMap[int, Effect] //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
||||||
DamageZone struct {
|
DamageZone struct {
|
||||||
Damage decimal.Decimal //伤害
|
Damage decimal.Decimal //伤害
|
||||||
BeforeADD decimal.Decimal //攻击伤害
|
BeforeADD decimal.Decimal //攻击伤害
|
||||||
BeforeMul decimal.Decimal
|
BeforeMul decimal.Decimal
|
||||||
BeforeDiv decimal.Decimal
|
BeforeFloor decimal.Decimal
|
||||||
BeforeSUB decimal.Decimal
|
BeforeDiv decimal.Decimal
|
||||||
BeforeLock decimal.Decimal //锁伤 先锁受击方,再锁攻击方 受击方免疫也是这么锁 免疫等于锁0
|
BeforeSUB decimal.Decimal
|
||||||
|
BeforeLock decimal.Decimal //锁伤 先锁受击方,再锁攻击方 受击方免疫也是这么锁 免疫等于锁0
|
||||||
|
BeforeLocked decimal.Decimal
|
||||||
//BeforePost decimal.Decimal
|
//BeforePost decimal.Decimal
|
||||||
|
|
||||||
//OldAttack int //攻击伤害被挡前伤害记录
|
//OldAttack int //攻击伤害被挡前伤害记录
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"blazing/modules/blazing/model"
|
"blazing/modules/blazing/model"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"github.com/barkimedes/go-deepcopy"
|
"github.com/brunoga/deep"
|
||||||
"github.com/tnnmigga/enum"
|
"github.com/tnnmigga/enum"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,7 +31,9 @@ func Geteffect(etype EnumEffectType, id int) *EffectID {
|
|||||||
ret, ok := NodeM[id+int(etype)]
|
ret, ok := NodeM[id+int(etype)]
|
||||||
if ok {
|
if ok {
|
||||||
//todo 获取前GetEffect
|
//todo 获取前GetEffect
|
||||||
eff, _ := deepcopy.Anything(ret)
|
|
||||||
|
eff := deep.MustCopy(ret)
|
||||||
|
|
||||||
return &EffectID{
|
return &EffectID{
|
||||||
ID: id + int(etype),
|
ID: id + int(etype),
|
||||||
Effect: eff.(Effect),
|
Effect: eff.(Effect),
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
package node
|
|
||||||
|
|
||||||
// 返回false阻止继续运行
|
|
||||||
// 回合开始
|
|
||||||
func (this *EffectNode) PreBattleStart() bool {
|
|
||||||
|
|
||||||
return true
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回false阻止继续运行
|
|
||||||
// 回合开始
|
|
||||||
func (this *EffectNode) OnBattleStart() bool {
|
|
||||||
|
|
||||||
return true
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//回合结束前
|
|
||||||
|
|
||||||
func (this *EffectNode) PreBattleEnd() bool {
|
|
||||||
return true
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//回合结束
|
|
||||||
|
|
||||||
func (this *EffectNode) OnBattleEnd() bool {
|
|
||||||
return true
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
|
import "blazing/logic/service/fight/action"
|
||||||
|
|
||||||
// 治疗相关触发
|
// 治疗相关触发
|
||||||
func (this *EffectNode) OnBeforeHeal() bool {
|
// 治疗前触发 回复翻倍效果
|
||||||
|
func (e *EffectNode) Heal_Pre(action.BattleActionI) bool {
|
||||||
panic("not implemented") // TODO: Implement
|
panic("not implemented") // TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *EffectNode) OnHeal() bool {
|
func (e *EffectNode) Heal(_ action.BattleActionI) bool {
|
||||||
panic("not implemented") // TODO: Implement
|
panic("not implemented") // TODO: Implement
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
|
import "blazing/logic/service/fight/input"
|
||||||
|
|
||||||
// 切精灵返回false,重写change方法来实现切换效果
|
// 切精灵返回false,重写change方法来实现切换效果
|
||||||
// 精灵切换相关触发
|
// 精灵切换相关触发
|
||||||
func (e *EffectNode) OnSwitchIn() bool {
|
|
||||||
return true
|
func (e *EffectNode) OnSwitchIn(ctx input.Ctx) bool {
|
||||||
|
panic("not implemented") // TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EffectNode) OnSwitchOut() bool {
|
func (e *EffectNode) OnSwitchOut(ctx input.Ctx) bool {
|
||||||
//下场默认清除effect
|
//下场默认清除effect
|
||||||
if e.Owner { //清除对方的我方施加uff
|
if e.Owner { //清除对方的我方施加uff
|
||||||
e.NotALive()
|
e.NotALive()
|
||||||
@@ -14,13 +17,13 @@ func (e *EffectNode) OnSwitchOut() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EffectNode) OnOwnerSwitchIn() bool {
|
func (e *EffectNode) OnOwnerSwitchIn(ctx input.Ctx) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) OnOwnerSwitchOut(ctx input.Ctx) bool {
|
||||||
//自身下场清除掉自身的回合效果
|
//自身下场清除掉自身的回合效果
|
||||||
//this.GetBattle().Effects[this.GetInput().UserID].RemoveEffect(this)
|
//this.GetBattle().Effects[this.GetInput().UserID].RemoveEffect(this)
|
||||||
e.NotALive()
|
e.NotALive()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EffectNode) OnOwnerSwitchOut() bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package node
|
|
||||||
|
|
||||||
// 堆叠(Stack)相关触发
|
|
||||||
func (this *EffectNode) OnStackBefore() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) OnStack() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) OnBeforeConsumeStack() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) OnConsumeStack() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
@@ -1,41 +1,21 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
"blazing/logic/service/fight/input"
|
"blazing/logic/service/fight/input"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 回合开始前
|
func (e *EffectNode) Turn_Start(ctx input.Ctx) {
|
||||||
func (e *EffectNode) PreTurnStart() bool {
|
panic("not implemented") // TODO: Implement
|
||||||
return true
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
func (e *EffectNode) Turn_End(ctx input.Ctx) {
|
||||||
// 回合开始
|
|
||||||
func (e *EffectNode) OnTurnStart(opp *input.Input) {
|
|
||||||
|
|
||||||
//处理异常状态
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *EffectNode) OnActionEnd() bool {
|
|
||||||
|
|
||||||
//处理异常状态
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *EffectNode) PreActionStart() bool {
|
|
||||||
|
|
||||||
//处理异常状态
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 回合结束一次性effect清楚掉
|
|
||||||
|
|
||||||
func (e *EffectNode) TurnEnd(opp *input.Input) {
|
|
||||||
|
|
||||||
if e.duration == 0 { // 保留 (负数表示永久)
|
if e.duration == 0 { // 保留 (负数表示永久)
|
||||||
e.NotALive()
|
e.NotALive()
|
||||||
}
|
}
|
||||||
e.duration--
|
e.duration--
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) OnDefeat(*input.Input, *info.SkillEntity) bool {
|
||||||
|
panic("not implemented") // TODO: Implement
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
package node
|
|
||||||
|
|
||||||
import (
|
|
||||||
"blazing/logic/service/fight/info"
|
|
||||||
"blazing/logic/service/fight/input"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (this *EffectNode) BeforeMultiHit() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
// 回合结束前
|
|
||||||
func (this *EffectNode) BeforeCalculateDamage(opp *input.Input, skill *info.SkillEntity) {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) PreDamage() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) CalculateDamage(opp *input.Input, skill *info.SkillEntity) {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) OnDamage() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) Shield() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) PostDamage() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) OnDefeat() bool {
|
|
||||||
panic("not implemented") // TODO: Implement
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *EffectNode) BeferProp(in *input.Input, prop, level int8, ptype info.EnumAbilityOpType) bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
@@ -1,48 +1,38 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"blazing/logic/service/fight/info"
|
|
||||||
"blazing/logic/service/fight/input"
|
"blazing/logic/service/fight/input"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e *EffectNode) OnSkillPP() bool {
|
func (e *EffectNode) Damage_ADD(ctx input.Ctx) bool {
|
||||||
|
return true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) Damage_Mul(ctx input.Ctx) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用技能前
|
func (e *EffectNode) Damage_Floor(ctx input.Ctx) bool {
|
||||||
func (e *EffectNode) CanSkill(opp *input.Input) bool {
|
return true
|
||||||
|
|
||||||
return e.Input.CurrentPet.HP != 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 命中前 攻击伤害结算
|
func (e *EffectNode) Damage_DIV(ctx input.Ctx) bool {
|
||||||
func (e *EffectNode) PreSkill(opp *input.Input, skill *info.SkillEntity) {
|
return true
|
||||||
|
|
||||||
}
|
|
||||||
func (e *EffectNode) PreAttacked(*input.Input, *info.SkillEntity) {
|
|
||||||
|
|
||||||
}
|
|
||||||
func (e *EffectNode) BeforeSkill(opp *input.Input, skill *info.SkillEntity) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用技能时,不可被继承,继承Miss和Hit就行
|
func (e *EffectNode) Damage_SUB(ctx input.Ctx) bool {
|
||||||
func (e *EffectNode) OnSkill(opp *input.Input, skill *info.SkillEntity) {
|
return true
|
||||||
|
|
||||||
if e.Hit() { //没命中
|
|
||||||
e.OnHit(opp, skill)
|
|
||||||
} else {
|
|
||||||
e.OnMiss(opp, skill)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// miss
|
func (e *EffectNode) Damage_Lock(ctx input.Ctx) bool {
|
||||||
func (e *EffectNode) OnMiss(opp *input.Input, skill *info.SkillEntity) {
|
return true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Effect interface {
|
func (e *EffectNode) Damage_Locked(ctx input.Ctx) bool {
|
||||||
OnMiss(opp *input.Input, skill *info.SkillEntity)
|
return true
|
||||||
OnHit(opp *input.Input, skill *info.SkillEntity)
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) Damage_Shield(ctx input.Ctx) bool {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
16
logic/service/fight/node/fight.go
Normal file
16
logic/service/fight/node/fight.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package node
|
||||||
|
|
||||||
|
import "blazing/logic/service/fight/input"
|
||||||
|
|
||||||
|
// 回合结束一次性effect清楚掉
|
||||||
|
|
||||||
|
func (e *EffectNode) Fight_Start(ctx input.Ctx) bool {
|
||||||
|
panic("not implemented") // TODO: Implement
|
||||||
|
}
|
||||||
|
func (e *EffectNode) PreBattleEnd(ctx input.Ctx) bool {
|
||||||
|
panic("not implemented") // TODO: Implement
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) OnBattleEnd(ctx input.Ctx) bool {
|
||||||
|
panic("not implemented") // TODO: Implement
|
||||||
|
}
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package node
|
|
||||||
|
|
||||||
import (
|
|
||||||
"blazing/logic/service/fight/info"
|
|
||||||
"blazing/logic/service/fight/input"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 受击触发
|
|
||||||
func (this *EffectNode) Attack(*input.Input, *info.DamageZone) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// 受击触发
|
|
||||||
func (this *EffectNode) BeforeAttack(*input.Input, *info.DamageZone) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// 受击触发
|
|
||||||
func (this *EffectNode) Attacked(*input.Input, *info.DamageZone) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// 受击触发
|
|
||||||
func (this *EffectNode) BeforeAttacked(*input.Input, *info.DamageZone) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// 受击触发
|
|
||||||
func (this *EffectNode) FloorDamage(*input.Input, *info.DamageZone) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// 受击触发
|
|
||||||
func (this *EffectNode) LockDamage(*input.Input, *info.DamageZone) {
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package node
|
package node
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
"blazing/logic/service/fight/input"
|
"blazing/logic/service/fight/input"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,20 +30,24 @@ func (this *EffectNode) Alive() bool {
|
|||||||
return !this.notAlive
|
return !this.notAlive
|
||||||
|
|
||||||
}
|
}
|
||||||
|
func (e *EffectNode) GetInput() *input.Input {
|
||||||
|
|
||||||
func (this *EffectNode) NotALive() {
|
return e.Input
|
||||||
|
|
||||||
this.notAlive = true
|
|
||||||
|
|
||||||
}
|
}
|
||||||
func (this *EffectNode) GetOwner() bool {
|
func (e *EffectNode) NotALive() {
|
||||||
|
|
||||||
return this.Owner
|
e.notAlive = true
|
||||||
|
|
||||||
}
|
}
|
||||||
func (this *EffectNode) SetOwner(b bool) {
|
func (e *EffectNode) GetOwner() bool {
|
||||||
|
|
||||||
this.Owner = b
|
return e.Owner
|
||||||
|
|
||||||
|
}
|
||||||
|
func (e *EffectNode) SetOwner(b bool) {
|
||||||
|
|
||||||
|
e.Owner = b
|
||||||
|
|
||||||
}
|
}
|
||||||
func (this *EffectNode) Stack(t ...int) int {
|
func (this *EffectNode) Stack(t ...int) int {
|
||||||
@@ -89,3 +94,9 @@ func (this *EffectNode) AttackTime(*input.Input, *input.Input) bool {
|
|||||||
return true
|
return true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
func (e *EffectNode) EFFect_Befer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
func (e *EffectNode) Prop_Befer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|||||||
53
logic/service/fight/node/skill.go
Normal file
53
logic/service/fight/node/skill.go
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
package node
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/logic/service/fight/info"
|
||||||
|
"blazing/logic/service/fight/input"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (e *EffectNode) Skill_Pre(ctx input.Ctx) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) Skill_PreUse(ctx input.Ctx) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) OnSkill(ctx input.Ctx) {
|
||||||
|
if e.Effect != nil {
|
||||||
|
if e.Hit() { //没命中
|
||||||
|
e.OnHit(ctx.Input, ctx.SkillEntity)
|
||||||
|
} else {
|
||||||
|
e.OnMiss(ctx.Input, ctx.SkillEntity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) Skill_Can(ctx input.Ctx) bool {
|
||||||
|
|
||||||
|
return e.Input.CurrentPet.HP != 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *EffectNode) Skill_Use(ctx input.Ctx) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
func (e *EffectNode) Skill_Useed(ctx input.Ctx) bool {
|
||||||
|
if e.Effect != nil {
|
||||||
|
if e.Input.CurrentPet.Info.Hp == 0 {
|
||||||
|
e.OnDefeat(ctx.Input, ctx.SkillEntity) //死亡
|
||||||
|
|
||||||
|
} else {
|
||||||
|
e.OnAlive(ctx.Input, ctx.SkillEntity) //存活
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type Effect interface {
|
||||||
|
OnMiss(opp *input.Input, skill *info.SkillEntity)
|
||||||
|
OnHit(opp *input.Input, skill *info.SkillEntity)
|
||||||
|
OnDefeat(opp *input.Input, skill *info.SkillEntity) bool //如果需要死亡
|
||||||
|
OnAlive(opp *input.Input, skill *info.SkillEntity) bool //如果需要存活
|
||||||
|
}
|
||||||
19
logic/service/pet/skill.go
Normal file
19
logic/service/pet/skill.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package pet
|
||||||
|
|
||||||
|
import "blazing/logic/service/player"
|
||||||
|
|
||||||
|
// ChangeSkillInfo 技能变更信息
|
||||||
|
type ChangeSkillInfo struct {
|
||||||
|
Head player.TomeeHeader `cmd:"2312" struc:"[0]pad"`
|
||||||
|
CatchTime uint32 `json:"catchTime"` // 精灵生成时间
|
||||||
|
Reserved uint32 `json:"reserved"` // 填充字段,默认为1
|
||||||
|
Reserved1 uint32 `json:"reserved1"` // 填充字段,默认为1
|
||||||
|
HasSkill uint32 `json:"hasSkill"` // 拥有的技能id
|
||||||
|
ReplaceSkill uint32 `json:"replaceSkill"` // 替换技能的id
|
||||||
|
}
|
||||||
|
|
||||||
|
// ChangeSkillInfo 技能变更信息
|
||||||
|
type ChangeSkillOutInfo struct {
|
||||||
|
CatchTime uint32 `json:"catchTime"` // 精灵生成时间
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user