894 lines
23 KiB
Go
894 lines
23 KiB
Go
package effect
|
|
|
|
import (
|
|
element "blazing/common/data/Element"
|
|
"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"
|
|
)
|
|
|
|
const effect2211LockCap = 3
|
|
|
|
func clearOwnStatusEffects(target *input.Input) bool {
|
|
if target == nil {
|
|
return false
|
|
}
|
|
cleared := false
|
|
for _, eff := range target.Effects {
|
|
if eff == nil || !eff.Alive() || eff.ID().GetEffectType() != input.EffectType.Status {
|
|
continue
|
|
}
|
|
eff.Alive(false)
|
|
cleared = true
|
|
}
|
|
return cleared
|
|
}
|
|
|
|
func tryAddStatusByID(owner, target *input.Input, statusID int) bool {
|
|
if owner == nil || target == nil {
|
|
return false
|
|
}
|
|
|
|
existing := target.GetEffect(input.EffectType.Status, statusID)
|
|
beforeStack := 0
|
|
beforeDuration := 0
|
|
if existing != nil && existing.Alive() {
|
|
beforeStack = existing.Stack()
|
|
beforeDuration = existing.Duration()
|
|
}
|
|
|
|
eff := owner.InitEffect(input.EffectType.Status, statusID)
|
|
if eff == nil {
|
|
return false
|
|
}
|
|
target.AddEffect(owner, eff)
|
|
|
|
after := target.GetEffect(input.EffectType.Status, statusID)
|
|
if after == nil || !after.Alive() {
|
|
return false
|
|
}
|
|
if existing == nil || !existing.Alive() {
|
|
return true
|
|
}
|
|
return after.Stack() > beforeStack || after.Duration() > beforeDuration
|
|
}
|
|
|
|
func countLightDarkSkills(target *input.Input) (light, dark int) {
|
|
if target == nil || target.CurPet[0] == nil {
|
|
return 0, 0
|
|
}
|
|
for _, skillInfo := range target.CurPet[0].Info.SkillList {
|
|
skill, ok := xmlres.SkillMap[int(skillInfo.ID)]
|
|
if !ok {
|
|
continue
|
|
}
|
|
switch skill.Type {
|
|
case int(element.ElementTypeLight):
|
|
light++
|
|
case int(element.ElementTypeDark):
|
|
dark++
|
|
}
|
|
}
|
|
return light, dark
|
|
}
|
|
|
|
func currentNewSelEffect(our *input.Input, id int) bool {
|
|
if our == nil || our.CurPet[0] == nil {
|
|
return false
|
|
}
|
|
eff := our.GetEffect(input.EffectType.NewSel, id)
|
|
if eff == nil || !eff.Alive() {
|
|
return false
|
|
}
|
|
return eff.ID().GetCatchTime() == our.CurPet[0].Info.CatchTime
|
|
}
|
|
|
|
func attackSkillPPCount(target *input.Input) int {
|
|
if target == nil || target.CurPet[0] == nil {
|
|
return 0
|
|
}
|
|
count := 0
|
|
for _, skillInfo := range target.CurPet[0].Info.SkillList {
|
|
skill, ok := xmlres.SkillMap[int(skillInfo.ID)]
|
|
if !ok || skill.Category == int(info.Category.STATUS) || skillInfo.PP == 0 {
|
|
continue
|
|
}
|
|
count++
|
|
}
|
|
return count
|
|
}
|
|
|
|
func zeroRandomAttackSkillPP(target *input.Input, count int) int {
|
|
if target == nil || target.CurPet[0] == nil || count <= 0 {
|
|
return 0
|
|
}
|
|
|
|
zeroed := 0
|
|
for zeroed < count {
|
|
candidates := make([]int, 0, len(target.CurPet[0].Info.SkillList))
|
|
for i, skillInfo := range target.CurPet[0].Info.SkillList {
|
|
skill, ok := xmlres.SkillMap[int(skillInfo.ID)]
|
|
if !ok || skill.Category == int(info.Category.STATUS) || skillInfo.PP == 0 {
|
|
continue
|
|
}
|
|
candidates = append(candidates, i)
|
|
}
|
|
if len(candidates) == 0 {
|
|
break
|
|
}
|
|
|
|
idx := candidates[grand.Intn(len(candidates))]
|
|
target.CurPet[0].Info.SkillList[idx].PP = 0
|
|
zeroed++
|
|
}
|
|
|
|
return zeroed
|
|
}
|
|
|
|
// Effect 2195: 消除对手回合类效果并降低先制
|
|
type Effect2195 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2195) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
before := activeTurnEffectCount(e.Ctx().Opp)
|
|
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
|
if before <= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 2195, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect2195Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect2195Sub) 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 2196: 概率附加自身效果
|
|
type Effect2196 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2196) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
|
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(e.Args()[1].IntPart()))
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2197: 自身处于护盾时必中
|
|
type Effect2197 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2197) SkillHit_ex() bool {
|
|
if e.Ctx().Our.HasShield() && e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
|
e.Ctx().SkillEntity.SetNoSide()
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2198: 双方任一方护盾时概率附加对手效果
|
|
type Effect2198 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2198) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if !e.Ctx().Our.HasShield() && !e.Ctx().Opp.HasShield() {
|
|
return true
|
|
}
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
|
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2199: 双方任一方护罩时概率附加对手效果
|
|
type Effect2199 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2199) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
if !e.Ctx().Our.HasShield() && !e.Ctx().Opp.HasShield() {
|
|
return true
|
|
}
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
|
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2200: 令双方进入{0},任意一方未触发则额外令对手进入{1}
|
|
type Effect2200 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2200) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
statusID := int(e.Args()[0].IntPart())
|
|
fallbackID := int(e.Args()[1].IntPart())
|
|
ourOK := tryAddStatusByID(e.Ctx().Our, e.Ctx().Our, statusID)
|
|
oppOK := tryAddStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
|
|
if !ourOK || !oppOK {
|
|
tryAddStatusByID(e.Ctx().Our, e.Ctx().Opp, fallbackID)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2201: 属性关系影响总伤害
|
|
type Effect2201 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2201) Skill_Use() bool {
|
|
if len(e.Args()) < 1 || e.Ctx().Our == nil || e.Ctx().Opp == nil {
|
|
return true
|
|
}
|
|
light, dark := countLightDarkSkills(e.Ctx().Our)
|
|
if light == dark {
|
|
return true
|
|
}
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); !ok {
|
|
return true
|
|
}
|
|
statusID := int(info.PetStatus.Fear)
|
|
if light > dark {
|
|
statusID = int(info.PetStatus.Tired)
|
|
}
|
|
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
|
|
return true
|
|
}
|
|
|
|
// Effect 2202: 属性克制时必定致命
|
|
type Effect2202 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2202) Skill_Use() bool {
|
|
if len(e.Args()) < 1 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
light, dark := countLightDarkSkills(e.Ctx().Our)
|
|
// 光暗相等时,吸取与必定暴击都可以同时生效。
|
|
if dark < light {
|
|
return true
|
|
}
|
|
if e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
divisor := e.Args()[0]
|
|
if divisor.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(divisor)
|
|
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
|
|
}
|
|
|
|
func (e *Effect2202) SkillHit() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
light, dark := countLightDarkSkills(e.Ctx().Our)
|
|
if light < dark {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.XML.CritRate = 16
|
|
return true
|
|
}
|
|
|
|
// Effect 2203: 技能无效时免疫下一次攻击
|
|
type Effect2203 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2203) Skill_Use_ex() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime != 0 {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2203)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect2203Sub struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2203Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
}
|
|
|
|
func (e *Effect2203Sub) SkillHit_ex() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.SetNoSide()
|
|
e.Ctx().SkillEntity.AttackTime = 0
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
// Effect 2204: 技能威力降低,异常时转为提升
|
|
type Effect2204 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2204) SkillHit() bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
power := e.Ctx().SkillEntity.XML.Power
|
|
if e.Ctx().Opp.StatEffect_Exist_all() {
|
|
power += power * int(e.Args()[1].IntPart()) / 100
|
|
} else {
|
|
power -= power * int(e.Args()[0].IntPart()) / 100
|
|
if power < 0 {
|
|
power = 0
|
|
}
|
|
}
|
|
e.Ctx().SkillEntity.XML.Power = power
|
|
return true
|
|
}
|
|
|
|
// Effect 2205: 自身异常时克制倍率取最大值
|
|
type Effect2205 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2205) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || !e.Ctx().Our.StatEffect_Exist_all() {
|
|
return true
|
|
}
|
|
if e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
attackMul, err := element.Calculator.GetOffensiveMultiplier(e.Ctx().SkillEntity.GetType().ID, e.Ctx().Opp.CurPet[0].GetType().ID)
|
|
if err != nil || attackMul <= 0 {
|
|
return true
|
|
}
|
|
counterMul, err := element.Calculator.GetOffensiveMultiplier(e.Ctx().Opp.CurPet[0].GetType().ID, e.Ctx().Our.CurPet[0].GetType().ID)
|
|
if err != nil || counterMul <= 0 || counterMul <= attackMul {
|
|
return true
|
|
}
|
|
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromFloat(counterMul / attackMul))
|
|
return true
|
|
}
|
|
|
|
// Effect 2206: 自身能力提升被消除则解除异常
|
|
type Effect2206 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2206) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2206, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect2206Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect2206Sub) PropBefer(source *input.Input, prop, level int8) bool {
|
|
if source != e.Ctx().Opp || level != 0 {
|
|
return true
|
|
}
|
|
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) || e.Ctx().Our.Prop[prop] <= 0 {
|
|
return true
|
|
}
|
|
clearOwnStatusEffects(e.Ctx().Our)
|
|
return true
|
|
}
|
|
|
|
// Effect 2207: 剩余异常回合数减少
|
|
type Effect2207 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2207) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().Our == nil {
|
|
return true
|
|
}
|
|
reduce := int(e.Args()[0].IntPart())
|
|
if reduce <= 0 {
|
|
return true
|
|
}
|
|
for _, eff := range e.Ctx().Our.Effects {
|
|
if eff == nil || !eff.Alive() || eff.ID().GetEffectType() != input.EffectType.Status {
|
|
continue
|
|
}
|
|
if eff.Duration() <= 0 {
|
|
continue
|
|
}
|
|
remaining := eff.Duration() - reduce
|
|
if remaining <= 0 {
|
|
eff.Alive(false)
|
|
continue
|
|
}
|
|
eff.Duration(remaining)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2208: 星盘每转动时增威力
|
|
type Effect2208 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2208) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity != nil {
|
|
e.Ctx().SkillEntity.XML.Power += int(e.Args()[0].IntPart())
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2209: 星盘每转动时吸血
|
|
type Effect2209 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2209) OnSkill() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity != nil && e.Ctx().Our.CurPet[0] != nil && e.Ctx().Opp.CurPet[0] != nil {
|
|
drain := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
|
|
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 2210: 星赐/星祸转化
|
|
type Effect2210 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2210) Skill_Use() bool {
|
|
skill := e.Ctx().SkillEntity
|
|
if skill == nil || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
if skill.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
hasStarCui := currentNewSelEffect(e.Ctx().Our, 33)
|
|
hasStarZhe := currentNewSelEffect(e.Ctx().Our, 34)
|
|
if hasStarCui == hasStarZhe {
|
|
return true
|
|
}
|
|
|
|
if hasStarCui {
|
|
skill.XML.Category = int(info.Category.PHYSICAL)
|
|
} else {
|
|
skill.XML.Category = int(info.Category.SPECIAL)
|
|
}
|
|
skill.XML.Type = e.Ctx().Our.CurPet[0].PetInfo.Type
|
|
skill.XML.Power += int(e.Ctx().Our.CurPet[0].Info.Dv)
|
|
return true
|
|
}
|
|
|
|
// Effect 2211: 螺旋之锁
|
|
type Effect2211 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2211) Skill_Use() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
|
|
addLayers := int(e.Args()[0].IntPart())
|
|
if addLayers <= 0 {
|
|
return true
|
|
}
|
|
|
|
lockEffect := e.Ctx().Opp.GetEffect(input.EffectType.Sub, 2211)
|
|
if lockSub, ok := lockEffect.(*Effect2211Sub); ok && lockSub != nil {
|
|
nextStack := lockSub.Stack() + addLayers
|
|
if nextStack > effect2211LockCap {
|
|
nextStack = effect2211LockCap
|
|
if lockSub.overflowTurns < int(e.Args()[1].IntPart()) {
|
|
lockSub.overflowTurns = int(e.Args()[1].IntPart())
|
|
}
|
|
lockSub.priorityDown = int(e.Args()[2].IntPart())
|
|
}
|
|
lockSub.Stack(nextStack)
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 2211, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
lockSub, ok := sub.(*Effect2211Sub)
|
|
if !ok || lockSub == nil {
|
|
return true
|
|
}
|
|
lockSub.CanStack(true)
|
|
lockSub.Duration(-1)
|
|
lockSub.Stack(addLayers)
|
|
if lockSub.Stack() > effect2211LockCap {
|
|
lockSub.Stack(effect2211LockCap)
|
|
lockSub.overflowTurns = int(e.Args()[1].IntPart())
|
|
lockSub.priorityDown = int(e.Args()[2].IntPart())
|
|
}
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, lockSub)
|
|
return true
|
|
}
|
|
|
|
type Effect2211Sub struct {
|
|
node.EffectNode
|
|
overflowTurns int
|
|
priorityDown int
|
|
}
|
|
|
|
func (e *Effect2211Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
if e.overflowTurns <= 0 || e.priorityDown <= 0 {
|
|
return true
|
|
}
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Opp.UserID)
|
|
if current != nil && current.SkillEntity != nil && current.SkillEntity.Category() != info.Category.STATUS {
|
|
current.SkillEntity.XML.Priority -= e.priorityDown
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect2211Sub) TurnEnd() {
|
|
if e.overflowTurns > 0 {
|
|
e.overflowTurns--
|
|
}
|
|
}
|
|
|
|
// Effect 2212: 威力不高于阈值时使对手行动失效
|
|
type Effect2212 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2212) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 2212, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect2212Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect2212Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
skill := e.Ctx().SkillEntity
|
|
if skill == nil || len(e.Args()) < 3 || skill.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
if skill.XML.Power > int(e.Args()[1].IntPart()) {
|
|
return false
|
|
}
|
|
|
|
statusEffect := e.Ctx().Opp.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
|
|
if statusEffect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2213: 消耗体力时给后排护盾
|
|
type Effect2213 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2213) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
|
|
currentHP := e.Ctx().Our.CurPet[0].GetHP()
|
|
if currentHP.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
shield := currentHP.Mul(e.Args()[0]).Div(hundred)
|
|
if shield.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: currentHP,
|
|
})
|
|
|
|
if carry, ok := e.Ctx().Our.GetEffect(input.EffectType.Sub, 2213).(*Effect2213Sub); ok && carry != nil {
|
|
carry.shield = carry.shield.Add(shield)
|
|
carry.granted = false
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2213)
|
|
carry, ok := sub.(*Effect2213Sub)
|
|
if !ok || carry == nil {
|
|
return true
|
|
}
|
|
carry.Duration(-1)
|
|
carry.shield = shield
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, carry)
|
|
return true
|
|
}
|
|
|
|
type Effect2213Sub struct {
|
|
node.EffectNode
|
|
shield alpacadecimal.Decimal
|
|
granted bool
|
|
}
|
|
|
|
func (e *Effect2213Sub) SwitchIn(in *input.Input) bool {
|
|
if in != e.Ctx().Our || e.granted || e.shield.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
e.granted = true
|
|
e.Ctx().Our.AddShield(e.shield)
|
|
return true
|
|
}
|
|
|
|
// Effect 2214: 螺旋之锁下PP归零
|
|
type Effect2214 struct {
|
|
node.EffectNode
|
|
boost bool
|
|
}
|
|
|
|
func (e *Effect2214) Skill_Use() bool {
|
|
e.boost = false
|
|
if len(e.Args()) < 1 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
|
|
lockEffect := e.Ctx().Opp.GetEffect(input.EffectType.Sub, 2211)
|
|
lockSub, ok := lockEffect.(*Effect2211Sub)
|
|
if !ok || lockSub == nil || lockSub.Stack() <= 0 {
|
|
return true
|
|
}
|
|
|
|
if attackSkillPPCount(e.Ctx().Opp) < lockSub.Stack() {
|
|
e.boost = true
|
|
}
|
|
zeroRandomAttackSkillPP(e.Ctx().Opp, lockSub.Stack())
|
|
return true
|
|
}
|
|
|
|
func (e *Effect2214) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || !e.boost || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
|
e.boost = false
|
|
return true
|
|
}
|
|
|
|
// Effect 2215: 每消耗PP提升威力
|
|
type Effect2215 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2215) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 || e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
skill, ok := xmlres.SkillMap[int(e.Ctx().SkillEntity.Info.ID)]
|
|
if !ok || skill.MaxPP <= 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
lostPercent := int64(skill.MaxPP-int(e.Ctx().SkillEntity.Info.PP)) * 100 / int64(skill.MaxPP)
|
|
step := int64(e.Args()[0].IntPart())
|
|
if step <= 0 {
|
|
return true
|
|
}
|
|
tiers := lostPercent / step
|
|
if tiers <= 0 {
|
|
return true
|
|
}
|
|
bonus := alpacadecimal.NewFromInt(100 + tiers*step)
|
|
zone.Damage = zone.Damage.Mul(bonus).Div(hundred)
|
|
return true
|
|
}
|
|
|
|
// Effect 2216: 致命一击时提升威力
|
|
type Effect2216 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2216) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Crit != 0 {
|
|
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[0])).Div(hundred)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 2217: 残缺文案占位
|
|
type Effect2217 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2217) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
e.Ctx().Opp.DelPP(int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 2218: 附加回合效果并在特定状态下变换类型
|
|
type Effect2218 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2218) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
|
|
targetType := int(e.Args()[1].IntPart())
|
|
if e.Ctx().Our.CurPet[0].PetInfo.Type == targetType {
|
|
for i := 0; i < 6; i++ {
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(e.Args()[2].IntPart()))
|
|
}
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 2218, int(e.Args()[0].IntPart()), targetType)
|
|
if sub != nil {
|
|
e.Ctx().Our.CurPet[0].PetInfo.Type = targetType
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect2218Sub struct {
|
|
node.EffectNode
|
|
oldType int
|
|
targetType int
|
|
}
|
|
|
|
func (e *Effect2218Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
if e.Ctx() != nil && e.Ctx().Our != nil && e.Ctx().Our.CurPet[0] != nil {
|
|
e.oldType = e.Ctx().Our.CurPet[0].PetInfo.Type
|
|
}
|
|
if len(a) > 0 {
|
|
e.Duration(a[0])
|
|
}
|
|
if len(a) > 1 {
|
|
e.targetType = a[1]
|
|
}
|
|
}
|
|
|
|
func (e *Effect2218Sub) Alive(t ...bool) bool {
|
|
if len(t) > 0 && !t[0] && e.Ctx() != nil && e.Ctx().Our != nil && e.Ctx().Our.CurPet[0] != nil && e.Ctx().Our.CurPet[0].PetInfo.Type == e.targetType {
|
|
e.Ctx().Our.CurPet[0].PetInfo.Type = e.oldType
|
|
}
|
|
return e.EffectNode.Alive(t...)
|
|
}
|
|
|
|
// Effect 2219: 光辉能量提升至体力比例
|
|
type Effect2219 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect2219) Skill_Use() bool {
|
|
if len(e.Args()) == 0 || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
target := int(e.Ctx().Our.CurPet[0].Info.MaxHp) * int(e.Args()[0].IntPart()) / 100
|
|
current := e.Ctx().Our.CurrentDivineEnergy()
|
|
if target <= current {
|
|
return true
|
|
}
|
|
e.Ctx().Our.AddDivineEnergy(target - current)
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 2195, &Effect2195{})
|
|
input.InitEffect(input.EffectType.Sub, 2195, &Effect2195Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 2196, &Effect2196{})
|
|
input.InitEffect(input.EffectType.Skill, 2197, &Effect2197{})
|
|
input.InitEffect(input.EffectType.Skill, 2198, &Effect2198{})
|
|
input.InitEffect(input.EffectType.Skill, 2199, &Effect2199{})
|
|
input.InitEffect(input.EffectType.Skill, 2200, &Effect2200{})
|
|
input.InitEffect(input.EffectType.Skill, 2201, &Effect2201{})
|
|
input.InitEffect(input.EffectType.Skill, 2202, &Effect2202{})
|
|
input.InitEffect(input.EffectType.Skill, 2203, &Effect2203{})
|
|
input.InitEffect(input.EffectType.Sub, 2203, &Effect2203Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 2204, &Effect2204{})
|
|
input.InitEffect(input.EffectType.Skill, 2205, &Effect2205{})
|
|
input.InitEffect(input.EffectType.Skill, 2206, &Effect2206{})
|
|
input.InitEffect(input.EffectType.Sub, 2206, &Effect2206Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 2207, &Effect2207{})
|
|
input.InitEffect(input.EffectType.Skill, 2208, &Effect2208{})
|
|
input.InitEffect(input.EffectType.Skill, 2209, &Effect2209{})
|
|
input.InitEffect(input.EffectType.Skill, 2210, &Effect2210{})
|
|
input.InitEffect(input.EffectType.Skill, 2211, &Effect2211{})
|
|
input.InitEffect(input.EffectType.Sub, 2211, &Effect2211Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 2212, &Effect2212{})
|
|
input.InitEffect(input.EffectType.Sub, 2212, &Effect2212Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 2213, &Effect2213{})
|
|
input.InitEffect(input.EffectType.Sub, 2213, &Effect2213Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 2214, &Effect2214{})
|
|
input.InitEffect(input.EffectType.Skill, 2215, &Effect2215{})
|
|
input.InitEffect(input.EffectType.Skill, 2216, &Effect2216{})
|
|
input.InitEffect(input.EffectType.Skill, 2217, &Effect2217{})
|
|
input.InitEffect(input.EffectType.Skill, 2218, &Effect2218{})
|
|
input.InitEffect(input.EffectType.Sub, 2218, &Effect2218Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 2219, &Effect2219{})
|
|
_ = grand.Intn(1)
|
|
_ = alpacadecimal.Zero
|
|
}
|