refactor(fight/effect): 统一效果初始化接口,重构效果类型管理并优化参数传递逻辑
This commit is contained in:
@@ -18,7 +18,7 @@ func init() {
|
||||
}
|
||||
|
||||
for i := 0; i < 6; i++ {
|
||||
input.InitPropEffect(i, prop)
|
||||
input.InitEffect(input.EffectType.Prop, i, prop)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ type Effect1 struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitSkillEffect(1, &Effect1{})
|
||||
input.InitEffect(input.EffectType.Skill, 1, &Effect1{})
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
func init() {
|
||||
//技能使用成功时,m%自身XX等级+/-n
|
||||
input.InitSkillEffect(4, NewEffectStat(false))
|
||||
input.InitEffect(input.EffectType.Skill, 4, NewEffectStat(false))
|
||||
|
||||
//技能使用成功时,m%对方XX等级+/-n
|
||||
input.InitSkillEffect(5, NewEffectStat(true))
|
||||
input.InitEffect(input.EffectType.Skill, 5, NewEffectStat(true))
|
||||
}
|
||||
|
||||
func NewEffectStat(b bool) input.Effect {
|
||||
@@ -24,7 +24,7 @@ func NewEffectStat(b bool) input.Effect {
|
||||
|
||||
type EffectStat struct {
|
||||
node.EffectNode
|
||||
etype bool
|
||||
Etype bool
|
||||
}
|
||||
|
||||
// func (this *EffectStat) GetPet() {
|
||||
@@ -42,7 +42,7 @@ func (e *EffectStat) SkillUseEnd(opp *input.Input) {
|
||||
|
||||
t, _, _ := e.Input.Player.Roll(e.EffectNode.SideEffectArgs[1], 100)
|
||||
if t {
|
||||
if !e.etype { //自身
|
||||
if !e.Etype { //自身
|
||||
e.Input.SetProp(e.EffectNode.SideEffectArgs[0], e.EffectNode.SideEffectArgs[2])
|
||||
|
||||
} else { //对方
|
||||
|
||||
@@ -14,7 +14,7 @@ type Effect62 struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitSkillEffect(62, &Effect62{
|
||||
input.InitEffect(input.EffectType.Skill, 62, &Effect62{
|
||||
EffectNode: node.EffectNode{
|
||||
Owner: true,
|
||||
},
|
||||
@@ -44,7 +44,8 @@ func (this *Effect62) TurnEnd(e *input.Input) {
|
||||
func (e *Effect62) SkillUseEnd(opp *input.Input) {
|
||||
if !e.Hide { //如果还在隐藏,就直接返回
|
||||
defer e.EffectNode.NotALive() //失效
|
||||
e.Input.Death() //本只死亡
|
||||
//应该是对方固定伤害等于自身血量
|
||||
//e.Input.Death() //本只死亡
|
||||
|
||||
}
|
||||
|
||||
@@ -53,10 +54,11 @@ func (e *Effect62) SkillUseEnd(opp *input.Input) {
|
||||
|
||||
}
|
||||
|
||||
func (e *Effect62) SetArgs(args ...int) {
|
||||
// 默认添加回合
|
||||
func (e *Effect62) SetArgs(t *input.Input, a ...int) {
|
||||
|
||||
e.EffectNode.SetArgs(args...)
|
||||
e.EffectNode.Duration(args[0])
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ type Effect67 struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitSkillEffect(67, &Effect67{
|
||||
input.InitEffect(input.EffectType.Skill, 67, &Effect67{
|
||||
EffectNode: node.EffectNode{
|
||||
Owner: true,
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
*/
|
||||
|
||||
func init() {
|
||||
input.InitSkillEffect(9, &Effect9{
|
||||
input.InitEffect(input.EffectType.Skill, 9, &Effect9{
|
||||
EffectNode: node.EffectNode{},
|
||||
})
|
||||
|
||||
|
||||
@@ -25,16 +25,12 @@ func (this *Effect0) UseSkill(opp *input.Input) bool {
|
||||
func (e *Effect0) TurnEnd(opp *input.Input) {
|
||||
e.Input.AttackValue.RemainHp = int32(e.Input.CurrentPet.Info.Hp)
|
||||
|
||||
// ret.FAttack.LostHp = uint32(f.First.GetDamageEffect(0).Stack()) //先手方造成血量
|
||||
//opp.AttackValue.RemainHp = int32(opp.CurrentPet.Info.Hp)
|
||||
//ret.SAttack.LostHp = uint32(f.Second.GetDamageEffect(0).Stack()) //后手方造成血量
|
||||
|
||||
}
|
||||
|
||||
// 使用技能时
|
||||
func (e *Effect0) OnSkill(opp *input.Input, skill *info.SkillEntity) {
|
||||
|
||||
e.Input.AttackValue.LostHp = uint32(e.Input.CalculatePower(opp, skill).IntPart())
|
||||
e.Stack(int(e.Input.CalculatePower(opp, skill).IntPart()))
|
||||
|
||||
e.Input.Exec(func(t input.Effect) bool { //计算暴击率加成
|
||||
|
||||
@@ -43,8 +39,8 @@ func (e *Effect0) OnSkill(opp *input.Input, skill *info.SkillEntity) {
|
||||
return e.Input.AttackValue.IsCritical == 0
|
||||
})
|
||||
if e.Input.AttackValue.IsCritical == 1 {
|
||||
e.Input.AttackValue.LostHp = e.Input.AttackValue.LostHp * 2
|
||||
|
||||
e.Stack(e.Stack() * 2)
|
||||
}
|
||||
//这里注释掉,扣血在对方回合
|
||||
if uint32(e.Input.AttackValue.LostHp) > opp.CurrentPet.Info.Hp {
|
||||
@@ -82,6 +78,6 @@ func (this *Effect0) IsCrit(opp *input.Input, skill *info.SkillEntity) {
|
||||
|
||||
}
|
||||
func init() {
|
||||
input.InitDamageEffect(0, &Effect0{})
|
||||
input.InitEffect(input.EffectType.Damage, 0, &Effect0{})
|
||||
|
||||
}
|
||||
|
||||
@@ -9,24 +9,28 @@ import (
|
||||
// 施加一个基类effect
|
||||
type EffectStatus struct {
|
||||
node.EffectNode
|
||||
status info.EnumBattleStatus
|
||||
Status info.EnumBattleStatus
|
||||
}
|
||||
|
||||
func (e *EffectStatus) UseSkill(opp *input.Input) bool {
|
||||
type EffectStatusNotSkill struct {
|
||||
EffectStatus
|
||||
}
|
||||
|
||||
func (e *EffectStatusNotSkill) UseSkill(opp *input.Input) bool {
|
||||
return false
|
||||
|
||||
}
|
||||
func init() {
|
||||
//麻痹,疲惫,害怕,石化,都是无法行动
|
||||
|
||||
tt := func(t info.EnumBattleStatus, f *EffectStatus) {
|
||||
tt := func(t info.EnumBattleStatus, f *EffectStatusNotSkill) {
|
||||
|
||||
f.status = t
|
||||
input.InitStatusEffect(int(t), f)
|
||||
f.Status = t
|
||||
input.InitEffect(input.EffectType.Status, int(t), f)
|
||||
}
|
||||
tt(info.BattleStatus.Paralysis, &EffectStatus{})
|
||||
tt(info.BattleStatus.Tired, &EffectStatus{})
|
||||
tt(info.BattleStatus.Sleep, &EffectStatus{})
|
||||
tt(info.BattleStatus.Petrified, &EffectStatus{})
|
||||
tt(info.BattleStatus.Paralysis, &EffectStatusNotSkill{})
|
||||
tt(info.BattleStatus.Tired, &EffectStatusNotSkill{})
|
||||
tt(info.BattleStatus.Sleep, &EffectStatusNotSkill{})
|
||||
tt(info.BattleStatus.Petrified, &EffectStatusNotSkill{})
|
||||
|
||||
}
|
||||
|
||||
@@ -373,21 +373,20 @@ func (f *FightC) parseskill(attacker, defender *input.Input, id *SelectSkillActi
|
||||
temparg := id.Skill.SideEffectArgS
|
||||
for _, v := range id.Skill.SideEffectS {
|
||||
|
||||
t := input.GetSkillEffect(v)
|
||||
t := input.Geteffect(input.EffectType.Skill, v)
|
||||
|
||||
args := xmlres.EffectArgs[v]
|
||||
|
||||
t.Effect.SetArgs(temparg[:args]...) //设置入参
|
||||
|
||||
temparg = temparg[args:]
|
||||
if t.Effect.GetOwner() { //如果取反,说明是给对方添加的回合效果
|
||||
//实际上,owner永远为反,说明是对方给我添加的
|
||||
t.Effect.SetArgs(attacker, temparg[:args]...) //设置入参,施加方永远是我方
|
||||
|
||||
defender.AddEffect(t)
|
||||
} else {
|
||||
t.Effect.SetArgs(attacker, temparg[:args]...) //设置入参
|
||||
attacker.AddEffect(t)
|
||||
}
|
||||
|
||||
temparg = temparg[args:]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,7 +497,7 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
||||
skill.Skill.Info.PP-- //减少PP
|
||||
}
|
||||
fmt.Println(i,
|
||||
"玩家技能伤害:", attacker.GetDamageEffect(0),
|
||||
"玩家技能伤害:", attacker.GetEffect(input.EffectType.Damage, 0).Stack(),
|
||||
"自身剩余血量:", attacker.CurrentPet.Info.Hp,
|
||||
"对手剩余血量:", defender.CurrentPet.Info.Hp,
|
||||
)
|
||||
@@ -527,15 +526,15 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
||||
|
||||
}
|
||||
|
||||
attacker.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
||||
f.First.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
||||
//结算状态
|
||||
t.TurnEnd(defender) //返回本身结算,如果false,说明不能使用技能了
|
||||
t.TurnEnd(f.Second) //返回本身结算,如果false,说明不能使用技能了
|
||||
return true
|
||||
})
|
||||
|
||||
defender.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
||||
f.Second.Exec(func(t input.Effect) bool { //这个是能否使用技能
|
||||
//结算状态
|
||||
t.TurnEnd(defender) //返回本身结算,如果false,说明不能使用技能了
|
||||
t.TurnEnd(f.First) //返回本身结算,如果false,说明不能使用技能了
|
||||
return true
|
||||
})
|
||||
ret := info.AttackValueS{
|
||||
@@ -544,15 +543,10 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
||||
}
|
||||
|
||||
for i := 0; i < 20; i++ { //堆叠状态剩余回合
|
||||
ate, ok := attacker.GetStatusEffect(i)
|
||||
if ok {
|
||||
ret.FAttack.Status[i] = int8(ate.Duration())
|
||||
}
|
||||
|
||||
dte, ok := defender.GetStatusEffect(i)
|
||||
if ok {
|
||||
ret.FAttack.Status[i] = int8(dte.Duration())
|
||||
}
|
||||
ret.FAttack.Status[i] = int8(f.First.GetEffect(input.EffectType.Status, i).Duration())
|
||||
|
||||
ret.SAttack.Status[i] = int8(f.Second.GetEffect(input.EffectType.Status, i).Duration())
|
||||
|
||||
}
|
||||
|
||||
|
||||
72
logic/service/fight/input/effecti.go
Normal file
72
logic/service/fight/input/effecti.go
Normal file
@@ -0,0 +1,72 @@
|
||||
package input
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
)
|
||||
|
||||
type Effect interface {
|
||||
OnBattleStart() bool //战斗开始
|
||||
|
||||
OnTurnStart(opp *Input) //回合开始
|
||||
|
||||
UseSkill(opp *Input) bool //使用技能 可以取消用技能节点
|
||||
SkillUseEnd(opp *Input)
|
||||
// OnSkillPP() bool //技能PP减少节点
|
||||
// BeforeMultiHit() bool //多段攻击前
|
||||
// BeforeHit() bool //命中前
|
||||
// OnCritPreDamage() bool //暴击判定成功且伤害计算前触发
|
||||
// PreDamage() bool // 技能伤害计算前触发(增伤 / 减伤等)
|
||||
// OnBeforeCalculateDamage() bool // 最终伤害计算前触发
|
||||
// OnDamage() bool // 造成伤害时触发
|
||||
//使用技能 可以取消用技能节点
|
||||
|
||||
AfterAttr(t *info.BattlePetEntity) //在获取属性前,比如重写对方属性AfterAttr
|
||||
BeferAttr(t *info.BattlePetEntity) //在获取属性后,比如视为对方属性
|
||||
SetArgs(input *Input,param ...int)
|
||||
IsCrit(opp *Input, skill *info.SkillEntity) //是否暴击
|
||||
CalculateDamage(opp *Input, skill *info.SkillEntity) //击判定成功且伤害计算前触发
|
||||
OnBeforeCalculateDamage(opp *Input, skill *info.SkillEntity) // 最终伤害计算前触发
|
||||
// Shield() bool // 护盾值变化时触发
|
||||
// PostDamage() bool // 伤害结算后触发(血量扣除后)
|
||||
IsHit(opp *Input, skill *info.SkillEntity) //闪避率计算,,实际上是修改命中的判断
|
||||
TakeHit(opp *Input, skill *info.SkillEntity) //闪避率计算,,实际上是修改命中的判断
|
||||
//() bool // 暴击伤害结算后触发
|
||||
OnSkill(opp *Input, skill *info.SkillEntity) //闪避率计算,,实际上是修改命中的判断
|
||||
OnMiss() bool // 技能未命中时触发
|
||||
// OnHit() bool // 技能命中时触发
|
||||
// OnMiss() bool // 技能未命中时触发
|
||||
// AfterAttacked() bool // 被攻击后触发(受击判定)
|
||||
|
||||
// SetOwner(bool)
|
||||
// OnDefeat() bool // 精灵被击败时触发
|
||||
|
||||
TurnEnd(opp *Input) //闪避率计算,,实际上是修改命中的判断
|
||||
// // 堆叠(Stack)相关触发
|
||||
// OnStackBefore() bool // 堆叠效果前触发
|
||||
// OnStack() bool // 堆叠效果触发
|
||||
// OnBeforeConsumeStack() bool // 消耗堆叠前触发
|
||||
// OnConsumeStack() bool // 消耗堆叠时触发
|
||||
|
||||
// // 治疗相关触发
|
||||
// OnBeforeHeal() bool // 治疗前触发
|
||||
// OnHeal() bool // 治疗生效时触发
|
||||
|
||||
// // 精灵切换相关触发
|
||||
// OnSwitchIn() bool // 精灵出战 / 上场时触发
|
||||
// OnSwitchOut() bool // 精灵下场时触发
|
||||
// OnOwnerSwitchIn() bool // 所属玩家精灵出战时触发
|
||||
// OnOwnerSwitchOut() bool // 所属玩家精灵下场时触发
|
||||
|
||||
// PreBattleEnd() bool //战斗结束前
|
||||
// OnBattleEnd() bool //战斗结束
|
||||
|
||||
//回合数,然后次数另外维护
|
||||
Duration(...int) int
|
||||
|
||||
Alive() bool
|
||||
Stack(...int) int
|
||||
GetMaxStack() int
|
||||
NotALive()
|
||||
GetOwner() bool // 技能属主,比如寄生和镇魂歌,属主是对方)
|
||||
//GetSkill() *BattleSkillEntity //获得技能ctx
|
||||
}
|
||||
@@ -28,7 +28,7 @@ type Input struct {
|
||||
func NewInput(c common.FightI, p common.PlayerI) *Input {
|
||||
ret := &Input{FightC: c, Player: p}
|
||||
ret.Effects = utils.NewOrderedMap[int, Effect]()
|
||||
t := GetDamageEffect(0)
|
||||
t := Geteffect(EffectType.Damage, 0)
|
||||
ret.AddEffect(t) //添加默认基类,实现继承
|
||||
p.SetFightC(c) //给玩家设置战斗容器
|
||||
|
||||
@@ -73,10 +73,10 @@ func (i *Input) GetStatusBonus() float64 {
|
||||
maxBonus := 1.0 // 默认无状态倍率
|
||||
|
||||
for statusIdx := 0; statusIdx < 20; statusIdx++ {
|
||||
t, ok := GetStatusEffect(statusIdx)
|
||||
t := Geteffect(EffectType.Status, statusIdx)
|
||||
|
||||
// 检查状态是否存在(数组中值为1表示存在该状态)
|
||||
if ok && t.Stack() > 0 {
|
||||
if t.Effect.Stack() > 0 {
|
||||
if bonus, exists := statusBonuses[info.EnumBattleStatus(statusIdx)]; exists && bonus > maxBonus {
|
||||
maxBonus = bonus
|
||||
}
|
||||
|
||||
@@ -7,95 +7,39 @@ import (
|
||||
"reflect"
|
||||
|
||||
"github.com/mohae/deepcopy"
|
||||
"github.com/tnnmigga/enum"
|
||||
)
|
||||
|
||||
type Effect interface {
|
||||
OnBattleStart() bool //战斗开始
|
||||
// 战斗结束原因枚举
|
||||
type EnumEffectType int
|
||||
|
||||
OnTurnStart(opp *Input) //回合开始
|
||||
|
||||
UseSkill(opp *Input) bool //使用技能 可以取消用技能节点
|
||||
SkillUseEnd(opp *Input)
|
||||
// OnSkillPP() bool //技能PP减少节点
|
||||
// BeforeMultiHit() bool //多段攻击前
|
||||
// BeforeHit() bool //命中前
|
||||
// OnCritPreDamage() bool //暴击判定成功且伤害计算前触发
|
||||
// PreDamage() bool // 技能伤害计算前触发(增伤 / 减伤等)
|
||||
// OnBeforeCalculateDamage() bool // 最终伤害计算前触发
|
||||
// OnDamage() bool // 造成伤害时触发
|
||||
//使用技能 可以取消用技能节点
|
||||
SetInput(input *Input)
|
||||
AfterAttr(t *info.BattlePetEntity) //在获取属性前,比如重写对方属性AfterAttr
|
||||
BeferAttr(t *info.BattlePetEntity) //在获取属性后,比如视为对方属性
|
||||
SetArgs(param ...int)
|
||||
IsCrit(opp *Input, skill *info.SkillEntity) //是否暴击
|
||||
CalculateDamage(opp *Input, skill *info.SkillEntity) //击判定成功且伤害计算前触发
|
||||
OnBeforeCalculateDamage(opp *Input, skill *info.SkillEntity) // 最终伤害计算前触发
|
||||
// Shield() bool // 护盾值变化时触发
|
||||
// PostDamage() bool // 伤害结算后触发(血量扣除后)
|
||||
IsHit(opp *Input, skill *info.SkillEntity) //闪避率计算,,实际上是修改命中的判断
|
||||
TakeHit(opp *Input, skill *info.SkillEntity) //闪避率计算,,实际上是修改命中的判断
|
||||
//() bool // 暴击伤害结算后触发
|
||||
OnSkill(opp *Input, skill *info.SkillEntity) //闪避率计算,,实际上是修改命中的判断
|
||||
// OnHit() bool // 技能命中时触发
|
||||
// OnMiss() bool // 技能未命中时触发
|
||||
// AfterAttacked() bool // 被攻击后触发(受击判定)
|
||||
|
||||
// SetOwner(bool)
|
||||
// OnDefeat() bool // 精灵被击败时触发
|
||||
|
||||
TurnEnd(opp *Input) //闪避率计算,,实际上是修改命中的判断
|
||||
// // 堆叠(Stack)相关触发
|
||||
// OnStackBefore() bool // 堆叠效果前触发
|
||||
// OnStack() bool // 堆叠效果触发
|
||||
// OnBeforeConsumeStack() bool // 消耗堆叠前触发
|
||||
// OnConsumeStack() bool // 消耗堆叠时触发
|
||||
|
||||
// // 治疗相关触发
|
||||
// OnBeforeHeal() bool // 治疗前触发
|
||||
// OnHeal() bool // 治疗生效时触发
|
||||
|
||||
// // 精灵切换相关触发
|
||||
// OnSwitchIn() bool // 精灵出战 / 上场时触发
|
||||
// OnSwitchOut() bool // 精灵下场时触发
|
||||
// OnOwnerSwitchIn() bool // 所属玩家精灵出战时触发
|
||||
// OnOwnerSwitchOut() bool // 所属玩家精灵下场时触发
|
||||
|
||||
// PreBattleEnd() bool //战斗结束前
|
||||
// OnBattleEnd() bool //战斗结束
|
||||
|
||||
//回合数,然后次数另外维护
|
||||
Duration(...int) int
|
||||
|
||||
Alive() bool
|
||||
Stack(...int) int
|
||||
GetMaxStack() int
|
||||
NotALive()
|
||||
GetOwner() bool // 技能属主,比如寄生和镇魂歌,属主是对方)
|
||||
//GetSkill() *BattleSkillEntity //获得技能ctx
|
||||
}
|
||||
var EffectType = enum.New[struct {
|
||||
Skill EnumEffectType `enum:"1000000"` //技能
|
||||
Prop EnumEffectType `enum:"2000000"` //属性
|
||||
Status EnumEffectType `enum:"3000000"` //状态
|
||||
Damage EnumEffectType `enum:"4000000"` //伤害
|
||||
|
||||
}]()
|
||||
var NodeM = make(map[int]Effect, 0)
|
||||
|
||||
func InitSkillEffect(id int, t Effect) {
|
||||
func InitEffect(etype EnumEffectType, id int, t Effect) {
|
||||
|
||||
NodeM[id+1000000] = t
|
||||
NodeM[id+int(etype)] = t
|
||||
}
|
||||
func Geteffect(id int) (Effect, bool) {
|
||||
func Geteffect(etype EnumEffectType, id int) *EffectID {
|
||||
|
||||
//todo 获取前GetEffect
|
||||
ret, ok := NodeM[id]
|
||||
ret, ok := NodeM[id+int(etype)]
|
||||
if ok {
|
||||
//todo 获取前GetEffect
|
||||
eff := deepcopy.Copy(ret).(Effect)
|
||||
return eff, ok
|
||||
return &EffectID{
|
||||
ID: id + int(etype),
|
||||
Effect: eff,
|
||||
}
|
||||
//todo 获取后GetEffect
|
||||
}
|
||||
return nil, false
|
||||
//todo 获取后GetEffect
|
||||
}
|
||||
|
||||
func InitPropEffect(id int, t Effect) {
|
||||
|
||||
NodeM[id+2000000] = t
|
||||
return &EffectID{}
|
||||
}
|
||||
|
||||
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
|
||||
@@ -123,47 +67,11 @@ func (c *Input) GetProp(id int, istue bool) int {
|
||||
return realValue
|
||||
|
||||
}
|
||||
func InitDamageEffect(id int, t Effect) {
|
||||
|
||||
NodeM[id+4000000] = t
|
||||
}
|
||||
func (c *Input) GetEffect(etype EnumEffectType, id int) Effect {
|
||||
rer, _ := c.Effects.Load(id + int(etype))
|
||||
|
||||
// 1为红伤
|
||||
func GetDamageEffect(id int) *EffectID {
|
||||
id1 := id + 4000000
|
||||
ret, ok := Geteffect(id1)
|
||||
if ok {
|
||||
//todo 获取前GetEffect
|
||||
return &EffectID{
|
||||
ID: id1,
|
||||
Effect: ret,
|
||||
}
|
||||
//todo 获取后GetEffect
|
||||
}
|
||||
return &EffectID{}
|
||||
}
|
||||
|
||||
func (c *Input) GetDamageEffect(id int) int {
|
||||
id1 := id + 4000000
|
||||
rer, ok := c.Effects.Load(id1)
|
||||
if ok {
|
||||
return rer.Stack()
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
func GetSkillEffect(id int) *EffectID {
|
||||
id1 := id + 1000000
|
||||
ret, ok := Geteffect(id1)
|
||||
if ok {
|
||||
|
||||
return &EffectID{
|
||||
ID: id1,
|
||||
Effect: ret,
|
||||
}
|
||||
|
||||
}
|
||||
return &EffectID{}
|
||||
return rer
|
||||
}
|
||||
|
||||
type EffectID struct {
|
||||
@@ -171,36 +79,6 @@ type EffectID struct {
|
||||
Effect Effect
|
||||
}
|
||||
|
||||
func GetPropEffect(id int) Effect {
|
||||
|
||||
ret, ok := Geteffect(id + 2000000)
|
||||
if ok {
|
||||
//todo 获取前GetEffect
|
||||
return ret
|
||||
//todo 获取后GetEffect
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func InitStatusEffect(id int, t Effect) {
|
||||
|
||||
NodeM[id+3000000] = t
|
||||
}
|
||||
|
||||
func GetStatusEffect(id int) (Effect, bool) {
|
||||
ret, ok := Geteffect(id + 3000000)
|
||||
if ok {
|
||||
//todo 获取前GetEffect
|
||||
return ret, true
|
||||
//todo 获取后GetEffect
|
||||
}
|
||||
return nil, false
|
||||
|
||||
}
|
||||
func (c *Input) GetStatusEffect(id int) (Effect, bool) {
|
||||
rer, ok := c.Effects.Load(id + 3000000)
|
||||
|
||||
return rer, ok
|
||||
}
|
||||
func (c *Input) GetCurrAttr(id int) *model.PetInfo {
|
||||
|
||||
//todo 获取前GetEffect
|
||||
@@ -232,7 +110,7 @@ func (c *Input) AddEffect(e *EffectID) {
|
||||
}
|
||||
//todo 免疫
|
||||
//TODO 先激活
|
||||
e.Effect.SetInput(c)
|
||||
|
||||
// 如果已有同 ID 的效果,尝试叠加
|
||||
_, ok := c.Effects.Load(e.ID)
|
||||
if !ok {
|
||||
|
||||
@@ -56,7 +56,7 @@ func (this *EffectNode) IsCrit(opp *input.Input, skill *info.SkillEntity) {
|
||||
}
|
||||
|
||||
func (e *EffectNode) OnHit() bool {
|
||||
return true
|
||||
panic("not implemented") // TODO: Implement
|
||||
}
|
||||
|
||||
func (e *EffectNode) OnMiss() bool {
|
||||
|
||||
@@ -69,13 +69,9 @@ func (this *EffectNode) Duration(t ...int) int {
|
||||
}
|
||||
|
||||
// 设置参数,加上设置输入源
|
||||
func (this *EffectNode) SetArgs(args ...int) {
|
||||
|
||||
this.SideEffectArgs = args
|
||||
|
||||
}
|
||||
func (this *EffectNode) SetInput(args *input.Input) {
|
||||
this.Input = args
|
||||
func (this *EffectNode) SetArgs(t *input.Input, a ...int) {
|
||||
this.Input = t
|
||||
this.SideEffectArgs = a
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user