fix: 修复宠物存活状态判定逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
移除 `NotAlive` 字段,改用 `Alive()` 方法通过 HP 判断存活状态,修正相关效果触发逻辑。
This commit is contained in:
@@ -15,13 +15,16 @@ func (e *Effect197) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||||
}
|
||||
func (e *Effect197) SwitchOut(in *input.Input) bool {
|
||||
if e.Ctx().Our.CurrentPet.NotAlive { // 被击败
|
||||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||||
if v > 0 {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(i), 0)
|
||||
}
|
||||
if e.Input == in {
|
||||
if !e.Ctx().Our.CurrentPet.Alive() { // 被击败
|
||||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||||
if v > 0 {
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(i), 0)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
e.Alive(false)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -15,11 +15,14 @@ func (e *Effect199) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.Duration(-1) // 持续n回合
|
||||
}
|
||||
func (e *Effect199) SwitchOut(in *input.Input) bool {
|
||||
if e.Ctx().Our.CurrentPet.NotAlive { // 被击败
|
||||
// 设置下一个出场精灵的增益效果
|
||||
effectType := int8(e.Args()[0].IntPart()) // xx类型
|
||||
effectValue := int8(e.Args()[1].IntPart()) // 等级+k
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue)
|
||||
if e.Input == in {
|
||||
if !e.Ctx().Our.CurrentPet.Alive() { // 被击败
|
||||
// 设置下一个出场精灵的增益效果
|
||||
effectType := int8(e.Args()[0].IntPart()) // xx类型
|
||||
effectValue := int8(e.Args()[1].IntPart()) // 等级+k
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue)
|
||||
}
|
||||
e.Alive(false)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -18,7 +18,7 @@ func (e *Effect495) OnSkill() bool {
|
||||
if success {
|
||||
// 秒杀对手
|
||||
e.Ctx().Opp.CurrentPet.Info.Hp = 0
|
||||
e.Ctx().Opp.CurrentPet.NotAlive = true
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
27
logic/service/fight/effect/547.go
Normal file
27
logic/service/fight/effect/547.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
type Effect547 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect547) Skill_Use() bool {
|
||||
fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.SideEffectArgs[0]))
|
||||
if fearEffect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect)
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, fearEffect)
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (e *Effect547) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(a[1]) // 持续n回合
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 547, &Effect547{})
|
||||
|
||||
}
|
||||
43
logic/service/fight/effect/559.go
Normal file
43
logic/service/fight/effect/559.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
)
|
||||
|
||||
// "id": 559,
|
||||
// "argsNum": 1,
|
||||
// "info": "{0}回合内若对手使用攻击技能则随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态"
|
||||
// },
|
||||
type Effect559 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect559) Skill_Use_ex() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
status := []info.EnumPetStatus{
|
||||
info.PetStatus.Burned,
|
||||
info.PetStatus.Frozen,
|
||||
info.PetStatus.Poisoned,
|
||||
info.PetStatus.Paralysis,
|
||||
info.PetStatus.Fear,
|
||||
info.PetStatus.Sleep,
|
||||
}
|
||||
|
||||
fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(status[grand.Intn(len(status))]))
|
||||
if fearEffect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 559, &Effect559{})
|
||||
|
||||
}
|
||||
@@ -37,7 +37,7 @@ func (e *Effect72) SkillHit() bool {
|
||||
Type: info.DamageType.True,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp)),
|
||||
})
|
||||
e.Ctx().Our.CurrentPet.NotAlive = true
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func (e *SelfKill) OnSkill() bool {
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
|
||||
})
|
||||
e.can = true
|
||||
e.Ctx().Our.CurrentPet.NotAlive = true
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -210,6 +210,6 @@ func (e *Effect112) Skill_Use() bool {
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.Min(alpacadecimal.NewFromInt(n), e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1))),
|
||||
})
|
||||
e.Ctx().Our.CurrentPet.NotAlive = true
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
|
||||
}
|
||||
func (f *FightC) TURNOVER(cur *input.Input) {
|
||||
cur.CurrentPet.NotAlive = true
|
||||
|
||||
f.Broadcast(func(ff *input.Input) {
|
||||
|
||||
ff.Exec(func(t input.Effect) bool {
|
||||
|
||||
@@ -23,10 +23,15 @@ type BattlePetEntity struct {
|
||||
//Status StatusDict //精灵的状态
|
||||
//能力提升属性
|
||||
//Prop PropDict
|
||||
NotAlive bool `struc:"skip"`
|
||||
//NotAlive bool `struc:"skip"`
|
||||
//DamageZone map[EnumCategory]map[EnumsZoneType]map[EnumsZoneType][]float64 // 三维map 伤害类型-》增还是减-》加还是乘-》值
|
||||
}
|
||||
|
||||
func (t *BattlePetEntity) Alive() bool {
|
||||
return t.Info.Hp > 0
|
||||
|
||||
}
|
||||
|
||||
// 创建精灵实例
|
||||
func CreateBattlePetEntity(info model.PetInfo, rand *rand.Rand) *BattlePetEntity {
|
||||
ret := &BattlePetEntity{}
|
||||
|
||||
@@ -235,7 +235,7 @@ func initfightready(in *input.Input) (model.FightUserInfo, []model.ReadyFightPet
|
||||
func (f *FightC) IsWin(c *input.Input) bool {
|
||||
|
||||
for _, v := range f.GetInputByPlayer(c.Player, true).AllPet {
|
||||
if !v.NotAlive { //如果存活
|
||||
if !v.Alive() { //如果存活
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ func (our *Input) SortPet() {
|
||||
}
|
||||
nonZeroHP = append(nonZeroHP, s)
|
||||
} else {
|
||||
s.NotAlive = true
|
||||
|
||||
zeroHP = append(zeroHP, s)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user