197 lines
4.3 KiB
Go
197 lines
4.3 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 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{})
|
|
}
|