170 lines
4.2 KiB
Go
170 lines
4.2 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 1563: 损失自身{0}点体力,给对手造成{1}点固定伤害,若自身体力不足{2}则损失全部体力且造成的固定伤害翻倍
|
||
type Effect1563 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1563) Skill_Use() bool {
|
||
if len(e.Args()) < 3 {
|
||
return true
|
||
}
|
||
|
||
selfDamage := e.Args()[0]
|
||
oppDamage := e.Args()[1]
|
||
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Args()[2]) < 0 {
|
||
selfDamage = e.Ctx().Our.CurrentPet.GetHP()
|
||
oppDamage = oppDamage.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
|
||
if selfDamage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: selfDamage,
|
||
})
|
||
}
|
||
if oppDamage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: oppDamage,
|
||
})
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 1564: 恢复自身{0}点体力,若自身满天赋值则{1}%附加等量百分比伤害
|
||
type Effect1564 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1564) Skill_Use() bool {
|
||
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
healAmount := e.Args()[0]
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||
if e.Ctx().Our.CurrentPet.Info.Dv != 31 {
|
||
return true
|
||
}
|
||
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||
if !success {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: healAmount,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1565: {0}回合内每回合结束时使对手随机{1}个技能PP归零
|
||
type Effect1565 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1565) Skill_Use() bool {
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1565, e.SideEffectArgs...)
|
||
if effect != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1565Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1565Sub) TurnEnd() {
|
||
if len(e.Args()) > 1 {
|
||
zeroRandomSkillPP(e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||
}
|
||
e.EffectNode.TurnEnd()
|
||
}
|
||
|
||
// Effect 1566: {0}回合内每回合结束后反转对手能力提升状态
|
||
type Effect1566 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1566) Skill_Use() bool {
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1566, e.SideEffectArgs...)
|
||
if effect != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1566Sub struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1566Sub) TurnEnd() {
|
||
for i, v := range e.Ctx().Opp.Prop[:] {
|
||
if v <= 0 {
|
||
continue
|
||
}
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), -2*v)
|
||
}
|
||
e.EffectNode.TurnEnd()
|
||
}
|
||
|
||
// Effect 1567: 获得海洋的祝福:使自身下2回合先制+2且攻击必定命中、必定致命
|
||
type Effect1567 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1567) Skill_Use() bool {
|
||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1567)
|
||
if effect != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1567Sub struct {
|
||
FixedDuration2Base
|
||
}
|
||
|
||
func (e *Effect1567Sub) 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 += 2
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1567Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().SkillEntity.XML.MustHit = 1
|
||
e.Ctx().SkillEntity.XML.CritRate = 16
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1563, &Effect1563{})
|
||
input.InitEffect(input.EffectType.Skill, 1564, &Effect1564{})
|
||
input.InitEffect(input.EffectType.Skill, 1565, &Effect1565{})
|
||
input.InitEffect(input.EffectType.Sub, 1565, &Effect1565Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1566, &Effect1566{})
|
||
input.InitEffect(input.EffectType.Sub, 1566, &Effect1566Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1567, &Effect1567{})
|
||
input.InitEffect(input.EffectType.Sub, 1567, &Effect1567Sub{})
|
||
}
|