```
feat(fight): 调整技能PP恢复逻辑与CD处理方式 - 修改 HealPP 方法,当传入值为 -1 时直接恢复至最大 PP 值 - 将 Move 结构体中的 CD 字段由 int 改为 *int,以支持可空值 - 在战斗回合解析中增加对 CD 指针的判空处理,避免空指针 panic - 移除 effect_87.go 中未使用的 math 包引入 - 添加 SideEffect 和相关字段到 skill
This commit is contained in:
@@ -44,24 +44,24 @@ type Move struct {
|
||||
ID int `xml:"ID,attr"`
|
||||
Name string `xml:"Name,attr"`
|
||||
|
||||
Category int `xml:"Category,attr"` //属性
|
||||
Type int `xml:"Type,attr"` //类型
|
||||
Power int `xml:"Power,attr"` //威力
|
||||
MaxPP int `xml:"MaxPP,attr"` //最大PP
|
||||
Accuracy int `xml:"Accuracy,attr"` //命中率
|
||||
CritRate int `xml:"CritRate,attr,omitempty"` //暴击率
|
||||
Priority int `xml:"Priority,attr,omitempty"` //优先级
|
||||
MustHit int `xml:"MustHit,attr,omitempty"` //是否必中
|
||||
SwapElemType int `xml:"SwapElemType,attr,omitempty"` //技能交换属性
|
||||
CopyElemType int `xml:"CopyElemType,attr,omitempty"` // 技能复制属性
|
||||
CritAtkFirst int `xml:"CritAtkFirst,attr,omitempty"` // 先出手时必定致命一击
|
||||
CritAtkSecond int `xml:"CritAtkSecond,attr,omitempty"` //后出手时必定致命一击
|
||||
CritSelfHalfHp int `xml:"CritSelfHalfHp,attr,omitempty"` //自身体力低于一半时必定致命一击
|
||||
CritFoeHalfHp int `xml:"CritFoeHalfHp,attr,omitempty"` //对方体力低于一半时必定致命一击
|
||||
DmgBindLv int `xml:"DmgBindLv,attr,omitempty"` //使对方受到的伤害值等于自身的等级
|
||||
PwrBindDv int `xml:"PwrBindDv,attr,omitempty"` //威力(power)取决于自身的潜力(个体值)
|
||||
PwrDouble int `xml:"PwrDouble,attr,omitempty"` //攻击时,若对方处于异常状态, 则威力翻倍;
|
||||
DmgBindHpDv int `xml:"DmgBindHpDv,attr,omitempty"` //使对方受到的伤害值等于自身的体力值
|
||||
Category int `xml:"Category,attr"` //属性
|
||||
Type int `xml:"Type,attr"` //类型
|
||||
Power int `xml:"Power,attr"` //威力
|
||||
MaxPP int `xml:"MaxPP,attr"` //最大PP
|
||||
Accuracy int `xml:"Accuracy,attr"` //命中率
|
||||
CritRate int `xml:"CritRate,attr,omitempty"` //暴击率
|
||||
Priority int `xml:"Priority,attr,omitempty"` //优先级
|
||||
MustHit int `xml:"MustHit,attr,omitempty"` //是否必中
|
||||
SwapElemType int `xml:"SwapElemType,attr,omitempty"` //技能交换属性
|
||||
CopyElemType int `xml:"CopyElemType,attr,omitempty"` // 技能复制属性
|
||||
CritAtkFirst int `xml:"CritAtkFirst,attr,omitempty"` // 先出手时必定致命一击
|
||||
CritAtkSecond int `xml:"CritAtkSecond,attr,omitempty"` //后出手时必定致命一击
|
||||
CritSelfHalfHp int `xml:"CritSelfHalfHp,attr,omitempty"` //自身体力低于一半时必定致命一击
|
||||
CritFoeHalfHp int `xml:"CritFoeHalfHp,attr,omitempty"` //对方体力低于一半时必定致命一击
|
||||
DmgBindLv int `xml:"DmgBindLv,attr,omitempty"` //使对方受到的伤害值等于自身的等级
|
||||
PwrBindDv int `xml:"PwrBindDv,attr,omitempty"` //威力(power)取决于自身的潜力(个体值)
|
||||
PwrDouble int `xml:"PwrDouble,attr,omitempty"` //攻击时,若对方处于异常状态, 则威力翻倍;
|
||||
DmgBindHpDv int `xml:"DmgBindHpDv,attr,omitempty"` //使对方受到的伤害值等于自身的体力值
|
||||
SideEffect string `xml:"SideEffect,attr,omitempty"`
|
||||
SideEffectArg string `xml:"SideEffectArg,attr,omitempty"`
|
||||
SideEffectS []int
|
||||
@@ -71,7 +71,7 @@ type Move struct {
|
||||
|
||||
Info string `xml:"info,attr,omitempty"`
|
||||
|
||||
CD int `xml:"CD,attr"`
|
||||
CD *int `xml:"CD,attr"`
|
||||
}
|
||||
|
||||
type SideEffect struct {
|
||||
|
||||
@@ -3,7 +3,6 @@ package effect
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
"math"
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -24,6 +23,6 @@ func (e *Effect87) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.HealPP(math.MaxInt)
|
||||
e.Ctx().Our.HealPP(-1)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -72,9 +72,12 @@ func (our *Input) Heal(in *Input, ac action.BattleActionI, value decimal.Decimal
|
||||
func (our *Input) HealPP(value int) {
|
||||
|
||||
for i := 0; i < len(our.CurrentPet.Info.SkillList); i++ {
|
||||
|
||||
our.CurrentPet.Info.SkillList[i].PP += uint32(value)
|
||||
our.CurrentPet.Info.SkillList[i].PP = utils.Min(our.CurrentPet.Info.SkillList[i].PP, uint32(xmlres.SkillMap[int(our.CurrentPet.Info.SkillList[i].ID)].MaxPP))
|
||||
if value == -1 {
|
||||
our.CurrentPet.Info.SkillList[i].PP = uint32(xmlres.SkillMap[int(our.CurrentPet.Info.SkillList[i].ID)].MaxPP)
|
||||
} else {
|
||||
our.CurrentPet.Info.SkillList[i].PP += uint32(value)
|
||||
our.CurrentPet.Info.SkillList[i].PP = utils.Min(our.CurrentPet.Info.SkillList[i].PP, uint32(xmlres.SkillMap[int(our.CurrentPet.Info.SkillList[i].ID)].MaxPP))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,11 @@ func (f *FightC) resolveRound(p1Action, p2Action action.BattleActionI) {
|
||||
f.GetInputByAction(a, false).CurrentPet.Info.Hp = 1
|
||||
}
|
||||
if b2k, ok := b2.(*action.SelectSkillAction); ok {
|
||||
f.waittime = b2k.CD
|
||||
|
||||
if b2k.CD != nil {
|
||||
f.waittime = *b2k.CD
|
||||
}
|
||||
|
||||
f.enterturn(b2.(*action.SelectSkillAction), nil)
|
||||
} else {
|
||||
|
||||
@@ -169,7 +173,9 @@ func (f *FightC) resolveRound(p1Action, p2Action action.BattleActionI) {
|
||||
f.GetInputByAction(a, false).CurrentPet.Info.Hp = 1
|
||||
}
|
||||
if b2k, ok := b2.(*action.SelectSkillAction); ok {
|
||||
f.waittime = b2k.CD
|
||||
if b2k.CD != nil {
|
||||
f.waittime = *b2k.CD
|
||||
}
|
||||
f.enterturn(b2.(*action.SelectSkillAction), nil)
|
||||
} else {
|
||||
if a1, ok := b2.(*action.UseItemAction); ok {
|
||||
@@ -254,15 +260,25 @@ func (f *FightC) handleSkillActions(a1, a2 action.BattleActionI) {
|
||||
|
||||
switch {
|
||||
case s1 == nil || s1.SkillEntity == nil:
|
||||
f.waittime = s2.CD
|
||||
if s2.CD != nil {
|
||||
f.waittime = *s2.CD
|
||||
}
|
||||
f.enterturn(s2, nil)
|
||||
fmt.Println("1 空过 2玩家执行技能:", s2.PlayerID, s2.Info.ID)
|
||||
case s2 == nil || s2.SkillEntity == nil:
|
||||
f.waittime = s1.CD
|
||||
if s1.CD != nil {
|
||||
f.waittime = *s1.CD
|
||||
}
|
||||
f.enterturn(s1, nil)
|
||||
fmt.Println("2 空过 玩家执行技能:", s1.PlayerID, s1.Info.ID)
|
||||
default:
|
||||
f.waittime = s1.CD + s2.CD
|
||||
if s1.CD != nil {
|
||||
f.waittime = *s1.CD
|
||||
}
|
||||
if s2.CD != nil {
|
||||
f.waittime += *s2.CD
|
||||
}
|
||||
|
||||
f.enterturn(s1, s2)
|
||||
fmt.Println("玩家执行技能:", s1.PlayerID, s1.Info.ID, s2.PlayerID, s2.Info.ID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user