feat: 新增一批技能效果实现
This commit is contained in:
364
logic/service/fight/effect/573_587_591_592_594_596_597_598.go
Normal file
364
logic/service/fight/effect/573_587_591_592_594_596_597_598.go
Normal file
@@ -0,0 +1,364 @@
|
||||
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 573: {0}回合内若自身能力提升状态被消除或吸取则{1}%使对手{2}{3}回合
|
||||
type Effect573 struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
|
||||
func (e *Effect573) PropBefer(source *input.Input, prop int8, level int8) bool {
|
||||
if source != e.Ctx().Opp {
|
||||
return true
|
||||
}
|
||||
if prop < 0 || int(prop) >= len(e.Ctx().Our.Prop) {
|
||||
return true
|
||||
}
|
||||
if level != 0 {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our.Prop[prop] <= 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 {
|
||||
return true
|
||||
}
|
||||
|
||||
statusEffect.Duration(int(e.Args()[3].IntPart()))
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 587: {0}回合内若被对手击败则对手损失{1}点体力,造成致命伤害时,对手剩余1点体力
|
||||
type Effect587 struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
|
||||
func (e *Effect587) SwitchOut(in *input.Input) bool {
|
||||
if e.Input != in {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our.CurrentPet.Alive() {
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
oppHP := e.Ctx().Opp.CurrentPet.GetHP()
|
||||
if oppHP.Cmp(alpacadecimal.NewFromInt(1)) <= 0 {
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
damage := e.Args()[1]
|
||||
maxDamage := oppHP.Sub(alpacadecimal.NewFromInt(1))
|
||||
if damage.Cmp(maxDamage) > 0 {
|
||||
damage = maxDamage
|
||||
}
|
||||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damage,
|
||||
})
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 591: 造成伤害大于{0},则下{1}回合自己所有直接攻击先制+{2}
|
||||
type Effect591 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect591) Skill_Use() bool {
|
||||
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect591Sub{}, -1)
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect591Sub struct {
|
||||
RoundEffectArg1Base
|
||||
}
|
||||
|
||||
func (e *Effect591Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||||
return true
|
||||
}
|
||||
if fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
if sattack == nil || sattack.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
if sattack.SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
|
||||
sattack.SkillEntity.XML.Priority += int(e.Args()[2].IntPart())
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 592: 下{0}回合每回合使用攻击技能{1}%令对手{2}
|
||||
type Effect592 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect592) Skill_Use() bool {
|
||||
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect592Sub{}, -1)
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect592Sub struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
|
||||
func (e *Effect592Sub) OnSkill() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
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
|
||||
}
|
||||
|
||||
// Effect 594: 造成的伤害低于{0}时{1}%令对手{2}
|
||||
type Effect594 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect594) Skill_Use() bool {
|
||||
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
|
||||
}
|
||||
|
||||
// Effect 596: 技能使用成功时,{0}%给予对手冻伤、中毒、烧伤中任意一种异常状态
|
||||
type Effect596 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect596) Skill_Use() bool {
|
||||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||||
if !success {
|
||||
return true
|
||||
}
|
||||
|
||||
statusTypes := []int{
|
||||
int(info.PetStatus.Frozen),
|
||||
int(info.PetStatus.Poisoned),
|
||||
int(info.PetStatus.Burned),
|
||||
}
|
||||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusTypes[grand.Intn(len(statusTypes))])
|
||||
if statusEffect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 597: {0}回合内每回合使用技能吸取对手最大体力的1/{1}
|
||||
type Effect597 struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
|
||||
func (e *Effect597) OnSkill() bool {
|
||||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Percent,
|
||||
Damage: damage,
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 598: {0}%恢复自己所有技能PP值{1}点
|
||||
type Effect598 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect598) Skill_Use() bool {
|
||||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||||
if !success {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.HealPP(int(e.Args()[1].IntPart()))
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 401: 若和对手属性相同,则技能威力翻倍
|
||||
type Effect401 struct {
|
||||
Effect400
|
||||
}
|
||||
|
||||
// Effect 585: 技能使用成功时,{0}
|
||||
type Effect585 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect585) Skill_Use() bool {
|
||||
for i, v := range e.SideEffectArgs {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 589: 复制对手{0}的能力提升状态
|
||||
type Effect589 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect589) Skill_Use() bool {
|
||||
for i, v := range e.SideEffectArgs {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
oppProp := e.Ctx().Opp.Prop[i]
|
||||
if oppProp <= 0 {
|
||||
continue
|
||||
}
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), oppProp)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 590: 使对手{0},{6}%弱化效果翻倍
|
||||
type Effect590 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect590) Skill_Use() bool {
|
||||
double := false
|
||||
if len(e.SideEffectArgs) > 6 {
|
||||
success, _, _ := e.Input.Player.Roll(e.SideEffectArgs[6], 100)
|
||||
double = success
|
||||
}
|
||||
|
||||
for i, v := range e.SideEffectArgs[:min(len(e.SideEffectArgs), 6)] {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
if double {
|
||||
v *= 2
|
||||
}
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 593: 附加{0}的{1}值的{2}%的百分比伤害
|
||||
type Effect593 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect593) OnSkill() bool {
|
||||
target := e.Ctx().Our
|
||||
if int(e.Args()[0].IntPart()) == 1 {
|
||||
target = e.Ctx().Opp
|
||||
}
|
||||
|
||||
propID := int(e.Args()[1].IntPart())
|
||||
if propID < 0 || propID >= 6 {
|
||||
return true
|
||||
}
|
||||
|
||||
base := target.GetProp(propID)
|
||||
damage := base.Mul(e.Args()[2]).Div(alpacadecimal.NewFromInt(100))
|
||||
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 595: 技能使用成功时,{0}%使对手{1},若没有触发,则对手{2}
|
||||
type Effect595 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect595) Skill_Use() bool {
|
||||
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||||
if success {
|
||||
statusID := int(e.Args()[1].IntPart())
|
||||
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusID)
|
||||
if statusEffect != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
for i, v := range e.SideEffectArgs[2:] {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(v))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 401, &Effect401{})
|
||||
input.InitEffect(input.EffectType.Skill, 573, &Effect573{})
|
||||
input.InitEffect(input.EffectType.Skill, 585, &Effect585{})
|
||||
input.InitEffect(input.EffectType.Skill, 589, &Effect589{})
|
||||
input.InitEffect(input.EffectType.Skill, 590, &Effect590{})
|
||||
input.InitEffect(input.EffectType.Skill, 587, &Effect587{})
|
||||
input.InitEffect(input.EffectType.Skill, 591, &Effect591{})
|
||||
input.InitEffect(input.EffectType.Sub, 591, &Effect591Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 592, &Effect592{})
|
||||
input.InitEffect(input.EffectType.Sub, 592, &Effect592Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 593, &Effect593{})
|
||||
input.InitEffect(input.EffectType.Skill, 594, &Effect594{})
|
||||
input.InitEffect(input.EffectType.Skill, 595, &Effect595{})
|
||||
input.InitEffect(input.EffectType.Skill, 596, &Effect596{})
|
||||
input.InitEffect(input.EffectType.Skill, 597, &Effect597{})
|
||||
input.InitEffect(input.EffectType.Skill, 598, &Effect598{})
|
||||
}
|
||||
@@ -323,8 +323,22 @@ var effectInfoByID = map[int]string{
|
||||
578: "{0}回合内对手所有属性技能命中率减少{1}%",
|
||||
579: "若当回合未击败对手,则恢复自身最大体力的1/{0}",
|
||||
580: "{0}回合内自身受到直接攻击伤害的{1}%反馈给对手",
|
||||
573: "{0}回合内若自身能力提升状态被消除或吸取则{1}%使对手{2}{3}回合",
|
||||
587: "{0}回合内若被对手击败则对手损失{1}点体力,造成致命伤害时,对手剩余1点体力",
|
||||
588: "先出手时,{0}%概率使自己{1}+{2}",
|
||||
591: "造成伤害大于{0},则下{1}回合自己所有直接攻击先制+{2}",
|
||||
592: "下{0}回合每回合使用攻击技能{1}%令对手{2}",
|
||||
594: "造成的伤害低于{0}时{1}%令对手{2}",
|
||||
595: "技能使用成功时,{0}%使对手{1},若没有触发,则对手{2}",
|
||||
596: "技能使用成功时,{0}%给予对手冻伤、中毒、烧伤中任意一种异常状态",
|
||||
597: "{0}回合内每回合使用技能吸取对手最大体力的1/{1}",
|
||||
598: "{0}%恢复自己所有技能PP值{1}点",
|
||||
400: "若和对手属性相同,则技能威力翻倍",
|
||||
401: "若和对手属性相同,则技能威力翻倍",
|
||||
585: "技能使用成功时,{0}",
|
||||
589: "复制对手{0}的能力提升状态",
|
||||
590: "使对手{0},{6}%弱化效果翻倍",
|
||||
593: "附加{0}的{1}值的{2}%的百分比伤害",
|
||||
480: "{0}回合内自身所有攻击威力为两倍",
|
||||
586: "{0}回合内自己的属性攻击必中",
|
||||
599: "{0}回合内受到{1}伤害减少{2}%",
|
||||
|
||||
Reference in New Issue
Block a user