183 lines
4.4 KiB
Go
183 lines
4.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"
|
|
)
|
|
|
|
// Effect 1223: 造成的攻击伤害若高于{0}则令自身下{1}回合所有技能先制+{2}
|
|
type Effect1223 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1223) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
|
|
return true
|
|
}
|
|
|
|
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect1223Sub{}, -1)
|
|
return true
|
|
}
|
|
|
|
type Effect1223Sub struct {
|
|
RoundEffectArg1Base
|
|
}
|
|
|
|
func (e *Effect1223Sub) 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()[2].IntPart())
|
|
return true
|
|
}
|
|
|
|
// Effect 1224: 消除对手回合类效果,消除成功则使自身下{0}回合必定致命一击
|
|
type Effect1224 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1224) 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
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1224, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1224Sub struct {
|
|
RoundEffectArg0Base
|
|
}
|
|
|
|
func (e *Effect1224Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.XML.CritRate = 16
|
|
return true
|
|
}
|
|
|
|
// Effect 1225: 对手处于能力下降时吸取对手最大体力的1/{0}
|
|
type Effect1225 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1225) OnSkill() bool {
|
|
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
if !e.Ctx().Opp.HasPropSub() {
|
|
return true
|
|
}
|
|
|
|
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
|
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
|
|
}
|
|
|
|
// Effect 1226: {0}回合内受到攻击伤害降低{1}点,回合结束时若当回合未受到攻击伤害则吸取对手{2}点体力
|
|
type Effect1226 struct {
|
|
RoundEffectArg0Base
|
|
hitThisRound bool
|
|
}
|
|
|
|
func (e *Effect1226) DamageSubEx(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
|
|
if zone.Damage.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.hitThisRound = true
|
|
}
|
|
|
|
reduction := e.Args()[1]
|
|
if reduction.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
if zone.Damage.Cmp(reduction) > 0 {
|
|
zone.Damage = zone.Damage.Sub(reduction)
|
|
} else {
|
|
zone.Damage = alpacadecimal.Zero
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1226) TurnEnd() {
|
|
if !e.hitThisRound && len(e.Args()) >= 3 && e.Args()[2].Cmp(alpacadecimal.Zero) > 0 {
|
|
drain := e.Args()[2]
|
|
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)
|
|
}
|
|
|
|
e.hitThisRound = false
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
// Effect 1227: 自身处于能力提升状态则有{0}%概率使对手{1},先出手时概率翻倍
|
|
type Effect1227 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1227) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || !e.Ctx().Our.HasPropADD() {
|
|
return true
|
|
}
|
|
|
|
chance := int(e.Args()[0].IntPart())
|
|
if e.IsFirst() {
|
|
chance *= 2
|
|
if chance > 100 {
|
|
chance = 100
|
|
}
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(chance, 100)
|
|
if !success {
|
|
return true
|
|
}
|
|
|
|
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
|
|
if statusEffect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1223, &Effect1223{})
|
|
input.InitEffect(input.EffectType.Sub, 1223, &Effect1223Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1224, &Effect1224{})
|
|
input.InitEffect(input.EffectType.Sub, 1224, &Effect1224Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1225, &Effect1225{})
|
|
input.InitEffect(input.EffectType.Skill, 1226, &Effect1226{})
|
|
input.InitEffect(input.EffectType.Skill, 1227, &Effect1227{})
|
|
}
|