205 lines
5.4 KiB
Go
205 lines
5.4 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/common/data/share"
|
||
"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 1373: 直接造成{0}点冰系伤害,自身每处于一种能力提升状态则造成的伤害提高{1}%
|
||
type Effect1373 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1373) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Args()[0]
|
||
boostCount := countPositivePropKinds(e.Ctx().Our)
|
||
if boostCount > 0 {
|
||
damage = damage.Add(
|
||
damage.Mul(e.Args()[1]).Mul(alpacadecimal.NewFromInt(int64(boostCount))).Div(hundred),
|
||
)
|
||
}
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1374: 命中后100%秒杀对方,若MISS则自身死亡,消除对手回合类效果且100%令对手冰封,同时令我方下一只出场精灵3回合内获得冰之祝福效果
|
||
type Effect1374 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1374) DamageFloor(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red {
|
||
return true
|
||
}
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 {
|
||
return true
|
||
}
|
||
|
||
zone.Damage = e.Ctx().Opp.CurrentPet.GetMaxHP()
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1374) Skill_Use() bool {
|
||
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.AttackTime == 0 {
|
||
e.Ctx().Our.CurrentPet.Info.Hp = 0
|
||
}
|
||
|
||
e.Ctx().Opp.CancelTurn(e.Ctx().Our)
|
||
applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(info.PetStatus.IceBound))
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1374, 3)
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1374Sub struct{ node.EffectNode }
|
||
|
||
func (e *Effect1374Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
e.CanStack(false)
|
||
}
|
||
|
||
func (e *Effect1374Sub) SwitchIn(in *input.Input) bool {
|
||
if in != e.Ctx().Our || len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
buff := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1375, int(e.Args()[0].IntPart()))
|
||
if buff != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, buff)
|
||
}
|
||
e.Alive(false)
|
||
return true
|
||
}
|
||
|
||
// Effect 1375: 自身下{0}回合获得了冰之祝福
|
||
type Effect1375 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1375) Skill_Use() bool {
|
||
if len(e.Args()) == 0 {
|
||
return true
|
||
}
|
||
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1375, int(e.Args()[0].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect1375Sub struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect1375Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.RoundEffectArg0Base.SetArgs(t, a...)
|
||
e.CanStack(false)
|
||
}
|
||
|
||
func (e *Effect1375Sub) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if ok, _, _ := e.Input.Player.Roll(50, 100); ok {
|
||
e.Ctx().SkillEntity.XML.CritRate = 16
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1375Sub) OnSkill() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||
return true
|
||
}
|
||
|
||
damage := alpacadecimal.NewFromInt(int64(grand.N(150, 300)))
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1376: {0}回合内自身使用攻击技能则{1}%令对手{2},未触发则吸取对手最大体力的1/{3}
|
||
type Effect1376 struct{ RoundEffectArg0Base }
|
||
|
||
func (e *Effect1376) OnSkill() bool {
|
||
if len(e.Args()) < 4 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
||
if addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[2].IntPart())) {
|
||
return true
|
||
}
|
||
}
|
||
|
||
if e.Args()[3].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[3])
|
||
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 1377: 使用后在战斗结束时可以获得500泰坦之灵,每日上限5000
|
||
type Effect1377 struct{ node.EffectNode }
|
||
|
||
func (e *Effect1377) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
}
|
||
|
||
func (e *Effect1377) OnBattleEnd() bool {
|
||
player := e.Ctx().Our.Player
|
||
if player == nil || player.GetInfo().UserID == 0 {
|
||
return true
|
||
}
|
||
|
||
count, err := share.GlobalCounterManager.GetCount(&share.DailyPeriod, player.GetInfo().UserID, 1377)
|
||
if err != nil && err != share.ErrCacheMiss {
|
||
return true
|
||
}
|
||
if err == share.ErrCacheMiss {
|
||
count = 0
|
||
}
|
||
if count >= 10 {
|
||
return true
|
||
}
|
||
|
||
if !player.ItemAdd(1400352, 500) {
|
||
return true
|
||
}
|
||
|
||
_, _ = share.GlobalCounterManager.IncrCount(&share.DailyPeriod, player.GetInfo().UserID, 1377)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1373, &Effect1373{})
|
||
input.InitEffect(input.EffectType.Skill, 1374, &Effect1374{})
|
||
input.InitEffect(input.EffectType.Sub, 1374, &Effect1374Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1375, &Effect1375{})
|
||
input.InitEffect(input.EffectType.Sub, 1375, &Effect1375Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 1376, &Effect1376{})
|
||
input.InitEffect(input.EffectType.Skill, 1377, &Effect1377{})
|
||
}
|