137 lines
3.6 KiB
Go
137 lines
3.6 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"
|
||
)
|
||
|
||
// Effect 1102: {0}回合内若对手使用属性技能则{1},未触发则减少对手1/{2}最大体力
|
||
type Effect1102 struct {
|
||
RoundEffectArg0Base
|
||
triggered bool
|
||
}
|
||
|
||
func (e *Effect1102) Skill_Use_ex() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
e.triggered = true
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func (e *Effect1102) TurnEnd() {
|
||
if !e.triggered && e.Duration() == 1 && e.Args()[2].Cmp(alpacadecimal.Zero) > 0 {
|
||
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[2])
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Percent,
|
||
Damage: damage,
|
||
})
|
||
}
|
||
e.EffectNode.TurnEnd()
|
||
}
|
||
|
||
// Effect 1103: 若对手处于能力提升状态则造成的攻击伤害额外提升{0}%
|
||
type Effect1103 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1103) SkillHit() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if !e.Ctx().Opp.HasPropADD() {
|
||
return true
|
||
}
|
||
|
||
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0])
|
||
return true
|
||
}
|
||
|
||
// Effect 1104: 造成的伤害低于{0}则吸取对手1/{1}最大体力
|
||
type Effect1104 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1104) Skill_Use() bool {
|
||
skill := e.Ctx().SkillEntity
|
||
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) >= 0 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
damage := e.Ctx().Opp.CurPet[0].GetMaxHP().Div(e.Args()[1])
|
||
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 1105: {0}回合内每回合攻击附加自身攻击和特攻中最高一项{1}%的固定伤害
|
||
type Effect1105 struct {
|
||
RoundEffectArg0Base
|
||
}
|
||
|
||
func (e *Effect1105) OnSkill() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
|
||
baseProp := alpacadecimal.Max(e.Ctx().Our.GetProp(0), e.Ctx().Our.GetProp(2))
|
||
damage := baseProp.Mul(e.Args()[1]).Div(hundred)
|
||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
|
||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: damage,
|
||
})
|
||
return true
|
||
}
|
||
|
||
// Effect 1106: 当回合造成的攻击伤害若高于{0}则{1}%令对手{2}
|
||
type Effect1106 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect1106) Skill_Use() bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||
return true
|
||
}
|
||
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
|
||
return true
|
||
}
|
||
|
||
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||
if !success {
|
||
return true
|
||
}
|
||
|
||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[2].IntPart()))
|
||
if statusEffect != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||
}
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 1102, &Effect1102{})
|
||
input.InitEffect(input.EffectType.Skill, 1103, &Effect1103{})
|
||
input.InitEffect(input.EffectType.Skill, 1104, &Effect1104{})
|
||
input.InitEffect(input.EffectType.Skill, 1105, &Effect1105{})
|
||
input.InitEffect(input.EffectType.Skill, 1106, &Effect1106{})
|
||
}
|