```
feat(player): 添加 UseCoins 方法统一处理玩家金币消耗逻辑 重构购买物品和变更外观功能,使用 UseCoins 方法替代手动操作 Coins 字段, 确保金币扣除的安全性和一致性。同时修复可能因并发导致的金币超扣问题。 此外,调整部分战斗系统接口参数传递方式,将 DamageZone 指
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
@@ -24,26 +25,26 @@ type Effect7 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect7) Skill_Hit_Pre() bool {
|
||||
func (e *Effect7) Skill_Hit_Pre(a, b *action.SelectSkillAction) bool {
|
||||
if e.Ctx().Opp.CurrentPet.Info.Hp <= e.Ctx().Our.CurrentPet.Info.Hp {
|
||||
e.Ctx().SkillEntity.Accuracy = 0
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
func (e *Effect7) Damage_Floor() bool {
|
||||
func (e *Effect7) Damage_Floor(t *info.DamageZone) bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
fmt.Println("Effect7_old", e.Ctx().DamageZone.Damage.IntPart())
|
||||
if e.Ctx().DamageZone.Type == info.DamageType.Red {
|
||||
fmt.Println("Effect7_old", t.Damage.IntPart())
|
||||
if t.Type == info.DamageType.Red {
|
||||
if e.Ctx().Our.CurrentPet.Info.Hp <= e.Ctx().Opp.CurrentPet.Info.Hp {
|
||||
|
||||
e.Ctx().DamageZone.Damage = decimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Hp - e.Ctx().Our.CurrentPet.Info.Hp))
|
||||
t.Damage = decimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.Hp - e.Ctx().Our.CurrentPet.Info.Hp))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
fmt.Println("Effect7_new", e.Ctx().DamageZone.Damage.IntPart())
|
||||
fmt.Println("Effect7_new", t.Damage.IntPart())
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user