2025-12-24 19:17:39 +08:00
|
|
|
|
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"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
// 效果119:若伤害为奇数,30%对手疲惫1回合;若为偶数,30%速度+1
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
type Effect119 struct {
|
|
|
|
|
|
node.EffectNode
|
|
|
|
|
|
can bool
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-09 17:42:52 +08:00
|
|
|
|
func (e *Effect119) Skill_Use() bool {
|
2026-01-04 21:41:10 +08:00
|
|
|
|
|
2025-12-24 19:17:39 +08:00
|
|
|
|
e.can = true
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (e *Effect119) DamageLock(damageValue *info.DamageZone) bool {
|
|
|
|
|
|
if !e.can {
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
isOdd := damageValue.Damage.IntPart()%2 == 1
|
|
|
|
|
|
|
|
|
|
|
|
if isOdd {
|
|
|
|
|
|
// 奇数:30%对手疲惫1回合
|
|
|
|
|
|
ok, _, _ := e.Input.Player.Roll(30, 100)
|
|
|
|
|
|
if ok {
|
2026-03-08 10:34:23 +08:00
|
|
|
|
eff := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Tired))
|
2025-12-24 19:17:39 +08:00
|
|
|
|
if eff == nil {
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
eff.Duration(1)
|
|
|
|
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 偶数:30%速度+1
|
|
|
|
|
|
ok, _, _ := e.Input.Player.Roll(30, 100)
|
|
|
|
|
|
if ok {
|
2026-03-08 23:24:18 +08:00
|
|
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1)
|
2025-12-24 19:17:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
e.can = false
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (e *Effect119) SetArgs(t *input.Input, a ...int) {
|
|
|
|
|
|
e.EffectNode.SetArgs(t, a...)
|
|
|
|
|
|
e.EffectNode.Duration(1)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
// 效果120:50%概率对方减血1/{0},50%概率自己减血1/{0}
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
type Effect120 struct {
|
|
|
|
|
|
node.EffectNode
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-09 17:42:52 +08:00
|
|
|
|
func (e *Effect120) Skill_Use() bool {
|
2025-12-24 19:17:39 +08:00
|
|
|
|
|
|
|
|
|
|
// 50%概率
|
|
|
|
|
|
ok, _, _ := e.Input.Player.Roll(50, 100)
|
|
|
|
|
|
|
|
|
|
|
|
denominator := int(e.Args()[0].IntPart())
|
|
|
|
|
|
percent := alpacadecimal.NewFromInt(100).Div(alpacadecimal.NewFromInt(int64(denominator)))
|
|
|
|
|
|
|
|
|
|
|
|
if ok {
|
|
|
|
|
|
// 对方减血1/{0}
|
|
|
|
|
|
oppMaxHP := alpacadecimal.NewFromInt(int64(e.Ctx().Opp.CurrentPet.Info.MaxHp))
|
|
|
|
|
|
damage := oppMaxHP.Mul(percent).Div(alpacadecimal.NewFromInt(100))
|
|
|
|
|
|
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
2026-03-05 17:40:42 +08:00
|
|
|
|
Type: info.DamageType.Percent,
|
2025-12-24 19:17:39 +08:00
|
|
|
|
Damage: damage,
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 自己减血1/{0}
|
|
|
|
|
|
ourMaxHP := alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp))
|
|
|
|
|
|
damage := ourMaxHP.Mul(percent).Div(alpacadecimal.NewFromInt(100))
|
|
|
|
|
|
e.Ctx().Our.Damage(e.Ctx().Opp, &info.DamageZone{
|
2026-03-05 17:40:42 +08:00
|
|
|
|
Type: info.DamageType.Percent,
|
2025-12-24 19:17:39 +08:00
|
|
|
|
Damage: damage,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
// 效果121:属性相同时,{0}%概率让对方麻痹
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
type Effect121 struct {
|
|
|
|
|
|
node.EffectNode
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-09 17:42:52 +08:00
|
|
|
|
func (e *Effect121) Skill_Use() bool {
|
2025-12-24 19:17:39 +08:00
|
|
|
|
|
|
|
|
|
|
// 检查属性是否相同
|
|
|
|
|
|
if e.Ctx().Our.CurrentPet.PetInfo.Type == e.Ctx().Opp.CurrentPet.PetInfo.Type {
|
|
|
|
|
|
chance := int(e.Args()[0].IntPart())
|
|
|
|
|
|
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
|
|
|
|
|
if ok {
|
2026-03-08 10:34:23 +08:00
|
|
|
|
eff := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Paralysis))
|
2025-12-24 19:17:39 +08:00
|
|
|
|
if eff == nil {
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
duration := int(e.Input.FightC.GetRand().Int31n(2))
|
|
|
|
|
|
duration++
|
|
|
|
|
|
eff.Duration(duration)
|
|
|
|
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, eff)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
// 效果123:{0}回合内受到任何伤害,自身{1}提高{2}个等级
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
type Effect123 struct {
|
|
|
|
|
|
node.EffectNode
|
|
|
|
|
|
roundCount int
|
|
|
|
|
|
can bool
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (e *Effect123) SetArgs(t *input.Input, a ...int) {
|
|
|
|
|
|
e.EffectNode.SetArgs(t, a...)
|
|
|
|
|
|
e.roundCount = e.EffectNode.SideEffectArgs[0]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-05 22:54:41 +08:00
|
|
|
|
func (e *Effect123) TurnStart(at, de *action.SelectSkillAction) {
|
2025-12-24 19:17:39 +08:00
|
|
|
|
if e.roundCount > 0 {
|
|
|
|
|
|
e.can = true
|
|
|
|
|
|
e.roundCount--
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (e *Effect123) Be_Damage(at, _ alpacadecimal.Decimal) {
|
|
|
|
|
|
if e.can {
|
|
|
|
|
|
propIndex := int(e.Args()[1].IntPart())
|
|
|
|
|
|
changeAmount := int(e.Args()[2].IntPart())
|
2026-03-08 23:24:18 +08:00
|
|
|
|
e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
|
2025-12-24 19:17:39 +08:00
|
|
|
|
e.can = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
// 初始化
|
|
|
|
|
|
// -----------------------------------------------------------
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
input.InitEffect(input.EffectType.Skill, 119, &Effect119{})
|
|
|
|
|
|
input.InitEffect(input.EffectType.Skill, 120, &Effect120{})
|
|
|
|
|
|
input.InitEffect(input.EffectType.Skill, 121, &Effect121{})
|
2026-03-07 13:54:42 +08:00
|
|
|
|
|
2025-12-24 19:17:39 +08:00
|
|
|
|
input.InitEffect(input.EffectType.Skill, 123, &Effect123{})
|
|
|
|
|
|
}
|