refactor: 重构技能效果实现
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
35
logic/service/fight/effect/137.go
Normal file
35
logic/service/fight/effect/137.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// 137 - 损失一半当前体力值,攻击和速度提升2个等级
|
||||
type Effect137 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect137) OnSkill() bool {
|
||||
// 损失一半当前体力值
|
||||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||||
halfHp := currentHp.Div(alpacadecimal.NewFromInt(2))
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: halfHp,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 2, info.AbilityOpType.ADD)
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, 2, info.AbilityOpType.ADD)
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 137, &Effect137{})
|
||||
|
||||
}
|
||||
54
logic/service/fight/effect/142.go
Normal file
54
logic/service/fight/effect/142.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// 142 - 损失1/n的体力值,下回合能较快出手
|
||||
type Effect142 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect142) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
|
||||
|
||||
if fattack == nil {
|
||||
return true
|
||||
}
|
||||
//先手是自己
|
||||
if fattack.PlayerID == e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
//对调
|
||||
sattack.SkillEntity.Priority += 1
|
||||
return true
|
||||
}
|
||||
func (e *Effect142) OnSkill() bool {
|
||||
// 损失1/n的体力值
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
damageAmount := maxHp.Div(e.Args()[0]) // 1/n
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damageAmount,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 142, &Effect142{})
|
||||
|
||||
}
|
||||
34
logic/service/fight/effect/403.go
Normal file
34
logic/service/fight/effect/403.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// 403 - 技能使用成功时,n%令自身特攻和速度等级+m。若和对手属性相同,则技能效果翻倍
|
||||
type Effect403 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect403) OnSkill() bool {
|
||||
chance := e.Args()[0].IntPart()
|
||||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||||
|
||||
if success {
|
||||
boostValue := int8(e.Args()[1].IntPart())
|
||||
// 检查属性是否相同
|
||||
if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type {
|
||||
boostValue *= 2
|
||||
}
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, boostValue, info.AbilityOpType.ADD)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 2, boostValue, info.AbilityOpType.ADD)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 403, &Effect403{})
|
||||
|
||||
}
|
||||
41
logic/service/fight/effect/428.go
Normal file
41
logic/service/fight/effect/428.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
element "blazing/common/data/Element"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// 428 - 遇到天敌时附加m点固定伤害
|
||||
type Effect428 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect428) SkillHit_ex() bool {
|
||||
t, _ := element.Calculator.GetOffensiveMultiplier(e.Ctx().Opp.CurrentPet.Type, e.Ctx().Our.CurrentPet.Type)
|
||||
// evs := gconv.Uint32s(strings.Split(xmlres.PetMAP[int(e.Ctx().Our.CurrentPet.ID)].NaturalEnemy, " "))
|
||||
// _, ok := lo.Find(evs, func(t uint32) bool {
|
||||
// return t == uint32(e.Ctx().Opp.CurrentPet.ID)
|
||||
// })
|
||||
if t <= 1 {
|
||||
return true
|
||||
}
|
||||
// 附加m点固定伤害
|
||||
additionalDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: additionalDamage,
|
||||
}
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 428, &Effect428{})
|
||||
|
||||
}
|
||||
82
logic/service/fight/effect/435.go
Normal file
82
logic/service/fight/effect/435.go
Normal file
@@ -0,0 +1,82 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// 435 - 牺牲自己,使下回合出场的精灵首次攻击必定命中,必定先手
|
||||
type Effect435 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
can2 bool
|
||||
}
|
||||
|
||||
func (e *Effect435) SetArgs(t *input.Input, a ...int) {
|
||||
|
||||
//e.CanStack(-1)//后续的不会顶掉这个效果
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(-1) //次数类,无限回合
|
||||
|
||||
}
|
||||
|
||||
// 命中之后
|
||||
func (e *Effect435) OnSkill() bool {
|
||||
|
||||
e.can = true
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
|
||||
})
|
||||
e.Ctx().Our.CurrentPet.NotAlive = true
|
||||
return true
|
||||
}
|
||||
func (e *Effect435) SwitchOut(in *input.Input) bool {
|
||||
return true
|
||||
}
|
||||
func (e *Effect435) SwitchIn(in *input.Input) bool {
|
||||
// 1. 检查效果是否生效(当次攻击有效)
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
//
|
||||
if in != e.Ctx().Our {
|
||||
return true
|
||||
}
|
||||
|
||||
e.can2 = true
|
||||
return true
|
||||
}
|
||||
func (e *Effect435) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
|
||||
if !e.can2 {
|
||||
return true
|
||||
}
|
||||
if fattack == nil {
|
||||
return true
|
||||
}
|
||||
//先手是自己
|
||||
if fattack.PlayerID == e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
//对调
|
||||
sattack.SkillEntity.Priority += 7
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 435, &Effect435{})
|
||||
|
||||
}
|
||||
38
logic/service/fight/effect/470.go
Normal file
38
logic/service/fight/effect/470.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// 470 - n回合内若自身攻击技能命中则m%令对手p
|
||||
type Effect470 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect470) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||||
chance := e.Args()[1].IntPart() // m%
|
||||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||||
if success {
|
||||
effectType := int(e.Args()[2].IntPart()) // p类型(异常状态)
|
||||
|
||||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||||
if statusEffect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect470) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 513, &Effect513{})
|
||||
|
||||
}
|
||||
33
logic/service/fight/effect/507.go
Normal file
33
logic/service/fight/effect/507.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// 507 - 下回合若受到的伤害大于m,则恢复自身所有体力
|
||||
type Effect507 struct {
|
||||
node.EffectNode
|
||||
threshold int
|
||||
triggered bool
|
||||
}
|
||||
|
||||
func (e *Effect507) OnSkill() bool {
|
||||
e.threshold = int(e.Args()[0].IntPart())
|
||||
e.triggered = true
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect507) Skill_Use_ex() bool {
|
||||
if e.triggered && e.Ctx().Our.SumDamage.IntPart() > int64(e.threshold) {
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
|
||||
}
|
||||
e.triggered = false
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 507, &Effect507{})
|
||||
|
||||
}
|
||||
43
logic/service/fight/effect/511.go
Normal file
43
logic/service/fight/effect/511.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// 511 - n%概率威力翻倍 体力低于1/m时概率增加k%
|
||||
type Effect511 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect511) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// 基础概率
|
||||
baseChance := e.Args()[0].IntPart()
|
||||
|
||||
// 检查体力是否低于1/m
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||||
threshold := maxHp.Div(e.Args()[1]) // 1/m
|
||||
|
||||
chance := baseChance
|
||||
if currentHp.Cmp(threshold) < 0 {
|
||||
// 体力低于阈值,概率增加k%
|
||||
chance += int64(e.Args()[2].IntPart())
|
||||
}
|
||||
|
||||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||||
if success {
|
||||
// 威力翻倍
|
||||
e.Ctx().SkillEntity.Power *= 2
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 511, &Effect511{})
|
||||
|
||||
}
|
||||
42
logic/service/fight/effect/513.go
Normal file
42
logic/service/fight/effect/513.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// 513 - 处在烧伤、中毒、冻伤状态时威力翻倍,命中后解除这些异常状态
|
||||
type Effect513 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect513) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
stas := []info.EnumPetStatus{
|
||||
info.PetStatus.Burned,
|
||||
info.PetStatus.Poisoned,
|
||||
info.PetStatus.Frozen,
|
||||
}
|
||||
var hasSpecificStatus bool
|
||||
for _, sta := range stas {
|
||||
if e.Ctx().Our.StatEffect_Exist(sta) {
|
||||
hasSpecificStatus = true
|
||||
r := e.Ctx().Our.GetEffect(input.EffectType.Status, int(sta))
|
||||
r.Alive(false)
|
||||
}
|
||||
}
|
||||
if hasSpecificStatus {
|
||||
// 威力翻倍
|
||||
e.Ctx().SkillEntity.Power *= 2
|
||||
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 513, &Effect513{})
|
||||
|
||||
}
|
||||
@@ -78,28 +78,6 @@ func (e *Effect441) SetArgs(t *input.Input, a ...int) {
|
||||
e.maxCritIncrease = a[1]
|
||||
}
|
||||
|
||||
// 507 - 下回合若受到的伤害大于m,则恢复自身所有体力
|
||||
type Effect507 struct {
|
||||
node.EffectNode
|
||||
threshold int
|
||||
triggered bool
|
||||
}
|
||||
|
||||
func (e *Effect507) OnSkill() bool {
|
||||
e.threshold = int(e.Args()[0].IntPart())
|
||||
e.triggered = true
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect507) Skill_Use_ex() bool {
|
||||
if e.triggered && e.Ctx().Our.SumDamage.IntPart() > int64(e.threshold) {
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
|
||||
}
|
||||
e.triggered = false
|
||||
return true
|
||||
}
|
||||
|
||||
// 477 - n回合内若受到攻击,则对手攻击,防御,特攻,特防,速度,命中等级降低
|
||||
type Effect477 struct {
|
||||
node.EffectNode
|
||||
@@ -256,44 +234,6 @@ func (e *Effect407) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// 403 - 技能使用成功时,n%令自身特攻和速度等级+m。若和对手属性相同,则技能效果翻倍
|
||||
type Effect403 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect403) OnSkill() bool {
|
||||
chance := e.Args()[0].IntPart()
|
||||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||||
|
||||
if success {
|
||||
boostValue := int(e.Args()[1].IntPart())
|
||||
|
||||
// 提升自身特攻等级
|
||||
spAtkUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpAtkUp))
|
||||
if spAtkUpEffect != nil {
|
||||
spAtkUpEffect.SetArgs(e.Ctx().Our, boostValue)
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, spAtkUpEffect)
|
||||
}
|
||||
|
||||
// 提升自身速度等级
|
||||
speedUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedUp))
|
||||
if speedUpEffect != nil {
|
||||
speedUpEffect.SetArgs(e.Ctx().Our, boostValue)
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, speedUpEffect)
|
||||
}
|
||||
}
|
||||
|
||||
// 检查属性是否相同
|
||||
if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type {
|
||||
// 技能效果翻倍,这需要在实际的技能计算中实现
|
||||
if e.Ctx().SkillEntity != nil {
|
||||
e.Ctx().SkillEntity.Power *= 2
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 491 - 3回合内对手造成的伤害降低m%
|
||||
type Effect491 struct {
|
||||
node.EffectNode
|
||||
@@ -399,7 +339,6 @@ func (e *Effect504) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
// 1044 - 吸取对手能力提升状态,吸取成功则下n回合造成的伤害翻倍
|
||||
type Effect1044 struct {
|
||||
node.EffectNode
|
||||
@@ -543,7 +482,6 @@ func (e *Effect444) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
// 475 - 若造成的伤害不足m,则下n回合的攻击必定致命一击
|
||||
type Effect475 struct {
|
||||
node.EffectNode
|
||||
@@ -610,7 +548,6 @@ func (e *Effect430) OnSkill() bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
// 465 - m%令对手疲惫n回合,每次使用几率提升x%,最高y%
|
||||
type Effect465 struct {
|
||||
@@ -651,8 +588,6 @@ func (e *Effect465) SetArgs(t *input.Input, a ...int) {
|
||||
e.incrementPerUse = a[3] // 每次使用几率提升x%
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 501 - 若造成的伤害不足m,则对手XX等级-n
|
||||
type Effect501 struct {
|
||||
node.EffectNode
|
||||
@@ -973,8 +908,6 @@ func (e *Effect156) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 437 - 若对手处于能力强化状态,则对手XX等级m
|
||||
type Effect437 struct {
|
||||
node.EffectNode
|
||||
@@ -1371,72 +1304,6 @@ func (e *Effect521) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// 511 - n%概率威力翻倍 体力低于1/m时概率增加k%
|
||||
type Effect511 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect511) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// 基础概率
|
||||
baseChance := e.Args()[0].IntPart()
|
||||
|
||||
// 检查体力是否低于1/m
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||||
threshold := maxHp.Div(e.Args()[1]) // 1/m
|
||||
|
||||
chance := baseChance
|
||||
if currentHp.Cmp(threshold) < 0 {
|
||||
// 体力低于阈值,概率增加k%
|
||||
chance += int(e.Args()[2].IntPart())
|
||||
}
|
||||
|
||||
success, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if success {
|
||||
// 威力翻倍
|
||||
e.Ctx().SkillEntity.Power *= 2
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 137 - 损失一半当前体力值,攻击和速度提升2个等级
|
||||
type Effect137 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect137) OnSkill() bool {
|
||||
// 损失一半当前体力值
|
||||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||||
halfHp := currentHp.Div(alpacadecimal.NewFromInt(2))
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.PercentageBased,
|
||||
Damage: halfHp,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
|
||||
// 攻击提升2个等级
|
||||
atkUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.AtkUp))
|
||||
if atkUpEffect != nil {
|
||||
atkUpEffect.SetArgs(e.Ctx().Our, 2) // 提升2级
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, atkUpEffect)
|
||||
}
|
||||
|
||||
// 速度提升2个等级
|
||||
speedUpEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedUp))
|
||||
if speedUpEffect != nil {
|
||||
speedUpEffect.SetArgs(e.Ctx().Our, 2) // 提升2级
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, speedUpEffect)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 497 - 附加m点固定伤害,每次使用额外附加n点,最高k点,遇到天敌时效果翻倍
|
||||
type Effect497 struct {
|
||||
node.EffectNode
|
||||
@@ -1512,25 +1379,6 @@ func (e *Effect443) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||||
}
|
||||
|
||||
// 609 - 若对手XX,技能威力翻倍(XX代表异常状态:麻痹0,中毒1,烧伤2,冻伤5,害怕6,疲惫7,睡眠8,石化9,冰封15)
|
||||
type Effect609 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect609) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// 检查对手是否处于任何异常状态
|
||||
if e.Ctx().Opp.CurrentPet.HasAnyStatus() {
|
||||
// 威力翻倍
|
||||
e.Ctx().SkillEntity.Power *= 2
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 157 - n回合内,若受到攻击对手防御等级-1、特防等级-1、命中等级-1
|
||||
type Effect157 struct {
|
||||
node.EffectNode
|
||||
@@ -1632,33 +1480,6 @@ func (e *Effect199) SkillUseed() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// 470 - n回合内若自身攻击技能命中则m%令对手p
|
||||
type Effect470 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect470) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||||
chance := e.Args()[1].IntPart() // m%
|
||||
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
||||
if success {
|
||||
effectType := int(e.Args()[2].IntPart()) // p类型(异常状态)
|
||||
|
||||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType)
|
||||
if statusEffect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect470) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||||
}
|
||||
|
||||
// 461 - 使用后若自身体力低于1/m则从下回合开始必定致命一击
|
||||
type Effect461 struct {
|
||||
node.EffectNode
|
||||
@@ -1700,36 +1521,6 @@ func (e *Effect506) OnSkill() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// 513 - 处在烧伤、中毒、冻伤状态时威力翻倍,命中后解除这些异常状态
|
||||
type Effect513 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect513) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// 检查是否处在烧伤、中毒、冻伤状态之一
|
||||
hasSpecificStatus := e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Burned) ||
|
||||
e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Poisoned) ||
|
||||
e.Ctx().Our.CurrentPet.HasStatus(info.PetStatus.Frozen)
|
||||
|
||||
if hasSpecificStatus {
|
||||
// 威力翻倍
|
||||
e.Ctx().SkillEntity.Power *= 2
|
||||
|
||||
// 解除这些异常状态
|
||||
e.Ctx().Our.RemoveSpecificStatus([]info.EnumPetStatus{
|
||||
info.PetStatus.Burned,
|
||||
info.PetStatus.Poisoned,
|
||||
info.PetStatus.Frozen,
|
||||
})
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 493 - m回合内若对手使用攻击技能则自身下n回合必定暴击
|
||||
type Effect493 struct {
|
||||
node.EffectNode
|
||||
@@ -1755,33 +1546,6 @@ func (e *Effect493) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.Duration(a[0]) // 持续m回合
|
||||
}
|
||||
|
||||
// 428 - 遇到天敌时附加m点固定伤害
|
||||
type Effect428 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect428) SkillHit_ex() bool {
|
||||
// 检查是否遇到天敌
|
||||
if e.isDisadvantageousMatch() {
|
||||
// 附加m点固定伤害
|
||||
additionalDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: additionalDamage,
|
||||
}
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect428) isDisadvantageousMatch() bool {
|
||||
// 检查是否遇到天敌
|
||||
return e.Ctx().Our.CurrentPet.Type == element.ElementTypeFire &&
|
||||
e.Ctx().Opp.CurrentPet.Type == element.ElementTypeWater
|
||||
}
|
||||
|
||||
// 166 - n回合内,若对手使用属性攻击则m%对手XX等级k
|
||||
type Effect166 struct {
|
||||
node.EffectNode
|
||||
@@ -1810,45 +1574,3 @@ func (e *Effect166) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.EffectNode.Duration(a[0]) // 持续n回合
|
||||
}
|
||||
|
||||
// 435 - 牺牲自己,使下回合出场的精灵首次攻击必定命中,必定先手
|
||||
type Effect435 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect435) SkillUseed() bool {
|
||||
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 { // 牺牲自己(被击败)
|
||||
// 设置下个出场精灵的效果
|
||||
e.Ctx().Our.SetNextPetMustHit(true)
|
||||
e.Ctx().Our.SetNextPetMustGoFirst(true)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 142 - 损失1/n的体力值,下回合能较快出手
|
||||
type Effect142 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect142) OnSkill() bool {
|
||||
// 损失1/n的体力值
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
damageAmount := maxHp.Div(e.Args()[0]) // 1/n
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.PercentageBased,
|
||||
Damage: damageAmount,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
|
||||
// 设置下回合能较快出手
|
||||
speedBoostEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpeedPlus))
|
||||
if speedBoostEffect != nil {
|
||||
speedBoostEffect.Duration(1) // 仅下回合
|
||||
speedBoostEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // 先制度+m
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, speedBoostEffect)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@ import (
|
||||
*/
|
||||
type Effect71 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
count int
|
||||
can bool
|
||||
can2 bool
|
||||
}
|
||||
|
||||
func (e *Effect71) SwitchOut(in *input.Input) bool {
|
||||
@@ -53,26 +55,25 @@ func (e *Effect71) SwitchIn(in *input.Input) bool {
|
||||
if in != e.Ctx().Our {
|
||||
return true
|
||||
}
|
||||
t := &Effect71_sub{
|
||||
count:2,
|
||||
}
|
||||
t.Duration(-1)
|
||||
tt := e.ID()
|
||||
tt.SetEffectType(input.EffectType.Sub)
|
||||
e.can2 = true
|
||||
// t := &Effect71_sub{
|
||||
// count: 2,
|
||||
// }
|
||||
// t.Duration(-1)
|
||||
// tt := e.ID()
|
||||
// tt.SetEffectType(input.EffectType.Sub)
|
||||
|
||||
t.ID(tt)
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, t)
|
||||
// t.ID(tt)
|
||||
// e.Ctx().Our.AddEffect(e.Ctx().Our, t)
|
||||
|
||||
e.Alive(false)
|
||||
// e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect71_sub struct {
|
||||
node.EffectNode
|
||||
count int
|
||||
}
|
||||
|
||||
func (e *Effect71_sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
func (e *Effect71) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if !e.can2 {
|
||||
return true
|
||||
}
|
||||
|
||||
//fmt.Println(e.Ctx().SkillEntity)
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
|
||||
@@ -71,6 +71,7 @@ func init() {
|
||||
return o.StatEffect_Exist(info.PetStatus.Paralysis)
|
||||
})
|
||||
initskill(129, &Effect129{})
|
||||
|
||||
registerStatusFunc(132, func(i, o *input.Input) bool {
|
||||
return i.CurrentPet.Info.Hp < o.CurrentPet.Info.Hp
|
||||
})
|
||||
@@ -90,6 +91,7 @@ func init() {
|
||||
}
|
||||
return false
|
||||
})
|
||||
initskill(609, &Effect609{})
|
||||
}
|
||||
|
||||
type Effect129 struct {
|
||||
@@ -110,3 +112,16 @@ func registerStatusFunc(id int, fn func(*input.Input, *input.Input) bool) {
|
||||
statusFuncRegistry.Register(id, fn)
|
||||
input.InitEffect(input.EffectType.Skill, id, &Effect96{StatusID: id})
|
||||
}
|
||||
|
||||
type Effect609 struct {
|
||||
node.EffectNode
|
||||
StatusID int
|
||||
}
|
||||
|
||||
func (e *Effect609) SkillHit() bool {
|
||||
if e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.SideEffectArgs[0])) {
|
||||
return true
|
||||
}
|
||||
e.Ctx().SkillEntity.Power *= 2
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,59 +1,49 @@
|
||||
package fight
|
||||
|
||||
import (
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight/input"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
// func TestSKill() {
|
||||
// // var root xmlres.Monsters
|
||||
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
)
|
||||
// // // // 解析XML字符串
|
||||
// // err := xml.Unmarshal(gfile.GetBytes("/public/binaryData/69_com.robot.core.config.xml.PetXMLInfo_xmlClass_com.robot.core.config.xml.PetXMLInfo_xmlClass.bin"), &root)
|
||||
// // if err != nil {
|
||||
// // panic(err)
|
||||
// // }
|
||||
// var skimap = make(map[int]int)
|
||||
// for _, v := range xmlres.PetMAP {
|
||||
// if v.ID > 2000 {
|
||||
// continue
|
||||
// }
|
||||
// for _, v1 := range v.LearnableMoves.Moves {
|
||||
// for _, v3 := range xmlres.SkillMap[int(v1.ID)].SideEffectS {
|
||||
// t := input.Geteffect(input.EffectType.Skill, v3)
|
||||
// if t == nil {
|
||||
// k, ok := skimap[v3]
|
||||
// if ok {
|
||||
// skimap[v3] = k + 1
|
||||
// } else {
|
||||
|
||||
func TestSKill() {
|
||||
// var root xmlres.Monsters
|
||||
// skimap[v3] = 1
|
||||
// }
|
||||
// //println("技能效果不存在", v3)
|
||||
// }
|
||||
// }
|
||||
|
||||
// // // 解析XML字符串
|
||||
// err := xml.Unmarshal(gfile.GetBytes("/public/binaryData/69_com.robot.core.config.xml.PetXMLInfo_xmlClass_com.robot.core.config.xml.PetXMLInfo_xmlClass.bin"), &root)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
var skimap = make(map[int]int)
|
||||
for _, v := range xmlres.PetMAP {
|
||||
if v.ID > 2000 {
|
||||
continue
|
||||
}
|
||||
for _, v1 := range v.LearnableMoves.Moves {
|
||||
for _, v3 := range xmlres.SkillMap[int(v1.ID)].SideEffectS {
|
||||
t := input.Geteffect(input.EffectType.Skill, v3)
|
||||
if t == nil {
|
||||
k, ok := skimap[v3]
|
||||
if ok {
|
||||
skimap[v3] = k + 1
|
||||
} else {
|
||||
// }
|
||||
|
||||
skimap[v3] = 1
|
||||
}
|
||||
//println("技能效果不存在", v3)
|
||||
}
|
||||
}
|
||||
// }
|
||||
// var root xmlres.MovesTbl
|
||||
// err := xml.Unmarshal(gfile.GetBytes("public/config/227.xml"), &root)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// ttt := utils.ToMap(root.EFF, func(t xmlres.SideEffect) int {
|
||||
// return t.ID
|
||||
// })
|
||||
|
||||
}
|
||||
// for k, v := range skimap {
|
||||
// fmt.Println(k, v, ttt[1000000+k].Des)
|
||||
// }
|
||||
|
||||
}
|
||||
var root xmlres.MovesTbl
|
||||
err := xml.Unmarshal(gfile.GetBytes("public/config/227.xml"), &root)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ttt := utils.ToMap(root.EFF, func(t xmlres.SideEffect) int {
|
||||
return t.ID
|
||||
})
|
||||
|
||||
for k, v := range skimap {
|
||||
fmt.Println(k, v, ttt[1000000+k].Des)
|
||||
}
|
||||
|
||||
fmt.Println("实现效果数量", len(input.NodeM), "技能效果不存在数量", len(skimap))
|
||||
// g.Dump(skimap)
|
||||
}
|
||||
// fmt.Println("实现效果数量", len(input.NodeM), "技能效果不存在数量", len(skimap))
|
||||
// // g.Dump(skimap)
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user