Files
bl/logic/service/fight/effect/1635_1639.go
2026-04-04 06:11:01 +08:00

182 lines
5.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 1635: 立刻恢复自身{0}点体力,{1}回合后恢复自身全部体力
type Effect1635 struct{ node.EffectNode }
func (e *Effect1635) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Our == nil {
return true
}
if e.Args()[0].Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0])
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1635, int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1635Sub struct{ RoundEffectArg0Base }
func (e *Effect1635Sub) TurnEnd() {
if e.Duration() == 1 && e.Ctx().Our != nil && e.Ctx().Our.CurPet[0] != nil {
heal := e.Ctx().Our.CurPet[0].GetMaxHP().Sub(e.Ctx().Our.CurPet[0].GetHP())
if heal.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
}
}
e.EffectNode.TurnEnd()
}
// Effect 1636: 涵双1回合释放4-8张玫瑰卡牌进行攻击每张卡牌额外附加50点固定伤害自身体力低于最大体力的1/3时效果翻倍
type Effect1636 struct {
node.EffectNode
bonus alpacadecimal.Decimal
}
func (e *Effect1636) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
hits := 4 + grand.Intn(5)
if e.Ctx().Our != nil && e.Ctx().Our.CurPet[0] != nil {
threshold := e.Ctx().Our.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(3))
if e.Ctx().Our.CurPet[0].GetHP().Cmp(threshold) < 0 {
hits *= 2
}
}
if hits > 1 {
e.Ctx().SkillEntity.AttackTime += uint32(hits - 1)
}
e.bonus = alpacadecimal.NewFromInt(int64(hits * 50))
return true
}
func (e *Effect1636) DamageAdd(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.bonus.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
zone.Damage = zone.Damage.Add(e.bonus)
e.bonus = alpacadecimal.Zero
return true
}
// Effect 1637: {0}回合内若对手使用属性技能,则使用属性技能后的下{1}回合属性技能命中效果失效
type Effect1637 struct{ node.EffectNode }
func (e *Effect1637) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Opp == nil {
return true
}
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1637, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1637Sub struct {
RoundEffectArg0Base
triggered bool
}
func (e *Effect1637Sub) ActionStart(fattack, sattack *action.SelectSkillAction) bool {
if e.triggered || len(e.Args()) < 2 {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() != info.Category.STATUS {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 16371, int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Opp, sub)
}
e.triggered = true
e.Alive(false)
return true
}
type Effect16371Sub struct{ RoundEffectArg0Base }
func (e *Effect16371Sub) SkillHit_ex() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.SetNoSide()
e.Ctx().SkillEntity.AttackTime = 0
return true
}
// Effect 1638: {0}回合内若自身未受到攻击伤害则令对手全属性-{1}
type Effect1638 struct{ node.EffectNode }
func (e *Effect1638) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Our == nil {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1638, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1638Sub struct {
RoundEffectArg0Base
touched bool
}
func (e *Effect1638Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone != nil && zone.Type == info.DamageType.Red && zone.Damage.Cmp(alpacadecimal.Zero) > 0 {
e.touched = true
}
return true
}
func (e *Effect1638Sub) TurnEnd() {
if !e.touched && len(e.Args()) >= 2 {
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[1].IntPart()))
}
e.touched = false
e.EffectNode.TurnEnd()
}
// Effect 1639: 自身处于能力提升状态时100%打出致命一击
type Effect1639 struct{ node.EffectNode }
func (e *Effect1639) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
if e.Ctx().Our == nil || !e.Ctx().Our.HasPropADD() {
return true
}
e.Ctx().SkillEntity.XML.CritRate = 16
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1635, &Effect1635{})
input.InitEffect(input.EffectType.Sub, 1635, &Effect1635Sub{})
input.InitEffect(input.EffectType.Skill, 1636, &Effect1636{})
input.InitEffect(input.EffectType.Skill, 1637, &Effect1637{})
input.InitEffect(input.EffectType.Sub, 1637, &Effect1637Sub{})
input.InitEffect(input.EffectType.Sub, 16371, &Effect16371Sub{})
input.InitEffect(input.EffectType.Skill, 1638, &Effect1638{})
input.InitEffect(input.EffectType.Sub, 1638, &Effect1638Sub{})
input.InitEffect(input.EffectType.Skill, 1639, &Effect1639{})
}