268 lines
7.3 KiB
Go
268 lines
7.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 1625: 造成的伤害高于{0}则{1}%令自身全属性+{2}
|
|
type Effect1625 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1625) Skill_Use() bool {
|
|
if len(e.Args()) < 3 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
|
|
return true
|
|
}
|
|
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
|
applyAllPropUp(e.Ctx().Our, int8(e.Args()[2].IntPart()))
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1626: 后出手时将当回合护盾所承受的伤害值以百分比伤害的形式{0}%反弹给对手
|
|
type Effect1626 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1626) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
|
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
|
if current == nil || fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID || len(e.Args()) == 0 {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1626, int(e.Args()[0].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1626Sub struct {
|
|
FixedDuration1Base
|
|
absorbed alpacadecimal.Decimal
|
|
}
|
|
|
|
func (e *Effect1626Sub) Damage_Shield(zone *info.DamageZone) bool {
|
|
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
absorbed := alpacadecimal.Min(e.Ctx().Our.CurrentShield(), zone.Damage)
|
|
if absorbed.Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
e.absorbed = e.absorbed.Add(absorbed)
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1626Sub) TurnEnd() {
|
|
if len(e.Args()) > 0 && e.absorbed.Cmp(alpacadecimal.Zero) > 0 {
|
|
damage := e.absorbed.Mul(e.Args()[0]).Div(hundred)
|
|
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
|
|
}
|
|
}
|
|
e.EffectNode.TurnEnd()
|
|
}
|
|
|
|
// Effect 1627: {0}回合做{1}-{2}次攻击,若本回合攻击次数达到最大则必定秒杀对手
|
|
type Effect1627 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1627) Skill_Use() bool {
|
|
if len(e.Args()) < 3 {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1627, e.SideEffectArgs...)
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1627Sub struct {
|
|
RoundEffectArg0Base
|
|
ohko bool
|
|
}
|
|
|
|
func (e *Effect1627Sub) SkillHit() bool {
|
|
e.ohko = false
|
|
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
|
return true
|
|
}
|
|
minHits := int(e.Args()[1].IntPart())
|
|
maxHits := int(e.Args()[2].IntPart())
|
|
if minHits <= 0 {
|
|
minHits = 1
|
|
}
|
|
if maxHits < minHits {
|
|
maxHits = minHits
|
|
}
|
|
|
|
hits := minHits
|
|
if maxHits > minHits {
|
|
hits += grand.Intn(maxHits - minHits + 1)
|
|
}
|
|
if hits > 1 {
|
|
e.Ctx().SkillEntity.AttackTime += uint32(hits - 1)
|
|
}
|
|
e.ohko = hits == maxHits
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1627Sub) OnSkill() bool {
|
|
if !e.ohko || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil || e.Ctx().Opp.CurPet[0].Info.Hp == 0 {
|
|
return true
|
|
}
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
|
Type: info.DamageType.Fixed,
|
|
Damage: e.Ctx().Opp.CurPet[0].GetHP(),
|
|
})
|
|
return true
|
|
}
|
|
|
|
// Effect 1628: 每次使用该技能击败对手则恢复自身全部体力,同时重置该技能使用次数并使该技能攻击威力提升{0}点,未击败对手时令自身下回合攻击技能先制+{1}
|
|
type Effect1628 struct {
|
|
node.EffectNode
|
|
bonusPower int
|
|
}
|
|
|
|
func (e *Effect1628) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
if old := t.GetEffect(input.EffectType.Skill, 1628); old != nil {
|
|
if prev, ok := old.(*Effect1628); ok {
|
|
e.bonusPower = prev.bonusPower
|
|
}
|
|
}
|
|
}
|
|
|
|
func (e *Effect1628) SkillHit() bool {
|
|
if e.bonusPower == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
e.Ctx().SkillEntity.XML.Power += e.bonusPower
|
|
return true
|
|
}
|
|
|
|
func (e *Effect1628) Skill_Use() bool {
|
|
if len(e.Args()) < 2 || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
if e.Ctx().Opp.CurPet[0].Info.Hp == 0 {
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP())
|
|
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Info != nil {
|
|
e.Ctx().SkillEntity.Info.PP = uint32(e.Ctx().SkillEntity.XML.MaxPP)
|
|
}
|
|
e.bonusPower += int(e.Args()[0].IntPart())
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1628, int(e.Args()[1].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1628Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
priority int
|
|
}
|
|
|
|
func (e *Effect1628Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
e.CanStack(false)
|
|
e.remaining = 1
|
|
if len(a) > 0 {
|
|
e.priority = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1628Sub) 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 += e.priority
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
// Effect 1629: {0}基础速度值{1}{2}则自身下回合先制+{3}
|
|
type Effect1629 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1629) Skill_Use() bool {
|
|
if len(e.Args()) < 4 {
|
|
return true
|
|
}
|
|
compareTarget := e.Ctx().Our
|
|
if int(e.Args()[1].IntPart()) != 0 {
|
|
compareTarget = e.Ctx().Opp
|
|
}
|
|
if compareTarget == nil || compareTarget.CurPet[0] == nil {
|
|
return true
|
|
}
|
|
speed := alpacadecimal.NewFromInt(int64(compareTarget.CurPet[0].PetInfo.Spd))
|
|
if !effectCompareByMode(int(e.Args()[2].IntPart()), speed, e.Args()[0]) {
|
|
return true
|
|
}
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1629, int(e.Args()[3].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1629Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
priority int
|
|
}
|
|
|
|
func (e *Effect1629Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
e.CanStack(false)
|
|
e.remaining = 1
|
|
if len(a) > 0 {
|
|
e.priority = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1629Sub) 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 {
|
|
return true
|
|
}
|
|
current.SkillEntity.XML.Priority += e.priority
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1625, &Effect1625{})
|
|
input.InitEffect(input.EffectType.Skill, 1626, &Effect1626{})
|
|
input.InitEffect(input.EffectType.Sub, 1626, &Effect1626Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1627, &Effect1627{})
|
|
input.InitEffect(input.EffectType.Sub, 1627, &Effect1627Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1628, &Effect1628{})
|
|
input.InitEffect(input.EffectType.Sub, 1628, &Effect1628Sub{})
|
|
input.InitEffect(input.EffectType.Skill, 1629, &Effect1629{})
|
|
input.InitEffect(input.EffectType.Sub, 1629, &Effect1629Sub{})
|
|
}
|