feat: 新增战斗效果1568-1572及金豆订单修复
This commit is contained in:
245
logic/service/fight/effect/1568_1572.go
Normal file
245
logic/service/fight/effect/1568_1572.go
Normal file
@@ -0,0 +1,245 @@
|
||||
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 1568: 无视对手护盾效果
|
||||
type Effect1568 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1568) Skill_Use() bool {
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1568)
|
||||
if sub != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1568Sub struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1568Sub) Damage_Shield(zone *info.DamageZone) bool {
|
||||
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our == nil || e.Ctx().Our.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
e.Ctx().Our.ConsumeAllShield()
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1568Sub) SwitchOut(in *input.Input) bool {
|
||||
if in == e.Ctx().Our {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1569: {0}%令对手{1},触发时自身下{2}次攻击伤害翻倍,未触发则自身{3}且免疫下{4}次攻击
|
||||
type Effect1569 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1569) Skill_Use() bool {
|
||||
if len(e.Args()) < 5 {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Opp == nil || e.Ctx().Our == nil {
|
||||
return true
|
||||
}
|
||||
ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||||
if ok {
|
||||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1569, int(e.Args()[2].IntPart()))
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
addStatusEffect(e.Ctx().Our, e.Ctx().Our, int(e.Args()[3].IntPart()))
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1569, int(e.Args()[4].IntPart()))
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1569Sub struct {
|
||||
node.EffectNode
|
||||
remaining int
|
||||
fail bool
|
||||
}
|
||||
|
||||
func (e *Effect1569Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(-1)
|
||||
if len(a) > 0 {
|
||||
e.remaining = a[0]
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Effect1569Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||||
if e.remaining <= 0 || zone == nil || zone.Type != info.DamageType.Red || e.fail {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
||||
e.remaining--
|
||||
if e.remaining <= 0 {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1569Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||||
if !e.fail || e.remaining <= 0 || zone == nil || zone.Type != info.DamageType.Red {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity != nil {
|
||||
e.Ctx().SkillEntity.SetMiss()
|
||||
}
|
||||
zone.Damage = alpacadecimal.Zero
|
||||
e.remaining--
|
||||
if e.remaining <= 0 {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1570: 出手时若自身体力高于对手则{0}%令对手{1},未触发则附加对手最大体力1/{2}的百分比伤害
|
||||
type Effect1570 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1570) Skill_Use() bool {
|
||||
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Opp == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
var chance int
|
||||
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) > 0 {
|
||||
chance = int(e.Args()[0].IntPart())
|
||||
} else {
|
||||
chance = 0
|
||||
}
|
||||
if chance > 0 {
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
if ok {
|
||||
addStatusEffect(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
return true
|
||||
}
|
||||
}
|
||||
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[2])
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Percent,
|
||||
Damage: damage,
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1571: 使自身随机获得圣念状态或邪念状态,若已拥有则切换旨在另一个状态
|
||||
type Effect1571 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1571) Skill_Use() bool {
|
||||
if e.Ctx().Our == nil {
|
||||
return true
|
||||
}
|
||||
hasHoly := e.Ctx().Our.StatEffect_Exist(int(petStatus2077Holy))
|
||||
hasEvil := e.Ctx().Our.StatEffect_Exist(int(petStatus2077Evil))
|
||||
target := int(petStatus2077Holy)
|
||||
if hasHoly {
|
||||
target = int(petStatus2077Evil)
|
||||
} else if hasEvil {
|
||||
target = int(petStatus2077Holy)
|
||||
} else if grand.Intn(2) == 1 {
|
||||
target = int(petStatus2077Evil)
|
||||
}
|
||||
removeStatusEffect(e.Ctx().Our, int(petStatus2077Holy))
|
||||
removeStatusEffect(e.Ctx().Our, int(petStatus2077Evil))
|
||||
addStatusEffect(e.Ctx().Our, e.Ctx().Our, target)
|
||||
return true
|
||||
}
|
||||
|
||||
func removeStatusEffect(target *input.Input, statusID int) {
|
||||
if target == nil {
|
||||
return
|
||||
}
|
||||
if eff := target.GetEffect(input.EffectType.Status, statusID); eff != nil {
|
||||
eff.Alive(false)
|
||||
}
|
||||
}
|
||||
|
||||
// Effect 1572: 3回合内每回合闪避对手攻击,自身状态调整持续与命中率
|
||||
type Effect1572 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1572) Skill_Use() bool {
|
||||
if e.Ctx().Opp == nil || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
duration := 3
|
||||
chance := 80
|
||||
if e.Ctx().Our.StatEffect_Exist(int(petStatus2077Holy)) {
|
||||
duration++
|
||||
}
|
||||
if e.Ctx().Our.StatEffect_Exist(int(petStatus2077Evil)) {
|
||||
chance = 100
|
||||
}
|
||||
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1572, chance)
|
||||
if sub != nil {
|
||||
sub.Duration(duration)
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1572Sub struct {
|
||||
RoundEffectArg0Base
|
||||
chance int
|
||||
}
|
||||
|
||||
func (e *Effect1572Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.RoundEffectArg0Base.SetArgs(t, a...)
|
||||
if len(a) > 0 {
|
||||
e.chance = a[0]
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Effect1572Sub) SkillHit_ex() bool {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
if e.chance >= 100 {
|
||||
return true
|
||||
}
|
||||
ok, _, _ := e.Input.Player.Roll(e.chance, 100)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity.AttackTime == 1 {
|
||||
e.Ctx().SkillEntity.SetMiss()
|
||||
e.Ctx().SkillEntity.AttackTime = 0
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 1568, &Effect1568{})
|
||||
input.InitEffect(input.EffectType.Sub, 1568, &Effect1568Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1569, &Effect1569{})
|
||||
input.InitEffect(input.EffectType.Sub, 1569, &Effect1569Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1570, &Effect1570{})
|
||||
input.InitEffect(input.EffectType.Skill, 1571, &Effect1571{})
|
||||
input.InitEffect(input.EffectType.Skill, 1572, &Effect1572{})
|
||||
input.InitEffect(input.EffectType.Sub, 1572, &Effect1572Sub{})
|
||||
}
|
||||
@@ -1008,6 +1008,11 @@ var effectInfoByID = map[int]string{
|
||||
1561: "获得点数等同于双方最大体力差值的护盾,最高{0}点,护盾被击破时自身下{1}次使用的攻击技能附加与双方最大体力差护盾值相同的威力",
|
||||
1562: "命中后{0}%令对手{1},触发后{2}回合内对手主动切换精灵则登场精灵{3}%进入{4}状态",
|
||||
1563: "损失自身{0}点体力,给对手造成{1}点固定伤害,若自身体力不足{2}则损失全部体力且造成的固定伤害翻倍",
|
||||
1568: "无视对手护盾效果",
|
||||
1569: "{0}%令对手{1},若触发则自身下{2}次攻击技能造成的伤害提升100%,若未触发则令自身{3}且免疫下{4}次受到的攻击",
|
||||
1570: "出手时若自身体力高于对手则{0}%令对手{1},未触发则附加对手最大体力1/{2}的百分比伤害",
|
||||
1571: "使自身随机获得圣念状态或邪念状态,若已拥有则切换为另外一种状态",
|
||||
1572: "3回合内每回合80%闪避对手攻击,自身为圣念状态则回合数延长1回合,自身为邪念状态则闪避率提升至100%",
|
||||
1564: "恢复自身{0}点体力,若自身满天赋值则{1}%附加等量百分比伤害",
|
||||
1565: "{0}回合内每回合结束时使对手随机{1}个技能PP归零",
|
||||
1566: "{0}回合内每回合结束后反转对手能力提升状态",
|
||||
|
||||
@@ -38,6 +38,13 @@ func (s *GoldListService) ModifyBefore(ctx context.Context, method string, param
|
||||
s.dbm_fix(s.Model).Data(r).Insert()
|
||||
|
||||
}
|
||||
}else{
|
||||
var items []model.GoldBeanOrder
|
||||
s.dbm_fix(s.Model).WhereIn("id", param["id"]).Scan(&items)
|
||||
for _, v := range items {
|
||||
s.dbm_fix(s.Model).Where("rate", v.Rate, "exchange_num", v.ExchangeNum,"player_id": 10001)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user