```
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

fix(fight): 修复技能实体属性访问问题

- 修改所有技能实体的ID、Power、CritRate、MustHit、Priority等属性访问方式
  从直接访问改为通过XML字段访问,确保数据一致性

- 更新多个boss技能效果处理逻辑中的属性引用路径

- 移除已废弃的effect/486文件

- 在New
This commit is contained in:
昔念
2026-03-09 18:49:51 +08:00
parent 99ef152434
commit 994cbb44b8
73 changed files with 360 additions and 289 deletions

View File

@@ -109,7 +109,7 @@ func (f *FightC) UseSkill(c common.PlayerI, id uint32) {
// }
for _, v := range f.GetInputByPlayer(c, false).CurrentPet.Skills {
if v.ID == int(id) {
if v.XML.ID == int(id) {
ret.SkillEntity = v
break

View File

@@ -29,14 +29,14 @@ func (e *NewSel148) DamageDivEx(t *info.DamageZone) bool {
if e.sks == nil {
e.sks = make(map[int]info.SkillEntity)
}
old, ok := e.sks[e.Ctx().SkillEntity.ID]
old, ok := e.sks[e.Ctx().SkillEntity.XML.ID]
if !ok {
e.sks[e.Ctx().SkillEntity.ID] = *e.Ctx().SkillEntity
e.sks[e.Ctx().SkillEntity.XML.ID] = *e.Ctx().SkillEntity
t.Damage = alpacadecimal.Zero
return true
}
if old.Power == e.Ctx().SkillEntity.Power {
if old.XML.Power == e.Ctx().SkillEntity.XML.Power {
t.Damage = alpacadecimal.Zero
return true
}

View File

@@ -25,7 +25,7 @@ func (e *NewSel17) ActionStart(a, b *action.SelectSkillAction) bool {
}
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Args()[0]) == -1 {
e.Ctx().SkillEntity.CritRate = 16
e.Ctx().SkillEntity.XML.CritRate = 16
}
return true

View File

@@ -23,7 +23,7 @@ func (e *NewSel18) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.MustHit = 1
e.Ctx().SkillEntity.XML.MustHit = 1
return true
}
func init() {

View File

@@ -35,7 +35,7 @@ func (e *NewSel19) ComparePre(fattack *action.SelectSkillAction, sattack *action
return true
}
//对调
sattack.SkillEntity.Priority = math.MaxInt
sattack.SkillEntity.XML.Priority = math.MaxInt
return true
}
func init() {

View File

@@ -27,7 +27,7 @@ func (e *NewSel20) DamageLockEx(t *info.DamageZone) bool {
return true
}
_, ok := lo.Find(e.SideEffectArgs, func(sid int) bool {
return sid == e.Ctx().SkillEntity.ID
return sid == e.Ctx().SkillEntity.XML.ID
})
if ok {
e.can = true

View File

@@ -26,14 +26,12 @@ func (e *NewSel21) DamageLockEx(t *info.DamageZone) bool {
return true
}
_, ok := lo.Find(e.SideEffectArgs, func(sid int) bool {
return sid == e.Ctx().SkillEntity.ID
return sid == e.Ctx().SkillEntity.XML.ID
})
if !ok {
t.Damage = alpacadecimal.Min(t.Damage, e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1)))
}
return true
}

View File

@@ -26,7 +26,7 @@ func (e *NewSel224) Skill_Use() bool {
_, ok := lo.Find(e.Args(), func(item alpacadecimal.Decimal) bool {
return skill.ID == int(item.IntPart())
return skill.XML.ID == int(item.IntPart())
})
if !ok {
return true

View File

@@ -36,7 +36,7 @@ func (e *NewSel23) ComparePre(fattack *action.SelectSkillAction, sattack *action
//full32 := int(e.Args()[0])<<16 | int(e.Args()[1])
if int(e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Args()[0])) == -1 {
sattack.SkillEntity.Priority = math.MaxInt
sattack.SkillEntity.XML.Priority = math.MaxInt
}
return true

View File

@@ -25,7 +25,7 @@ func (e *NewSel24) SkillHit_ex() bool {
_, ok := lo.Find(e.Args(), func(item alpacadecimal.Decimal) bool {
return skill.ID == int(item.IntPart())
return skill.XML.ID == int(item.IntPart())
})
if !ok {
return true

View File

@@ -30,7 +30,7 @@ func (e *NewSel27) DamageDivEx(t *info.DamageZone) bool {
e.index = 0
}
if int(e.Args()[e.index].IntPart()) == e.Ctx().SkillEntity.Type {
if int(e.Args()[e.index].IntPart()) == e.Ctx().SkillEntity.XML.Type {
e.index++
return true
}

View File

@@ -21,7 +21,7 @@ func (e *NewSel28) DamageAdd(t *info.DamageZone) bool {
return true
}
if e.Ctx().SkillEntity.Type != int(e.Args()[0].IntPart()) {
if e.Ctx().SkillEntity.XML.Type != int(e.Args()[0].IntPart()) {
return true
}
if t.Type != info.DamageType.Red {

View File

@@ -17,7 +17,7 @@ func (e *NewSel284) DamageDivEx(t *info.DamageZone) bool {
return true
}
if e.Ctx().SkillEntity.Priority > 0 {
if e.Ctx().SkillEntity.XML.Priority > 0 {
return true
}
//e.Ctx().SkillEntity.SetMiss()

View File

@@ -4,6 +4,8 @@ import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 29. 自身的所有技能命中率增加 n%;a1: n 百分比)
@@ -23,7 +25,7 @@ func (e *NewSel29) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.Accuracy += int(e.Args()[0].IntPart())
e.Ctx().SkillEntity.Accuracy = alpacadecimal.NewFromInt(int64(e.Ctx().SkillEntity.XML.Accuracy)).Mul(e.Args()[0].Add(alpacadecimal.NewFromInt(100)))
return true
}
func init() {

View File

@@ -43,7 +43,7 @@ func (e *NewSel36) DamageDivEx(t *info.DamageZone) bool {
return true
}
if int(e.Args()[e.index].IntPart()) != e.Ctx().SkillEntity.Type {
if int(e.Args()[e.index].IntPart()) != e.Ctx().SkillEntity.XML.Type {
t.Damage = alpacadecimal.Zero
}

View File

@@ -22,7 +22,7 @@ func (e *NewSel4) Skill_Use_ex() bool {
return true
}
if e.Ctx().SkillEntity.Type == e.Ctx().Our.CurrentPet.Type {
if e.Ctx().SkillEntity.XML.Type == e.Ctx().Our.CurrentPet.Type {
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Opp.SumDamage)

View File

@@ -34,11 +34,11 @@ func (e *NewSel405) ComparePre(fattack *action.SelectSkillAction, sattack *actio
}
// n%几率触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
if !success {
}
//对调
sattack.SkillEntity.Priority += 1
sattack.SkillEntity.XML.Priority += 1
return true
}
func init() {

View File

@@ -34,7 +34,7 @@ func (e *NewSel42) ComparePre(fattack *action.SelectSkillAction, sattack *action
return true
}
//对调
sattack.SkillEntity.Priority += int(e.Args()[0].IntPart())
sattack.SkillEntity.XML.Priority += int(e.Args()[0].IntPart())
return true
}
func init() {

View File

@@ -23,7 +23,7 @@ func (e *NewSel45) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.CritRate = int(e.Args()[0].IntPart())
e.Ctx().SkillEntity.XML.CritRate = int(e.Args()[0].IntPart())
return true
}

View File

@@ -27,7 +27,7 @@ func (e *NewSel5) DamageLockEx(t *info.DamageZone) bool {
}
_, ok := lo.Find(append(e.Args(), alpacadecimal.NewFromInt(8)), func(item alpacadecimal.Decimal) bool {
return int(item.IntPart()) == e.Ctx().Type
return int(item.IntPart()) == e.Ctx().XML.Type
})
if ok {
return true

View File

@@ -24,7 +24,7 @@ func (e *NewSel57) DamageAdd(*info.DamageZone) bool {
// 提高致命一击率n/16
if e.Ctx().SkillEntity != nil {
e.Ctx().SkillEntity.CritRate += int(e.Args()[1].IntPart() / 16)
e.Ctx().SkillEntity.XML.CritRate += int(e.Args()[1].IntPart() / 16)
}
return true
}

View File

@@ -1,7 +1,10 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 64. 受到致命一击的概率降低n/16a1: n
@@ -10,7 +13,7 @@ type NewSel64 struct {
NewSel0
}
func (e *NewSel64) SkillHit_ex() bool {
func (e *NewSel64) DamageLockEx(t *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
@@ -20,7 +23,18 @@ func (e *NewSel64) SkillHit_ex() bool {
return true
}
skill.CritRate -= int(e.Args()[0].IntPart())
if t.Type == info.DamageType.Red {
return true
}
if skill.Crit == 0 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 16)
if success {
t.Damage = alpacadecimal.Zero
}
return true
}
func init() {

View File

@@ -36,7 +36,7 @@ func (e *NewSel79) ActionStart(a, b *action.SelectSkillAction) bool {
// 如果上一回合被触发过,本回合攻击威力翻倍
if e.triggered {
e.Ctx().SkillEntity.Power = e.Ctx().SkillEntity.Power * 2
e.Ctx().SkillEntity.XML.Power = e.Ctx().SkillEntity.XML.Power * 2
e.triggered = false
}

View File

@@ -23,7 +23,7 @@ func (e *NewSel30) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.CritRate += int(e.Args()[0].IntPart())
e.Ctx().SkillEntity.XML.CritRate += int(e.Args()[0].IntPart())
return true
}

View File

@@ -32,7 +32,7 @@ func (e *Effect142) ComparePre(fattack *action.SelectSkillAction, sattack *actio
return true
}
//对调
sattack.SkillEntity.Priority += 1
sattack.SkillEntity.XML.Priority += 1
return true
}
func (e *Effect142) OnSkill() bool {

View File

@@ -34,7 +34,7 @@ func (e *Effect171) ComparePre(fattack *action.SelectSkillAction, sattack *actio
return true
}
//对调
sattack.SkillEntity.Priority += 1
sattack.SkillEntity.XML.Priority += 1
return true
}
func (e *Effect171) SetArgs(t *input.Input, a ...int) {

View File

@@ -17,7 +17,7 @@ func (e *Effect179) SkillHit() bool {
if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type {
// 属性相同技能威力提升n
e.Ctx().SkillEntity.Power += int(e.Args()[0].IntPart())
e.Ctx().SkillEntity.XML.Power += int(e.Args()[0].IntPart())
}
return true

View File

@@ -18,7 +18,7 @@ func (e *Effect193) SkillHit() bool {
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { // 对手处于异常状态
// 设定必定暴击
e.Ctx().SkillEntity.CritRate = 16
e.Ctx().SkillEntity.XML.CritRate = 16
}
return true

View File

@@ -72,7 +72,7 @@ func (e *Effect435) ComparePre(fattack *action.SelectSkillAction, sattack *actio
return true
}
//对调
sattack.SkillEntity.Priority += 7
sattack.SkillEntity.XML.Priority += 7
e.Alive(false)
return true
}

View File

@@ -0,0 +1,24 @@
package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 444 - 降低对手所有PP一点并恢复自身所有PP一点
type Effect444 struct {
node.EffectNode
}
func (e *Effect444) OnSkill() bool {
// 降低对手所有技能PP
e.Ctx().Opp.DelPP(1)
e.Ctx().Our.HealPP(1)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 444, &Effect444{})
}

View File

@@ -35,7 +35,7 @@ func (e *Effect454) ComparePre(fattack *action.SelectSkillAction, sattack *actio
threshold := maxHp.Div(e.Args()[0]) // 1/n
if currentHp.Cmp(threshold) < 0 {
sattack.SkillEntity.Priority += 1
sattack.SkillEntity.XML.Priority += 1
}
//对调

View File

@@ -0,0 +1,50 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 461 - 使用后若自身体力低于1/m则从下回合开始必定致命一击
type Effect461 struct {
node.EffectNode
can bool
}
func (e *Effect461) Skill_Use() bool {
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
currentHp := e.Ctx().Our.CurrentPet.GetHP()
threshold := maxHp.Div(e.Args()[1]) // 1/m
if currentHp.Cmp(threshold) < 0 {
e.can = true
}
return true
}
func (e *Effect461) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(-1) // 持续n回合
}
func (e *Effect461) ActionStart(a, b *action.SelectSkillAction) bool {
if !e.can {
return true
}
//fmt.Println(e.Ctx().SkillEntity)
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 461, &Effect461{})
}

View File

@@ -26,7 +26,7 @@ func (e *Effect468) SkillHit() bool {
if ispwoer {
// 威力翻倍
e.Ctx().SkillEntity.Power *= 2
e.Ctx().SkillEntity.XML.Power *= 2
}

View File

@@ -0,0 +1,30 @@
package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 474 - 先出手时m%自身XX等级+n
type Effect474 struct {
node.EffectNode
}
func (e *Effect474) OnSkill() bool {
if e.IsFirst() { // 先出手
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
effectType := int8(e.Args()[1].IntPart()) // XX类型
effectValue := int8(e.Args()[2].IntPart()) // 等级+n
e.Ctx().Our.SetProp(e.Ctx().Our, effectType, effectValue)
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 474, &Effect474{})
}

View File

@@ -24,7 +24,7 @@ func (e *Effect493) SkillHit() bool {
return true
}
e.Ctx().SkillEntity.CritRate = 16
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}

View File

@@ -0,0 +1,31 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 495 - 若对手处于XX状态则30%几率秒杀对手
type Effect495 struct {
node.EffectNode
}
func (e *Effect495) OnSkill() bool {
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) { // 对手处于异常状态
chance := 30 // 固定30%
success, _, _ := e.Input.Player.Roll(chance, 100)
if success {
// 秒杀对手
e.Ctx().Opp.CurrentPet.Info.Hp = 0
e.Ctx().Opp.CurrentPet.NotAlive = true
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 495, &Effect495{})
}

View File

@@ -0,0 +1,26 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 496 - 若打出致命一击则恢复自身所有体力
type Effect496 struct {
node.EffectNode
}
func (e *Effect496) SkillHit_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit != 0 {
// 如果造成了致命一击,恢复所有体力
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 496, &Effect496{})
}

View File

@@ -25,7 +25,7 @@ func (e *Effect498) ActionStart(a, b *action.SelectSkillAction) bool {
if !e.Ctx().Opp.StatEffect_Exist(input.StatusSleep) {
return true
}
e.Ctx().SkillEntity.CritRate += int(e.Args()[1].IntPart())
e.Ctx().SkillEntity.XML.CritRate += int(e.Args()[1].IntPart())
return true
}

View File

@@ -18,7 +18,7 @@ func (e *Effect500) SkillHit() bool {
if e.Ctx().Opp.StatEffect_Exist(info.PetStatus.Fear) {
// 伤害翻倍
e.Ctx().SkillEntity.Power *= 2
e.Ctx().SkillEntity.XML.Power *= 2
}
return true

View File

@@ -0,0 +1,30 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 505 - 若打出致命一击则造成伤害值的m%恢复自身体力
type Effect505 struct {
node.EffectNode
}
func (e *Effect505) Skill_Use() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit != 0 {
damageDone := e.Ctx().Our.SumDamage
healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // m%
healAmount := damageDone.Mul(healPercent)
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 505, &Effect505{})
}

View File

@@ -32,7 +32,7 @@ func (e *Effect511) SkillHit() bool {
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
// 威力翻倍
e.Ctx().SkillEntity.Power *= 2
e.Ctx().SkillEntity.XML.Power *= 2
}
return true

View File

@@ -30,7 +30,7 @@ func (e *Effect513) SkillHit() bool {
}
if hasSpecificStatus {
// 威力翻倍
e.Ctx().SkillEntity.Power *= 2
e.Ctx().SkillEntity.XML.Power *= 2
}

View File

@@ -25,7 +25,7 @@ func (e *Effect620) ActionStart(a, b *action.SelectSkillAction) bool {
if !e.Ctx().Opp.StatEffect_Exist(input.StatusSleep) {
return true
}
e.Ctx().SkillEntity.CritRate += int(e.Args()[1].IntPart())
e.Ctx().SkillEntity.XML.CritRate += int(e.Args()[1].IntPart())
return true
}

View File

@@ -41,7 +41,7 @@ func registerRandomPower(effectID, min, max int) {
// -----------------------------------------------------------
func (e *EffectRandomPower) SkillHit() bool {
if e.Max <= e.Min {
e.Ctx().SkillEntity.Power = e.Min
e.Ctx().SkillEntity.XML.Power = e.Min
return true
}
@@ -53,6 +53,6 @@ func (e *EffectRandomPower) SkillHit() bool {
// n = grand.Intn(e.Max-e.Min+1) + e.Min
// }
n := grand.N(e.Min, e.Max)
e.Ctx().SkillEntity.Power = n
e.Ctx().SkillEntity.XML.Power = n
return true
}

View File

@@ -23,7 +23,7 @@ type AddLvelEffect struct {
// 使用技能
func (e *AddLvelEffect) SkillHit() bool {
if (e.Skillid != 0 && e.Ctx().SkillEntity.ID != e.Skillid) || e.Ctx().SkillEntity.AttackTime == 0 {
if (e.Skillid != 0 && e.Ctx().SkillEntity.XML.ID != e.Skillid) || e.Ctx().SkillEntity.AttackTime == 0 {
e.Alive(false)
e.UseSkillCount = 0
return true
@@ -32,7 +32,7 @@ func (e *AddLvelEffect) SkillHit() bool {
e.Duration(-1) //次数类无限回合
e.CanStack(true) //后续的不会顶掉这个效果
e.Skillid = e.Ctx().SkillEntity.ID
e.Skillid = e.Ctx().SkillEntity.XML.ID
e.UseSkillCount++
return true
}
@@ -54,7 +54,7 @@ type Effect9 struct {
func (e *Effect9) SkillHit() bool {
e.Ctx().SkillEntity.Power += int(e.GetADD(alpacadecimal.Zero, e.Args()[0], e.Args()[1]).IntPart())
e.Ctx().SkillEntity.XML.Power += int(e.GetADD(alpacadecimal.Zero, e.Args()[0], e.Args()[1]).IntPart())
return true
}
@@ -167,7 +167,7 @@ func (e *Effect441) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.CritRate += int(e.GetADD(alpacadecimal.Zero, e.Args()[2], e.Args()[3]).IntPart())
e.Ctx().SkillEntity.XML.CritRate += int(e.GetADD(alpacadecimal.Zero, e.Args()[2], e.Args()[3]).IntPart())
return true
}

View File

@@ -228,29 +228,6 @@ func (e *Effect178) SkillHit_ex() bool {
return true
}
// 444 - 降低对手所有PP一点并恢复自身所有PP一点
type Effect444 struct {
node.EffectNode
}
func (e *Effect444) OnSkill() bool {
// 降低对手所有技能PP
for _, skill := range e.Ctx().Opp.CurrentPet.Skills {
if skill.PP > 0 {
skill.PP--
}
}
// 恢复自身所有技能PP
for _, skill := range e.Ctx().Our.CurrentPet.Skills {
if skill.MaxPP > skill.PP {
skill.PP = skill.MaxPP
}
}
return true
}
// 475 - 若造成的伤害不足m则下n回合的攻击必定致命一击
type Effect475 struct {
node.EffectNode
@@ -276,21 +253,6 @@ func (e *Effect475) SkillHit_ex() bool {
return true
}
// 496 - 若打出致命一击则恢复自身所有体力
type Effect496 struct {
node.EffectNode
}
func (e *Effect496) SkillHit_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.WasCritical {
// 如果造成了致命一击,恢复所有体力
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
}
return true
}
// 501 - 若造成的伤害不足m则对手XX等级-n
type Effect501 struct {
node.EffectNode
@@ -314,30 +276,6 @@ func (e *Effect501) SkillHit_ex() bool {
return true
}
// 474 - 先出手时m%自身XX等级+n
type Effect474 struct {
node.EffectNode
}
func (e *Effect474) OnSkill() bool {
if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
effectType := int(e.Args()[1].IntPart()) // XX类型
effectValue := int(e.Args()[2].IntPart()) // 等级+n
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
if statusEffect != nil {
statusEffect.SetArgs(e.Ctx().Our, effectValue)
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
}
}
}
return true
}
// 440 - n回合内对手使用技能消耗的PP值变为m倍
type Effect440 struct {
node.EffectNode
@@ -366,25 +304,6 @@ func (e *Effect516) OnSkill() bool {
return true
}
// 495 - 若对手处于XX状态则30%几率秒杀对手
type Effect495 struct {
node.EffectNode
}
func (e *Effect495) OnSkill() bool {
if e.Ctx().Opp.CurrentPet.HasAnyStatus() { // 对手处于异常状态
chance := 30 // 固定30%
success, _, _ := e.Input.Player.Roll(chance, 100)
if success {
// 秒杀对手
e.Ctx().Opp.CurrentPet.Info.Hp = 0
e.Ctx().Opp.CurrentPet.NotAlive = true
}
}
return true
}
// 457 - 复制对手释放的技能(组队对战时无效)
type Effect457 struct {
node.EffectNode
@@ -529,23 +448,6 @@ func (e *Effect197) SetArgs(t *input.Input, a ...int) {
e.EffectNode.Duration(a[0]) // 持续n回合
}
// 505 - 若打出致命一击则造成伤害值的m%恢复自身体力
type Effect505 struct {
node.EffectNode
}
func (e *Effect505) SkillHit_ex() bool {
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.WasCritical {
damageDone := e.Ctx().Our.SumDamage
healPercent := e.Args()[0].Div(alpacadecimal.NewFromInt(100)) // m%
healAmount := damageDone.Mul(healPercent)
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
}
return true
}
// 170 - 若先出手则免疫当回合伤害并回复1/n的最大体力值
type Effect170 struct {
node.EffectNode
@@ -646,25 +548,3 @@ func (e *Effect199) Skill_Use() bool {
return true
}
// 461 - 使用后若自身体力低于1/m则从下回合开始必定致命一击
type Effect461 struct {
node.EffectNode
}
func (e *Effect461) OnSkill() bool {
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
currentHp := e.Ctx().Our.CurrentPet.GetHP()
threshold := maxHp.Div(e.Args()[1]) // 1/m
if currentHp.Cmp(threshold) < 0 {
// 添加必定暴击效果,从下回合开始
critEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.MustCrit))
if critEffect != nil {
critEffect.Duration(int(e.Args()[0].IntPart())) // 持续回合数
e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect)
}
}
return true
}

View File

@@ -28,7 +28,7 @@ func (e *Effect100) SkillHit() bool {
odp := e.GetInput().CurrentPet.GetHP().Div(e.GetInput().CurrentPet.GetMaxHP()).Mul(alpacadecimal.NewFromInt(65))
if odp.Cmp(alpacadecimal.NewFromInt(165)) == -1 {
e.Ctx().SkillEntity.Power = int(alpacadecimal.NewFromInt(165).Sub(odp).IntPart())
e.Ctx().SkillEntity.XML.Power = int(alpacadecimal.NewFromInt(165).Sub(odp).IntPart())
}
return true

View File

@@ -24,7 +24,7 @@ func (e *Effect113) SkillHit() bool {
//技能威力=【165-65*【当前体力百分比】】,任意体力百分比对应的威力浮动范围∈[-10+10]
e.Ctx().SkillEntity.Power = int(e.Ctx().Our.CurrentPet.Info.Dv * 5)
e.Ctx().SkillEntity.XML.Power = int(e.Ctx().Our.CurrentPet.Info.Dv * 5)
return true
}

View File

@@ -30,7 +30,7 @@ func (e *Effect115) Skill_Use() bool {
if !ok {
return true
}
rr := alpacadecimal.NewFromInt(int64(e.Ctx().Our.GetProp(4, true))).Div(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[1])))
rr := alpacadecimal.NewFromInt(int64(e.Ctx().Our.GetProp(4))).Div(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[1])))
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,

View File

@@ -25,7 +25,7 @@ func (e *Effect160) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.CritRate = 16
e.Ctx().SkillEntity.XML.CritRate = 16
e.can = false
e.Alive(false)
return true

View File

@@ -24,9 +24,9 @@ func (e *Effect35) SkillHit() bool {
switch e.Ctx().SkillEntity.Category() {
case info.Category.PHYSICAL:
e.Ctx().SkillEntity.Power += (e.Ctx().Opp.GetProp(0, true) + e.Ctx().Opp.GetProp(1, true)) * 20
e.Ctx().SkillEntity.XML.Power += (int(e.Ctx().Opp.Prop[0]) + int(e.Ctx().Opp.Prop[1])) * 20
case info.Category.SPECIAL:
e.Ctx().SkillEntity.Power += (e.Ctx().Opp.GetProp(2, true) + e.Ctx().Opp.GetProp(3, true)) * 20
e.Ctx().SkillEntity.XML.Power += (int(e.Ctx().Opp.Prop[2]) + int(e.Ctx().Opp.Prop[3])) * 20
}
return true

View File

@@ -15,7 +15,7 @@ func (e *Effect37) SkillHit() bool {
cmphp := e.GetInput().CurrentPet.GetMaxHP().Div(e.Args()[0])
if e.GetInput().CurrentPet.GetHP().Cmp(cmphp) == -1 {
e.Ctx().SkillEntity.Power *= int(e.Args()[1].IntPart())
e.Ctx().SkillEntity.XML.Power *= int(e.Args()[1].IntPart())
}
return true
}

View File

@@ -43,7 +43,7 @@ func (e *Effect41) DamageDivEx(t *info.DamageZone) bool {
return true
}
if e.Ctx().SkillEntity.Type != int(element.ElementTypeFire) {
if e.Ctx().SkillEntity.XML.Type != int(element.ElementTypeFire) {
return true
}
if t.Type == info.DamageType.Red {

View File

@@ -23,7 +23,7 @@ func (e *Effect42) Damage_Mul(t *info.DamageZone) bool {
return true
}
if e.Ctx().SkillEntity.Type != int(element.ElementTypeElectric) {
if e.Ctx().SkillEntity.XML.Type != int(element.ElementTypeElectric) {
return true
}
//fmt.Println("Effect42_o", t.Damage)

View File

@@ -34,7 +34,7 @@ func (e *Effect481) ComparePre(fattack *action.SelectSkillAction, sattack *actio
return true
}
//对调
sattack.SkillEntity.Priority += int(e.Args()[0].IntPart())
sattack.SkillEntity.XML.Priority += int(e.Args()[0].IntPart())
return true
}
func init() {

View File

@@ -40,7 +40,7 @@ func (e *Effect58) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.CritRate = 16
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}

View File

@@ -23,12 +23,12 @@ func (e *Effect65) SkillHit() bool {
return true
}
if info.EnumCategory(e.Ctx().SkillEntity.Move.Type) != info.EnumCategory(e.Args()[1].IntPart()) {
if info.EnumCategory(e.Ctx().SkillEntity.XML.Type) != info.EnumCategory(e.Args()[1].IntPart()) {
return true
}
//技能威力=【165-65*【当前体力百分比】】,任意体力百分比对应的威力浮动范围∈[-10+10]
e.Ctx().SkillEntity.Power *= int(e.Args()[2].IntPart())
e.Ctx().SkillEntity.XML.Power *= int(e.Args()[2].IntPart())
return true
}

View File

@@ -26,7 +26,7 @@ type Effect7 struct {
func (e *Effect7) SkillHit() bool {
if e.Ctx().Opp.CurrentPet.Info.Hp <= e.Ctx().Our.CurrentPet.Info.Hp {
e.Ctx().SkillEntity.Accuracy = 0
e.Ctx().SkillEntity.Accuracy = alpacadecimal.Zero
}
return true

View File

@@ -38,7 +38,7 @@ func (e *Effect81) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.MustHit = 1
e.Ctx().SkillEntity.XML.MustHit = 1
return true
}
func (e *Effect81) SetArgs(t *input.Input, a ...int) {

View File

@@ -53,7 +53,7 @@ func (e *Effect83) ComparePre(fattack *action.SelectSkillAction, sattack *action
return true
}
//对调
sattack.SkillEntity.Priority = math.MaxInt
sattack.SkillEntity.XML.Priority = math.MaxInt
return true
}
@@ -74,7 +74,7 @@ func (e *Effect83) ActionStart(a, b *action.SelectSkillAction) bool {
return true
}
e.Ctx().SkillEntity.CritRate = 16
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}

View File

@@ -33,7 +33,7 @@ func (e *Effect95) ActionStart(a, b *action.SelectSkillAction) bool {
if !e.Ctx().Opp.StatEffect_Exist(input.StatusSleep) {
return true
}
e.Ctx().SkillEntity.CritRate += int(e.Args()[0].IntPart())
e.Ctx().SkillEntity.XML.CritRate += int(e.Args()[0].IntPart())
return true
}

View File

@@ -33,7 +33,7 @@ type Effect96 struct {
func (e *Effect96) SkillHit() bool {
if f := statusFuncRegistry.Get(e.StatusID); f != nil && f(e.Ctx().Our, e.Ctx().Opp) {
e.Ctx().SkillEntity.Power *= 2
e.Ctx().SkillEntity.XML.Power *= 2
}
return true
}
@@ -97,7 +97,7 @@ func (e *Effect129) SkillHit() bool {
if e.Ctx().Opp.CurrentPet.Info.Gender != e.SideEffectArgs[0] {
return true
}
e.Ctx().SkillEntity.Power *= 2
e.Ctx().SkillEntity.XML.Power *= 2
return true
}
@@ -116,6 +116,6 @@ func (e *Effect609) SkillHit() bool {
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.SideEffectArgs[0])) {
return true
}
e.Ctx().SkillEntity.Power *= 2
e.Ctx().SkillEntity.XML.Power *= 2
return true
}

View File

@@ -103,7 +103,7 @@ type Burned struct {
func (e *Burned) SkillHit() bool {
e.Ctx().SkillEntity.Power /= 2
e.Ctx().SkillEntity.XML.Power /= 2
return true
}
@@ -150,7 +150,7 @@ func (e *Flammable) ActionStart(fattack *action.SelectSkillAction, sattack *acti
if e.Ctx().SkillEntity == nil {
return true
}
e.Ctx().SkillEntity.Accuracy -= 30
e.Ctx().SkillEntity.Accuracy.Sub(alpacadecimal.NewFromInt(30))
return true
@@ -160,7 +160,7 @@ func (e *Flammable) Skill_Use_ex() bool {
return true
}
if e.Ctx().SkillEntity.Type != int(element.ElementTypeFire) {
if e.Ctx().SkillEntity.XML.Type != int(element.ElementTypeFire) {
return true
}
// 获取状态效果
@@ -183,7 +183,7 @@ func (e *Confused) ActionStart(fattack *action.SelectSkillAction, sattack *actio
if e.Ctx().SkillEntity == nil {
return true
}
e.Ctx().SkillEntity.Accuracy -= 80
e.Ctx().SkillEntity.Accuracy.Sub(alpacadecimal.NewFromInt(80))
ok, _, _ := e.Input.Player.Roll(5, 100)
if !ok {
return true

View File

@@ -94,7 +94,7 @@ func (e *Effect71) ActionStart(a, b *action.SelectSkillAction) bool {
e.Alive(false)
}
e.count--
e.Ctx().SkillEntity.CritRate = 16
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}

View File

@@ -16,7 +16,7 @@ import (
// processSkillAttack 处理技能攻击逻辑
func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info.SkillEntity) {
skill.AttackTimeC(attacker.GetProp(5, true)) //计算命中
skill.AttackTimeC(int(attacker.Prop[5])) //计算命中
defender.Exec(func(effect input.Effect) bool { //计算闪避,然后修改对方命中),同时相当于计算属性无效这种
effect.Ctx().SkillEntity = skill
@@ -45,8 +45,8 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, skill *info
//技能miss+效果生效 这里属于强制改命中效果,但是正常来说,技能miss掉后效果也应该失效
//技能失效+效果失效
attacker.AttackTime = skill.AttackTime
attacker.SkillID = uint32(skill.ID) //获取技能ID
if skill.AttackTime != 0 { //如果命中
attacker.SkillID = uint32(skill.XML.ID) //获取技能ID
if skill.AttackTime != 0 { //如果命中
attacker.CalculateCrit(defender, skill) //暴击计算
attacker.IsCritical = skill.Crit
attacker.SumDamage = attacker.CalculatePower(defender, skill)
@@ -165,15 +165,15 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
if firstAttack != nil && secondAttack != nil {
switch {
case firstAttack.SkillEntity.Priority < secondAttack.SkillEntity.Priority:
case firstAttack.SkillEntity.XML.Priority < secondAttack.SkillEntity.XML.Priority:
firstAttack, secondAttack = secondAttack, firstAttack //互换先手权
f.First, f.Second = f.Second, f.First
case firstAttack.SkillEntity.Priority == secondAttack.SkillEntity.Priority:
if f.Second.GetProp(4, false) > f.First.GetProp(4, false) {
case firstAttack.SkillEntity.XML.Priority == secondAttack.SkillEntity.XML.Priority:
if f.Second.GetProp(4) > f.First.GetProp(4) {
firstAttack, secondAttack = secondAttack, firstAttack //互换先手权
f.First, f.Second = f.Second, f.First
}
if f.Second.GetProp(4, false) == f.First.GetProp(4, false) {
if f.Second.GetProp(4) == f.First.GetProp(4) {
if grand.Meet(1, 2) { //随机出手
firstAttack, secondAttack = secondAttack, firstAttack //互换先手权
f.First, f.Second = f.Second, f.First

View File

@@ -50,24 +50,26 @@ func CreateBattlePetEntity(info model.PetInfo, rand *rand.Rand) *BattlePetEntity
// value 基础属性值
// stat 状态变化值(可正可负)
// 返回// 返回计算后的实际属性值确保结果至少为1
func CalculateRealValue(value int, stat int) int {
if stat == 0 {
if value <= 0 {
return 1
}
func CalculateRealValue(value alpacadecimal.Decimal, stat1 int) alpacadecimal.Decimal {
if stat1 == 0 {
return value
} else if stat > 0 {
r := int(float64(value) * (float64(stat+2) / 2.0))
if r <= 0 {
return 1
}
}
if !value.IsPositive() {
value = alpacadecimal.NewFromInt(1)
}
two := alpacadecimal.NewFromInt(2)
stat := alpacadecimal.NewFromInt(int64(stat1))
if stat.IsPositive() {
value.Mul(stat.Add(two).Mul(two))
r := value.Mul(stat.Add(two).Mul(two))
return r
} else {
r := int(float64(value) * (2.0 / float64(2-stat)))
if r <= 0 {
return 1
}
return r
r := two.Sub(stat)
return value.Mul(two.Div(r))
}
}
func (u *BattlePetEntity) GetHP() alpacadecimal.Decimal {

View File

@@ -10,7 +10,6 @@ import (
"strconv"
"github.com/alpacahq/alpacadecimal"
"github.com/shopspring/decimal"
"github.com/tnnmigga/enum"
)
@@ -53,14 +52,14 @@ func (d *DamageZone) Mul(n int) {
// 实现了战斗中技能的所有属性和行为包括PP管理、技能使用、属性获取等
// 战斗中可以修改技能实体值,比如是否暴击,是否必中等
type SkillEntity struct {
xmlres.Move
Info *model.SkillInfo
XML xmlres.Move
Info *model.SkillInfo
Accuracy alpacadecimal.Decimal // 伤害值
DamageValue alpacadecimal.Decimal // 伤害值
Rand *rand.Rand
Pet *BattlePetEntity
//MaxValue func(ahp, bhp uint32) decimal.Decimal
Crit uint32
Crit uint32 //记录是否实际暴击
AttackTime uint32 //记录技能实际是否命中,0表示未命中,1表示命中,2表示必中
Hit bool
}
@@ -75,9 +74,9 @@ func CreateSkill(skill *model.SkillInfo, rand *rand.Rand, pet *BattlePetEntity)
move, ok := xmlres.SkillMap[int(skill.ID)]
if ok {
ret.Move = move
ret.XML = move
}
ret.Accuracy = alpacadecimal.NewFromInt(int64(move.Accuracy))
ret.Info = skill
return &ret
@@ -121,12 +120,12 @@ func (s *SkillEntity) SetNoSide() bool {
// 获取技能类型
func (s *SkillEntity) Category() EnumCategory {
return EnumCategory(s.Move.Category)
return EnumCategory(s.XML.Category)
}
// 获取技能属性
func (s *SkillEntity) GetType() *element.ElementCombination {
ret, _ := element.Calculator.GetCombination(s.Move.Type)
ret, _ := element.Calculator.GetCombination(s.XML.Type)
return ret
}
@@ -142,10 +141,10 @@ func (s *SkillEntity) GetType() *element.ElementCombination {
// 获取技能名称为空时使用ID
func getSkillName(move *SkillEntity) string {
if move.Name == "" {
return strconv.FormatInt(int64(move.ID), 10)
if move.XML.Name == "" {
return strconv.FormatInt(int64(move.XML.ID), 10)
}
return move.Name
return move.XML.Name
}
// 获取副作用列表,处理空值情况
@@ -174,13 +173,13 @@ func getSkillName(move *SkillEntity) string {
func (s *SkillEntity) AttackTimeC(level int) uint32 {
s.AttackTime = 0 //先重置上一次的
if s.MustHit != 0 {
if s.XML.MustHit != 0 {
s.AttackTime = 2
s.Hit = true
return s.AttackTime
}
a := int64(s.GetAccuracy(level))
a := int64(s.GetAccuracy(level).IntPart())
r := s.Rand.Int63n(100)
if a >= r {
s.Hit = true
@@ -231,11 +230,11 @@ func (s *SkillEntity) Criticalrandom() alpacadecimal.Decimal {
}
// Accuracy 优化版命中率计算(用绝对值和正负判断处理等级)
func (a *SkillEntity) GetAccuracy(level int) uint32 {
func (a *SkillEntity) GetAccuracy(level int) alpacadecimal.Decimal {
// 基础参数校验
if level >= 0 { //强化等级
return uint32(CalculateRealValue((a.Accuracy), level))
return CalculateRealValue((a.Accuracy), level)
}
var temp float64
switch level {
@@ -253,10 +252,5 @@ func (a *SkillEntity) GetAccuracy(level int) uint32 {
temp = 0.25
}
return uint32(
decimal.NewFromInt(int64(a.Accuracy)). // 将b转为decimal类型
Mul(decimal.NewFromFloat(temp)). // 精确乘以0.85
//Round(0). // 四舍五入到整数
IntPart(), // 转为int64
)
return a.Accuracy.Mul(alpacadecimal.NewFromFloat(temp))
}

View File

@@ -91,7 +91,7 @@ func (our *Input) GetAction() {
}
if usedskill != nil {
our.FightC.UseSkill(our.Player, uint32(usedskill.ID))
our.FightC.UseSkill(our.Player, uint32(usedskill.XML.ID))
} else {
our.FightC.UseSkill(our.Player, 0)
}

View File

@@ -92,27 +92,17 @@ func (our *Input) InitEffect(etype EnumEffectType, id int, a ...int) Effect {
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
// 是否需要真实提升
func (our *Input) GetProp(id int, istue bool) int {
func (our *Input) GetProp(id int) int {
// 获取基础属性值
baseValue := int(our.AttackValue.Prop[id])
// 命中情况直接返回基础值(优先判断)
if id >= 5 {
return baseValue
}
// 处理id < 5的情况
if istue {
return baseValue
}
// 计算实际值(这里可以插入后续优化的函数调用)
realValue := info.CalculateRealValue(int(our.CurrentPet.Info.Prop[id]), baseValue)
realValue := info.CalculateRealValue(alpacadecimal.NewFromInt(int64(our.CurrentPet.Info.Prop[id])), baseValue)
// todo: 插入获取后处理函数,例如:
// realValue = postProcessValue(realValue, id, c)
return realValue
return int(realValue.IntPart())
}

View File

@@ -18,22 +18,22 @@ func (our *Input) CalculateCrit(opp *Input, skill *info.SkillEntity) {
if skill.Category() == info.Category.STATUS { //属性技能不用算暴击
return
}
CritRate := utils.Max(skill.CritRate, 1)
CritRate := utils.Max(skill.XML.CritRate, 1)
//CritAtkFirst: 先出手时必定致命一击; 默认: 0
if skill.CritAtkFirst != 0 && our.FightC.IsFirst(our.Player) {
if skill.XML.CritAtkFirst != 0 && our.FightC.IsFirst(our.Player) {
CritRate = 16
}
//CritAtkSecond: 后出手时必定致命一击; 默认: 0
if skill.CritAtkSecond != 0 && !our.FightC.IsFirst(our.Player) {
if skill.XML.CritAtkSecond != 0 && !our.FightC.IsFirst(our.Player) {
CritRate = 16
}
// CritSelfHalfHp: 自身体力低于一半时必定致命一击; 默认: 0
if skill.CritSelfHalfHp != 0 && (our.CurrentPet.HP < int(our.CurrentPet.Info.MaxHp)/2) {
if skill.XML.CritSelfHalfHp != 0 && (our.CurrentPet.HP < int(our.CurrentPet.Info.MaxHp)/2) {
CritRate = 16
}
// CritFoeHalfHp: 对方体力低于一半时必定致命一击; 默认: 0
if skill.CritSelfHalfHp != 0 && (opp.CurrentPet.HP < int(opp.CurrentPet.Info.MaxHp)/2) {
if skill.XML.CritSelfHalfHp != 0 && (opp.CurrentPet.HP < int(opp.CurrentPet.Info.MaxHp)/2) {
CritRate = 16
}
@@ -184,13 +184,13 @@ func (our *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) alpaca
switch skill.Category() { //判断技能类型
case info.Category.PHYSICAL:
attackDec = alpacadecimal.NewFromInt(int64(our.GetProp(0, false)))
defenseDec = alpacadecimal.NewFromInt(int64(deftype.GetProp(1, false)))
attackDec = alpacadecimal.NewFromInt(int64(our.GetProp(0)))
defenseDec = alpacadecimal.NewFromInt(int64(deftype.GetProp(1)))
case info.Category.SPECIAL:
attackDec = alpacadecimal.NewFromInt(int64(our.GetProp(2, false)))
defenseDec = alpacadecimal.NewFromInt(int64(deftype.GetProp(3, false)))
attackDec = alpacadecimal.NewFromInt(int64(our.GetProp(2)))
defenseDec = alpacadecimal.NewFromInt(int64(deftype.GetProp(3)))
default:
return alpacadecimal.Zero
@@ -199,36 +199,36 @@ func (our *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) alpaca
// 9. PwrBindDv: 1,威力power取决于潜力个体值*5; 2,威力power取决于最大体力*1/3+潜力(个体值); 默认: 0
// 10. PwrDouble: 攻击时,若对方处于异常状态, 则威力翻倍;
// 11. DmgBindHpDv: 造成的伤害等于自身剩余体力*1/2+潜力(个体值); 默认: 0
if skill.DmgBindLv != 0 {
if skill.XML.DmgBindLv != 0 {
//level := utils.Min(deftype.CurrentPet.Info.Level, 100)
skill.Power = int(deftype.CurrentPet.Info.Level)
skill.XML.Power = int(deftype.CurrentPet.Info.Level)
}
if skill.PwrBindDv != 0 {
if skill.PwrBindDv == 1 {
if skill.XML.PwrBindDv != 0 {
if skill.XML.PwrBindDv == 1 {
skill.Power = int(our.CurrentPet.Info.Dv * 5)
skill.XML.Power = int(our.CurrentPet.Info.Dv * 5)
}
if skill.PwrBindDv == 2 {
skill.Power = int(our.CurrentPet.Info.Hp/3 + our.CurrentPet.Info.Dv)
if skill.XML.PwrBindDv == 2 {
skill.XML.Power = int(our.CurrentPet.Info.Hp/3 + our.CurrentPet.Info.Dv)
}
}
if skill.PwrDouble != 0 {
if skill.XML.PwrDouble != 0 {
if deftype.StatEffect_Exist_all() {
skill.Power = skill.Power * 2
skill.XML.Power = skill.XML.Power * 2
}
}
if skill.DmgBindHpDv != 0 {
skill.Power = int(our.CurrentPet.Info.Hp/2 + our.CurrentPet.Info.Dv)
if skill.XML.DmgBindHpDv != 0 {
skill.XML.Power = int(our.CurrentPet.Info.Hp/2 + our.CurrentPet.Info.Dv)
}
// 5. 基础伤害公式:等级因子 * 威力因子 * 攻击 / 防御 / 50 + 2
baseDamage := levelFactor.
Mul(alpacadecimal.NewFromInt(int64(skill.Power))).
Mul(alpacadecimal.NewFromInt(int64(skill.XML.Power))).
Mul(attackDec).
Div(defenseDec).
Div(alpacadecimal.NewFromInt(50)).

View File

@@ -239,9 +239,9 @@ func (our *Input) Parseskill(skill *action.SelectSkillAction) {
// our.Initeffectcache() //这里说明是延续的效果,每次复制出来一个新的就好了
//i.NewEffects = make([]Effect, 0) //这里说明是新增的效果
temparg := skill.SideEffectArgS
temparg := skill.XML.SideEffectArgS
for _, v := range skill.SideEffectS {
for _, v := range skill.XML.SideEffectS {
args := xmlres.EffectArgs[v]
t := our.InitEffect(EffectType.Skill, v, temparg[:args]...)

View File

@@ -315,8 +315,8 @@ func (f *FightC) resolveRound(p1Action, p2Action action.BattleActionI) {
func (f *FightC) handleActiveSwitchAction(_ *action.ActiveSwitchAction, otherAction action.BattleActionI) {
if skillAction, ok := otherAction.(*action.SelectSkillAction); ok {
if skillAction.SkillEntity != nil && skillAction.CD != nil {
f.waittime = *skillAction.CD
if skillAction.SkillEntity != nil && skillAction.XML.CD != nil {
f.waittime = *skillAction.XML.CD
}
f.enterturn(skillAction, nil)
} else {
@@ -334,8 +334,8 @@ func (f *FightC) handleUseItemAction(itemAction *action.UseItemAction, otherActi
}
if skillAction, ok := otherAction.(*action.SelectSkillAction); ok {
if skillAction.SkillEntity != nil && skillAction.CD != nil {
f.waittime = *skillAction.CD
if skillAction.SkillEntity != nil && skillAction.XML.CD != nil {
f.waittime = *skillAction.XML.CD
}
f.enterturn(skillAction, nil)
} else {
@@ -419,8 +419,8 @@ func (f *FightC) handleSkillActions(a1, a2 action.BattleActionI) {
switch {
case s1 == nil || s1.SkillEntity == nil:
if s2.SkillEntity != nil {
if s2.CD != nil {
f.waittime = *s2.CD
if s2.XML.CD != nil {
f.waittime = *s2.XML.CD
}
}
@@ -428,18 +428,18 @@ func (f *FightC) handleSkillActions(a1, a2 action.BattleActionI) {
// fmt.Println("1 空过 2玩家执行技能:", s2.PlayerID, s2.Info.ID)
case s2 == nil || s2.SkillEntity == nil:
if s1.SkillEntity != nil {
if s1.CD != nil {
f.waittime = *s1.CD
if s1.XML.CD != nil {
f.waittime = *s1.XML.CD
}
}
f.enterturn(s1, nil)
//fmt.Println("2 空过 玩家执行技能:", s1.PlayerID, s1.Info.ID)
default:
if s1.CD != nil {
f.waittime = *s1.CD
if s1.XML.CD != nil {
f.waittime = *s1.XML.CD
}
if s2.CD != nil {
f.waittime += *s2.CD
if s2.XML.CD != nil {
f.waittime += *s2.XML.CD
}
f.enterturn(s1, s2)