228 lines
5.6 KiB
Go
228 lines
5.6 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"
|
|
)
|
|
|
|
func applyEvilDragonBite(owner *input.Input) {
|
|
if owner == nil || owner.CurPet[0] == nil || owner.Opp == nil || owner.Opp.CurPet[0] == nil {
|
|
return
|
|
}
|
|
|
|
damage := alpacadecimal.NewFromInt(int64(randomInRange(150, 300)))
|
|
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return
|
|
}
|
|
|
|
owner.Opp.Damage(owner, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: damage,
|
|
})
|
|
owner.Heal(owner, &action.SelectSkillAction{}, damage)
|
|
}
|
|
|
|
func addEvilDragonBiteSub(owner *input.Input, count int) {
|
|
if owner == nil || count <= 0 {
|
|
return
|
|
}
|
|
|
|
effect := owner.InitEffect(input.EffectType.Sub, 1330, count)
|
|
if effect != nil {
|
|
owner.AddEffect(owner, effect)
|
|
}
|
|
}
|
|
|
|
// Effect 1328: {0}%的概率造成{1}倍伤害,每次使用概率增加{2}%,最高概率{3}%
|
|
type Effect1328 struct {
|
|
node.EffectNode
|
|
useCount int
|
|
trigger bool
|
|
}
|
|
|
|
func (e *Effect1328) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
e.trigger = false
|
|
if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
chance := int(e.Args()[0].IntPart()) + e.useCount*int(e.Args()[2].IntPart())
|
|
maxChance := int(e.Args()[3].IntPart())
|
|
if chance > maxChance {
|
|
chance = maxChance
|
|
}
|
|
|
|
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
|
e.trigger = ok
|
|
e.useCount++
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1328) Damage_Mul(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || !e.trigger || len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
zone.Damage = zone.Damage.Mul(e.Args()[1])
|
|
return true
|
|
}
|
|
|
|
// Effect 1329: {0}回合内对手使用攻击技能则自身下{1}次攻击技能必定触发邪龙之噬
|
|
type Effect1329 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1329) Skill_Use() bool {
|
|
if len(e.Args()) < 2 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1329, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1329Sub struct{ RoundEffectArg0Base }
|
|
|
|
func (e *Effect1329Sub) Skill_Use_ex() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
addEvilDragonBiteSub(e.Ctx().Our, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
// Effect 1330: 使自身下{0}次攻击技能必定触发邪龙之噬
|
|
type Effect1330 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1330) Skill_Use() bool {
|
|
if len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
addEvilDragonBiteSub(e.Ctx().Our, int(e.Args()[0].IntPart()))
|
|
return true
|
|
}
|
|
|
|
type Effect1330Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1330Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1330Sub) 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 || current.SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
current.SkillEntity.XML.Priority += 1
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1330Sub) 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 {
|
|
applyEvilDragonBite(e.Ctx().Our)
|
|
}
|
|
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1331: 击败对手则令对手下一只出场的精灵{0},且使自身下{1}次攻击技能必定触发邪龙之噬
|
|
type Effect1331 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1331) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().Opp.CurPet[0] == nil || e.Ctx().Opp.CurPet[0].Info.Hp > 0 {
|
|
return true
|
|
}
|
|
|
|
statusSub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1331, int(e.Args()[0].IntPart()))
|
|
if statusSub != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusSub)
|
|
}
|
|
addEvilDragonBiteSub(e.Ctx().Our, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
type Effect1331Sub struct{ node.EffectNode }
|
|
|
|
func (e *Effect1331Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.CanStack(false)
|
|
e.Duration(1)
|
|
}
|
|
|
|
func (e *Effect1331Sub) SwitchIn(in *input.Input) bool {
|
|
if in != e.Ctx().Our || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
|
|
applyStatusByID(e.Ctx().Opp, e.Ctx().Our, int(e.Args()[0].IntPart()))
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
|
|
// Effect 1332: 消除对手回合类效果,消除成功则随机附加{0}种异常状态
|
|
type Effect1332 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1332) 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
|
|
}
|
|
|
|
addRandomStatuses1116(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[0].IntPart()))
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1328, &Effect1328{})
|
|
input.InitEffect(input.EffectType.Skill, 1329, &Effect1329{})
|
|
input.InitEffect(input.EffectType.Sub, 1329, &Effect1329Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1330, &Effect1330{})
|
|
input.InitEffect(input.EffectType.Sub, 1330, &Effect1330Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1331, &Effect1331{})
|
|
input.InitEffect(input.EffectType.Sub, 1331, &Effect1331Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1332, &Effect1332{})
|
|
}
|