220 lines
6.4 KiB
Go
220 lines
6.4 KiB
Go
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 1655: {0}回合内每回合结束后{1}%恢复自身所有技能{2}点PP值
|
||
type Effect1655 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1655) Skill_Use() bool {
|
||
if len(e.Args()) < 3 || e.Ctx().Our == nil {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1655, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1655Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect1655Sub) TurnEnd() {
|
||
if len(e.Args()) >= 3 {
|
||
chance := int(e.Args()[1].IntPart())
|
||
amount := int(e.Args()[2].IntPart())
|
||
if chance > 0 && amount > 0 {
|
||
if ok, _, _ := e.Input.Player.Roll(chance, 100); ok {
|
||
e.Ctx().Our.HealPP(amount)
|
||
}
|
||
}
|
||
}
|
||
e.EffectNode.TurnEnd()
|
||
}
|
||
|
||
// Effect 1656: 100%复制对手当回合释放的技能,若对手当回合使用的技能为攻击技能则令对手随机1个技能PP值归零,若对手当回合使用的技能为属性技能则令对手下回合先制-2
|
||
type Effect1656 struct {
|
||
node.EffectNode
|
||
applied bool
|
||
}
|
||
|
||
func (e *Effect1656) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
if e.applied || e.Ctx().Our == nil || e.Ctx().Opp == nil {
|
||
return true
|
||
}
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
opponent := actionByPlayer(fattack, sattack, e.Ctx().Opp.UserID)
|
||
if current == nil || opponent == nil || opponent.SkillEntity == nil {
|
||
return true
|
||
}
|
||
|
||
clone := cloneSkillEntity(opponent.SkillEntity)
|
||
if clone == nil {
|
||
return true
|
||
}
|
||
current.SkillEntity = clone
|
||
e.applied = true
|
||
|
||
if opponent.SkillEntity.Category() == info.Category.STATUS {
|
||
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1656, 2)
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
} else {
|
||
zeroRandomSkillPP(e.Ctx().Opp, 1)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1656) Action_end() bool {
|
||
e.applied = false
|
||
return true
|
||
}
|
||
|
||
type Effect1656Sub struct {
|
||
FixedDuration1Base
|
||
priority int
|
||
}
|
||
|
||
func (e *Effect1656Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.FixedDuration1Base.SetArgs(t, a...)
|
||
e.CanStack(false)
|
||
if len(a) > 0 {
|
||
e.priority = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect1656Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
if e.priority == 0 {
|
||
return true
|
||
}
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current == nil || current.SkillEntity == nil {
|
||
return true
|
||
}
|
||
current.SkillEntity.XML.Priority -= e.priority
|
||
return true
|
||
}
|
||
|
||
// Effect 1657: 己方每有一只精灵死亡则附加{0}点固定伤害,对手体力高于最大体力的1/{1}时转变为{2}点
|
||
type Effect1657 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1657) Skill_Use() bool {
|
||
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
||
return true
|
||
}
|
||
dead := countPets(e.Ctx().Our, false)
|
||
if dead <= 0 {
|
||
return true
|
||
}
|
||
|
||
perDead := e.Args()[0]
|
||
if e.Args()[1].Cmp(alpacadecimal.Zero) > 0 {
|
||
threshold := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[1])
|
||
if e.Ctx().Opp.CurPet[0].GetHP().Cmp(threshold) > 0 {
|
||
perDead = e.Args()[2]
|
||
}
|
||
}
|
||
|
||
damage := perDead.Mul(alpacadecimal.NewFromInt(int64(dead)))
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1658: 3回合内每回合80%闪避对手攻击,未触发时自身处于圣念状态则使对手随机1项技能PP值归零,自身处于邪念状态则使对手失明
|
||
type Effect1658 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1658) Skill_Use() bool {
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1658, 3, 80)
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1658Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect1658Sub) SkillHit_ex() bool {
|
||
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 || e.Ctx().Opp == nil {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity.AttackTime == 2 {
|
||
return true
|
||
}
|
||
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
||
e.Ctx().SkillEntity.SetMiss()
|
||
return true
|
||
}
|
||
|
||
if e.Ctx().Our.StatEffect_Exist(petStatus2077Holy) {
|
||
zeroRandomSkillPP(e.Ctx().Opp, 1)
|
||
return true
|
||
}
|
||
if e.Ctx().Our.StatEffect_Exist(petStatus2077Evil) {
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.Blind))
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1659: 随机附加给对手{0}-{1}点固定伤害,若打出致命一击则效果转变为吸取对手{2}-{3}点体力
|
||
type Effect1659 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1659) Skill_Use() bool {
|
||
if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 || e.Ctx().Opp == nil {
|
||
return true
|
||
}
|
||
|
||
if e.Ctx().SkillEntity.Crit != 0 {
|
||
minDrain := int(e.Args()[2].IntPart())
|
||
maxDrain := int(e.Args()[3].IntPart())
|
||
if maxDrain < minDrain {
|
||
maxDrain = minDrain
|
||
}
|
||
value := minDrain
|
||
if maxDrain > minDrain {
|
||
value += grand.Intn(maxDrain - minDrain + 1)
|
||
}
|
||
if value > 0 {
|
||
damage := alpacadecimal.NewFromInt(int64(value))
|
||
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
|
||
}
|
||
|
||
minDamage := int(e.Args()[0].IntPart())
|
||
maxDamage := int(e.Args()[1].IntPart())
|
||
if maxDamage < minDamage {
|
||
maxDamage = minDamage
|
||
}
|
||
value := minDamage
|
||
if maxDamage > minDamage {
|
||
value += grand.Intn(maxDamage - minDamage + 1)
|
||
}
|
||
if value > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: alpacadecimal.NewFromInt(int64(value))})
|
||
}
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1655, &Effect1655{})
|
||
input.InitEffect(input.EffectType.Sub, 1655, &Effect1655Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1656, &Effect1656{})
|
||
input.InitEffect(input.EffectType.Sub, 1656, &Effect1656Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1657, &Effect1657{})
|
||
input.InitEffect(input.EffectType.Skill, 1658, &Effect1658{})
|
||
input.InitEffect(input.EffectType.Sub, 1658, &Effect1658Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1659, &Effect1659{})
|
||
}
|