fix(fight): 修复技能效果获取逻辑并调整伤害计算方式
-
This commit is contained in:
@@ -27,10 +27,11 @@ type Input struct {
|
||||
|
||||
func NewInput(c common.FightI, p common.PlayerI) *Input {
|
||||
ret := &Input{FightC: c, Player: p}
|
||||
t := ret.GetDamageEffect(0)
|
||||
ret.Effects = utils.NewOrderedMap[int, Effect]()
|
||||
t := GetDamageEffect(0)
|
||||
ret.AddEffect(t) //添加默认基类,实现继承
|
||||
p.SetFightC(c) //给玩家设置战斗容器
|
||||
ret.Effects = utils.NewOrderedMap[int, Effect]()
|
||||
|
||||
return ret
|
||||
|
||||
}
|
||||
@@ -72,7 +73,7 @@ func (i *Input) GetStatusBonus() float64 {
|
||||
maxBonus := 1.0 // 默认无状态倍率
|
||||
|
||||
for statusIdx := 0; statusIdx < 20; statusIdx++ {
|
||||
t, ok := i.GetStatusEffect(statusIdx)
|
||||
t, ok := GetStatusEffect(statusIdx)
|
||||
|
||||
// 检查状态是否存在(数组中值为1表示存在该状态)
|
||||
if ok && t.Stack() > 0 {
|
||||
|
||||
@@ -79,7 +79,7 @@ var NodeM = make(map[int]Effect, 0)
|
||||
|
||||
func InitSkillEffect(id int, t Effect) {
|
||||
|
||||
NodeM[id+1000000] = t
|
||||
NodeM[id+1000000-1] = t
|
||||
}
|
||||
func Geteffect(id int) (Effect, bool) {
|
||||
|
||||
@@ -95,7 +95,7 @@ func Geteffect(id int) (Effect, bool) {
|
||||
|
||||
func InitPropEffect(id int, t Effect) {
|
||||
|
||||
NodeM[id+2000000] = t
|
||||
NodeM[id+2000000-1] = t
|
||||
}
|
||||
|
||||
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
|
||||
@@ -125,11 +125,11 @@ func (c *Input) GetProp(id int, istue bool) int {
|
||||
}
|
||||
func InitDamageEffect(id int, t Effect) {
|
||||
|
||||
NodeM[id+4000000] = t
|
||||
NodeM[id+4000000-1] = t
|
||||
}
|
||||
|
||||
// 1为红伤
|
||||
func (c *Input) GetDamageEffect(id int) *EffectID {
|
||||
func GetDamageEffect(id int) *EffectID {
|
||||
id1 := id + 4000000
|
||||
ret, ok := Geteffect(id1)
|
||||
if ok {
|
||||
@@ -142,7 +142,17 @@ func (c *Input) GetDamageEffect(id int) *EffectID {
|
||||
}
|
||||
return &EffectID{}
|
||||
}
|
||||
func (c *Input) GetSkillEffect(id int) *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 {
|
||||
@@ -161,7 +171,7 @@ type EffectID struct {
|
||||
Effect Effect
|
||||
}
|
||||
|
||||
func (c *Input) GetPropEffect(id int) Effect {
|
||||
func GetPropEffect(id int) Effect {
|
||||
|
||||
ret, ok := Geteffect(id + 2000000)
|
||||
if ok {
|
||||
@@ -173,10 +183,10 @@ func (c *Input) GetPropEffect(id int) Effect {
|
||||
}
|
||||
func InitStatusEffect(id int, t Effect) {
|
||||
|
||||
NodeM[id+3000000] = t
|
||||
NodeM[id+3000000-1] = t
|
||||
}
|
||||
|
||||
func (c *Input) GetStatusEffect(id int) (Effect, bool) {
|
||||
func GetStatusEffect(id int) (Effect, bool) {
|
||||
ret, ok := Geteffect(id + 3000000)
|
||||
if ok {
|
||||
//todo 获取前GetEffect
|
||||
@@ -186,6 +196,11 @@ func (c *Input) GetStatusEffect(id int) (Effect, bool) {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user