`` refactor(fight/effect): 重构效果系统,优化效果存储结构和叠层逻辑,移除EffectID结构``
This commit is contained in:
@@ -2,7 +2,6 @@ package input
|
||||
|
||||
import (
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/common"
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
@@ -21,7 +20,7 @@ type Input struct {
|
||||
*info.AttackValue
|
||||
FightC common.FightI
|
||||
// info.BattleActionI
|
||||
Effects *utils.OrderMap[int, Effect] //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
||||
Effects []Effect //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
||||
DamageZone struct {
|
||||
Damage decimal.Decimal //伤害
|
||||
BeforeADD decimal.Decimal //攻击伤害
|
||||
@@ -40,7 +39,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](nil)
|
||||
ret.Effects = make([]Effect, 0)
|
||||
|
||||
// t := Geteffect(EffectType.Damage, 0)
|
||||
// t.Effect.SetArgs(ret)
|
||||
@@ -95,7 +94,7 @@ func (i *Input) GetStatusBonus() float64 {
|
||||
t := Geteffect(EffectType.Status, statusIdx)
|
||||
|
||||
// 检查状态是否存在(数组中值为1表示存在该状态)
|
||||
if t.ID != 0 && t.Effect.Stack() > 0 {
|
||||
if t != nil && t.Stack() > 0 {
|
||||
if bonus, exists := statusBonuses[info.EnumBattleStatus(statusIdx)]; exists && bonus > maxBonus {
|
||||
maxBonus = bonus
|
||||
}
|
||||
@@ -116,21 +115,22 @@ func (i *Input) Parseskill(defender *Input, skill *action.SelectSkillAction) {
|
||||
|
||||
args := xmlres.EffectArgs[v]
|
||||
//这里是给双方添加buff
|
||||
if t.ID != 0 {
|
||||
t.Effect.SetArgs(i, temparg[:args]...) //设置入参,施加方永远是我方
|
||||
if t != nil {
|
||||
t.SetArgs(i, temparg[:args]...) //设置入参,施加方永远是我方
|
||||
t.ID(v)
|
||||
|
||||
if t.Effect.GetOwner() { //如果取反,说明是给对方添加的回合效果
|
||||
if t.GetOwner() { //如果取反,说明是给对方添加的回合效果
|
||||
//实际上,owner永远为反,说明是对方给我添加的
|
||||
t.Effect.SetArgs(i, temparg[:args]...) //设置入参,施加方永远是我方
|
||||
t.SetArgs(i, temparg[:args]...) //设置入参,施加方永远是我方
|
||||
//给双方添加
|
||||
defender.AddEffect(t)
|
||||
} else {
|
||||
t.Effect.SetArgs(i, temparg[:args]...) //设置入参
|
||||
t.SetArgs(i, temparg[:args]...) //设置入参
|
||||
i.AddEffect(t)
|
||||
}
|
||||
//这里是临时缓存buff,后面确认命中后修改HIT状态
|
||||
|
||||
i.EffectCache = append(i.EffectCache, t.Effect)
|
||||
i.EffectCache = append(i.EffectCache, t)
|
||||
}
|
||||
|
||||
temparg = temparg[args:]
|
||||
|
||||
Reference in New Issue
Block a user