This commit is contained in:
163
logic/service/fight/effect/642_646.go
Normal file
163
logic/service/fight/effect/642_646.go
Normal file
@@ -0,0 +1,163 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
func counterDamageByLevel(level int) alpacadecimal.Decimal {
|
||||
if level < 0 || level > 5 {
|
||||
return alpacadecimal.Zero
|
||||
}
|
||||
|
||||
return alpacadecimal.NewFromInt(int64((level + 1) * 50))
|
||||
}
|
||||
|
||||
// Effect 642: {0}回合内若对手攻击技能命中则己方在场精灵{1}%做出{2}
|
||||
type Effect642 struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
|
||||
func (e *Effect642) Skill_Use_ex() bool {
|
||||
skill := e.Ctx().SkillEntity
|
||||
if skill == nil || skill.AttackTime == 0 || skill.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
|
||||
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||||
if !success {
|
||||
return true
|
||||
}
|
||||
|
||||
damage := counterDamageByLevel(int(e.Args()[2].IntPart()))
|
||||
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 643: {0}%概率使对手{1}回合内{2}能力每回合变化{3}
|
||||
type Effect643 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect643) Skill_Use() bool {
|
||||
skill := e.Ctx().SkillEntity
|
||||
if skill == nil || skill.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||||
if !success {
|
||||
return true
|
||||
}
|
||||
|
||||
effect := e.Ctx().Our.InitEffect(
|
||||
input.EffectType.Sub,
|
||||
643,
|
||||
int(e.Args()[0].IntPart()),
|
||||
int(e.Args()[1].IntPart()),
|
||||
int(e.Args()[2].IntPart()),
|
||||
int(e.Args()[3].IntPart()),
|
||||
)
|
||||
if effect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect643Sub struct {
|
||||
RoundEffectArg1Base
|
||||
}
|
||||
|
||||
func (e *Effect643Sub) TurnEnd() {
|
||||
propID := int(e.Args()[2].IntPart())
|
||||
if propID >= 0 && propID < 6 {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Opp, int8(propID), int8(e.Args()[3].IntPart()))
|
||||
}
|
||||
|
||||
e.EffectNode.TurnEnd()
|
||||
}
|
||||
|
||||
// Effect 644: 当回合未击败对手,则减少对手当前体力1/{0}
|
||||
type Effect644 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect644) Action_end() bool {
|
||||
skill := e.Ctx().SkillEntity
|
||||
if skill == nil || skill.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
damage := e.Ctx().Opp.CurrentPet.GetHP().Div(e.Args()[0])
|
||||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Percent,
|
||||
Damage: damage,
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 645: 体力低于1/{0}时威力{1}倍
|
||||
type Effect645 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect645) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
threshold := e.GetInput().CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||||
if e.GetInput().CurrentPet.GetHP().Cmp(threshold) < 0 {
|
||||
e.Ctx().SkillEntity.XML.Power *= int(e.Args()[1].IntPart())
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 646: 体力高于对手时,此技能命中后100%使对手{0}
|
||||
type Effect646 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect646) Skill_Use() bool {
|
||||
skill := e.Ctx().SkillEntity
|
||||
if skill == nil || skill.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
for i, delta := range e.SideEffectArgs[:min(len(e.SideEffectArgs), 6)] {
|
||||
if delta == 0 {
|
||||
continue
|
||||
}
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(delta))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 642, &Effect642{})
|
||||
input.InitEffect(input.EffectType.Skill, 643, &Effect643{})
|
||||
input.InitEffect(input.EffectType.Sub, 643, &Effect643Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 644, &Effect644{})
|
||||
input.InitEffect(input.EffectType.Skill, 645, &Effect645{})
|
||||
input.InitEffect(input.EffectType.Skill, 646, &Effect646{})
|
||||
}
|
||||
@@ -381,6 +381,11 @@ var effectInfoByID = map[int]string{
|
||||
639: "造成伤害{0}{1},则下{2}回合所有技能附带{3}点固定伤害",
|
||||
640: "命中后{0}%使对手{1}{2}回合,遇到天敌概率翻倍",
|
||||
641: "命中后{0}%使对手进入流血状态",
|
||||
642: "{0}回合内若对手攻击技能命中则己方在场精灵{1}%做出{2}",
|
||||
643: "{0}%概率使对手{1}回合内{2}能力每回合变化{3}",
|
||||
644: "当回合未击败对手,则减少对手当前体力1/{0}",
|
||||
645: "体力低于1/{0}时威力{1}倍",
|
||||
646: "体力高于对手时,此技能命中后100%使对手{0}",
|
||||
680: "先出手时{0}%使对手{1}{2}回合",
|
||||
681: "下{0}回合自身攻击技能必定致命、必定命中",
|
||||
682: "受到的伤害超过{0},自身{1}",
|
||||
|
||||
Reference in New Issue
Block a user