feat: 实现大量技能效果及战斗逻辑修复
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-30 00:51:18 +08:00
committed by cnb
parent a7171e9ef4
commit 87fdccaddf
63 changed files with 5505 additions and 1090 deletions

View File

@@ -0,0 +1,139 @@
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"
)
// Effect 1047: {0}%令对手{1}未触发则吸取对手最大体力的1/{2}
type Effect1047 struct {
node.EffectNode
}
func (e *Effect1047) Skill_Use() bool {
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[2])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
// Effect 1048: 若对手处于异常状态则自身造成的攻击伤害额外提升{0}%
type Effect1048 struct {
node.EffectNode
}
func (e *Effect1048) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if !e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0])
return true
}
// Effect 1049: 击败对手则自身全属性+{0}
type Effect1049 struct {
node.EffectNode
}
func (e *Effect1049) Skill_Use() bool {
if e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
return true
}
boost := int8(e.Args()[0].IntPart())
for i := range e.Ctx().Our.Prop {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
}
return true
}
// Effect 1050: 未击败对手则下{0}回合攻击使对手{1}%{2}
type Effect1050 struct {
node.EffectNode
}
func (e *Effect1050) Skill_Use() bool {
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect1050Sub{}, -1)
return true
}
type Effect1050Sub struct {
RoundEffectArg0Base
}
func (e *Effect1050Sub) OnSkill() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 1051: 对手体力高于{0}则将对手体力减少到{1}
type Effect1051 struct {
node.EffectNode
}
func (e *Effect1051) Skill_Use() bool {
currentHP := e.Ctx().Opp.CurrentPet.GetHP()
if currentHP.Cmp(e.Args()[0]) <= 0 {
return true
}
targetHP := e.Args()[1]
if targetHP.Cmp(alpacadecimal.Zero) < 0 {
targetHP = alpacadecimal.Zero
}
if currentHP.Cmp(targetHP) <= 0 {
return true
}
e.Ctx().Opp.CurrentPet.Info.Hp = uint32(targetHP.IntPart())
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1047, &Effect1047{})
input.InitEffect(input.EffectType.Skill, 1048, &Effect1048{})
input.InitEffect(input.EffectType.Skill, 1049, &Effect1049{})
input.InitEffect(input.EffectType.Skill, 1050, &Effect1050{})
input.InitEffect(input.EffectType.Sub, 1050, &Effect1050Sub{})
input.InitEffect(input.EffectType.Skill, 1051, &Effect1051{})
}

View File

@@ -0,0 +1,173 @@
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"
)
// Effect 1213: {0}回合内每回合使用技能附加对手最大体力1/{1}的百分比伤害
type Effect1213 struct {
RoundEffectArg0Base
}
func (e *Effect1213) OnSkill() bool {
if len(e.Args()) < 2 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1214: 对手处于异常状态则吸取对手{0}点体力
type Effect1214 struct {
node.EffectNode
}
func (e *Effect1214) Skill_Use() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if !e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
drain := e.Args()[0]
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: drain,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
return true
}
// Effect 1215: 消除对手所有护盾效果,消除成功则使对手全属性-{0},自身体力低于对手时弱化效果翻倍
type Effect1215 struct {
node.EffectNode
}
func (e *Effect1215) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
if e.Ctx().Opp.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.ConsumeAllShield()
debuffLevel := int(e.Args()[0].IntPart())
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) < 0 {
debuffLevel *= 2
}
if debuffLevel <= 0 {
return true
}
if debuffLevel > 6 {
debuffLevel = 6
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(debuffLevel))
return true
}
// Effect 1216: 反转对手能力提升状态反转成功则恢复自身所有体力和PP值
type Effect1216 struct {
node.EffectNode
}
func (e *Effect1216) Skill_Use() bool {
reversed := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
reversed = true
}
}
if !reversed {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP())
e.Ctx().Our.HealPP(-1)
return true
}
// Effect 1217: 消除对手能力提升状态,消除成功则对手下{0}次攻击技能无效
type Effect1217 struct {
node.EffectNode
}
func (e *Effect1217) Skill_Use() bool {
cleared := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1217, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1217Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1217Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1217Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1213, &Effect1213{})
input.InitEffect(input.EffectType.Skill, 1214, &Effect1214{})
input.InitEffect(input.EffectType.Skill, 1215, &Effect1215{})
input.InitEffect(input.EffectType.Skill, 1216, &Effect1216{})
input.InitEffect(input.EffectType.Skill, 1217, &Effect1217{})
input.InitEffect(input.EffectType.Sub, 1217, &Effect1217Sub{})
}

View File

@@ -0,0 +1,202 @@
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"
)
// Effect 1218: 未击败对手则下{0}回合自身先制+{1}
type Effect1218 struct {
node.EffectNode
}
func (e *Effect1218) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Opp.CurrentPet.Info.Hp == 0 {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect1218Sub{}, -1)
return true
}
type Effect1218Sub struct {
RoundEffectArg0Base
}
func (e *Effect1218Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
return true
}
// Effect 1219: 消除对手回合类效果,消除成功则下回合受到的伤害转化为自身体力
type Effect1219 struct {
node.EffectNode
}
func (e *Effect1219) Skill_Use() bool {
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1219)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1219Sub struct {
FixedDuration1Base
}
func (e *Effect1219Sub) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, zone.Damage)
zone.Damage = alpacadecimal.Zero
return true
}
// Effect 1220: 消除对手能力提升状态,消除成功则下{0}回合自身攻击必定致命一击
type Effect1220 struct {
node.EffectNode
}
func (e *Effect1220) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
cleared := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1220, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1220Sub struct {
RoundEffectArg0Base
}
func (e *Effect1220Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 1221: 反转自身能力下降状态,反转成功则自身免疫下{0}次受到的异常状态
type Effect1221 struct {
node.EffectNode
}
func (e *Effect1221) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
reversed := false
for i, v := range e.Ctx().Our.Prop[:] {
if v >= 0 {
continue
}
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -2*v) {
reversed = true
}
}
if !reversed {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1221, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1221Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1221Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1221Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if in != e.Ctx().Opp || !input.IS_Stat(effEffect) {
return true
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return false
}
// Effect 1222: 先出手时使对手随机{0}个技能PP值归零
type Effect1222 struct {
node.EffectNode
}
func (e *Effect1222) OnSkill() bool {
if len(e.Args()) == 0 || !e.IsFirst() {
return true
}
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1218, &Effect1218{})
input.InitEffect(input.EffectType.Sub, 1218, &Effect1218Sub{})
input.InitEffect(input.EffectType.Skill, 1219, &Effect1219{})
input.InitEffect(input.EffectType.Sub, 1219, &Effect1219Sub{})
input.InitEffect(input.EffectType.Skill, 1220, &Effect1220{})
input.InitEffect(input.EffectType.Sub, 1220, &Effect1220Sub{})
input.InitEffect(input.EffectType.Skill, 1221, &Effect1221{})
input.InitEffect(input.EffectType.Sub, 1221, &Effect1221Sub{})
input.InitEffect(input.EffectType.Skill, 1222, &Effect1222{})
}

View File

@@ -0,0 +1,182 @@
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"
)
// Effect 1223: 造成的攻击伤害若高于{0}则令自身下{1}回合所有技能先制+{2}
type Effect1223 struct {
node.EffectNode
}
func (e *Effect1223) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect1223Sub{}, -1)
return true
}
type Effect1223Sub struct {
RoundEffectArg1Base
}
func (e *Effect1223Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += int(e.Args()[2].IntPart())
return true
}
// Effect 1224: 消除对手回合类效果,消除成功则使自身下{0}回合必定致命一击
type Effect1224 struct {
node.EffectNode
}
func (e *Effect1224) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1224, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1224Sub struct {
RoundEffectArg0Base
}
func (e *Effect1224Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 1225: 对手处于能力下降时吸取对手最大体力的1/{0}
type Effect1225 struct {
node.EffectNode
}
func (e *Effect1225) OnSkill() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if !e.Ctx().Opp.HasPropSub() {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
// Effect 1226: {0}回合内受到攻击伤害降低{1}点,回合结束时若当回合未受到攻击伤害则吸取对手{2}点体力
type Effect1226 struct {
RoundEffectArg0Base
hitThisRound bool
}
func (e *Effect1226) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
return true
}
if zone.Damage.Cmp(alpacadecimal.Zero) > 0 {
e.hitThisRound = true
}
reduction := e.Args()[1]
if reduction.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if zone.Damage.Cmp(reduction) > 0 {
zone.Damage = zone.Damage.Sub(reduction)
} else {
zone.Damage = alpacadecimal.Zero
}
return true
}
func (e *Effect1226) TurnEnd() {
if !e.hitThisRound && len(e.Args()) >= 3 && e.Args()[2].Cmp(alpacadecimal.Zero) > 0 {
drain := e.Args()[2]
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: drain,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
}
e.hitThisRound = false
e.EffectNode.TurnEnd()
}
// Effect 1227: 自身处于能力提升状态则有{0}%概率使对手{1},先出手时概率翻倍
type Effect1227 struct {
node.EffectNode
}
func (e *Effect1227) Skill_Use() bool {
if len(e.Args()) < 2 || !e.Ctx().Our.HasPropADD() {
return true
}
chance := int(e.Args()[0].IntPart())
if e.IsFirst() {
chance *= 2
if chance > 100 {
chance = 100
}
}
success, _, _ := e.Input.Player.Roll(chance, 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1223, &Effect1223{})
input.InitEffect(input.EffectType.Sub, 1223, &Effect1223Sub{})
input.InitEffect(input.EffectType.Skill, 1224, &Effect1224{})
input.InitEffect(input.EffectType.Sub, 1224, &Effect1224Sub{})
input.InitEffect(input.EffectType.Skill, 1225, &Effect1225{})
input.InitEffect(input.EffectType.Skill, 1226, &Effect1226{})
input.InitEffect(input.EffectType.Skill, 1227, &Effect1227{})
}

View File

@@ -0,0 +1,212 @@
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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 1228: {0}回合内对手使用攻击技能则随机进入{1}种异常状态,未触发则消除对手回合类效果
type Effect1228 struct {
RoundEffectArg0Base
triggered bool
}
func (e *Effect1228) Skill_Use_ex() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
count := int(e.Args()[1].IntPart())
statusTypes := []int{
int(info.PetStatus.Burned),
int(info.PetStatus.Frozen),
int(info.PetStatus.Poisoned),
int(info.PetStatus.Paralysis),
int(info.PetStatus.Fear),
int(info.PetStatus.Sleep),
}
if count <= 0 {
return true
}
if count > len(statusTypes) {
count = len(statusTypes)
}
indices := grand.Perm(len(statusTypes))
for _, idx := range indices[:count] {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusTypes[idx])
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
}
e.triggered = true
return true
}
func (e *Effect1228) TurnEnd() {
if !e.triggered && e.Duration() == 1 {
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
}
e.EffectNode.TurnEnd()
}
// Effect 1229: 自身体力高于对手时附加自身当前体力1/{0}的百分比伤害
type Effect1229 struct {
node.EffectNode
}
func (e *Effect1229) Skill_Use() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) <= 0 {
return true
}
damage := e.Ctx().Our.CurrentPet.GetHP().Div(e.Args()[0])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1230: 自身体力低于对手时,下{0}次自身技能先制+{1}
type Effect1230 struct {
node.EffectNode
}
func (e *Effect1230) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) >= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1230, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1230Sub struct {
node.EffectNode
remaining int
priority int
}
func (e *Effect1230Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
if len(a) > 1 {
e.priority = a[1]
}
}
func (e *Effect1230Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += e.priority
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1231: {0}%令对手{1}未触发则附加对手最大体力1/{2}的百分比伤害
type Effect1231 struct {
node.EffectNode
}
func (e *Effect1231) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[2])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1232: 反转自身能力下降状态,反转成功则附加给对手等同的能力下降状态
type Effect1232 struct {
node.EffectNode
}
func (e *Effect1232) OnSkill() bool {
type propDown struct {
index int8
level int8
}
var downs []propDown
for i, v := range e.Ctx().Our.Prop[:] {
if v >= 0 {
continue
}
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -2*v) {
downs = append(downs, propDown{index: int8(i), level: v})
}
}
if len(downs) == 0 {
return true
}
for _, down := range downs {
e.Ctx().Opp.SetProp(e.Ctx().Our, down.index, down.level)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1228, &Effect1228{})
input.InitEffect(input.EffectType.Skill, 1229, &Effect1229{})
input.InitEffect(input.EffectType.Skill, 1230, &Effect1230{})
input.InitEffect(input.EffectType.Sub, 1230, &Effect1230Sub{})
input.InitEffect(input.EffectType.Skill, 1231, &Effect1231{})
input.InitEffect(input.EffectType.Skill, 1232, &Effect1232{})
}

View File

@@ -0,0 +1,138 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1233: 吸取对手最大体力的{0}%,每次使用增加{1}%,最高{2}%
type Effect1233 struct {
AddLvelEffect
}
func (e *Effect1233) Skill_Use() bool {
percent := e.Args()[0]
if e.UseSkillCount > 1 {
percent = percent.Add(e.Args()[1].Mul(alpacadecimal.NewFromInt(e.UseSkillCount - 1)))
}
if percent.Cmp(e.Args()[2]) > 0 {
percent = e.Args()[2]
}
if percent.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Mul(percent).Div(alpacadecimal.NewFromInt(100))
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, nil, damage)
return true
}
// Effect 1234: 消除对手回合类效果,消除成功则对手全属性-{0}
type Effect1234 struct {
node.EffectNode
}
func (e *Effect1234) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[0].IntPart()))
return true
}
// Effect 1235: {0}回合内每回合{1}%闪避对手攻击,未触发则使对手随机{2}项技能PP值归零
type Effect1235 struct {
RoundEffectArg0Base
}
func (e *Effect1235) SkillHit_ex() bool {
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.AttackTime == 2 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
e.Ctx().SkillEntity.SetMiss()
return true
}
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[2].IntPart()))
return true
}
// Effect 1236: {0}回合内若对手使用攻击技能则造成伤害前附加对手最大体力1/{1}的百分比伤害
type Effect1236 struct {
RoundEffectArg0Base
}
func (e *Effect1236) SkillHit_ex() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1237: 使双方精灵所有技能PP值归零消除双方能力提升、下降状态以及回合类效果
type Effect1237 struct {
node.EffectNode
}
func (e *Effect1237) OnSkill() bool {
for i := range e.Ctx().Our.CurrentPet.Info.SkillList {
e.Ctx().Our.CurrentPet.Info.SkillList[i].PP = 0
}
for i := range e.Ctx().Opp.CurrentPet.Info.SkillList {
e.Ctx().Opp.CurrentPet.Info.SkillList[i].PP = 0
}
for i := range e.Ctx().Our.Prop {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
}
e.Ctx().Our.CancelTurn(e.Ctx().Our)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1233, &Effect1233{})
input.InitEffect(input.EffectType.Skill, 1234, &Effect1234{})
input.InitEffect(input.EffectType.Skill, 1235, &Effect1235{})
input.InitEffect(input.EffectType.Skill, 1236, &Effect1236{})
input.InitEffect(input.EffectType.Skill, 1237, &Effect1237{})
}

View File

@@ -0,0 +1,262 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1238: 全属性+{0},对手不为{1}系时强化效果翻倍
type Effect1238 struct {
node.EffectNode
}
func (e *Effect1238) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
boostValue := int8(e.Args()[0].IntPart())
if e.Ctx().Opp.CurrentPet.PetInfo.Type != int(e.Args()[1].IntPart()) {
boostValue *= 2
}
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boostValue)
}
return true
}
// Effect 1239: 恢复自身最大体力的1/{0}自身体力低于1/{1}时造成等量百分比伤害
type Effect1239 struct {
node.EffectNode
}
func (e *Effect1239) Skill_Use() bool {
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
healAmount := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
if healAmount.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
lowHP := false
if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
lowHP = e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0
}
e.Ctx().Our.Heal(e.Ctx().Our, nil, healAmount)
if lowHP {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: healAmount,
})
}
return true
}
// Effect 1240: 当回合未击败对手则下{0}次自身技能附加自身最大体力1/{1}的百分比伤害
type Effect1240 struct {
node.EffectNode
}
func (e *Effect1240) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Opp.CurrentPet.Info.Hp == 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1240, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1240Sub struct {
node.EffectNode
remaining int
divisor int
}
func (e *Effect1240Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
if len(a) > 1 {
e.divisor = a[1]
}
}
func (e *Effect1240Sub) OnSkill() bool {
if e.remaining <= 0 || e.divisor <= 0 {
e.Alive(false)
return true
}
damage := e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(int64(e.divisor)))
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1241: 吸取对手{0}点固定体力自身体力低于1/{1}时吸取效果翻倍
type Effect1241 struct {
node.EffectNode
}
func (e *Effect1241) Skill_Use() bool {
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
drain := e.Args()[0]
if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 {
drain = drain.Mul(alpacadecimal.NewFromInt(2))
}
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: drain,
})
e.Ctx().Our.Heal(e.Ctx().Our, nil, drain)
return true
}
// Effect 1242: {0}%的概率伤害为{1}倍,未触发则下次翻倍概率额外提升{2}%且伤害提升变为{3}倍
type Effect1242 struct {
node.EffectNode
triggered bool
nextBonus int
boostedMode bool
}
func (e *Effect1242) SkillHit() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 4 {
return true
}
bonus := 0
if state := findEffect1242State(e.Ctx().Our, skill.XML.ID); state != nil {
bonus = state.bonusChance
e.boostedMode = true
}
chance := int(e.Args()[0].IntPart()) + bonus
if chance > 100 {
chance = 100
}
e.triggered, _, _ = e.Input.Player.Roll(chance, 100)
e.nextBonus = bonus + int(e.Args()[2].IntPart())
if e.triggered {
if state := findEffect1242State(e.Ctx().Our, skill.XML.ID); state != nil {
state.Alive(false)
}
}
return true
}
func (e *Effect1242) Damage_Mul(zone *info.DamageZone) bool {
if !e.triggered || zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
multiplier := int(e.Args()[1].IntPart())
if e.boostedMode {
multiplier = int(e.Args()[3].IntPart())
}
if multiplier > 1 {
zone.Mul(multiplier)
}
return true
}
func (e *Effect1242) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 4 || e.triggered {
return true
}
if state := findEffect1242State(e.Ctx().Our, skill.XML.ID); state != nil {
state.bonusChance = e.nextBonus
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1242, skill.XML.ID, e.nextBonus)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1242Sub struct {
node.EffectNode
skillID int
bonusChance int
}
func (e *Effect1242Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.skillID = a[0]
}
if len(a) > 1 {
e.bonusChance = a[1]
}
}
func (e *Effect1242Sub) SwitchOut(in *input.Input) bool {
if in == e.Ctx().Our {
e.Alive(false)
}
return true
}
func findEffect1242State(in *input.Input, skillID int) *Effect1242Sub {
if in == nil {
return nil
}
for i := len(in.Effects) - 1; i >= 0; i-- {
effect, ok := in.Effects[i].(*Effect1242Sub)
if !ok || !effect.Alive() || effect.skillID != skillID {
continue
}
return effect
}
return nil
}
func init() {
input.InitEffect(input.EffectType.Skill, 1238, &Effect1238{})
input.InitEffect(input.EffectType.Skill, 1239, &Effect1239{})
input.InitEffect(input.EffectType.Skill, 1240, &Effect1240{})
input.InitEffect(input.EffectType.Sub, 1240, &Effect1240Sub{})
input.InitEffect(input.EffectType.Skill, 1241, &Effect1241{})
input.InitEffect(input.EffectType.Skill, 1242, &Effect1242{})
input.InitEffect(input.EffectType.Sub, 1242, &Effect1242Sub{})
}

View File

@@ -0,0 +1,196 @@
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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 1243: 对手处于能力下降状态时先制+1
type Effect1243 struct {
node.EffectNode
}
func (e *Effect1243) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !e.Ctx().Opp.HasPropSub() {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority++
return true
}
// Effect 1244: 随机附加{0}-{1}点固伤,对手处于能力下降状态时固伤变为{2}-{3}点
type Effect1244 struct {
node.EffectNode
}
func (e *Effect1244) OnSkill() bool {
if len(e.Args()) < 4 {
return true
}
minDamage := int(e.Args()[0].IntPart())
maxDamage := int(e.Args()[1].IntPart())
if e.Ctx().Opp.HasPropSub() {
minDamage = int(e.Args()[2].IntPart())
maxDamage = int(e.Args()[3].IntPart())
}
if minDamage > maxDamage {
minDamage, maxDamage = maxDamage, minDamage
}
if maxDamage <= 0 {
return true
}
damage := maxDamage
if minDamage < maxDamage {
damage = grand.N(minDamage, maxDamage)
}
if damage <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: alpacadecimal.NewFromInt(int64(damage)),
})
return true
}
// Effect 1245: 若自身处于能力提升状态则附加给对手等同于自身能力提升状态的能力下降状态,若未满足或未触发则令对手随机{0}项技能PP值归零
type Effect1245 struct {
node.EffectNode
}
func (e *Effect1245) OnSkill() bool {
applied := false
if e.Ctx().Our.HasPropADD() {
for i, v := range e.Ctx().Our.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -v) {
applied = true
}
}
}
if applied {
return true
}
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
// Effect 1246: 消除双方能力提升、下降状态,消除任意一方成功则令对手下{0}次使用的攻击技能无效
type Effect1246 struct {
node.EffectNode
}
func (e *Effect1246) OnSkill() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
cleared := false
for i := range e.Ctx().Our.Prop {
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1246, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1246Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1246Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1246Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetMiss()
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1247: 先出手时使对手当回合内无法通过技能恢复自身体力
type Effect1247 struct {
node.EffectNode
}
func (e *Effect1247) Skill_Use() bool {
if !e.IsFirst() {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1247)
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1247Sub struct {
FixedDuration1Base
}
func (e *Effect1247Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
if value == nil || *value <= 0 {
return true
}
if _, ok := ac.(*action.SelectSkillAction); !ok {
return true
}
*value = 0
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1243, &Effect1243{})
input.InitEffect(input.EffectType.Skill, 1244, &Effect1244{})
input.InitEffect(input.EffectType.Skill, 1245, &Effect1245{})
input.InitEffect(input.EffectType.Skill, 1246, &Effect1246{})
input.InitEffect(input.EffectType.Sub, 1246, &Effect1246Sub{})
input.InitEffect(input.EffectType.Skill, 1247, &Effect1247{})
input.InitEffect(input.EffectType.Sub, 1247, &Effect1247Sub{})
}

View File

@@ -0,0 +1,166 @@
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"
"github.com/gogf/gf/v2/util/grand"
)
var effect1394Statuses = []int{
int(info.PetStatus.Burned),
int(info.PetStatus.Frozen),
int(info.PetStatus.Poisoned),
int(info.PetStatus.Paralysis),
int(info.PetStatus.Fear),
int(info.PetStatus.Sleep),
}
func applyRandomStatuses1394(owner, target *input.Input, count int) {
if owner == nil || target == nil || count <= 0 || len(effect1394Statuses) == 0 {
return
}
if count > len(effect1394Statuses) {
count = len(effect1394Statuses)
}
indexes := grand.Perm(len(effect1394Statuses))
for _, idx := range indexes[:count] {
statusEffect := owner.InitEffect(input.EffectType.Status, effect1394Statuses[idx])
if statusEffect != nil {
target.AddEffect(owner, statusEffect)
}
}
}
// Effect 1393: {0}回合内每回合使用技能则造成伤害前令对手防御-{1}、速度-{2}未触发则附加对手最大体力1/{3}的百分比伤害
type Effect1393 struct {
RoundEffectArg0Base
triggered bool
}
func (e *Effect1393) SkillHit() bool {
e.triggered = false
if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
defenseDown := e.Ctx().Opp.SetProp(e.Ctx().Our, 1, -int8(e.Args()[1].IntPart()))
speedDown := e.Ctx().Opp.SetProp(e.Ctx().Our, 4, -int8(e.Args()[2].IntPart()))
e.triggered = defenseDown || speedDown
return true
}
func (e *Effect1393) Skill_Use() bool {
if e.triggered || len(e.Args()) < 4 || e.Args()[3].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[3])
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1394: {0}回合内对手使用属性技能则随机进入{1}种异常状态
type Effect1394 struct {
RoundEffectArg0Base
}
func (e *Effect1394) Skill_Use_ex() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
applyRandomStatuses1394(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
// Effect 1395: 若先出手则必定打出致命一击
type Effect1395 struct {
node.EffectNode
}
func (e *Effect1395) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if !e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 1396: {0}回合内每回合吸取对手最大体力的1/{1}自身体力低于最大体力的1/{2}时转变为吸取对手最大体力的1/{3}
type Effect1396 struct {
RoundEffectArg0Base
}
func (e *Effect1396) TurnEnd() {
if e.Ctx().Our.CurrentPet.Info.Hp > 0 && e.Ctx().Opp.CurrentPet.Info.Hp > 0 && len(e.Args()) >= 4 {
divisor := e.Args()[1]
thresholdDivisor := e.Args()[2]
if thresholdDivisor.Cmp(alpacadecimal.Zero) > 0 {
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(thresholdDivisor)
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 {
divisor = e.Args()[3]
}
}
if divisor.Cmp(alpacadecimal.Zero) > 0 {
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(divisor)
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
}
}
}
e.EffectNode.TurnEnd()
}
// Effect 1397: 全属性+{0}自身体力低于1/{1}时强化效果翻倍
type Effect1397 struct {
node.EffectNode
}
func (e *Effect1397) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
boostValue := int8(e.Args()[0].IntPart())
if len(e.Args()) > 1 && e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 {
boostValue *= 2
}
}
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boostValue)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1393, &Effect1393{})
input.InitEffect(input.EffectType.Skill, 1394, &Effect1394{})
input.InitEffect(input.EffectType.Skill, 1395, &Effect1395{})
input.InitEffect(input.EffectType.Skill, 1396, &Effect1396{})
input.InitEffect(input.EffectType.Skill, 1397, &Effect1397{})
}

View File

@@ -0,0 +1,229 @@
package effect
import (
"blazing/common/data/xmlres"
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
func setSkillPowerOverride(skill *info.SkillEntity, delta int) {
if skill == nil {
return
}
move, ok := xmlres.SkillMap[int(skill.Info.ID)]
if !ok {
skill.XML.Power += delta
return
}
skill.XML.Power = move.Power + delta
}
func clearPositiveProps(target, owner *input.Input) bool {
if target == nil || owner == nil {
return false
}
cleared := false
for i, v := range target.Prop[:] {
if v <= 0 {
continue
}
if target.SetProp(owner, int8(i), 0) {
cleared = true
}
}
return cleared
}
func applyStatus(owner, target *input.Input, statusID int) {
if owner == nil || target == nil {
return
}
statusEffect := owner.InitEffect(input.EffectType.Status, statusID)
if statusEffect != nil {
target.AddEffect(owner, statusEffect)
}
}
// Effect 1398: 消除对手能力提升状态,消除成功则{0}%令对手{1},未触发则{2}%令对手{3}
type Effect1398 struct {
node.EffectNode
}
func (e *Effect1398) Skill_Use() bool {
if len(e.Args()) < 4 {
return true
}
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
fallback, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100)
if fallback {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[3].IntPart()))
}
return true
}
// Effect 1399: 消除对手回合类效果,消除成功则对手{0},未触发则自身免疫下{1}次受到的异常状态
type Effect1399 struct {
node.EffectNode
}
func (e *Effect1399) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before > 0 {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
immuneEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1399, int(e.Args()[1].IntPart()))
if immuneEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, immuneEffect)
}
return true
}
type Effect1399Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1399Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1399Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if in != e.Ctx().Opp || !input.IS_Stat(effEffect) {
return true
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return false
}
// Effect 1400: {0}回合内若自身回合类效果被消除则{1}%令对手{2}
type Effect1400 struct {
node.EffectNode
}
func (e *Effect1400) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect1400Sub{}, -1)
return true
}
type Effect1400Sub struct {
RoundEffectArg0Base
triggered bool
}
func (e *Effect1400Sub) Alive(t ...bool) bool {
if len(t) > 0 && !t[0] && !e.triggered && e.Duration() > 0 && e.Ctx().Opp != nil && e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
e.triggered = true
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
}
}
return e.EffectNode.Alive(t...)
}
// Effect 1401: 后出手时{0}%令对手对手{1},未触发则使自身下{2}回合必定致命一击
type Effect1401 struct {
node.EffectNode
}
func (e *Effect1401) Skill_Use() bool {
if len(e.Args()) < 3 || e.IsFirst() {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
critEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1401, int(e.Args()[2].IntPart()))
if critEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, critEffect)
}
return true
}
type Effect1401Sub struct {
node.EffectNode
}
func (e *Effect1401Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
if len(a) > 0 {
e.Duration(a[0])
}
}
func (e *Effect1401Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 1402: 技能威力提升1点不受其他威力提升/下降效果加成
type Effect1402 struct {
node.EffectNode
}
func (e *Effect1402) CalculatePre() bool {
if e.Ctx().SkillEntity == nil {
return true
}
setSkillPowerOverride(e.Ctx().SkillEntity, 1)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1398, &Effect1398{})
input.InitEffect(input.EffectType.Skill, 1399, &Effect1399{})
input.InitEffect(input.EffectType.Sub, 1399, &Effect1399Sub{})
input.InitEffect(input.EffectType.Skill, 1400, &Effect1400{})
input.InitEffect(input.EffectType.Sub, 1400, &Effect1400Sub{})
input.InitEffect(input.EffectType.Skill, 1401, &Effect1401{})
input.InitEffect(input.EffectType.Sub, 1401, &Effect1401Sub{})
input.InitEffect(input.EffectType.Skill, 1402, &Effect1402{})
}

View File

@@ -0,0 +1,77 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"math"
)
type fixedPowerOverrideEffect struct {
node.EffectNode
delta int
}
func (e *fixedPowerOverrideEffect) CalculatePre() bool {
setSkillPowerOverride(e.Ctx().SkillEntity, e.delta)
return true
}
// Effect 1403: 技能威力提升4点不受其他威力提升/下降效果加成
type Effect1403 struct{ fixedPowerOverrideEffect }
// Effect 1404: 技能威力提升7点不受其他威力提升/下降效果加成
type Effect1404 struct{ fixedPowerOverrideEffect }
// Effect 1405: 技能威力提升10点不受其他威力提升/下降效果加成
type Effect1405 struct{ fixedPowerOverrideEffect }
// Effect 1406: 技能威力提升14点不受其他威力提升/下降效果加成
type Effect1406 struct{ fixedPowerOverrideEffect }
// Effect 1407: 技能威力提升17点不受其他威力提升/下降效果加成
type Effect1407 struct{ fixedPowerOverrideEffect }
// Effect 1408: 技能威力提升20点不受其他威力提升/下降效果加成
type Effect1408 struct{ fixedPowerOverrideEffect }
// Effect 1409: 技能威力提升24点不受其他威力提升/下降效果加成
type Effect1409 struct{ fixedPowerOverrideEffect }
// Effect 1410: 技能威力提升27点不受其他威力提升/下降效果加成
type Effect1410 struct{ fixedPowerOverrideEffect }
// Effect 1411: 技能威力提升30点不受其他威力提升/下降效果加成
type Effect1411 struct{ fixedPowerOverrideEffect }
// Effect 1412: 自身体力低于300时必定先手
type Effect1412 struct {
node.EffectNode
}
func (e *Effect1412) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if e.Ctx().Our.CurrentPet.GetHP().IntPart() >= 300 {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority = math.MaxInt
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1403, &Effect1403{fixedPowerOverrideEffect{delta: 4}})
input.InitEffect(input.EffectType.Skill, 1404, &Effect1404{fixedPowerOverrideEffect{delta: 7}})
input.InitEffect(input.EffectType.Skill, 1405, &Effect1405{fixedPowerOverrideEffect{delta: 10}})
input.InitEffect(input.EffectType.Skill, 1406, &Effect1406{fixedPowerOverrideEffect{delta: 14}})
input.InitEffect(input.EffectType.Skill, 1407, &Effect1407{fixedPowerOverrideEffect{delta: 17}})
input.InitEffect(input.EffectType.Skill, 1408, &Effect1408{fixedPowerOverrideEffect{delta: 20}})
input.InitEffect(input.EffectType.Skill, 1409, &Effect1409{fixedPowerOverrideEffect{delta: 24}})
input.InitEffect(input.EffectType.Skill, 1410, &Effect1410{fixedPowerOverrideEffect{delta: 27}})
input.InitEffect(input.EffectType.Skill, 1411, &Effect1411{fixedPowerOverrideEffect{delta: 30}})
input.InitEffect(input.EffectType.Skill, 1412, &Effect1412{})
}

View File

@@ -0,0 +1,267 @@
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"
"github.com/gogf/gf/v2/util/grand"
)
const petStatusDazed info.EnumPetStatus = 29
var effect1498Statuses = []int{
int(info.PetStatus.Burned),
int(info.PetStatus.Frozen),
int(info.PetStatus.Blind),
int(petStatusDazed),
}
func applyRandomStatuses1498(owner, target *input.Input, count int) int {
if owner == nil || target == nil || count <= 0 {
return 0
}
if count > len(effect1498Statuses) {
count = len(effect1498Statuses)
}
added := 0
indexes := grand.Perm(len(effect1498Statuses))
for _, idx := range indexes[:count] {
statusEffect := owner.InitEffect(input.EffectType.Status, effect1498Statuses[idx])
if statusEffect == nil {
continue
}
before := len(target.Effects)
target.AddEffect(owner, statusEffect)
if len(target.Effects) > before {
added++
}
}
return added
}
func reduceRandomSkillPP(target *input.Input) {
if target == nil {
return
}
skills := target.CurrentPet.Info.SkillList
if len(skills) == 0 {
return
}
idx := grand.Intn(len(skills))
if skills[idx].PP > 0 {
skills[idx].PP--
}
}
func hasDarkSeed(target *input.Input) bool {
if target == nil {
return false
}
effect := target.GetEffect(input.EffectType.Sub, 1501)
return effect != nil && effect.Alive()
}
// Effect 1498: 随机附加烧伤,冻伤,失明,失神中的{0}种异常状态,未触发则自身下{1}回合造成的伤害提升{2}%
type Effect1498 struct {
node.EffectNode
}
func (e *Effect1498) OnSkill() bool {
if len(e.Args()) < 3 {
return true
}
if applyRandomStatuses1498(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart())) > 0 {
return true
}
boostEffect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
1498,
int(e.Args()[1].IntPart()),
int(e.Args()[2].IntPart()),
)
if boostEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, boostEffect)
}
return true
}
type Effect1498Sub struct {
node.EffectNode
percent alpacadecimal.Decimal
}
func (e *Effect1498Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
if len(a) > 0 {
e.Duration(a[0])
}
if len(a) > 1 {
e.percent = alpacadecimal.NewFromInt(int64(a[1]))
}
}
func (e *Effect1498Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Add(e.percent)).Div(hundred)
return true
}
// Effect 1499: 体力低于最大体力的1/3时先制+3
type Effect1499 struct {
node.EffectNode
}
func (e *Effect1499) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
if e.Ctx().Our.CurrentPet.GetHP().Mul(alpacadecimal.NewFromInt(3)).Cmp(maxHP) >= 0 {
return true
}
current.SkillEntity.XML.Priority += 3
return true
}
// Effect 1500: 1回合做{0}-{1}次攻击,自身处于护盾状态下连击上限为{2}
// 当前战斗模型未逐段执行多段攻击,这里按随机连击次数折算为红伤倍率提升。
type Effect1500 struct {
node.EffectNode
}
func (e *Effect1500) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
minHits := int(e.Args()[0].IntPart())
maxHits := int(e.Args()[1].IntPart())
if minHits <= 0 {
minHits = 1
}
if maxHits < minHits {
maxHits = minHits
}
if e.Ctx().Our.HasShield() {
shieldCap := int(e.Args()[2].IntPart())
if shieldCap > 0 && shieldCap < maxHits {
maxHits = shieldCap
}
if maxHits < minHits {
maxHits = minHits
}
}
hits := minHits
if maxHits > minHits {
hits += grand.Intn(maxHits - minHits + 1)
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(hits)))
return true
}
// Effect 1501: 命中后为对手种下一颗黑暗之种
type Effect1501 struct {
node.EffectNode
}
func (e *Effect1501) Skill_Use() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
return true
}
darkSeed := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1501)
if darkSeed != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, darkSeed)
}
return true
}
type Effect1501Sub struct {
node.EffectNode
stage int
}
func (e *Effect1501Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
e.CanStack(false)
}
func (e *Effect1501Sub) SwitchOut(in *input.Input) bool {
if in == e.Ctx().Our {
e.Alive(false)
}
return true
}
func (e *Effect1501Sub) TurnEnd() {
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 {
return
}
if e.stage >= 4 {
e.Ctx().Our.DelPP(1)
return
}
reduceRandomSkillPP(e.Ctx().Our)
e.stage++
}
// Effect 1502: 对手身上存在黑暗之种时先制+1
type Effect1502 struct {
node.EffectNode
}
func (e *Effect1502) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !hasDarkSeed(e.Ctx().Opp) {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += 1
return true
}
func init() {
dazed := &StatusCannotAct{}
dazed.Status = petStatusDazed
input.InitEffect(input.EffectType.Status, int(petStatusDazed), dazed)
input.InitEffect(input.EffectType.Skill, 1498, &Effect1498{})
input.InitEffect(input.EffectType.Sub, 1498, &Effect1498Sub{})
input.InitEffect(input.EffectType.Skill, 1499, &Effect1499{})
input.InitEffect(input.EffectType.Skill, 1500, &Effect1500{})
input.InitEffect(input.EffectType.Skill, 1501, &Effect1501{})
input.InitEffect(input.EffectType.Sub, 1501, &Effect1501Sub{})
input.InitEffect(input.EffectType.Skill, 1502, &Effect1502{})
}

View File

@@ -0,0 +1,216 @@
package effect
import (
element "blazing/common/data/Element"
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
"github.com/gogf/gf/v2/util/grand"
)
const petStatusCurse info.EnumPetStatus = 23
var effect1507Statuses = []int{
int(info.PetStatus.Burned),
int(info.PetStatus.Frozen),
int(info.PetStatus.Poisoned),
int(info.PetStatus.Paralysis),
int(info.PetStatus.Fear),
int(info.PetStatus.Sleep),
}
func clearDarkSeed(target *input.Input) bool {
if target == nil {
return false
}
cleared := false
for _, eff := range target.Effects {
if eff == nil || !eff.Alive() {
continue
}
effID := eff.ID()
if effID.GetEffectType() != input.EffectType.Sub || int(effID.Suffix()) != 1501 {
continue
}
eff.Alive(false)
cleared = true
}
return cleared
}
func darkSeedStage(target *input.Input) int {
if target == nil {
return -1
}
eff := target.GetEffect(input.EffectType.Sub, 1501)
if eff == nil || !eff.Alive() {
return -1
}
darkSeed, ok := eff.(*Effect1501Sub)
if !ok {
return -1
}
return darkSeed.stage
}
func hasDragonType(target *input.Input) bool {
if target == nil || target.CurrentPet == nil {
return false
}
petType := target.CurrentPet.GetType()
if petType == nil {
return false
}
if petType.Primary == element.ElementTypeDragon {
return true
}
return petType.Secondary != nil && *petType.Secondary == element.ElementTypeDragon
}
func applyRandomStatuses1507(owner, target *input.Input, count int) bool {
if owner == nil || target == nil || count <= 0 {
return false
}
if count > len(effect1507Statuses) {
count = len(effect1507Statuses)
}
triggered := false
indexes := grand.Perm(len(effect1507Statuses))
for _, idx := range indexes[:count] {
statusEffect := owner.InitEffect(input.EffectType.Status, effect1507Statuses[idx])
if statusEffect == nil {
continue
}
before := len(target.Effects)
target.AddEffect(owner, statusEffect)
if len(target.Effects) > before {
triggered = true
}
}
return triggered
}
// Effect 1503: 清除对手身上的黑暗之种清除成功则令对手随机受到1-500点固定伤害
type Effect1503 struct {
node.EffectNode
}
func (e *Effect1503) Skill_Use() bool {
if !clearDarkSeed(e.Ctx().Opp) {
return true
}
damage := alpacadecimal.NewFromInt(int64(grand.Intn(500) + 1))
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
// Effect 1504: 40%令对手诅咒,若对手身上存在黑暗之种则概率翻倍
type Effect1504 struct {
node.EffectNode
}
func (e *Effect1504) Skill_Use() bool {
chance := 40
if hasDarkSeed(e.Ctx().Opp) {
chance *= 2
}
if chance > 100 {
chance = 100
}
success, _, _ := e.Input.Player.Roll(chance, 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(petStatusCurse))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 1505: 黑暗之种成长期时附加200点固定伤害黑暗之种长大后固定伤害翻倍
type Effect1505 struct {
node.EffectNode
}
func (e *Effect1505) Skill_Use() bool {
stage := darkSeedStage(e.Ctx().Opp)
if stage < 0 {
return true
}
damage := int64(200)
if stage >= 4 {
damage *= 2
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: alpacadecimal.NewFromInt(damage),
})
return true
}
// Effect 1506: 若对手不是龙系精灵则恢复自身{0}点体力
type Effect1506 struct {
node.EffectNode
}
func (e *Effect1506) Skill_Use() bool {
if len(e.Args()) == 0 || hasDragonType(e.Ctx().Opp) {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0])
return true
}
// Effect 1507: {0}回合内自身受到攻击则令对手随机进入{1}种异常状态,未触发则消除对手回合类效果
type Effect1507 struct {
RoundEffectArg0Base
triggered bool
}
func (e *Effect1507) Skill_Use_ex() bool {
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if applyRandomStatuses1507(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart())) {
e.triggered = true
}
return true
}
func (e *Effect1507) TurnEnd() {
if !e.triggered && e.Duration() == 1 {
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
}
e.EffectNode.TurnEnd()
}
func init() {
curse := &BaseStatus{}
curse.Status = petStatusCurse
input.InitEffect(input.EffectType.Status, int(petStatusCurse), curse)
input.InitEffect(input.EffectType.Skill, 1503, &Effect1503{})
input.InitEffect(input.EffectType.Skill, 1504, &Effect1504{})
input.InitEffect(input.EffectType.Skill, 1505, &Effect1505{})
input.InitEffect(input.EffectType.Skill, 1506, &Effect1506{})
input.InitEffect(input.EffectType.Skill, 1507, &Effect1507{})
}

View File

@@ -0,0 +1,277 @@
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"
"github.com/gogf/gf/v2/util/grand"
)
var effect1508IgnoredImmunityIDs = map[int]struct{}{
170: {},
525: {},
570: {},
850: {},
1011: {},
1511: {},
}
func applyRandomStatuses1510(owner, target *input.Input, count int) bool {
if owner == nil || target == nil || count <= 0 {
return false
}
if count > len(effect1507Statuses) {
count = len(effect1507Statuses)
}
triggered := false
indexes := grand.Perm(len(effect1507Statuses))
for _, idx := range indexes[:count] {
statusEffect := owner.InitEffect(input.EffectType.Status, effect1507Statuses[idx])
if statusEffect == nil {
continue
}
before := len(target.Effects)
target.AddEffect(owner, statusEffect)
if len(target.Effects) > before {
triggered = true
}
}
return triggered
}
// Effect 1508: 先出手时无视攻击免疫效果
type Effect1508 struct {
node.EffectNode
disabled []input.Effect
}
func (e *Effect1508) SkillHit() bool {
if !e.IsFirst() || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.disabled = e.disabled[:0]
for _, eff := range e.Ctx().Opp.Effects {
if eff == nil || !eff.Alive() {
continue
}
if _, ok := effect1508IgnoredImmunityIDs[int(eff.ID().Suffix())]; !ok {
continue
}
eff.Alive(false)
e.disabled = append(e.disabled, eff)
}
return true
}
func (e *Effect1508) restoreDisabled() {
for _, eff := range e.disabled {
if eff == nil {
continue
}
eff.Alive(true)
}
e.disabled = e.disabled[:0]
}
func (e *Effect1508) Skill_Use() bool {
e.restoreDisabled()
return true
}
func (e *Effect1508) Action_end() bool {
e.restoreDisabled()
return true
}
// Effect 1509: 令对手全属性-{0}且随机{1}个技能PP值归零技能无效时消耗自身全部体力并令对手全属性-1然后对手下3次使用技能消耗的PP值为3倍
type Effect1509 struct {
node.EffectNode
}
func (e *Effect1509) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
skill := e.Ctx().SkillEntity
if skill != nil && skill.AttackTime == 0 {
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Our.CurrentPet.GetMaxHP(),
})
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, 1)
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1509)
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[0].IntPart()))
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart()))
return true
}
type Effect1509Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1509Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
e.remaining = 3
}
func (e *Effect1509Sub) HookPP(count *int) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
*count *= 3
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1510: {0}回合内对手主动切换精灵则登场精灵{1}%随机进入{2}种异常状态
type Effect1510 struct {
node.EffectNode
}
func (e *Effect1510) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1510, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1510Sub struct {
node.EffectNode
pending bool
}
func (e *Effect1510Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.CanStack(false)
if len(a) > 0 {
e.Duration(a[0])
}
}
func (e *Effect1510Sub) SwitchOut(in *input.Input) bool {
if in != e.Ctx().Our || e.Ctx().Our.CurrentPet == nil {
return true
}
if e.Ctx().Our.CurrentPet.Info.Hp > 0 {
e.pending = true
}
return true
}
func (e *Effect1510Sub) SwitchIn(in *input.Input) bool {
if !e.pending || in != e.Ctx().Our || len(e.Args()) < 3 {
return true
}
e.pending = false
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
applyRandomStatuses1510(e.Ctx().Opp, e.Ctx().Our, int(e.Args()[2].IntPart()))
return true
}
// Effect 1511: 先出手时免疫当回合受到的攻击伤害,若对手为自身天敌则免疫并反弹给对手造成伤害值{0}%的百分比伤害
type Effect1511 struct {
node.EffectNode
}
func (e *Effect1511) DamageLockEx(zone *info.DamageZone) bool {
if !e.IsFirst() || zone == nil || zone.Type != info.DamageType.Red || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := zone.Damage
zone.Damage = alpacadecimal.Zero
if !e.ISNaturalEnemy() || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
reflectDamage := damage.Mul(e.Args()[0]).Div(hundred)
if reflectDamage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: reflectDamage,
})
return true
}
// Effect 1512: 集结天幕四龙之神力使自身下2回合先制+3且攻击必定命中、必定致命
type Effect1512 struct {
node.EffectNode
}
func (e *Effect1512) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1512)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1512Sub struct {
FixedDuration2Base
}
func (e *Effect1512Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += 3
return true
}
func (e *Effect1512Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.MustHit = 1
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1508, &Effect1508{})
input.InitEffect(input.EffectType.Skill, 1509, &Effect1509{})
input.InitEffect(input.EffectType.Sub, 1509, &Effect1509Sub{})
input.InitEffect(input.EffectType.Skill, 1510, &Effect1510{})
input.InitEffect(input.EffectType.Sub, 1510, &Effect1510Sub{})
input.InitEffect(input.EffectType.Skill, 1511, &Effect1511{})
input.InitEffect(input.EffectType.Skill, 1512, &Effect1512{})
input.InitEffect(input.EffectType.Sub, 1512, &Effect1512Sub{})
}

View File

@@ -0,0 +1,126 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1553: 自身体力高于最大体力的1/{0}时攻击后附加造成伤害值{1}%的百分比伤害
type Effect1553 struct {
node.EffectNode
}
func (e *Effect1553) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 2 {
return true
}
if e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) <= 0 {
return true
}
damage := e.Ctx().Our.SumDamage.Mul(e.Args()[1]).Div(hundred)
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 1554: 若自身当前体力低于最大体力的1/{0}则令自身{1}且免疫下{2}次受到的攻击
type Effect1554 struct {
node.EffectNode
}
func (e *Effect1554) Skill_Use() bool {
if len(e.Args()) < 3 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) >= 0 {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, statusEffect)
}
immuneEffect := e.Ctx().Our.InitEffect(input.EffectType.Skill, 570, int(e.Args()[2].IntPart()))
if immuneEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, immuneEffect)
}
return true
}
// Effect 1555: 对手不处于能力提升时令对手所有技能PP值-{0}
type Effect1555 struct {
node.EffectNode
}
func (e *Effect1555) Skill_Use() bool {
if len(e.Args()) == 0 || e.Ctx().Opp.HasPropADD() {
return true
}
e.Ctx().Opp.DelPP(int(e.Args()[0].IntPart()))
return true
}
// Effect 1556: {0}回合内每回合{1}%闪避对手攻击,未触发则使对手全属性-{2}
type Effect1556 struct {
RoundEffectArg0Base
}
func (e *Effect1556) SkillHit_ex() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 3 {
return true
}
if skill.AttackTime != 2 {
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success && skill.SetMiss() {
return true
}
}
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[2].IntPart()))
return true
}
// Effect 1557: 本回合未打出致命一击则令对手随机{0}个技能PP值归零
type Effect1557 struct {
node.EffectNode
}
func (e *Effect1557) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || skill.Crit != 0 || len(e.Args()) == 0 {
return true
}
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1553, &Effect1553{})
input.InitEffect(input.EffectType.Skill, 1554, &Effect1554{})
input.InitEffect(input.EffectType.Skill, 1555, &Effect1555{})
input.InitEffect(input.EffectType.Skill, 1556, &Effect1556{})
input.InitEffect(input.EffectType.Skill, 1557, &Effect1557{})
}

View File

@@ -0,0 +1,351 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1558: 下{0}回合若打出致命一击则造成的攻击伤害提升{1}%
type Effect1558 struct {
node.EffectNode
}
func (e *Effect1558) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1558, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1558Sub struct {
RoundEffectArg0Base
}
func (e *Effect1558Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.Crit == 0 {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[1])).Div(hundred)
return true
}
// Effect 1559: {0}回合内自身释放技能{1}%不消耗PP值
type Effect1559 struct {
node.EffectNode
}
func (e *Effect1559) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1559, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1559Sub struct {
RoundEffectArg0Base
}
func (e *Effect1559Sub) HookPP(count *int) bool {
if len(e.Args()) < 2 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
*count = 0
}
return true
}
// Effect 1560: 将当回合护盾所承受的伤害值以百分比伤害的形式{0}%反弹给对手,若护盾未承受伤害值则使对手随机的{1}个技能PP值归零
type Effect1560 struct {
node.EffectNode
}
func (e *Effect1560) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1560, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1560Sub struct {
FixedDuration1Base
absorbed alpacadecimal.Decimal
}
func (e *Effect1560Sub) Damage_Shield(zone *info.DamageZone) bool {
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
absorbed := alpacadecimal.Min(e.Ctx().Our.CurrentShield(), zone.Damage)
if absorbed.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.absorbed = e.absorbed.Add(absorbed)
return true
}
func (e *Effect1560Sub) TurnEnd() {
if len(e.Args()) >= 2 {
if e.absorbed.Cmp(alpacadecimal.Zero) > 0 {
damage := e.absorbed.Mul(e.Args()[0]).Div(hundred)
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
}
} else {
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart()))
}
}
e.EffectNode.TurnEnd()
}
// Effect 1561: 获得点数等同于双方最大体力差值的护盾,最高{0}点,护盾被击破时自身下{1}次使用的攻击技能附加与双方最大体力差护盾值相同的威力
type Effect1561 struct {
node.EffectNode
}
func (e *Effect1561) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
ourMaxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
oppMaxHP := e.Ctx().Opp.CurrentPet.GetMaxHP()
shieldValue := ourMaxHP.Sub(oppMaxHP)
if shieldValue.Cmp(alpacadecimal.Zero) < 0 {
shieldValue = shieldValue.Mul(alpacadecimal.NewFromInt(-1))
}
if shieldValue.Cmp(e.Args()[0]) > 0 {
shieldValue = e.Args()[0]
}
if shieldValue.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.AddShield(shieldValue)
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
1561,
int(shieldValue.IntPart()),
int(e.Args()[1].IntPart()),
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1561Sub struct {
node.EffectNode
trackedPet *info.BattlePetEntity
shieldValue alpacadecimal.Decimal
absorbed alpacadecimal.Decimal
uses int
}
func (e *Effect1561Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
e.CanStack(false)
e.trackedPet = t.CurrentPet
if len(a) > 0 {
e.shieldValue = alpacadecimal.NewFromInt(int64(a[0]))
}
if len(a) > 1 {
e.uses = a[1]
}
}
func (e *Effect1561Sub) Damage_Shield(zone *info.DamageZone) bool {
if e.trackedPet == nil || e.Ctx().Our.CurrentPet != e.trackedPet {
return true
}
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 || e.shieldValue.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
absorbed := alpacadecimal.Min(e.Ctx().Our.CurrentShield(), zone.Damage)
if absorbed.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.absorbed = e.absorbed.Add(absorbed)
if e.absorbed.Cmp(e.shieldValue) < 0 {
return true
}
if e.uses <= 0 {
e.Alive(false)
return true
}
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
15611,
int(e.shieldValue.IntPart()),
e.uses,
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
e.Alive(false)
return true
}
func (e *Effect1561Sub) SwitchOut(in *input.Input) bool {
if in != e.Ctx().Our {
return true
}
if e.trackedPet != nil && e.trackedPet.Alive() {
return true
}
e.Alive(false)
return true
}
type Effect1561PowerSub struct {
node.EffectNode
trackedPet *info.BattlePetEntity
bonusPower int
remaining int
}
func (e *Effect1561PowerSub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
e.CanStack(false)
e.trackedPet = t.CurrentPet
if len(a) > 0 {
e.bonusPower = a[0]
}
if len(a) > 1 {
e.remaining = a[1]
}
}
func (e *Effect1561PowerSub) SkillHit() bool {
if e.trackedPet == nil || e.Ctx().Our.CurrentPet != e.trackedPet || e.remaining <= 0 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.Power += e.bonusPower
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
func (e *Effect1561PowerSub) SwitchOut(in *input.Input) bool {
if in != e.Ctx().Our {
return true
}
if e.trackedPet != nil && e.trackedPet.Alive() {
return true
}
e.Alive(false)
return true
}
// Effect 1562: 命中后{0}%令对手{1},触发后{2}回合内对手主动切换精灵则登场精灵{3}%进入{4}状态
type Effect1562 struct {
node.EffectNode
}
func (e *Effect1562) OnSkill() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.AttackTime == 0 || len(e.Args()) < 5 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1562, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1562Sub struct {
node.EffectNode
pending bool
}
func (e *Effect1562Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.CanStack(false)
if len(a) > 2 {
e.Duration(a[2])
}
}
func (e *Effect1562Sub) SwitchOut(in *input.Input) bool {
if in != e.Ctx().Our || e.Ctx().Our.CurrentPet == nil {
return true
}
if e.Ctx().Our.CurrentPet.Info.Hp > 0 {
e.pending = true
}
return true
}
func (e *Effect1562Sub) SwitchIn(in *input.Input) bool {
if !e.pending || in != e.Ctx().Our || len(e.Args()) < 5 {
return true
}
e.pending = false
success, _, _ := e.Input.Player.Roll(int(e.Args()[3].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Opp.InitEffect(input.EffectType.Status, int(e.Args()[4].IntPart()))
if statusEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Opp, statusEffect)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1558, &Effect1558{})
input.InitEffect(input.EffectType.Sub, 1558, &Effect1558Sub{})
input.InitEffect(input.EffectType.Skill, 1559, &Effect1559{})
input.InitEffect(input.EffectType.Sub, 1559, &Effect1559Sub{})
input.InitEffect(input.EffectType.Skill, 1560, &Effect1560{})
input.InitEffect(input.EffectType.Sub, 1560, &Effect1560Sub{})
input.InitEffect(input.EffectType.Skill, 1561, &Effect1561{})
input.InitEffect(input.EffectType.Sub, 1561, &Effect1561Sub{})
input.InitEffect(input.EffectType.Sub, 15611, &Effect1561PowerSub{})
input.InitEffect(input.EffectType.Skill, 1562, &Effect1562{})
input.InitEffect(input.EffectType.Sub, 1562, &Effect1562Sub{})
}

View File

@@ -0,0 +1,169 @@
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"
)
// Effect 1563: 损失自身{0}点体力,给对手造成{1}点固定伤害,若自身体力不足{2}则损失全部体力且造成的固定伤害翻倍
type Effect1563 struct {
node.EffectNode
}
func (e *Effect1563) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
selfDamage := e.Args()[0]
oppDamage := e.Args()[1]
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Args()[2]) < 0 {
selfDamage = e.Ctx().Our.CurrentPet.GetHP()
oppDamage = oppDamage.Mul(alpacadecimal.NewFromInt(2))
}
if selfDamage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: selfDamage,
})
}
if oppDamage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: oppDamage,
})
}
return true
}
// Effect 1564: 恢复自身{0}点体力,若自身满天赋值则{1}%附加等量百分比伤害
type Effect1564 struct {
node.EffectNode
}
func (e *Effect1564) Skill_Use() bool {
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
healAmount := e.Args()[0]
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
if e.Ctx().Our.CurrentPet.Info.Dv != 31 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: healAmount,
})
return true
}
// Effect 1565: {0}回合内每回合结束时使对手随机{1}个技能PP归零
type Effect1565 struct {
node.EffectNode
}
func (e *Effect1565) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1565, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1565Sub struct {
RoundEffectArg0Base
}
func (e *Effect1565Sub) TurnEnd() {
if len(e.Args()) > 1 {
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart()))
}
e.EffectNode.TurnEnd()
}
// Effect 1566: {0}回合内每回合结束后反转对手能力提升状态
type Effect1566 struct {
node.EffectNode
}
func (e *Effect1566) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1566, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1566Sub struct {
RoundEffectArg0Base
}
func (e *Effect1566Sub) TurnEnd() {
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v)
}
e.EffectNode.TurnEnd()
}
// Effect 1567: 获得海洋的祝福使自身下2回合先制+2且攻击必定命中、必定致命
type Effect1567 struct {
node.EffectNode
}
func (e *Effect1567) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1567)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1567Sub struct {
FixedDuration2Base
}
func (e *Effect1567Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority += 2
return true
}
func (e *Effect1567Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.MustHit = 1
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1563, &Effect1563{})
input.InitEffect(input.EffectType.Skill, 1564, &Effect1564{})
input.InitEffect(input.EffectType.Skill, 1565, &Effect1565{})
input.InitEffect(input.EffectType.Sub, 1565, &Effect1565Sub{})
input.InitEffect(input.EffectType.Skill, 1566, &Effect1566{})
input.InitEffect(input.EffectType.Sub, 1566, &Effect1566Sub{})
input.InitEffect(input.EffectType.Skill, 1567, &Effect1567{})
input.InitEffect(input.EffectType.Sub, 1567, &Effect1567Sub{})
}

View File

@@ -0,0 +1,161 @@
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"
)
// Effect 1670: {0}%令对手{1},对手为自身天敌时概率提升{2}%,未触发则消除对手回合类效果
type Effect1670 struct {
node.EffectNode
}
func (e *Effect1670) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
chance := int(e.Args()[0].IntPart())
if e.ISNaturalEnemy() {
chance += int(e.Args()[2].IntPart())
if chance > 100 {
chance = 100
}
}
success, _, _ := e.Input.Player.Roll(chance, 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
return true
}
}
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
return true
}
// Effect 1671: 造成的攻击伤害不低于{0},若对手处于能力提升状态则造成的攻击伤害不低于{1}
type Effect1671 struct {
node.EffectNode
}
func (e *Effect1671) DamageFloor(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if len(e.Args()) < 2 {
return true
}
threshold := e.Args()[0]
if e.Ctx().Opp.HasPropADD() {
threshold = e.Args()[1]
}
if zone.Damage.Cmp(threshold) < 0 {
zone.Damage = threshold
}
return true
}
// Effect 1672: 出手时若自身未满体力则吸取对手{0}点体力
type Effect1672 struct {
node.EffectNode
}
func (e *Effect1672) OnSkill() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) >= 0 {
return true
}
drain := e.Args()[0]
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: drain,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, drain)
return true
}
// Effect 1673: 命中后{0}%的概率秒杀对手,未触发则造成的伤害不少于{1}
type Effect1673 struct {
node.EffectNode
}
func (e *Effect1673) DamageFloor(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if len(e.Args()) < 2 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
zone.Damage = e.Ctx().Opp.CurrentPet.GetMaxHP()
return true
}
if zone.Damage.Cmp(e.Args()[1]) < 0 {
zone.Damage = e.Args()[1]
}
return true
}
// Effect 1674: {0}回合内每回合使用技能吸取对手最大体力的1/{1},若对手未受到百分比伤害则额外附加{2}点真实伤害
type Effect1674 struct {
RoundEffectArg0Base
}
func (e *Effect1674) OnSkill() bool {
if len(e.Args()) < 3 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) > 0 {
beforeHP := e.Ctx().Opp.CurrentPet.Info.Hp
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
if e.Ctx().Opp.CurrentPet.Info.Hp < beforeHP {
return true
}
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: e.Args()[2],
})
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1670, &Effect1670{})
input.InitEffect(input.EffectType.Skill, 1671, &Effect1671{})
input.InitEffect(input.EffectType.Skill, 1672, &Effect1672{})
input.InitEffect(input.EffectType.Skill, 1673, &Effect1673{})
input.InitEffect(input.EffectType.Skill, 1674, &Effect1674{})
}

View File

@@ -0,0 +1,227 @@
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"
)
// Effect 1675: 反转对手能力提升状态,反转成功则对手{0}回合内无法通过自身技能恢复体力
type Effect1675 struct {
node.EffectNode
}
func (e *Effect1675) Skill_Use() bool {
reversed := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v) {
reversed = true
}
}
if !reversed || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1675, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1675Sub struct {
RoundEffectArg0Base
}
func (e *Effect1675Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
if value == nil || *value <= 0 {
return true
}
if _, ok := ac.(*action.SelectSkillAction); !ok {
return true
}
*value = 0
return true
}
// Effect 1676: {0}回合内每回合使用技能{1}%令对手{2},未触发则令自身全属性+{3}
type Effect1676 struct {
RoundEffectArg0Base
}
func (e *Effect1676) OnSkill() bool {
if len(e.Args()) < 4 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
return true
}
}
boost := int8(e.Args()[3].IntPart())
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boost)
}
return true
}
// Effect 1677: 附加给自身{0}点固定伤害致死时令自身残留1点体力附加给对手{1}点固定伤害,令自身下{2}次受到的攻击伤害转化为体力
type Effect1677 struct {
node.EffectNode
}
func (e *Effect1677) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
selfDamage := e.Args()[0]
if selfDamage.Cmp(alpacadecimal.Zero) > 0 {
currentHP := e.Ctx().Our.CurrentPet.GetHP()
if currentHP.Cmp(alpacadecimal.NewFromInt(1)) > 0 {
maxSelfDamage := currentHP.Sub(alpacadecimal.NewFromInt(1))
if selfDamage.Cmp(maxSelfDamage) > 0 {
selfDamage = maxSelfDamage
}
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: selfDamage,
})
}
}
if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[1],
})
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1677, int(e.Args()[2].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1677Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1677Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1677Sub) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
return true
}
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, zone.Damage)
zone.Damage = alpacadecimal.Zero
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1678: 附加自身防御和特防能力提升总段数x{0}的固定伤害
type Effect1678 struct {
node.EffectNode
}
func (e *Effect1678) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
total := int64(0)
if e.Ctx().Our.Prop[1] > 0 {
total += int64(e.Ctx().Our.Prop[1])
}
if e.Ctx().Our.Prop[3] > 0 {
total += int64(e.Ctx().Our.Prop[3])
}
if total <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0].Mul(alpacadecimal.NewFromInt(total)),
})
return true
}
// Effect 1679: 造成的伤害高于{0}则{1}%令对手{2}未触发则吸取对手最大体力的1/{3}
type Effect1679 struct {
node.EffectNode
}
func (e *Effect1679) Skill_Use() bool {
if len(e.Args()) < 4 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
return true
}
}
if e.Args()[3].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[3])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1675, &Effect1675{})
input.InitEffect(input.EffectType.Sub, 1675, &Effect1675Sub{})
input.InitEffect(input.EffectType.Skill, 1676, &Effect1676{})
input.InitEffect(input.EffectType.Skill, 1677, &Effect1677{})
input.InitEffect(input.EffectType.Sub, 1677, &Effect1677Sub{})
input.InitEffect(input.EffectType.Skill, 1678, &Effect1678{})
input.InitEffect(input.EffectType.Skill, 1679, &Effect1679{})
}

View File

@@ -0,0 +1,278 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 1680: 对手不处于异常状态时附加{0}点真实伤害
type Effect1680 struct {
node.EffectNode
}
func (e *Effect1680) OnSkill() bool {
if len(e.Args()) == 0 || e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: e.Args()[0],
})
return true
}
// Effect 1681: 吸取对手能力提升状态,吸取成功则下{0}次受到的攻击伤害减少{1}点
type Effect1681 struct {
node.EffectNode
}
func (e *Effect1681) Skill_Use() bool {
absorbed := false
for i, v := range e.Ctx().Opp.Prop[:] {
if v <= 0 {
continue
}
if !e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
continue
}
absorbed = true
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
}
if !absorbed || len(e.Args()) < 2 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1681, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1681Sub struct {
node.EffectNode
remaining int
reduce int
}
func (e *Effect1681Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
if len(a) > 1 {
e.reduce = a[1]
}
}
func (e *Effect1681Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 || e.reduce <= 0 {
return true
}
reduceDamage := alpacadecimal.NewFromInt(int64(e.reduce))
if zone.Damage.Cmp(reduceDamage) > 0 {
zone.Damage = zone.Damage.Sub(reduceDamage)
} else {
zone.Damage = alpacadecimal.Zero
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1682: {0}%的概率伤害为{1}倍,未触发则令敌我双方全属性-{2}且下次翻倍概率额外提升{3}%
type Effect1682 struct {
node.EffectNode
triggered bool
nextBonus int
}
func (e *Effect1682) SkillHit() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 4 {
return true
}
bonus := 0
if state := findEffect1682State(e.Ctx().Our, skill.XML.ID); state != nil {
bonus = state.bonusChance
}
chance := int(e.Args()[0].IntPart()) + bonus
if chance > 100 {
chance = 100
}
e.triggered, _, _ = e.Input.Player.Roll(chance, 100)
e.nextBonus = bonus + int(e.Args()[3].IntPart())
if e.triggered {
if state := findEffect1682State(e.Ctx().Our, skill.XML.ID); state != nil {
state.Alive(false)
}
}
return true
}
func (e *Effect1682) Damage_Mul(zone *info.DamageZone) bool {
if !e.triggered || zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Mul(int(e.Args()[1].IntPart()))
return true
}
func (e *Effect1682) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || len(e.Args()) < 4 || e.triggered {
return true
}
reduce := int8(e.Args()[2].IntPart())
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -reduce)
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -reduce)
}
if state := findEffect1682State(e.Ctx().Our, skill.XML.ID); state != nil {
state.bonusChance = e.nextBonus
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1682, skill.XML.ID, e.nextBonus)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1682Sub struct {
node.EffectNode
skillID int
bonusChance int
}
func (e *Effect1682Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.skillID = a[0]
}
if len(a) > 1 {
e.bonusChance = a[1]
}
}
func (e *Effect1682Sub) SwitchOut(in *input.Input) bool {
if in == e.Ctx().Our {
e.Alive(false)
}
return true
}
func findEffect1682State(in *input.Input, skillID int) *Effect1682Sub {
if in == nil {
return nil
}
for i := len(in.Effects) - 1; i >= 0; i-- {
effect, ok := in.Effects[i].(*Effect1682Sub)
if !ok || !effect.Alive() || effect.skillID != skillID {
continue
}
return effect
}
return nil
}
// Effect 1683: {0}回合内自身的能力提升状态无法被消除或吸取
type Effect1683 struct {
node.EffectNode
}
func (e *Effect1683) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1683, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1683Sub struct {
RoundEffectArg0Base
}
func (e *Effect1683Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
return true
}
if e.Ctx().Our.Prop[prop] <= 0 {
return true
}
if level == 0 {
return false
}
return true
}
// Effect 1684: {0}回合内对手的能力下降状态无法被解除或反转
type Effect1684 struct {
node.EffectNode
}
func (e *Effect1684) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1684, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1684Sub struct {
RoundEffectArg0Base
}
func (e *Effect1684Sub) PropBefer(source *input.Input, prop int8, level int8) bool {
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
return true
}
if e.Ctx().Our.Prop[prop] >= 0 {
return true
}
if level >= 0 {
return false
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1680, &Effect1680{})
input.InitEffect(input.EffectType.Skill, 1681, &Effect1681{})
input.InitEffect(input.EffectType.Sub, 1681, &Effect1681Sub{})
input.InitEffect(input.EffectType.Skill, 1682, &Effect1682{})
input.InitEffect(input.EffectType.Sub, 1682, &Effect1682Sub{})
input.InitEffect(input.EffectType.Skill, 1683, &Effect1683{})
input.InitEffect(input.EffectType.Sub, 1683, &Effect1683Sub{})
input.InitEffect(input.EffectType.Skill, 1684, &Effect1684{})
input.InitEffect(input.EffectType.Sub, 1684, &Effect1684Sub{})
}

View File

@@ -0,0 +1,176 @@
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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 1685: 1回合做{0}-{1}次攻击,对手处于异常状态时连击上限为{2}
// 当前战斗模型未逐段执行多段攻击,这里按随机连击次数折算为红伤倍率提升。
type Effect1685 struct {
node.EffectNode
}
func (e *Effect1685) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
minHits := int(e.Args()[0].IntPart())
maxHits := int(e.Args()[1].IntPart())
if minHits <= 0 {
minHits = 1
}
if maxHits < minHits {
maxHits = minHits
}
if e.Ctx().Opp.StatEffect_Exist_all() {
statusCap := int(e.Args()[2].IntPart())
if statusCap > 0 && statusCap < maxHits {
maxHits = statusCap
}
if maxHits < minHits {
maxHits = minHits
}
}
hits := minHits
if maxHits > minHits {
hits += grand.Intn(maxHits - minHits + 1)
}
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(int64(hits)))
return true
}
// Effect 1686: 先出手时造成的攻击伤害提升{0}%,若对手当前体力值高于自身则伤害额外提升{1}%
type Effect1686 struct {
node.EffectNode
}
func (e *Effect1686) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || !e.IsFirst() {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) < 2 {
return true
}
percent := e.Args()[0]
if e.Ctx().Opp.CurrentPet.GetHP().Cmp(e.Ctx().Our.CurrentPet.GetHP()) > 0 {
percent = percent.Add(e.Args()[1])
}
zone.Damage = zone.Damage.Mul(hundred.Add(percent)).Div(hundred)
return true
}
// Effect 1687: {0}回合内免疫并反弹所有受到的控制类异常状态
type Effect1687 struct {
RoundEffectArg0Base
}
func (e *Effect1687) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
if in != e.Ctx().Opp || !input.IS_Stat(effEffect) {
return true
}
if !isControlStatus1687(int(effEffect.ID().Suffix())) {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(effEffect.ID().Suffix()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return false
}
func isControlStatus1687(statusID int) bool {
switch info.EnumPetStatus(statusID) {
case info.PetStatus.Paralysis,
info.PetStatus.Tired,
info.PetStatus.Fear,
info.PetStatus.Petrified,
info.PetStatus.Sleep:
return true
default:
return false
}
}
// Effect 1688: 消除敌我双方能力提升状态和回合类效果消除任意一项成功则吸取对手最大体力的1/{0}且{1}%令对手{2}
type Effect1688 struct {
node.EffectNode
}
func (e *Effect1688) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
success := false
if clearPositiveProps(e.Ctx().Our, e.Ctx().Our) {
success = true
}
if clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
success = true
}
ourTurnEffects := activeTurnEffectCount(e.Ctx().Our)
oppTurnEffects := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Our.CancelTurn(e.Ctx().Our)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if ourTurnEffects > 0 || oppTurnEffects > 0 {
success = true
}
if !success {
return true
}
if e.Args()[0].Cmp(alpacadecimal.Zero) > 0 {
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
}
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if ok {
applyStatus(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart()))
}
return true
}
// Effect 1689: 本回合未打出致命一击则恢复自己所有技能{0}点PP值并降低对手所有技能{1}点PP值
type Effect1689 struct {
node.EffectNode
}
func (e *Effect1689) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || skill.Crit != 0 || len(e.Args()) < 2 {
return true
}
e.Ctx().Our.HealPP(int(e.Args()[0].IntPart()))
e.Ctx().Opp.DelPP(int(e.Args()[1].IntPart()))
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1685, &Effect1685{})
input.InitEffect(input.EffectType.Skill, 1686, &Effect1686{})
input.InitEffect(input.EffectType.Skill, 1687, &Effect1687{})
input.InitEffect(input.EffectType.Skill, 1688, &Effect1688{})
input.InitEffect(input.EffectType.Skill, 1689, &Effect1689{})
}

View File

@@ -0,0 +1,254 @@
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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 1690: 火之力量觉醒,使自身下{0}次攻击获得灼心之焰效果
type Effect1690 struct {
node.EffectNode
}
func (e *Effect1690) Skill_Use() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1690, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1690Sub struct {
node.EffectNode
remaining int
}
func (e *Effect1690Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
}
func (e *Effect1690Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || e.remaining <= 0 {
return true
}
if current.SkillEntity.Category() == info.Category.STATUS {
return true
}
current.SkillEntity.XML.Priority += 1
return true
}
func (e *Effect1690Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil || e.remaining <= 0 {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
func (e *Effect1690Sub) Skill_Use() bool {
if e.Ctx().SkillEntity == nil || e.remaining <= 0 {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.AttackTime != 0 {
indexes := grand.Perm(6)
for _, idx := range indexes[:2] {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(idx), 1)
}
}
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
// Effect 1691: 终阶源盾下{0}次被激活或被消耗则回合结束时附加{1}点固定伤害
type Effect1691 struct {
node.EffectNode
}
func (e *Effect1691) Skill_Use() bool {
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1691, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect1691Sub struct {
node.EffectNode
remaining int
damage alpacadecimal.Decimal
triggeredTurn bool
}
func (e *Effect1691Sub) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.Duration(-1)
if len(a) > 0 {
e.remaining = a[0]
}
if len(a) > 1 {
e.damage = alpacadecimal.NewFromInt(int64(a[1]))
}
}
func (e *Effect1691Sub) ShieldChange(before, after alpacadecimal.Decimal) bool {
if e.remaining <= 0 {
e.Alive(false)
return true
}
if (before.Cmp(alpacadecimal.Zero) == 0 && after.Cmp(alpacadecimal.Zero) > 0) ||
(before.Cmp(alpacadecimal.Zero) > 0 && after.Cmp(alpacadecimal.Zero) == 0) {
e.triggeredTurn = true
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
}
return true
}
func (e *Effect1691Sub) TurnEnd() {
if e.triggeredTurn && e.damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.damage,
})
e.triggeredTurn = false
}
e.EffectNode.TurnEnd()
}
// Effect 1692: {0}%的概率造成伤害翻倍,终阶源盾处于激活状态时概率提升至{1}%
type Effect1692 struct {
node.EffectNode
}
func (e *Effect1692) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) < 2 {
return true
}
chance := int(e.Args()[0].IntPart())
if e.Ctx().Our.HasShield() {
chance = int(e.Args()[1].IntPart())
}
ok, _, _ := e.Input.Player.Roll(chance, 100)
if ok {
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
}
return true
}
// Effect 1693: {0}回合内每回合使用技能附加对手最大体力1/{1}的百分比伤害,对手免疫百分比伤害时额外附加{2}点真实伤害
type Effect1693 struct {
RoundEffectArg0Base
}
func (e *Effect1693) OnSkill() bool {
if len(e.Args()) < 3 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
if damage.Cmp(alpacadecimal.Zero) > 0 {
beforeHP := e.Ctx().Opp.CurrentPet.Info.Hp
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
if e.Ctx().Opp.CurrentPet.Info.Hp < beforeHP {
return true
}
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.True,
Damage: e.Args()[2],
})
return true
}
// Effect 1694: 随机吸取对手{0}-{1}点体力,若自身处于能力提升状态则效果转变为{2}-{3}点
type Effect1694 struct {
node.EffectNode
}
func (e *Effect1694) Skill_Use() bool {
if len(e.Args()) < 4 {
return true
}
minDrain := int(e.Args()[0].IntPart())
maxDrain := int(e.Args()[1].IntPart())
if e.Ctx().Our.HasPropADD() {
minDrain = int(e.Args()[2].IntPart())
maxDrain = int(e.Args()[3].IntPart())
}
if maxDrain < minDrain {
minDrain, maxDrain = maxDrain, minDrain
}
drain := minDrain
if maxDrain > minDrain {
drain = grand.N(minDrain, maxDrain)
}
if drain <= 0 {
return true
}
damage := alpacadecimal.NewFromInt(int64(drain))
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1690, &Effect1690{})
input.InitEffect(input.EffectType.Sub, 1690, &Effect1690Sub{})
input.InitEffect(input.EffectType.Skill, 1691, &Effect1691{})
input.InitEffect(input.EffectType.Sub, 1691, &Effect1691Sub{})
input.InitEffect(input.EffectType.Skill, 1692, &Effect1692{})
input.InitEffect(input.EffectType.Skill, 1693, &Effect1693{})
input.InitEffect(input.EffectType.Skill, 1694, &Effect1694{})
}

View File

@@ -0,0 +1,169 @@
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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 615: {0}回合内使用技能恢复{1}点体力体力低于1/{2}时恢复至满
type Effect615 struct {
RoundEffectArg0Base
}
func (e *Effect615) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
healAmount := e.Args()[1]
if len(e.Args()) > 2 && e.Args()[2].Cmp(alpacadecimal.Zero) > 0 {
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
threshold := maxHP.Div(e.Args()[2])
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 {
healAmount = maxHP
}
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
return true
}
// Effect 616: 当自身血量少于1/3时先制+2
type Effect616 struct {
node.EffectNode
}
func (e *Effect616) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
if e.Ctx().Our.CurrentPet.GetHP().Mul(e.Args()[0]).Cmp(maxHP) >= 0 {
return true
}
current.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
return true
}
// Effect 617: 消耗自身所有体力给对手造成{0}-{1}点伤害,若造成伤害大于对手体力则对手必定留1点血
type Effect617 struct {
node.EffectNode
}
func (e *Effect617) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Our.CurrentPet.GetMaxHP(),
})
minDamage := int(e.Args()[0].IntPart())
maxDamage := int(e.Args()[1].IntPart())
if maxDamage < minDamage {
minDamage, maxDamage = maxDamage, minDamage
}
randomDamage := minDamage
if maxDamage > minDamage {
randomDamage = grand.N(minDamage, maxDamage)
}
remainHP := e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1))
if remainHP.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := alpacadecimal.Min(alpacadecimal.NewFromInt(int64(randomDamage)), remainHP)
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
// Effect 618: 消耗自身所有体力,使下一只出战精灵{0}回合内每回合恢复{1}点体力
type Effect618 struct {
SelfKill
}
func (e *Effect618) SwitchIn(in *input.Input) bool {
if !e.can || in != e.Ctx().Our {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 618, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
e.Alive(false)
return true
}
type Effect618Sub struct {
RoundEffectArg0Base
}
func (e *Effect618Sub) TurnEnd() {
if len(e.Args()) > 1 && e.Ctx().Our.CurrentPet.Info.Hp > 0 {
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[1])
}
e.EffectNode.TurnEnd()
}
// Effect 619: 下{0}回合令对手所有技能先制-{1}
type Effect619 struct {
node.EffectNode
}
func (e *Effect619) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
619,
e.SideEffectArgs...,
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect619Sub struct {
RoundEffectArg0Base
}
func (e *Effect619Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
priorityDown := int(e.Args()[1].IntPart())
if fattack != nil && fattack.PlayerID == e.Ctx().Opp.UserID && fattack.SkillEntity != nil {
fattack.SkillEntity.XML.Priority -= priorityDown
}
if sattack != nil && sattack.PlayerID == e.Ctx().Opp.UserID && sattack.SkillEntity != nil {
sattack.SkillEntity.XML.Priority -= priorityDown
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 615, &Effect615{})
input.InitEffect(input.EffectType.Skill, 616, &Effect616{})
input.InitEffect(input.EffectType.Skill, 617, &Effect617{})
input.InitEffect(input.EffectType.Skill, 618, &Effect618{})
input.InitEffect(input.EffectType.Sub, 618, &Effect618Sub{})
input.InitEffect(input.EffectType.Skill, 619, &Effect619{})
input.InitEffect(input.EffectType.Sub, 619, &Effect619Sub{})
}

View File

@@ -0,0 +1,169 @@
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"
)
// Effect 621: 消除对手能力上升状态,消除成功对手{0}{1}
type Effect621 struct {
node.EffectNode
}
func (e *Effect621) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
return true
}
propID := int(e.Args()[0].IntPart())
if propID < 0 || propID >= 6 {
return true
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propID), int8(e.Args()[1].IntPart()))
return true
}
// Effect 622: 自身{0}{6}%概率强化效果翻倍
type Effect622 struct {
node.EffectNode
}
func (e *Effect622) Skill_Use() bool {
if len(e.SideEffectArgs) < 7 {
return true
}
double := false
success, _, _ := e.Input.Player.Roll(e.SideEffectArgs[6], 100)
double = success
for i, v := range e.SideEffectArgs[:6] {
if v == 0 {
continue
}
if double {
v *= 2
}
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v))
}
return true
}
// Effect 623: 消除自身能力下降状态,消除成功下{0}回合自身直接攻击必定暴击
type Effect623 struct {
node.EffectNode
}
func (e *Effect623) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
cleared := false
for i, v := range e.Ctx().Our.Prop[:] {
if v >= 0 {
continue
}
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
cleared = true
}
}
if !cleared {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect623Sub{}, -1)
return true
}
type Effect623Sub struct {
RoundEffectArg0Base
}
func (e *Effect623Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
// Effect 624: 消除对手能力上升状态,消除成功{0}回合内受到伤害减少{1}点
type Effect624 struct {
node.EffectNode
}
func (e *Effect624) Skill_Use() bool {
if len(e.Args()) < 2 {
return true
}
if !clearPositiveProps(e.Ctx().Opp, e.Ctx().Our) {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect624Sub{}, -1)
return true
}
type Effect624Sub struct {
RoundEffectArg0Base
}
func (e *Effect624Sub) DamageSubEx(zone *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 {
return true
}
reduction := e.Args()[1]
if zone.Damage.Cmp(reduction) > 0 {
zone.Damage = zone.Damage.Sub(reduction)
} else {
zone.Damage = alpacadecimal.Zero
}
return true
}
// Effect 625: 使对手{0},若对手处于弱化状态,弱化效果翻倍
type Effect625 struct {
node.EffectNode
}
func (e *Effect625) Skill_Use() bool {
double := e.Ctx().Opp.HasPropSub()
for i, v := range e.SideEffectArgs[:min(len(e.SideEffectArgs), 6)] {
if v == 0 {
continue
}
if double {
v *= 2
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 621, &Effect621{})
input.InitEffect(input.EffectType.Skill, 622, &Effect622{})
input.InitEffect(input.EffectType.Skill, 623, &Effect623{})
input.InitEffect(input.EffectType.Sub, 623, &Effect623Sub{})
input.InitEffect(input.EffectType.Skill, 624, &Effect624{})
input.InitEffect(input.EffectType.Sub, 624, &Effect624Sub{})
input.InitEffect(input.EffectType.Skill, 625, &Effect625{})
}

View File

@@ -30,16 +30,7 @@ func (e *Effect632) Skill_Use() bool {
return true
}
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
632,
int(e.Args()[0].IntPart()),
int(e.Args()[1].IntPart()),
int(e.Args()[2].IntPart()),
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect632Sub{}, -1)
return true
}
@@ -55,6 +46,9 @@ func (e *Effect632Sub) SetArgs(t *input.Input, a ...int) {
}
func (e *Effect632Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
@@ -128,10 +122,7 @@ func (e *Effect635) Skill_Use() bool {
return true
}
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 635, int(e.Args()[0].IntPart()))
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect635Sub{}, -1)
return true
}

View File

@@ -0,0 +1,150 @@
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/gogf/gf/v2/util/grand"
)
var randomMajorAbnormalStatuses = []int{
int(info.PetStatus.Burned),
int(info.PetStatus.Frozen),
int(info.PetStatus.Poisoned),
int(info.PetStatus.Paralysis),
int(info.PetStatus.Fear),
int(info.PetStatus.Sleep),
}
func addRandomMajorAbnormalStatus(owner, target *input.Input) {
if owner == nil || target == nil || len(randomMajorAbnormalStatuses) == 0 {
return
}
statusID := randomMajorAbnormalStatuses[grand.Intn(len(randomMajorAbnormalStatuses))]
statusEffect := owner.InitEffect(input.EffectType.Status, statusID)
if statusEffect != nil {
target.AddEffect(owner, statusEffect)
}
}
// Effect 769: 若对手不处于异常状态则造成的攻击伤害额外提升{0}%
type Effect769 struct {
node.EffectNode
}
func (e *Effect769) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0])
return true
}
// Effect 770: 若对手处于异常状态,则恢复自身全部体力
type Effect770 struct {
node.EffectNode
}
func (e *Effect770) Skill_Use() bool {
if !e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurrentPet.GetMaxHP())
return true
}
// Effect 771: {0}回合内每次使用攻击技能都有{1}%概率使对手进入任意一种异常状态
type Effect771 struct {
RoundEffectArg0Base
}
func (e *Effect771) OnSkill() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if len(e.Args()) < 2 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
addRandomMajorAbnormalStatus(e.Ctx().Our, e.Ctx().Opp)
return true
}
// Effect 772: {0}回合内若对手使用攻击技能则有{1}%概率随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态
type Effect772 struct {
RoundEffectArg0Base
}
func (e *Effect772) Skill_Use_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if len(e.Args()) < 2 {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
addRandomMajorAbnormalStatus(e.Ctx().Our, e.Ctx().Opp)
return true
}
// Effect 773: 若自身体力低于对手则与对手互换体力
type Effect773 struct {
node.EffectNode
}
func (e *Effect773) OnSkill() bool {
ourHP := e.Ctx().Our.CurrentPet.GetHP().IntPart()
oppHP := e.Ctx().Opp.CurrentPet.GetHP().IntPart()
if ourHP >= oppHP {
return true
}
ourMaxHP := e.Ctx().Our.CurrentPet.GetMaxHP().IntPart()
oppMaxHP := e.Ctx().Opp.CurrentPet.GetMaxHP().IntPart()
newOurHP := oppHP
if newOurHP > ourMaxHP {
newOurHP = ourMaxHP
}
if newOurHP < 0 {
newOurHP = 0
}
newOppHP := ourHP
if newOppHP > oppMaxHP {
newOppHP = oppMaxHP
}
if newOppHP < 0 {
newOppHP = 0
}
e.Ctx().Our.CurrentPet.Info.Hp = uint32(newOurHP)
e.Ctx().Opp.CurrentPet.Info.Hp = uint32(newOppHP)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 769, &Effect769{})
input.InitEffect(input.EffectType.Skill, 770, &Effect770{})
input.InitEffect(input.EffectType.Skill, 771, &Effect771{})
input.InitEffect(input.EffectType.Skill, 772, &Effect772{})
input.InitEffect(input.EffectType.Skill, 773, &Effect773{})
}

View File

@@ -0,0 +1,190 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// Effect 911: 全属性+{0},自身处于能力提升状态时强化效果翻倍
type Effect911 struct {
node.EffectNode
}
func (e *Effect911) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
boostValue := int8(e.Args()[0].IntPart())
if e.Ctx().Our.HasPropADD() {
boostValue *= 2
}
for i := 0; i < 6; i++ {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), boostValue)
}
return true
}
// Effect 912: 若对手处于能力下降则使对手随机{0}个技能的PP归零
type Effect912 struct {
node.EffectNode
}
func (e *Effect912) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
if !e.Ctx().Opp.HasPropSub() {
return true
}
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[0].IntPart()))
return true
}
// Effect 913: 消除对手回合类效果,消除成功则下回合自身造成的攻击伤害额外提升{0}%
type Effect913 struct {
node.EffectNode
}
func (e *Effect913) Skill_Use() bool {
if len(e.Args()) == 0 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect913Sub{}, -1)
return true
}
type Effect913Sub struct {
FixedDuration1Base
}
func (e *Effect913Sub) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
return true
}
// Effect 914: 若对手处于{0}状态则{1}回合内{2}%令对手使用的技能无效
type Effect914 struct {
node.EffectNode
}
func (e *Effect914) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
if !e.Ctx().Opp.StatEffect_Exist(info.EnumPetStatus(e.Args()[0].IntPart())) {
return true
}
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
914,
int(e.Args()[1].IntPart()),
int(e.Args()[2].IntPart()),
)
if effect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect914Sub struct {
RoundEffectArg0Base
}
func (e *Effect914Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if len(e.Args()) < 2 {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
e.Ctx().SkillEntity.SetNoSide()
e.Ctx().SkillEntity.AttackTime = 0
return true
}
// Effect 915: 消除对手回合类效果,消除成功则自身下{0}回合攻击有{1}%使对手{2}
type Effect915 struct {
node.EffectNode
}
func (e *Effect915) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
before := activeTurnEffectCount(e.Ctx().Opp)
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
if before <= 0 {
return true
}
effect := e.Ctx().Our.InitEffect(
input.EffectType.Sub,
915,
int(e.Args()[0].IntPart()),
int(e.Args()[1].IntPart()),
int(e.Args()[2].IntPart()),
)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect915Sub struct {
RoundEffectArg0Base
}
func (e *Effect915Sub) OnSkill() bool {
if len(e.Args()) < 3 {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 911, &Effect911{})
input.InitEffect(input.EffectType.Skill, 912, &Effect912{})
input.InitEffect(input.EffectType.Skill, 913, &Effect913{})
input.InitEffect(input.EffectType.Sub, 913, &Effect913Sub{})
input.InitEffect(input.EffectType.Skill, 914, &Effect914{})
input.InitEffect(input.EffectType.Sub, 914, &Effect914Sub{})
input.InitEffect(input.EffectType.Skill, 915, &Effect915{})
input.InitEffect(input.EffectType.Sub, 915, &Effect915Sub{})
}

View File

@@ -356,6 +356,11 @@ var effectInfoByID = map[int]string{
606: "若体力{0}对手,技能威力翻倍",
607: "{0}回合内若{1}使用属性技能则{2}的{3}",
608: "若对手体力低于1/2该技能先制额外+1",
615: "{0}回合内使用技能恢复{1}点体力体力低于1/{2}时恢复至满",
616: "当自身血量少于1/3时先制+2",
617: "消耗自身所有体力给对手造成{0}-{1}点伤害,若造成伤害大于对手体力则对手必定留1点血",
618: "消耗自身所有体力,使下一只出战精灵{0}回合内每回合恢复{1}点体力",
619: "下{0}回合令对手所有技能先制-{1}",
612: "{0}%概率攻击{1}次",
614: "{0}回合内若对手使用攻击技能则对手{1}",
668: "若对手处于能力提升状态则先制额外+1",
@@ -365,6 +370,11 @@ var effectInfoByID = map[int]string{
672: "当回合击败对手则恢复自身全部体力",
139: "50%威力301-350、30%威力101-300,20%威力5-100",
620: "{0}回合内致命一击率上升{1}/16",
621: "消除对手能力上升状态,消除成功对手{0}{1}",
622: "自身{0}{6}%概率强化效果翻倍",
623: "消除自身能力下降状态,消除成功下{0}回合自身直接攻击必定暴击",
624: "消除对手能力上升状态,消除成功{0}回合内受到伤害减少{1}点",
625: "使对手{0},若对手处于弱化状态,弱化效果翻倍",
626: "随机使自己{0}项能力+{1}",
627: "对手处于能力提升状态时附加其{0}值{1}%的百分比伤害",
628: "若对手处于能力下降状态则造成伤害的{0}%恢复体力",
@@ -431,12 +441,22 @@ var effectInfoByID = map[int]string{
868: "消除对手能力提升状态,消除成功则令对手下回合所有技能先制-{0}",
869: "附加自身速度{0}%的百分比伤害,每次触发增加{1}%,最高{2}%",
870: "吸取对手{0}点体力",
911: "全属性+{0},自身处于能力提升状态时强化效果翻倍",
912: "若对手处于能力下降则使对手随机{0}个技能的PP归零",
913: "消除对手回合类效果,消除成功则下回合自身造成的攻击伤害额外提升{0}%",
914: "若对手处于{0}状态则{1}回合内{2}%令对手使用的技能无效",
915: "消除对手回合类效果,消除成功则自身下{0}回合攻击有{1}%使对手{2}",
851: "使对手随机进入害怕、失明、烧伤、冻伤、中毒其中{0}种异常状态",
852: "附加自身最大体力{0}%的百分比伤害并恢复等量体力恢复体力时若自身体力低于最大体力的1/{1}则恢复效果和百分比伤害翻倍",
853: "附加自身最大体力值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%",
854: "令对手下1次使用的威力高于{0}的攻击技能无效",
855: "将下次受到的伤害{0}%反馈给对手",
690: "下{0}回合,能力提升状态消失则对手使用属性技能失效",
769: "若对手不处于异常状态则造成的攻击伤害额外提升{0}%",
770: "若对手处于异常状态,则恢复自身全部体力",
771: "{0}回合内每次使用攻击技能都有{1}%概率使对手进入任意一种异常状态",
772: "{0}回合内若对手使用攻击技能则有{1}%概率随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态",
773: "若自身体力低于对手则与对手互换体力",
776: "下{0}回合自身造成的攻击伤害翻倍",
1016: "造成的伤害不足{0}则下{1}次攻击造成的伤害提高{2}%",
1017: "消耗自身所有护盾值,造成等量固定伤害",
@@ -454,6 +474,11 @@ var effectInfoByID = map[int]string{
1029: "造成的伤害低于{0}则下{1}回合自身先制+{2}",
1030: "将自身能力下降状态反馈给对手,反馈成功则对手{0}",
1044: "吸取对手能力提升状态,吸取成功则下{0}回合造成的伤害翻倍",
1047: "{0}%令对手{1}未触发则吸取对手最大体力的1/{2}",
1048: "若对手处于异常状态则自身造成的攻击伤害额外提升{0}%",
1049: "击败对手则自身全属性+{0}",
1050: "未击败对手则下{0}回合攻击使对手{1}%{2}",
1051: "对手体力高于{0}则将对手体力减少到{1}",
1097: "造成的攻击伤害若低于280则令对手疲惫未击败对手则令对手下1回合使用的攻击技能无效;技能结束后对手体力值高于0则50%进行一次额外行动以触发星皇之怒星皇之怒50%令对手失明未触发则2回合内令对手使用的属性技能无效",
1098: "致命一击率提升20%每次使用增加20%最高100%打出致命一击后令自身下2次技能触发的星皇之怒威力不再减少;技能结束后对手体力值高于0则50%进行一次额外行动以触发星皇之怒星皇之怒下2次自身使用的攻击技能先制+2",
1099: "消除对手能力提升状态,消除成功则自身免疫下{0}次受到的异常状态",
@@ -470,7 +495,117 @@ var effectInfoByID = map[int]string{
1110: "反转对手能力提升状态,反转成功则令对手下{0}次属性技能失效,反转失败则消除对手能力提升状态",
1111: "{0}%令对手{1},未触发则{2}回合内自身造成的攻击伤害额外提升{3}%",
1146: "双方每处于{0}种能力提升状态则附加{1}点固定伤害",
1213: "{0}回合内每回合使用技能附加对手最大体力1/{1}的百分比伤害",
1214: "对手处于异常状态则吸取对手{0}点体力",
1215: "消除对手所有护盾效果,消除成功则使对手全属性-{0},自身体力低于对手时弱化效果翻倍",
1216: "反转对手能力提升状态反转成功则恢复自身所有体力和PP值",
1217: "消除对手能力提升状态,消除成功则对手下{0}次攻击技能无效",
1218: "未击败对手则下{0}回合自身先制+{1}",
1219: "消除对手回合类效果,消除成功则下回合受到的伤害转化为自身体力",
1220: "消除对手能力提升状态,消除成功则下{0}回合自身攻击必定致命一击",
1221: "反转自身能力下降状态,反转成功则自身免疫下{0}次受到的异常状态",
1222: "先出手时使对手随机{0}个技能PP值归零",
1223: "造成的攻击伤害若高于{0}则令自身下{1}回合所有技能先制+{2}",
1224: "消除对手回合类效果,消除成功则使自身下{0}回合必定致命一击",
1225: "对手处于能力下降时吸取对手最大体力的1/{0}",
1226: "{0}回合内受到攻击伤害降低{1}点,回合结束时若当回合未受到攻击伤害则吸取对手{2}点体力",
1227: "自身处于能力提升状态则有{0}%概率使对手{1},先出手时概率翻倍",
1228: "{0}回合内对手使用攻击技能则随机进入{1}种异常状态,未触发则消除对手回合类效果",
1229: "自身体力高于对手时附加自身当前体力1/{0}的百分比伤害",
1230: "自身体力低于对手时,下{0}次自身技能先制+{1}",
1231: "{0}%令对手{1}未触发则附加对手最大体力1/{2}的百分比伤害",
1232: "反转自身能力下降状态,反转成功则附加给对手等同的能力下降状态",
1233: "吸取对手最大体力的{0}%,每次使用增加{1}%,最高{2}%",
1234: "消除对手回合类效果,消除成功则对手全属性-{0}",
1235: "{0}回合内每回合{1}%闪避对手攻击,未触发则使对手随机{2}项技能PP值归零",
1236: "{0}回合内若对手使用攻击技能则造成伤害前附加对手最大体力1/{1}的百分比伤害",
1237: "使双方精灵所有技能PP值归零消除双方能力提升、下降状态以及回合类效果",
1238: "全属性+{0},对手不为{1}系时强化效果翻倍",
1239: "恢复自身最大体力的1/{0}自身体力低于1/{1}时造成等量百分比伤害",
1240: "当回合未击败对手则下{0}次自身技能附加自身最大体力1/{1}的百分比伤害",
1241: "吸取对手{0}点固定体力自身体力低于1/{1}时吸取效果翻倍",
1242: "{0}%的概率伤害为{1}倍,未触发则下次翻倍概率额外提升{2}%且伤害提升变为{3}倍",
1243: "对手处于能力下降状态时先制+1",
1244: "随机附加{0}-{1}点固伤,对手处于能力下降状态时固伤变为{2}-{3}点",
1245: "若自身处于能力提升状态则附加给对手等同于自身能力提升状态的能力下降状态,若未满足或未触发则令对手随机{0}项技能PP值归零",
1246: "消除双方能力提升、下降状态,消除任意一方成功则令对手下{0}次使用的攻击技能无效",
1247: "先出手时使对手当回合内无法通过技能恢复自身体力",
1393: "{0}回合内每回合使用技能则造成伤害前令对手防御-{1}、速度-{2}未触发则附加对手最大体力1/{3}的百分比伤害",
1394: "{0}回合内对手使用属性技能则随机进入{1}种异常状态",
1395: "若先出手则必定打出致命一击",
1396: "{0}回合内每回合吸取对手最大体力的1/{1}自身体力低于最大体力的1/{2}时转变为吸取对手最大体力的1/{3}",
1397: "全属性+{0}自身体力低于1/{1}时强化效果翻倍",
1398: "消除对手能力提升状态,消除成功则{0}%令对手{1},未触发则{2}%令对手{3}",
1399: "消除对手回合类效果,消除成功则对手{0},未触发则自身免疫下{1}次受到的异常状态",
1400: "{0}回合内若自身回合类效果被消除则{1}%令对手{2}",
1401: "后出手时{0}%令对手对手{1},未触发则使自身下{2}回合必定致命一击",
1402: "技能威力提升1点不受其他威力提升/下降效果加成",
1403: "技能威力提升4点不受其他威力提升/下降效果加成",
1404: "技能威力提升7点不受其他威力提升/下降效果加成",
1405: "技能威力提升10点不受其他威力提升/下降效果加成",
1406: "技能威力提升14点不受其他威力提升/下降效果加成",
1407: "技能威力提升17点不受其他威力提升/下降效果加成",
1408: "技能威力提升20点不受其他威力提升/下降效果加成",
1409: "技能威力提升24点不受其他威力提升/下降效果加成",
1410: "技能威力提升27点不受其他威力提升/下降效果加成",
1411: "技能威力提升30点不受其他威力提升/下降效果加成",
1412: "自身体力低于300时必定先手",
1498: "随机附加烧伤,冻伤,失明,失神中的{0}种异常状态,未触发则自身下{1}回合造成的伤害提升{2}%",
1499: "体力低于最大体力的1/3时先制+3",
1500: "1回合做{0}-{1}次攻击,自身处于护盾状态下连击上限为{2}",
1501: "命中后为对手种下一颗黑暗之种黑暗之种经过4回合逐渐成长每回合结束使对手随机1个技能PP值-1长大后使对手所有技能PP值-1",
1502: "对手身上存在黑暗之种时先制+1",
1503: "清除对手身上的黑暗之种清除成功则令对手随机受到1-500点固定伤害",
1504: "40%令对手诅咒,若对手身上存在黑暗之种则概率翻倍",
1505: "黑暗之种成长期时附加200点固定伤害黑暗之种长大后固定伤害翻倍",
1506: "若对手不是龙系精灵则恢复自身{0}点体力",
1507: "{0}回合内自身受到攻击则令对手随机进入{1}种异常状态,未触发则消除对手回合类效果",
1508: "先出手时无视攻击免疫效果",
1509: "令对手全属性-{0}且随机{1}个技能PP值归零技能无效时消耗自身全部体力并令对手全属性-1然后对手下3次使用技能消耗的PP值为3倍",
1510: "{0}回合内对手主动切换精灵则登场精灵{1}%随机进入{2}种异常状态",
1511: "先出手时免疫当回合受到的攻击伤害,若对手为自身天敌则免疫并反弹给对手造成伤害值{0}%的百分比伤害",
1512: "集结天幕四龙之神力使自身下2回合先制+3且攻击必定命中、必定致命",
1553: "自身体力高于最大体力的1/{0}时攻击后附加造成伤害值{1}%的百分比伤害",
1554: "若自身当前体力低于最大体力的1/{0}则令自身{1}且免疫下{2}次受到的攻击",
1555: "对手不处于能力提升时令对手所有技能PP值-{0}",
1556: "{0}回合内每回合{1}%闪避对手攻击,未触发则使对手全属性-{2}",
1557: "本回合未打出致命一击则令对手随机{0}个技能PP值归零",
1558: "下{0}回合若打出致命一击则造成的攻击伤害提升{1}%",
1559: "{0}回合内自身释放技能{1}%不消耗PP值",
1560: "将当回合护盾所承受的伤害值以百分比伤害的形式{0}%反弹给对手,若护盾未承受伤害值则使对手随机的{1}个技能PP值归零",
1561: "获得点数等同于双方最大体力差值的护盾,最高{0}点,护盾被击破时自身下{1}次使用的攻击技能附加与双方最大体力差护盾值相同的威力",
1562: "命中后{0}%令对手{1},触发后{2}回合内对手主动切换精灵则登场精灵{3}%进入{4}状态",
1563: "损失自身{0}点体力,给对手造成{1}点固定伤害,若自身体力不足{2}则损失全部体力且造成的固定伤害翻倍",
1564: "恢复自身{0}点体力,若自身满天赋值则{1}%附加等量百分比伤害",
1565: "{0}回合内每回合结束时使对手随机{1}个技能PP归零",
1566: "{0}回合内每回合结束后反转对手能力提升状态",
1567: "获得海洋的祝福使自身下2回合先制+2且攻击必定命中、必定致命",
1605: "{0}%令对手{1}",
1670: "{0}%令对手{1},对手为自身天敌时概率提升{2}%,未触发则消除对手回合类效果",
1671: "造成的攻击伤害不低于{0},若对手处于能力提升状态则造成的攻击伤害不低于{1}",
1672: "出手时若自身未满体力则吸取对手{0}点体力",
1673: "命中后{0}%的概率秒杀对手,未触发则造成的伤害不少于{1}",
1674: "{0}回合内每回合使用技能吸取对手最大体力的1/{1},若对手未受到百分比伤害则额外附加{2}点真实伤害",
1675: "反转对手能力提升状态,反转成功则对手{0}回合内无法通过自身技能恢复体力",
1676: "{0}回合内每回合使用技能{1}%令对手{2},未触发则令自身全属性+{3}",
1677: "附加给自身{0}点固定伤害致死时令自身残留1点体力附加给对手{1}点固定伤害,令自身下{2}次受到的攻击伤害转化为体力",
1678: "附加自身防御和特防能力提升总段数x{0}的固定伤害",
1679: "造成的伤害高于{0}则{1}%令对手{2}未触发则吸取对手最大体力的1/{3}",
1680: "对手不处于异常状态时附加{0}点真实伤害",
1681: "吸取对手能力提升状态,吸取成功则下{0}次受到的攻击伤害减少{1}点",
1682: "{0}%的概率伤害为{1}倍,未触发则令敌我双方全属性-{2}且下次翻倍概率额外提升{3}%",
1683: "{0}回合内自身的能力提升状态无法被消除或吸取",
1684: "{0}回合内对手的能力下降状态无法被解除或反转",
1685: "1回合做{0}-{1}次攻击,对手处于异常状态时连击上限为{2}",
1686: "先出手时造成的攻击伤害提升{0}%,若对手当前体力值高于自身则伤害额外提升{1}%",
1687: "{0}回合内免疫并反弹所有受到的控制类异常状态",
1688: "消除敌我双方能力提升状态和回合类效果消除任意一项成功则吸取对手最大体力的1/{0}且{1}%令对手{2}",
1689: "本回合未打出致命一击则恢复自己所有技能{0}点PP值并降低对手所有技能{1}点PP值",
1690: "火之力量觉醒,使自身下{0}次攻击获得灼心之焰效果",
1691: "终阶源盾下{0}次被激活或被消耗则回合结束时附加{1}点固定伤害",
1692: "{0}%的概率造成伤害翻倍,终阶源盾处于激活状态时概率提升至{1}%",
1693: "{0}回合内每回合使用技能附加对手最大体力1/{1}的百分比伤害,对手免疫百分比伤害时额外附加{2}点真实伤害",
1694: "随机吸取对手{0}-{1}点体力,若自身处于能力提升状态则效果转变为{2}-{3}点",
}
func EffectInfo(id int) string {

View File

@@ -47,15 +47,36 @@ func (our *Input) CalculateCrit(opp *Input, skill *info.SkillEntity) {
// 恢复血量
func (our *Input) Heal(in *Input, ac action.BattleActionI, value alpacadecimal.Decimal) {
healValue := int(value.IntPart())
if ac != nil {
if _, ok := ac.(*action.UseItemAction); !ok {
our.Exec(func(t Effect) bool {
t.Heal_Pre(ac, &healValue)
return true
})
}
}
//使用道具回血
if _, ok := ac.(*action.UseItemAction); !ok &&
ac != nil &&
in == our {
our.AttackValue.GainHp += int32(value.IntPart()) //道具有专门的回血包
in == our &&
healValue > 0 {
our.AttackValue.GainHp += int32(healValue) //道具有专门的回血包
}
our.CurrentPet.Info.ModelHP(value.IntPart())
if healValue >= 0 {
our.CurrentPet.Info.ModelHP(int64(healValue))
return
}
damage := uint32(-healValue)
if damage >= our.CurrentPet.Info.Hp {
our.CurrentPet.Info.Hp = 0
return
}
our.CurrentPet.Info.Hp -= damage
}
func (our *Input) HealPP(value int) {

View File

@@ -2,6 +2,10 @@ package input
import "github.com/alpacahq/alpacadecimal"
type shieldChangeEffect interface {
ShieldChange(before, after alpacadecimal.Decimal) bool
}
func (our *Input) CurrentShield() alpacadecimal.Decimal {
if our == nil || our.CurrentPet == nil {
return alpacadecimal.Zero
@@ -20,7 +24,9 @@ func (our *Input) AddShield(value alpacadecimal.Decimal) bool {
if value.Cmp(alpacadecimal.Zero) <= 0 {
return false
}
before := our.CurrentPet.Shield
our.CurrentPet.Shield = our.CurrentPet.Shield.Add(value)
our.notifyShieldChange(before, our.CurrentPet.Shield)
return true
}
@@ -32,11 +38,13 @@ func (our *Input) AbsorbShieldDamage(damage alpacadecimal.Decimal) alpacadecimal
return alpacadecimal.Zero
}
before := our.CurrentPet.Shield
absorbed := alpacadecimal.Min(our.CurrentPet.Shield, damage)
our.CurrentPet.Shield = our.CurrentPet.Shield.Sub(absorbed)
if our.CurrentPet.Shield.Cmp(alpacadecimal.Zero) < 0 {
our.CurrentPet.Shield = alpacadecimal.Zero
}
our.notifyShieldChange(before, our.CurrentPet.Shield)
return absorbed
}
@@ -45,7 +53,29 @@ func (our *Input) ConsumeAllShield() alpacadecimal.Decimal {
return alpacadecimal.Zero
}
before := our.CurrentPet.Shield
value := our.CurrentPet.Shield
our.CurrentPet.Shield = alpacadecimal.Zero
our.notifyShieldChange(before, our.CurrentPet.Shield)
return value
}
func (our *Input) notifyShieldChange(before, after alpacadecimal.Decimal) {
if our == nil || before.Cmp(after) == 0 {
return
}
for _, effect := range our.Effects {
if effect == nil || !effect.Alive() {
continue
}
hook, ok := effect.(shieldChangeEffect)
if !ok {
continue
}
effect.Ctx().Our = our
effect.Ctx().Opp = our.Opp
hook.ShieldChange(before, after)
}
}

View File

@@ -380,12 +380,6 @@ func (f *FightC) handleItemAction(a *action.UseItemAction) {
}
case gconv.Int(item.HP) != 0:
addhp := item.HP
f.GetInputByAction(a, false).Exec(func(rr input.Effect) bool {
rr.Heal_Pre(a, &addhp)
return true
})
f.GetInputByAction(a, false).Heal(f.GetInputByAction(a, false), a, alpacadecimal.NewFromInt(int64(addhp)))
f.Broadcast(func(ff *input.Input) {
ff.Player.SendPackCmd(2406, &info.UsePetIteminfo{