diff --git a/logic/service/fight/action.go b/logic/service/fight/action.go index 76a2aedba..920155583 100644 --- a/logic/service/fight/action.go +++ b/logic/service/fight/action.go @@ -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 diff --git a/logic/service/fight/boss/NewSeIdx_148.go b/logic/service/fight/boss/NewSeIdx_148.go index f51186317..11c41e298 100644 --- a/logic/service/fight/boss/NewSeIdx_148.go +++ b/logic/service/fight/boss/NewSeIdx_148.go @@ -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 } diff --git a/logic/service/fight/boss/NewSeIdx_17.go b/logic/service/fight/boss/NewSeIdx_17.go index 15de42614..cf83834df 100644 --- a/logic/service/fight/boss/NewSeIdx_17.go +++ b/logic/service/fight/boss/NewSeIdx_17.go @@ -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 diff --git a/logic/service/fight/boss/NewSeIdx_18.go b/logic/service/fight/boss/NewSeIdx_18.go index 44ea1c892..37fd6dc52 100644 --- a/logic/service/fight/boss/NewSeIdx_18.go +++ b/logic/service/fight/boss/NewSeIdx_18.go @@ -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() { diff --git a/logic/service/fight/boss/NewSeIdx_19.go b/logic/service/fight/boss/NewSeIdx_19.go index 8f75a45ef..e4248b598 100644 --- a/logic/service/fight/boss/NewSeIdx_19.go +++ b/logic/service/fight/boss/NewSeIdx_19.go @@ -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() { diff --git a/logic/service/fight/boss/NewSeIdx_20.go b/logic/service/fight/boss/NewSeIdx_20.go index 6a0131a90..7a39bfb9f 100644 --- a/logic/service/fight/boss/NewSeIdx_20.go +++ b/logic/service/fight/boss/NewSeIdx_20.go @@ -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 diff --git a/logic/service/fight/boss/NewSeIdx_21.go b/logic/service/fight/boss/NewSeIdx_21.go index b9cf4312a..a6a5d03dc 100644 --- a/logic/service/fight/boss/NewSeIdx_21.go +++ b/logic/service/fight/boss/NewSeIdx_21.go @@ -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 } diff --git a/logic/service/fight/boss/NewSeIdx_224.go b/logic/service/fight/boss/NewSeIdx_224.go index 648cf5f43..658ef10fc 100644 --- a/logic/service/fight/boss/NewSeIdx_224.go +++ b/logic/service/fight/boss/NewSeIdx_224.go @@ -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 diff --git a/logic/service/fight/boss/NewSeIdx_23.go b/logic/service/fight/boss/NewSeIdx_23.go index 51e164b25..bb94238d1 100644 --- a/logic/service/fight/boss/NewSeIdx_23.go +++ b/logic/service/fight/boss/NewSeIdx_23.go @@ -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 diff --git a/logic/service/fight/boss/NewSeIdx_24.go b/logic/service/fight/boss/NewSeIdx_24.go index be96b14f9..73ae8e376 100644 --- a/logic/service/fight/boss/NewSeIdx_24.go +++ b/logic/service/fight/boss/NewSeIdx_24.go @@ -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 diff --git a/logic/service/fight/boss/NewSeIdx_27.go b/logic/service/fight/boss/NewSeIdx_27.go index 1e6327c51..3067d5ca1 100644 --- a/logic/service/fight/boss/NewSeIdx_27.go +++ b/logic/service/fight/boss/NewSeIdx_27.go @@ -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 } diff --git a/logic/service/fight/boss/NewSeIdx_28.go b/logic/service/fight/boss/NewSeIdx_28.go index b503818bd..be952b99e 100644 --- a/logic/service/fight/boss/NewSeIdx_28.go +++ b/logic/service/fight/boss/NewSeIdx_28.go @@ -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 { diff --git a/logic/service/fight/boss/NewSeIdx_284.go b/logic/service/fight/boss/NewSeIdx_284.go index 46edea931..8c85abebc 100644 --- a/logic/service/fight/boss/NewSeIdx_284.go +++ b/logic/service/fight/boss/NewSeIdx_284.go @@ -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() diff --git a/logic/service/fight/boss/NewSeIdx_29.go b/logic/service/fight/boss/NewSeIdx_29.go index 22dc1cd4f..470412373 100644 --- a/logic/service/fight/boss/NewSeIdx_29.go +++ b/logic/service/fight/boss/NewSeIdx_29.go @@ -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() { diff --git a/logic/service/fight/boss/NewSeIdx_36.go b/logic/service/fight/boss/NewSeIdx_36.go index 5f73811e7..38f7b5eb6 100644 --- a/logic/service/fight/boss/NewSeIdx_36.go +++ b/logic/service/fight/boss/NewSeIdx_36.go @@ -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 } diff --git a/logic/service/fight/boss/NewSeIdx_4.go b/logic/service/fight/boss/NewSeIdx_4.go index 3093fca70..c8a959228 100644 --- a/logic/service/fight/boss/NewSeIdx_4.go +++ b/logic/service/fight/boss/NewSeIdx_4.go @@ -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) diff --git a/logic/service/fight/boss/NewSeIdx_405.go b/logic/service/fight/boss/NewSeIdx_405.go index 6bfc0e2f2..dbff1ff36 100644 --- a/logic/service/fight/boss/NewSeIdx_405.go +++ b/logic/service/fight/boss/NewSeIdx_405.go @@ -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() { diff --git a/logic/service/fight/boss/NewSeIdx_42.go b/logic/service/fight/boss/NewSeIdx_42.go index fd72b0f6f..c9e31e675 100644 --- a/logic/service/fight/boss/NewSeIdx_42.go +++ b/logic/service/fight/boss/NewSeIdx_42.go @@ -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() { diff --git a/logic/service/fight/boss/NewSeIdx_45.go b/logic/service/fight/boss/NewSeIdx_45.go index 33ff8301f..b2ae31d95 100644 --- a/logic/service/fight/boss/NewSeIdx_45.go +++ b/logic/service/fight/boss/NewSeIdx_45.go @@ -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 } diff --git a/logic/service/fight/boss/NewSeIdx_5.go b/logic/service/fight/boss/NewSeIdx_5.go index 00e2fc461..ddff6f679 100644 --- a/logic/service/fight/boss/NewSeIdx_5.go +++ b/logic/service/fight/boss/NewSeIdx_5.go @@ -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 diff --git a/logic/service/fight/boss/NewSeIdx_57.go b/logic/service/fight/boss/NewSeIdx_57.go index f286a48f3..01389a1d4 100644 --- a/logic/service/fight/boss/NewSeIdx_57.go +++ b/logic/service/fight/boss/NewSeIdx_57.go @@ -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 } diff --git a/logic/service/fight/boss/NewSeIdx_64.go b/logic/service/fight/boss/NewSeIdx_64.go index 5da7371a1..f4b6af306 100644 --- a/logic/service/fight/boss/NewSeIdx_64.go +++ b/logic/service/fight/boss/NewSeIdx_64.go @@ -1,7 +1,10 @@ package effect import ( + "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" + + "github.com/alpacahq/alpacadecimal" ) // 64. 受到致命一击的概率降低n/16(a1: 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() { diff --git a/logic/service/fight/boss/NewSeIdx_79.go b/logic/service/fight/boss/NewSeIdx_79.go index a70d27d0a..9c6b99ef5 100644 --- a/logic/service/fight/boss/NewSeIdx_79.go +++ b/logic/service/fight/boss/NewSeIdx_79.go @@ -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 } diff --git a/logic/service/fight/boss/NewSeIdx_8_30.go b/logic/service/fight/boss/NewSeIdx_8_30.go index e6d6c32cf..98163e6e2 100644 --- a/logic/service/fight/boss/NewSeIdx_8_30.go +++ b/logic/service/fight/boss/NewSeIdx_8_30.go @@ -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 } diff --git a/logic/service/fight/effect/142.go b/logic/service/fight/effect/142.go index c966bbab8..2fa9dcfdf 100644 --- a/logic/service/fight/effect/142.go +++ b/logic/service/fight/effect/142.go @@ -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 { diff --git a/logic/service/fight/effect/171.go b/logic/service/fight/effect/171.go index d487a821f..400c239be 100644 --- a/logic/service/fight/effect/171.go +++ b/logic/service/fight/effect/171.go @@ -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) { diff --git a/logic/service/fight/effect/179.go b/logic/service/fight/effect/179.go index 78cf27990..aaefa13b1 100644 --- a/logic/service/fight/effect/179.go +++ b/logic/service/fight/effect/179.go @@ -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 diff --git a/logic/service/fight/effect/193.go b/logic/service/fight/effect/193.go index 893c6a4a1..442847484 100644 --- a/logic/service/fight/effect/193.go +++ b/logic/service/fight/effect/193.go @@ -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 diff --git a/logic/service/fight/effect/435.go b/logic/service/fight/effect/435.go index b00d97871..fad4294f7 100644 --- a/logic/service/fight/effect/435.go +++ b/logic/service/fight/effect/435.go @@ -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 } diff --git a/logic/service/fight/effect/444.go b/logic/service/fight/effect/444.go new file mode 100644 index 000000000..5cf5289b2 --- /dev/null +++ b/logic/service/fight/effect/444.go @@ -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{}) + +} diff --git a/logic/service/fight/effect/454.go b/logic/service/fight/effect/454.go index 5c3c8e086..e4709f0a8 100644 --- a/logic/service/fight/effect/454.go +++ b/logic/service/fight/effect/454.go @@ -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 } //对调 diff --git a/logic/service/fight/effect/461.go b/logic/service/fight/effect/461.go new file mode 100644 index 000000000..32466d048 --- /dev/null +++ b/logic/service/fight/effect/461.go @@ -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{}) + +} diff --git a/logic/service/fight/effect/468.go b/logic/service/fight/effect/468.go index 058dd0c4a..b7cf58cc5 100644 --- a/logic/service/fight/effect/468.go +++ b/logic/service/fight/effect/468.go @@ -26,7 +26,7 @@ func (e *Effect468) SkillHit() bool { if ispwoer { // 威力翻倍 - e.Ctx().SkillEntity.Power *= 2 + e.Ctx().SkillEntity.XML.Power *= 2 } diff --git a/logic/service/fight/effect/474.go b/logic/service/fight/effect/474.go new file mode 100644 index 000000000..544782899 --- /dev/null +++ b/logic/service/fight/effect/474.go @@ -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{}) + +} diff --git a/logic/service/fight/effect/486.go b/logic/service/fight/effect/486.go1 similarity index 100% rename from logic/service/fight/effect/486.go rename to logic/service/fight/effect/486.go1 diff --git a/logic/service/fight/effect/493.go b/logic/service/fight/effect/493.go index 2b32c5aa7..26be787ea 100644 --- a/logic/service/fight/effect/493.go +++ b/logic/service/fight/effect/493.go @@ -24,7 +24,7 @@ func (e *Effect493) SkillHit() bool { return true } - e.Ctx().SkillEntity.CritRate = 16 + e.Ctx().SkillEntity.XML.CritRate = 16 return true } diff --git a/logic/service/fight/effect/495.go b/logic/service/fight/effect/495.go new file mode 100644 index 000000000..d197e2f6e --- /dev/null +++ b/logic/service/fight/effect/495.go @@ -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{}) + +} diff --git a/logic/service/fight/effect/496.go b/logic/service/fight/effect/496.go new file mode 100644 index 000000000..06ca46b48 --- /dev/null +++ b/logic/service/fight/effect/496.go @@ -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{}) + +} diff --git a/logic/service/fight/effect/498.go b/logic/service/fight/effect/498.go index 955d1a967..0a256bf39 100644 --- a/logic/service/fight/effect/498.go +++ b/logic/service/fight/effect/498.go @@ -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 } diff --git a/logic/service/fight/effect/500.go b/logic/service/fight/effect/500.go index 6ff52b800..e4575b57a 100644 --- a/logic/service/fight/effect/500.go +++ b/logic/service/fight/effect/500.go @@ -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 diff --git a/logic/service/fight/effect/505.go b/logic/service/fight/effect/505.go new file mode 100644 index 000000000..e607316cc --- /dev/null +++ b/logic/service/fight/effect/505.go @@ -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{}) + +} diff --git a/logic/service/fight/effect/511.go b/logic/service/fight/effect/511.go index 713e02289..502a3d23f 100644 --- a/logic/service/fight/effect/511.go +++ b/logic/service/fight/effect/511.go @@ -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 diff --git a/logic/service/fight/effect/513.go b/logic/service/fight/effect/513.go index 9b308a226..d37e84493 100644 --- a/logic/service/fight/effect/513.go +++ b/logic/service/fight/effect/513.go @@ -30,7 +30,7 @@ func (e *Effect513) SkillHit() bool { } if hasSpecificStatus { // 威力翻倍 - e.Ctx().SkillEntity.Power *= 2 + e.Ctx().SkillEntity.XML.Power *= 2 } diff --git a/logic/service/fight/effect/620.go b/logic/service/fight/effect/620.go index 4b117ad66..9b91e0ac2 100644 --- a/logic/service/fight/effect/620.go +++ b/logic/service/fight/effect/620.go @@ -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 } diff --git a/logic/service/fight/effect/EffectRandomPower.go b/logic/service/fight/effect/EffectRandomPower.go index 34247efe6..8d9d8b7eb 100644 --- a/logic/service/fight/effect/EffectRandomPower.go +++ b/logic/service/fight/effect/EffectRandomPower.go @@ -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 } diff --git a/logic/service/fight/effect/addlevel.go b/logic/service/fight/effect/addlevel.go index 267d945ef..1b45d76f5 100644 --- a/logic/service/fight/effect/addlevel.go +++ b/logic/service/fight/effect/addlevel.go @@ -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 } diff --git a/logic/service/fight/effect/back.go b/logic/service/fight/effect/back.go1 similarity index 82% rename from logic/service/fight/effect/back.go rename to logic/service/fight/effect/back.go1 index 1ecba4cc1..0c53455e6 100644 --- a/logic/service/fight/effect/back.go +++ b/logic/service/fight/effect/back.go1 @@ -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 -} diff --git a/logic/service/fight/effect/effect_100.go b/logic/service/fight/effect/effect_100.go index 1611f694d..8484301b4 100644 --- a/logic/service/fight/effect/effect_100.go +++ b/logic/service/fight/effect/effect_100.go @@ -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 diff --git a/logic/service/fight/effect/effect_113.go b/logic/service/fight/effect/effect_113.go index da4910168..8682bd3c8 100644 --- a/logic/service/fight/effect/effect_113.go +++ b/logic/service/fight/effect/effect_113.go @@ -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 } diff --git a/logic/service/fight/effect/effect_115.go b/logic/service/fight/effect/effect_115.go index 2e3cc5546..8335abc24 100644 --- a/logic/service/fight/effect/effect_115.go +++ b/logic/service/fight/effect/effect_115.go @@ -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, diff --git a/logic/service/fight/effect/effect_160.go b/logic/service/fight/effect/effect_160.go index a8fca04ad..7fdf9861d 100644 --- a/logic/service/fight/effect/effect_160.go +++ b/logic/service/fight/effect/effect_160.go @@ -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 diff --git a/logic/service/fight/effect/effect_35.go b/logic/service/fight/effect/effect_35.go index a864bf88f..d6b2f2344 100644 --- a/logic/service/fight/effect/effect_35.go +++ b/logic/service/fight/effect/effect_35.go @@ -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 diff --git a/logic/service/fight/effect/effect_37.go b/logic/service/fight/effect/effect_37.go index f2256ea27..9104cb95e 100644 --- a/logic/service/fight/effect/effect_37.go +++ b/logic/service/fight/effect/effect_37.go @@ -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 } diff --git a/logic/service/fight/effect/effect_41.go b/logic/service/fight/effect/effect_41.go index ce9cb076b..f44faa399 100644 --- a/logic/service/fight/effect/effect_41.go +++ b/logic/service/fight/effect/effect_41.go @@ -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 { diff --git a/logic/service/fight/effect/effect_42.go b/logic/service/fight/effect/effect_42.go index 4bbe4ca5e..2b79d0d35 100644 --- a/logic/service/fight/effect/effect_42.go +++ b/logic/service/fight/effect/effect_42.go @@ -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) diff --git a/logic/service/fight/effect/effect_481.go b/logic/service/fight/effect/effect_481.go index 75c286d3f..016180e06 100644 --- a/logic/service/fight/effect/effect_481.go +++ b/logic/service/fight/effect/effect_481.go @@ -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() { diff --git a/logic/service/fight/effect/effect_58.go b/logic/service/fight/effect/effect_58.go index 245ea32bf..24cb7dcf1 100644 --- a/logic/service/fight/effect/effect_58.go +++ b/logic/service/fight/effect/effect_58.go @@ -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 } diff --git a/logic/service/fight/effect/effect_65.go b/logic/service/fight/effect/effect_65.go index 472664911..7d1c68ef8 100644 --- a/logic/service/fight/effect/effect_65.go +++ b/logic/service/fight/effect/effect_65.go @@ -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 } diff --git a/logic/service/fight/effect/effect_7.go b/logic/service/fight/effect/effect_7.go index 01f4e1b6d..3ffd44a05 100644 --- a/logic/service/fight/effect/effect_7.go +++ b/logic/service/fight/effect/effect_7.go @@ -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 diff --git a/logic/service/fight/effect/effect_81.go b/logic/service/fight/effect/effect_81.go index 2f7d9357f..587614f76 100644 --- a/logic/service/fight/effect/effect_81.go +++ b/logic/service/fight/effect/effect_81.go @@ -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) { diff --git a/logic/service/fight/effect/effect_83.go b/logic/service/fight/effect/effect_83.go index d7c0b3dae..c6d463546 100644 --- a/logic/service/fight/effect/effect_83.go +++ b/logic/service/fight/effect/effect_83.go @@ -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 } diff --git a/logic/service/fight/effect/effect_95.go b/logic/service/fight/effect/effect_95.go index 90f409ba9..e12cac5de 100644 --- a/logic/service/fight/effect/effect_95.go +++ b/logic/service/fight/effect/effect_95.go @@ -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 } diff --git a/logic/service/fight/effect/effect_power_doblue.go b/logic/service/fight/effect/effect_power_doblue.go index 702017d45..e1b83ddd6 100644 --- a/logic/service/fight/effect/effect_power_doblue.go +++ b/logic/service/fight/effect/effect_power_doblue.go @@ -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 } diff --git a/logic/service/fight/effect/effect_status.go b/logic/service/fight/effect/effect_status.go index e8fef2aec..8234fec71 100644 --- a/logic/service/fight/effect/effect_status.go +++ b/logic/service/fight/effect/effect_status.go @@ -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 diff --git a/logic/service/fight/effect/selfkill.go b/logic/service/fight/effect/selfkill.go index d8efdf478..cdf0614bd 100644 --- a/logic/service/fight/effect/selfkill.go +++ b/logic/service/fight/effect/selfkill.go @@ -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 } diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index e1a04d8de..c2452e2d0 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -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 diff --git a/logic/service/fight/info/BattlePetEntity.go b/logic/service/fight/info/BattlePetEntity.go index 29ec70c91..26b4512ee 100644 --- a/logic/service/fight/info/BattlePetEntity.go +++ b/logic/service/fight/info/BattlePetEntity.go @@ -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 { diff --git a/logic/service/fight/info/BattleSkillEntity.go b/logic/service/fight/info/BattleSkillEntity.go index 58a2a3105..32f4be4eb 100644 --- a/logic/service/fight/info/BattleSkillEntity.go +++ b/logic/service/fight/info/BattleSkillEntity.go @@ -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)) } diff --git a/logic/service/fight/input/ai.go b/logic/service/fight/input/ai.go index 12e162dc7..aa758090a 100644 --- a/logic/service/fight/input/ai.go +++ b/logic/service/fight/input/ai.go @@ -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) } diff --git a/logic/service/fight/input/effect.go b/logic/service/fight/input/effect.go index 48f90e099..1c5023448 100644 --- a/logic/service/fight/input/effect.go +++ b/logic/service/fight/input/effect.go @@ -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()) } diff --git a/logic/service/fight/input/fight.go b/logic/service/fight/input/fight.go index eed2673cb..3baf565e2 100644 --- a/logic/service/fight/input/fight.go +++ b/logic/service/fight/input/fight.go @@ -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)). diff --git a/logic/service/fight/input/input.go b/logic/service/fight/input/input.go index 3eed3fd0d..c909d3975 100644 --- a/logic/service/fight/input/input.go +++ b/logic/service/fight/input/input.go @@ -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]...) diff --git a/logic/service/fight/loop.go b/logic/service/fight/loop.go index a77369994..00fb76162 100644 --- a/logic/service/fight/loop.go +++ b/logic/service/fight/loop.go @@ -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)