433 lines
12 KiB
Go
433 lines
12 KiB
Go
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"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
"github.com/gogf/gf/v2/util/grand"
|
||
)
|
||
|
||
func totalLostPP2045(in *input.Input) int64 {
|
||
if in == nil || in.CurPet[0] == nil {
|
||
return 0
|
||
}
|
||
total := int64(0)
|
||
for _, s := range in.CurPet[0].Info.SkillList {
|
||
if skill, ok := xmlres.SkillMap[int(s.ID)]; ok {
|
||
total += int64(skill.MaxPP) - int64(s.PP)
|
||
}
|
||
}
|
||
return total
|
||
}
|
||
|
||
// Effect 2045: 未打出致命一击则对手每被施加若干道谙符令自身下次使用的攻击技能先制提升
|
||
type Effect2045 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2045) OnSkill() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2045, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2045Sub struct{ node.EffectNode }
|
||
|
||
func (e *Effect2045Sub) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.XML.Priority += 1
|
||
return true
|
||
}
|
||
|
||
// Effect 2046: 致命一击时恢复自身最大体力的一部分
|
||
type Effect2046 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2046) SkillHit() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Crit == 0 {
|
||
return true
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[1]))
|
||
return true
|
||
}
|
||
|
||
// Effect 2047: 吸取对手能力提升状态
|
||
type Effect2047 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2047) OnSkill() bool {
|
||
if len(e.Args()) < 1 {
|
||
return true
|
||
}
|
||
absorbed := false
|
||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
if v > 0 && e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0) {
|
||
absorbed = true
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), v)
|
||
}
|
||
}
|
||
if absorbed {
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2047, int(e.Args()[0].IntPart()))
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2047Sub struct{ node.EffectNode }
|
||
|
||
func (e *Effect2047Sub) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.SetMiss()
|
||
return true
|
||
}
|
||
|
||
// Effect 2048: 造成伤害若低于阈值则免疫若干次异常,并在达到符数阈值后额外解除对手全部谙符
|
||
type Effect2048 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2048) OnSkill() bool {
|
||
return len(e.Args()) >= 4
|
||
}
|
||
|
||
// Effect 2049: 造成伤害若高于阈值则附加固定伤害,符数达到阈值时把固定伤害转为真实伤害
|
||
type Effect2049 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2049) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if zone.Damage.Cmp(e.Args()[0]) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Args()[1]})
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2050: 对手先制等级在指定阈值时技能无效
|
||
type Effect2050 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2050) SkillHit_ex() bool {
|
||
if e.Ctx().SkillEntity == nil || len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity.XML.Priority == int(e.Args()[1].IntPart()) || e.Ctx().SkillEntity.XML.Priority == int(e.Args()[2].IntPart()) {
|
||
e.Ctx().SkillEntity.SetMiss()
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2051: 命中后附加刻印和痕
|
||
type Effect2051 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2051) OnSkill() bool {
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Status, 2051)
|
||
if eff != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2052: 回合内对手必定命中一击
|
||
type Effect2052 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2052) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
if fattack != nil && fattack.SkillEntity != nil {
|
||
fattack.SkillEntity.XML.CritRate = 16
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2053: 回合结束反弹能力下降
|
||
type Effect2053 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2053) TurnEnd() {
|
||
clearOwnDownProps(e.Ctx().Our)
|
||
}
|
||
|
||
// Effect 2054: 攻击后自身免疫若干次异常
|
||
type Effect2054 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2054) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2054, int(e.Args()[1].IntPart()))
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2054Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2054Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect2054Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
if in != e.Ctx().Our || !input.IS_Stat(effEffect) {
|
||
return true
|
||
}
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return false
|
||
}
|
||
|
||
// Effect 2055: 若对手是天敌则消除对手回合类效果
|
||
type Effect2055 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2055) Skill_Use() bool { return true }
|
||
|
||
// Effect 2056: 击败对手后恢复自身全部体力
|
||
type Effect2056 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2056) OnSkill() bool {
|
||
if e.Ctx().Opp.CurPet[0].GetHP().Cmp(alpacadecimal.Zero) > 0 {
|
||
return true
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP())
|
||
return true
|
||
}
|
||
|
||
// Effect 2057: 自身为天敌时威力翻倍
|
||
type Effect2057 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2057) Damage_Mul(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if !e.ISNaturalEnemy() {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
||
return true
|
||
}
|
||
|
||
// Effect 2058: 自身为天敌则先制
|
||
type Effect2058 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2058) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
if !e.ISNaturalEnemy() {
|
||
return true
|
||
}
|
||
if fattack != nil && fattack.SkillEntity != nil {
|
||
fattack.SkillEntity.XML.Priority += 1
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2059: 自身免疫若干次异常,每次成功吸取对手体力
|
||
type Effect2059 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2059) OnSkill() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2059, int(e.Args()[0].IntPart()))
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2059Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect2059Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect2059Sub) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
if in != e.Ctx().Our || !input.IS_Stat(effEffect) {
|
||
return true
|
||
}
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return false
|
||
}
|
||
|
||
// Effect 2060: 对手使用属性技能时反弹并恢复体力
|
||
type Effect2060 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2060) Skill_Use() bool {
|
||
if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[3])})
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[3]))
|
||
return true
|
||
}
|
||
|
||
// Effect 2061: 随机附加弱化异常
|
||
type Effect2061 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2061) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
statusIDs := []int{
|
||
int(info.PetStatus.Weakened),
|
||
int(info.PetStatus.Paralysis),
|
||
int(info.PetStatus.Fear),
|
||
int(info.PetStatus.Tired),
|
||
}
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusIDs[grand.Intn(len(statusIDs))])
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2062: 消除回合类/能力提升类效果并附加圣诫或邪诫
|
||
type Effect2062 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2062) Skill_Use() bool { return true }
|
||
|
||
// Effect 2063: 切换为圣谒形态
|
||
type Effect2063 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2063) Skill_Use() bool {
|
||
e.Ctx().Our.CurPet[0].PetInfo.Type = 0
|
||
return true
|
||
}
|
||
|
||
// Effect 2064: 切换为邪魇形态
|
||
type Effect2064 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2064) Skill_Use() bool {
|
||
e.Ctx().Our.CurPet[0].PetInfo.Type = 1
|
||
return true
|
||
}
|
||
|
||
// Effect 2065: 圣谕形态下随机清空对手PP,邪魇形态下属性技能无效
|
||
type Effect2065 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2065) Skill_Use() bool {
|
||
if e.Ctx().Our.CurPet[0] == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.CurPet[0].PetInfo.Type == 0 {
|
||
zeroRandomSkillPP(e.Ctx().Opp, 1)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 2066: 尽可能触发湮灭直至对手的圣告/邪诫之一消失
|
||
type Effect2066 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2066) OnSkill() bool { return true }
|
||
|
||
// Effect 2067: 闪避对手攻击,结束后恢复PP和体力
|
||
type Effect2067 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2067) Skill_Use() bool {
|
||
if len(e.Args()) < 4 {
|
||
return true
|
||
}
|
||
eff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2067, e.SideEffectArgs...)
|
||
if eff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, eff)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect2067Sub struct{ node.EffectNode }
|
||
|
||
func (e *Effect2067Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.SetMiss()
|
||
return true
|
||
}
|
||
|
||
func (e *Effect2067Sub) TurnEnd() {
|
||
if len(e.Args()) < 4 {
|
||
e.EffectNode.TurnEnd()
|
||
return
|
||
}
|
||
zeroRandomSkillPP(e.Ctx().Our, int(e.Args()[2].IntPart()))
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[3])
|
||
e.EffectNode.TurnEnd()
|
||
}
|
||
|
||
// Effect 2068: 命中后回合结束消除对手回合类效果
|
||
type Effect2068 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2068) Skill_Use() bool { return true }
|
||
|
||
// Effect 2069: 自身能力提升被消除时失效
|
||
type Effect2069 struct{ node.EffectNode }
|
||
|
||
func (e *Effect2069) PropBefer(in *input.Input, prop, level int8) bool { return true }
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 2045, &Effect2045{})
|
||
input.InitEffect(input.EffectType.Sub, 2045, &Effect2045Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2046, &Effect2046{})
|
||
input.InitEffect(input.EffectType.Skill, 2047, &Effect2047{})
|
||
input.InitEffect(input.EffectType.Sub, 2047, &Effect2047Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2048, &Effect2048{})
|
||
input.InitEffect(input.EffectType.Skill, 2049, &Effect2049{})
|
||
input.InitEffect(input.EffectType.Skill, 2050, &Effect2050{})
|
||
input.InitEffect(input.EffectType.Skill, 2051, &Effect2051{})
|
||
input.InitEffect(input.EffectType.Skill, 2052, &Effect2052{})
|
||
input.InitEffect(input.EffectType.Skill, 2053, &Effect2053{})
|
||
input.InitEffect(input.EffectType.Skill, 2054, &Effect2054{})
|
||
input.InitEffect(input.EffectType.Sub, 2054, &Effect2054Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2055, &Effect2055{})
|
||
input.InitEffect(input.EffectType.Skill, 2056, &Effect2056{})
|
||
input.InitEffect(input.EffectType.Skill, 2057, &Effect2057{})
|
||
input.InitEffect(input.EffectType.Skill, 2058, &Effect2058{})
|
||
input.InitEffect(input.EffectType.Skill, 2059, &Effect2059{})
|
||
input.InitEffect(input.EffectType.Sub, 2059, &Effect2059Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2060, &Effect2060{})
|
||
input.InitEffect(input.EffectType.Skill, 2061, &Effect2061{})
|
||
input.InitEffect(input.EffectType.Skill, 2062, &Effect2062{})
|
||
input.InitEffect(input.EffectType.Skill, 2063, &Effect2063{})
|
||
input.InitEffect(input.EffectType.Skill, 2064, &Effect2064{})
|
||
input.InitEffect(input.EffectType.Skill, 2065, &Effect2065{})
|
||
input.InitEffect(input.EffectType.Skill, 2066, &Effect2066{})
|
||
input.InitEffect(input.EffectType.Skill, 2067, &Effect2067{})
|
||
input.InitEffect(input.EffectType.Sub, 2067, &Effect2067Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 2068, &Effect2068{})
|
||
input.InitEffect(input.EffectType.Skill, 2069, &Effect2069{})
|
||
}
|