228 lines
6.1 KiB
Go
228 lines
6.1 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 1573: 自身为圣念状态时下2回合受到的攻击伤害减少50%,自身为邪念状态时下2回合造成的攻击伤害提升50%
|
||
type Effect1573 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1573) Skill_Use() bool {
|
||
mode := 0
|
||
if e.Ctx().Our.StatEffect_Exist(petStatus2077Holy) {
|
||
mode = 1
|
||
} else if e.Ctx().Our.StatEffect_Exist(petStatus2077Evil) {
|
||
mode = 2
|
||
}
|
||
if mode == 0 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1573, mode)
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1573Sub struct {
|
||
FixedDuration2Base
|
||
mode int
|
||
}
|
||
|
||
func (e *Effect1573Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.FixedDuration2Base.SetArgs(t, a...)
|
||
if len(a) > 0 {
|
||
e.mode = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect1573Sub) DamageDivEx(zone *info.DamageZone) bool {
|
||
if e.mode != 1 || zone == nil || zone.Type != info.DamageType.Red {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Div(alpacadecimal.NewFromInt(2))
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1573Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||
if e.mode != 2 || zone == nil || zone.Type != info.DamageType.Red {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||
return true
|
||
}
|
||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(3)).Div(alpacadecimal.NewFromInt(2))
|
||
return true
|
||
}
|
||
|
||
// Effect 1574: 附加自身攻击值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%
|
||
type Effect1574 struct {
|
||
node.EffectNode
|
||
bonus int
|
||
}
|
||
|
||
func (e *Effect1574) OnSkill() bool {
|
||
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Opp == nil {
|
||
return true
|
||
}
|
||
|
||
percent := int(e.Args()[0].IntPart()) + e.bonus
|
||
maxPercent := int(e.Args()[2].IntPart())
|
||
if percent > maxPercent {
|
||
percent = maxPercent
|
||
}
|
||
if percent <= 0 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Ctx().Our.GetProp(0).Add(e.Ctx().Our.GetProp(4)).Mul(alpacadecimal.NewFromInt(int64(percent))).Div(hundred)
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: damage,
|
||
})
|
||
}
|
||
e.bonus += int(e.Args()[1].IntPart())
|
||
return true
|
||
}
|
||
|
||
// Effect 1575: 下{0}回合后出手则对手{1}
|
||
type Effect1575 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1575) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1575, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1575Sub struct {
|
||
RoundEffectArg0Base
|
||
statusID int
|
||
}
|
||
|
||
func (e *Effect1575Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.RoundEffectArg0Base.SetArgs(t, a...)
|
||
e.CanStack(false)
|
||
if len(a) > 1 {
|
||
e.statusID = a[1]
|
||
}
|
||
}
|
||
|
||
func (e *Effect1575Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||
if current == nil || current.SkillEntity == nil {
|
||
return true
|
||
}
|
||
if e.Duration() > 1 || e.IsFirst() {
|
||
return true
|
||
}
|
||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, e.statusID)
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
// Effect 1576: 消耗自身全部体力,使对手{0}回合内无法通过自身技能恢复体力
|
||
type Effect1576 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1576) Skill_Use() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp == nil {
|
||
return true
|
||
}
|
||
damage := e.Ctx().Our.CurPet[0].GetHP()
|
||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1576, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1576Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect1576Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
|
||
if value == nil || *value <= 0 {
|
||
return true
|
||
}
|
||
if _, ok := ac.(*action.SelectSkillAction); !ok || ac.GetPlayerID() != e.Ctx().Our.UserID {
|
||
return true
|
||
}
|
||
*value = 0
|
||
return true
|
||
}
|
||
|
||
// Effect 1577: {0}回合做{1}-{2}次攻击,当前技能PP值小于{3}时连击上限为{4}
|
||
type Effect1577 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1577) Skill_Use() bool {
|
||
if len(e.Args()) < 5 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1577, e.SideEffectArgs...)
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1577Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect1577Sub) SkillHit() bool {
|
||
if len(e.Args()) < 5 || 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
|
||
}
|
||
|
||
if skill := e.Ctx().SkillEntity.Info; skill != nil && int(skill.PP) < int(e.Args()[3].IntPart()) {
|
||
ppCap := int(e.Args()[4].IntPart())
|
||
if ppCap > 0 && ppCap < maxHits {
|
||
maxHits = ppCap
|
||
}
|
||
if maxHits < minHits {
|
||
maxHits = minHits
|
||
}
|
||
}
|
||
|
||
hits := minHits
|
||
if maxHits > minHits {
|
||
hits += grand.Intn(maxHits - minHits + 1)
|
||
}
|
||
if hits <= 1 {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.AttackTime += uint32(hits - 1)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1573, &Effect1573{})
|
||
input.InitEffect(input.EffectType.Sub, 1573, &Effect1573Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1574, &Effect1574{})
|
||
input.InitEffect(input.EffectType.Skill, 1575, &Effect1575{})
|
||
input.InitEffect(input.EffectType.Sub, 1575, &Effect1575Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1576, &Effect1576{})
|
||
input.InitEffect(input.EffectType.Sub, 1576, &Effect1576Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1577, &Effect1577{})
|
||
input.InitEffect(input.EffectType.Sub, 1577, &Effect1577Sub{})
|
||
}
|