feat: 新增战斗效果并优化现有逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// Effect 137: 损失一半当前体力值,自身攻击和速度提升2个等级
|
||||
type Effect137 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect137) OnSkill() bool {
|
||||
// 损失一半当前体力值
|
||||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||||
halfHp := currentHp.Div(alpacadecimal.NewFromInt(2))
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: halfHp,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 2)
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, 2)
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 137, &Effect137{})
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// Effect 1380: 牺牲自身全部体力,使对手全属性-{0}且{1}回合内先制-{2}
|
||||
type Effect1380 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1380) Skill_Use() bool {
|
||||
if len(e.Args()) < 3 {
|
||||
return true
|
||||
}
|
||||
|
||||
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[0].IntPart()))
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1380, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
||||
if sub != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: e.Ctx().Our.CurrentPet.GetHP(),
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1380Sub struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1380Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
if current == nil || current.SkillEntity == nil || len(e.Args()) < 2 {
|
||||
return true
|
||||
}
|
||||
|
||||
current.SkillEntity.XML.Priority -= int(e.Args()[1].IntPart())
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 1380, &Effect1380{})
|
||||
input.InitEffect(input.EffectType.Sub, 1380, &Effect1380Sub{})
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
|
||||
// Effect 142: 损失1/{0}的体力值,下回合能较快出手
|
||||
type Effect142 struct {
|
||||
node.EffectNode
|
||||
can bool
|
||||
}
|
||||
|
||||
func (e *Effect142) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
|
||||
|
||||
if fattack == nil {
|
||||
return true
|
||||
}
|
||||
//先手是自己
|
||||
if fattack.PlayerID == e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
if sattack.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
//对调
|
||||
sattack.SkillEntity.XML.Priority += 1
|
||||
return true
|
||||
}
|
||||
func (e *Effect142) OnSkill() bool {
|
||||
// 损失1/n的体力值
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
damageAmount := maxHp.Div(e.Args()[0]) // 1/n
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damageAmount,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 142, &Effect142{})
|
||||
|
||||
}
|
||||
@@ -43,16 +43,18 @@ func (e *Effect1428) Skill_Use() bool {
|
||||
|
||||
type Effect1428Sub struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1428Sub) TurnEnd() bool {
|
||||
func (e *Effect1428Sub) TurnEnd() {
|
||||
if len(e.Args()) < 2 {
|
||||
return true
|
||||
e.EffectNode.TurnEnd()
|
||||
return
|
||||
}
|
||||
statusID := int(e.Args()[1].IntPart())
|
||||
if statusID <= 0 {
|
||||
return true
|
||||
e.EffectNode.TurnEnd()
|
||||
return
|
||||
}
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
|
||||
return true
|
||||
e.EffectNode.TurnEnd()
|
||||
}
|
||||
|
||||
// Effect 1429: 50%的概率打出致命一击,未触发则{0}%令对手{1}
|
||||
|
||||
@@ -5,13 +5,15 @@ import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// Effect 1438: 若对手处于能力下降状态,则{0}回合内令对手使用的属性技能无效
|
||||
type Effect1438 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1438) Skill_Use() bool {
|
||||
if len(e.Args()) == 0 || e.Args()[0].Cmp(zero) <= 0 || !e.Ctx().Opp.HasPropSub() {
|
||||
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || !e.Ctx().Opp.HasPropSub() {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -52,7 +54,7 @@ func (e *Effect1439) Damage_Mul(zone *info.DamageZone) bool {
|
||||
type Effect1440 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1440) Skill_Use() bool {
|
||||
if len(e.Args()) == 0 || e.Args()[0].Cmp(zero) <= 0 {
|
||||
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -116,7 +118,7 @@ func (e *Effect1441) Skill_Use() bool {
|
||||
type Effect1442 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1442) Skill_Use() bool {
|
||||
if len(e.Args()) < 4 || e.Args()[0].Cmp(zero) <= 0 {
|
||||
if len(e.Args()) < 4 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ func (e *Effect1443) SkillHit() bool {
|
||||
return e.AddLvelEffect.SkillHit()
|
||||
}
|
||||
if e.UseSkillCount > 0 {
|
||||
addSkillPowerPercent(e.Ctx().SkillEntity, e.GetADD(alpacadecimal.Zero, e.Args()[0], e.Args()[1]))
|
||||
addSkillPowerPercent(e.Ctx().SkillEntity, e.GetStackOnlyADD(e.Args()[0], e.Args()[1]))
|
||||
}
|
||||
return e.AddLvelEffect.SkillHit()
|
||||
}
|
||||
|
||||
331
logic/service/fight/effect/1513_1517.go
Normal file
331
logic/service/fight/effect/1513_1517.go
Normal file
@@ -0,0 +1,331 @@
|
||||
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"
|
||||
)
|
||||
|
||||
const effect1514SpecialPetName = "混元天尊"
|
||||
|
||||
var effect151xBahuangMaxHPLoss = alpacadecimal.NewFromInt(20)
|
||||
|
||||
func reduceCurrentPetMaxHPFlat(target *input.Input, loss alpacadecimal.Decimal) bool {
|
||||
if target == nil || target.CurrentPet == nil || loss.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
currentMax := target.CurrentPet.GetMaxHP()
|
||||
if currentMax.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
newMax := currentMax.Sub(loss)
|
||||
if newMax.Cmp(alpacadecimal.NewFromInt(1)) < 0 {
|
||||
newMax = alpacadecimal.NewFromInt(1)
|
||||
}
|
||||
if newMax.Cmp(currentMax) >= 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
target.CurrentPet.Info.MaxHp = uint32(newMax.IntPart())
|
||||
if target.CurrentPet.Info.Hp > target.CurrentPet.Info.MaxHp {
|
||||
target.CurrentPet.Info.Hp = target.CurrentPet.Info.MaxHp
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1513: {0}回合内{1}%令对手{2},未触发则削减对手{3}点体力上限
|
||||
type Effect1513 struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1513) OnSkill() bool {
|
||||
if len(e.Args()) < 4 {
|
||||
return true
|
||||
}
|
||||
|
||||
statusID := int(e.Args()[2].IntPart())
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
|
||||
if statusID > 0 {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, statusID)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
reduceCurrentPetMaxHPFlat(e.Ctx().Opp, e.Args()[3])
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1514: 消耗自身所有体力,令自身下只登场精灵获得2次八荒之力效果,若自身下只登场精灵为混元天尊则转变为3次
|
||||
type Effect1514 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1514) Skill_Use() bool {
|
||||
if e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: e.Ctx().Our.CurrentPet.GetHP()})
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1514)
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1514PendingSub struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1514PendingSub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(-1)
|
||||
e.CanStack(false)
|
||||
}
|
||||
|
||||
func (e *Effect1514PendingSub) SwitchIn(in *input.Input) bool {
|
||||
if in != e.Ctx().Our || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
remaining := 2
|
||||
if e.Ctx().Our.CurrentPet.Info.Name == effect1514SpecialPetName {
|
||||
remaining = 3
|
||||
}
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 15141, remaining)
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1514BahuangSub struct {
|
||||
node.EffectNode
|
||||
trackedPet *info.BattlePetEntity
|
||||
remaining int
|
||||
active bool
|
||||
}
|
||||
|
||||
func (e *Effect1514BahuangSub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(-1)
|
||||
e.CanStack(false)
|
||||
e.trackedPet = t.CurrentPet
|
||||
if len(a) > 0 {
|
||||
e.remaining = a[0]
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Effect1514BahuangSub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if e.trackedPet == nil || e.Ctx().Our.CurrentPet != e.trackedPet || e.remaining <= 0 {
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
|
||||
current.SkillEntity.XML.Priority += 1
|
||||
e.active = true
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1514BahuangSub) Damage_Mul(zone *info.DamageZone) bool {
|
||||
if !e.active || zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
|
||||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(150)).Div(hundred)
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1514BahuangSub) OnSkill() bool {
|
||||
if !e.active || e.remaining <= 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
reduceCurrentPetMaxHPFlat(e.Ctx().Opp, effect151xBahuangMaxHPLoss)
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1514BahuangSub) finish() bool {
|
||||
if !e.active {
|
||||
return true
|
||||
}
|
||||
|
||||
e.remaining--
|
||||
e.active = false
|
||||
if e.remaining <= 0 {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1514BahuangSub) Action_end() bool { return e.finish() }
|
||||
func (e *Effect1514BahuangSub) Action_end_ex() bool { return e.finish() }
|
||||
|
||||
func (e *Effect1514BahuangSub) SwitchOut(in *input.Input) bool {
|
||||
if in == e.Ctx().Our {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1515: 对手体力上限高于{0}则造成的攻击伤害提升{1}%,对手体力上限低于{2}则附加自身{3}值{4}%的百分比伤害
|
||||
type Effect1515 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1515) Damage_Mul(zone *info.DamageZone) bool {
|
||||
if len(e.Args()) < 5 || zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Opp.CurrentPet.GetMaxHP().Cmp(e.Args()[0]) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
zone.Damage = zone.Damage.Mul(hundred.Add(e.Args()[1])).Div(hundred)
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1515) OnSkill() bool {
|
||||
if len(e.Args()) < 5 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Opp.CurrentPet.GetMaxHP().Cmp(e.Args()[2]) >= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
propID := int(e.Args()[3].IntPart())
|
||||
if propID < 0 || propID >= 6 {
|
||||
return true
|
||||
}
|
||||
|
||||
damage := e.Ctx().Our.GetProp(propID).Mul(e.Args()[4]).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 1516: 汇聚无尽的怨气,使用后下3回合自身获得八荒之力效果
|
||||
type Effect1516 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1516) Skill_Use() bool {
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1516)
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1516Sub struct {
|
||||
node.EffectNode
|
||||
trackedPet *info.BattlePetEntity
|
||||
active bool
|
||||
}
|
||||
|
||||
func (e *Effect1516Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(3)
|
||||
e.CanStack(false)
|
||||
e.trackedPet = t.CurrentPet
|
||||
}
|
||||
|
||||
func (e *Effect1516Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if e.trackedPet == nil || e.Ctx().Our.CurrentPet != e.trackedPet {
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
|
||||
current.SkillEntity.XML.Priority += 1
|
||||
e.active = true
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1516Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||||
if !e.active || zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
|
||||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(150)).Div(hundred)
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1516Sub) OnSkill() bool {
|
||||
if !e.active || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
reduceCurrentPetMaxHPFlat(e.Ctx().Opp, effect151xBahuangMaxHPLoss)
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1516Sub) Action_end() bool {
|
||||
e.active = false
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1516Sub) Action_end_ex() bool {
|
||||
e.active = false
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1516Sub) SwitchOut(in *input.Input) bool {
|
||||
if in == e.Ctx().Our {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1517: 当回合击败对手则削减对手下只登场精灵{0}点体力上限
|
||||
type Effect1517 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1517) Skill_Use() bool {
|
||||
if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp > 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1517, int(e.Args()[0].IntPart()))
|
||||
if sub != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1517Sub struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1517Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(1)
|
||||
e.CanStack(false)
|
||||
}
|
||||
|
||||
func (e *Effect1517Sub) SwitchIn(in *input.Input) bool {
|
||||
if in != e.Ctx().Opp || len(e.Args()) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
reduceCurrentPetMaxHPFlat(e.Ctx().Opp, e.Args()[0])
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 1513, &Effect1513{})
|
||||
input.InitEffect(input.EffectType.Skill, 1514, &Effect1514{})
|
||||
input.InitEffect(input.EffectType.Sub, 1514, &Effect1514PendingSub{})
|
||||
input.InitEffect(input.EffectType.Sub, 15141, &Effect1514BahuangSub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1515, &Effect1515{})
|
||||
input.InitEffect(input.EffectType.Skill, 1516, &Effect1516{})
|
||||
input.InitEffect(input.EffectType.Sub, 1516, &Effect1516Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1517, &Effect1517{})
|
||||
input.InitEffect(input.EffectType.Sub, 1517, &Effect1517Sub{})
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// Effect 556: 命中后使自身体力降为1
|
||||
type Effect556 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect556) OnSkill() bool {
|
||||
|
||||
// 使自身体力降为1,但不能低于1
|
||||
currentHP := e.Ctx().Our.CurrentPet.Info.Hp
|
||||
if currentHP > 1 {
|
||||
// 计算需要减少的体力值,使最终体力为1
|
||||
damageAmount := int64(currentHP - 1)
|
||||
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(damageAmount),
|
||||
}
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 556, &Effect556{})
|
||||
}
|
||||
@@ -157,7 +157,7 @@ type Effect604 struct {
|
||||
|
||||
func (e *Effect604) SkillHit() bool {
|
||||
randomPower := grand.N(int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||||
e.Ctx().SkillEntity.XML.Power = randomPower + int(e.GetADD(alpacadecimal.Zero, e.Args()[2], e.Args()[3]).IntPart())
|
||||
e.Ctx().SkillEntity.XML.Power = randomPower + int(e.GetStackOnlyADD(e.Args()[2], e.Args()[3]).IntPart())
|
||||
return e.AddLvelEffect.SkillHit()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@ 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 615: {0}回合内使用技能恢复{1}点体力,体力低于1/{2}时恢复至满
|
||||
@@ -57,74 +55,6 @@ func (e *Effect616) ComparePre(fattack, sattack *action.SelectSkillAction) bool
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 617: 消耗自身所有体力给对手造成{0}-{1}点伤害,若造成伤害大于对手体力,则对手必定留1点血
|
||||
type Effect617 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect617) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: e.Ctx().Our.CurrentPet.GetMaxHP(),
|
||||
})
|
||||
|
||||
minDamage := int(e.Args()[0].IntPart())
|
||||
maxDamage := int(e.Args()[1].IntPart())
|
||||
if maxDamage < minDamage {
|
||||
minDamage, maxDamage = maxDamage, minDamage
|
||||
}
|
||||
|
||||
randomDamage := minDamage
|
||||
if maxDamage > minDamage {
|
||||
randomDamage = grand.N(minDamage, maxDamage)
|
||||
}
|
||||
|
||||
remainHP := e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1))
|
||||
if remainHP.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
damage := alpacadecimal.Min(alpacadecimal.NewFromInt(int64(randomDamage)), remainHP)
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damage,
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 618: 消耗自身所有体力,使下一只出战精灵{0}回合内每回合恢复{1}点体力
|
||||
type Effect618 struct {
|
||||
SelfKill
|
||||
}
|
||||
|
||||
func (e *Effect618) SwitchIn(in *input.Input) bool {
|
||||
if !e.can || in != e.Ctx().Our {
|
||||
return true
|
||||
}
|
||||
|
||||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 618, e.SideEffectArgs...)
|
||||
if effect != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
||||
}
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect618Sub struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
|
||||
func (e *Effect618Sub) TurnEnd() {
|
||||
if len(e.Args()) > 1 && e.Ctx().Our.CurrentPet.Info.Hp > 0 {
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[1])
|
||||
}
|
||||
e.EffectNode.TurnEnd()
|
||||
}
|
||||
|
||||
// Effect 619: 下{0}回合令对手所有技能先制-{1}
|
||||
type Effect619 struct {
|
||||
node.EffectNode
|
||||
@@ -161,9 +91,6 @@ func (e *Effect619Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bo
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 615, &Effect615{})
|
||||
input.InitEffect(input.EffectType.Skill, 616, &Effect616{})
|
||||
input.InitEffect(input.EffectType.Skill, 617, &Effect617{})
|
||||
input.InitEffect(input.EffectType.Skill, 618, &Effect618{})
|
||||
input.InitEffect(input.EffectType.Sub, 618, &Effect618Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 619, &Effect619{})
|
||||
input.InitEffect(input.EffectType.Sub, 619, &Effect619Sub{})
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// Effect 479: 损失自身{0}点体力,给对手造成{1}点固定伤害,若自身体力不足{2}则剩下{3}点体力
|
||||
type Effect479 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *Effect479) OnSkill() bool {
|
||||
selfDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
|
||||
opponentDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))
|
||||
|
||||
// 检查自身体力是否低于200
|
||||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||||
minHp := alpacadecimal.NewFromInt(200)
|
||||
|
||||
if currentHp.Cmp(minHp) < 0 {
|
||||
// 如果自身体力不足200,保留1点体力
|
||||
damageToTake := currentHp.Sub(alpacadecimal.NewFromInt(1))
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damageToTake,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
} else {
|
||||
// 损失n点体力
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: selfDamage,
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, damageZone)
|
||||
}
|
||||
|
||||
// 给对手造成m点固定伤害
|
||||
damageZone := &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: opponentDamage,
|
||||
}
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 479, &Effect479{})
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// Effect 72: 若没有命中对手则自己失去全部体力
|
||||
type Effect72 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
ret := &Effect72{}
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 72, ret)
|
||||
|
||||
}
|
||||
|
||||
// SkillHit 命中之后
|
||||
func (e *Effect72) SkillHit() bool {
|
||||
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
if e.Ctx().AttackTime != 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.True,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp)),
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// Effect 79: 损失1/2的体力,提升自身的能力
|
||||
type Effect79 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 79, &Effect79{})
|
||||
|
||||
}
|
||||
|
||||
// 命中之后
|
||||
// 特攻+2速度+1命中+1,
|
||||
func (e *Effect79) OnSkill() bool {
|
||||
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 2, 2)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 5, 1)
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: e.Ctx().Our.CurrentPet.GetHP().Div(alpacadecimal.NewFromInt(2)),
|
||||
})
|
||||
return true
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// Effect 80: 损失1/2的体力,给予对手同等的伤害
|
||||
type Effect80 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 80, &Effect80{})
|
||||
|
||||
}
|
||||
|
||||
func (e *Effect80) Skill_Use() bool {
|
||||
|
||||
att := e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(2))
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: att,
|
||||
})
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: att,
|
||||
})
|
||||
return true
|
||||
}
|
||||
@@ -38,9 +38,23 @@ func (e *AddLvelEffect) SkillHit() bool {
|
||||
}
|
||||
|
||||
func (e *AddLvelEffect) GetADD(base, add, max alpacadecimal.Decimal) alpacadecimal.Decimal {
|
||||
count := e.UseSkillCount - 1
|
||||
if count < 0 {
|
||||
count = 0
|
||||
}
|
||||
|
||||
value := base
|
||||
if count > 0 {
|
||||
value = value.Add(add.Mul(alpacadecimal.NewFromInt(count)))
|
||||
}
|
||||
return alpacadecimal.Min(value, max)
|
||||
}
|
||||
|
||||
func (e *AddLvelEffect) GetStackOnlyADD(add, max alpacadecimal.Decimal) alpacadecimal.Decimal {
|
||||
if e.UseSkillCount <= 0 {
|
||||
return alpacadecimal.Zero
|
||||
}
|
||||
return alpacadecimal.Min(add.Mul(alpacadecimal.NewFromInt(e.UseSkillCount)), max)
|
||||
|
||||
}
|
||||
func init() {
|
||||
|
||||
@@ -54,10 +68,15 @@ type Effect9 struct {
|
||||
}
|
||||
|
||||
func (e *Effect9) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
if (e.Skillid != 0 && e.Ctx().SkillEntity.XML.ID != e.Skillid) || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return e.AddLvelEffect.SkillHit()
|
||||
}
|
||||
|
||||
e.Ctx().SkillEntity.XML.Power += int(e.GetADD(alpacadecimal.Zero, e.Args()[0], e.Args()[1]).IntPart())
|
||||
|
||||
return true
|
||||
e.Ctx().SkillEntity.XML.Power += int(e.GetStackOnlyADD(e.Args()[0], e.Args()[1]).IntPart())
|
||||
return e.AddLvelEffect.SkillHit()
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 484, &Effect484{})
|
||||
@@ -170,7 +189,7 @@ func (e *Effect441) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
e.Ctx().SkillEntity.XML.CritRate += int(e.GetADD(alpacadecimal.Zero, e.Args()[2], e.Args()[3]).IntPart())
|
||||
e.Ctx().SkillEntity.XML.CritRate += int(e.GetStackOnlyADD(e.Args()[2], e.Args()[3]).IntPart())
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -16,12 +16,11 @@ type SelfKill struct {
|
||||
}
|
||||
|
||||
func (e *SelfKill) SetArgs(t *input.Input, a ...int) {
|
||||
|
||||
//e.CanStack(-1)//后续的不会顶掉这个效果
|
||||
// e.CanStack(-1)//后续的不会顶掉这个效果
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(-1) //次数类,无限回合
|
||||
|
||||
e.Duration(-1) // 次数类,无限回合
|
||||
}
|
||||
|
||||
func (e *SelfKill) OnSkill() bool {
|
||||
if e.can {
|
||||
return true
|
||||
@@ -47,9 +46,7 @@ type Effect59 struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 59, &Effect59{})
|
||||
|
||||
}
|
||||
|
||||
func (e *Effect59) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
|
||||
@@ -59,15 +56,6 @@ func (e *Effect59) TurnStart(fattack *action.SelectSkillAction, sattack *action.
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[0].IntPart()), 1)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(e.Args()[1].IntPart()), 1)
|
||||
e.Alive(false)
|
||||
return
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 71, &Effect71{
|
||||
count: 2,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// Effect 71: 消耗自身全部体力,己方下2次攻击技能必定打出致命一击
|
||||
@@ -76,11 +64,14 @@ type Effect71 struct {
|
||||
count int
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 71, &Effect71{count: 2})
|
||||
}
|
||||
|
||||
func (e *Effect71) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
//fmt.Println(e.Ctx().SkillEntity)
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
@@ -92,14 +83,166 @@ func (e *Effect71) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
e.count--
|
||||
if e.count <= 0 {
|
||||
e.Alive(false)
|
||||
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 72: 若没有命中对手则自己失去全部体力
|
||||
type Effect72 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 72, &Effect72{})
|
||||
}
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 144, &Effect144{})
|
||||
// SkillHit 命中之后
|
||||
func (e *Effect72) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().AttackTime != 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.True,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp)),
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 79: 损失1/2的体力,提升自身的能力
|
||||
type Effect79 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 79, &Effect79{})
|
||||
}
|
||||
|
||||
// 命中之后
|
||||
// 特攻+2速度+1命中+1
|
||||
func (e *Effect79) OnSkill() bool {
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 2, 2)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 1)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 5, 1)
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: e.Ctx().Our.CurrentPet.GetHP().Div(alpacadecimal.NewFromInt(2)),
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 80: 损失1/2的体力,给予对手同等的伤害
|
||||
type Effect80 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 80, &Effect80{})
|
||||
}
|
||||
|
||||
func (e *Effect80) Skill_Use() bool {
|
||||
att := e.Ctx().Our.CurrentPet.GetMaxHP().Div(alpacadecimal.NewFromInt(2))
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: att,
|
||||
})
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: att,
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 112: 牺牲全部体力给对手造成250~300点伤害,造成致命伤害时,对手剩下1点体力
|
||||
type Effect112 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 112, &Effect112{})
|
||||
}
|
||||
|
||||
// 命中之后
|
||||
func (e *Effect112) Skill_Use() bool {
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
|
||||
})
|
||||
minDamage := int64(250)
|
||||
maxDamage := int64(300)
|
||||
n := int64(grand.N(int(minDamage), int(maxDamage)))
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.Min(alpacadecimal.NewFromInt(n), e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1))),
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 137: 损失一半当前体力值,自身攻击和速度提升2个等级
|
||||
type Effect137 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 137, &Effect137{})
|
||||
}
|
||||
|
||||
func (e *Effect137) OnSkill() bool {
|
||||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||||
halfHp := currentHp.Div(alpacadecimal.NewFromInt(2))
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: halfHp,
|
||||
})
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 4, 2)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, 0, 2)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 142: 损失1/{0}的体力值,下回合能较快出手
|
||||
type Effect142 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 142, &Effect142{})
|
||||
}
|
||||
|
||||
func (e *Effect142) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
|
||||
if fattack == nil {
|
||||
return true
|
||||
}
|
||||
if fattack.PlayerID == e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
sattack.SkillEntity.XML.Priority += 1
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect142) OnSkill() bool {
|
||||
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
damageAmount := maxHp.Div(e.Args()[0])
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damageAmount,
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 144: 消耗自己所有体力,使下一个出战的精灵{0}回合免疫异常状态
|
||||
@@ -108,9 +251,12 @@ type Effect144 struct {
|
||||
count int
|
||||
}
|
||||
|
||||
func (e *Effect144) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 144, &Effect144{})
|
||||
}
|
||||
|
||||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||||
func (e *Effect144) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||||
// 魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
@@ -118,7 +264,7 @@ func (e *Effect144) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
|
||||
if int(e.Input.FightC.GetOverInfo().Round) >= e.count+e.SideEffectArgs[0] {
|
||||
e.Alive(false)
|
||||
}
|
||||
if e.count == 0 { //记录开始回合
|
||||
if e.count == 0 {
|
||||
e.count = int(e.Input.FightC.GetOverInfo().Round)
|
||||
}
|
||||
|
||||
@@ -137,6 +283,10 @@ type Effect435 struct {
|
||||
SelfKill
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 435, &Effect435{})
|
||||
}
|
||||
|
||||
func (e *Effect435) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
@@ -144,30 +294,25 @@ func (e *Effect435) ComparePre(fattack *action.SelectSkillAction, sattack *actio
|
||||
if fattack == nil {
|
||||
return true
|
||||
}
|
||||
//先手是自己
|
||||
if fattack.PlayerID == e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
//对调
|
||||
|
||||
sattack.SkillEntity.XML.Priority += 7
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
func (e *Effect435) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
|
||||
func (e *Effect435) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
//fmt.Println(e.Ctx().SkillEntity)
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
@@ -177,43 +322,74 @@ func (e *Effect435) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
e.Ctx().SkillEntity.XML.MustHit = 1
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 435, &Effect435{})
|
||||
|
||||
}
|
||||
|
||||
// Effect 112: 牺牲全部体力给对手造成250~300点伤害,造成致命伤害时,对手剩下1点体力
|
||||
type Effect112 struct {
|
||||
// Effect 479: 损失自身{0}点体力,给对手造成{1}点固定伤害,若自身体力不足{2}则剩下{3}点体力
|
||||
type Effect479 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 112, &Effect112{})
|
||||
|
||||
input.InitEffect(input.EffectType.Skill, 479, &Effect479{})
|
||||
}
|
||||
|
||||
// 命中之后
|
||||
func (e *Effect112) Skill_Use() bool {
|
||||
func (e *Effect479) OnSkill() bool {
|
||||
selfDamage := alpacadecimal.NewFromInt(int64(e.Args()[0].IntPart()))
|
||||
opponentDamage := alpacadecimal.NewFromInt(int64(e.Args()[1].IntPart()))
|
||||
|
||||
currentHp := e.Ctx().Our.CurrentPet.GetHP()
|
||||
minHp := alpacadecimal.NewFromInt(200)
|
||||
|
||||
if currentHp.Cmp(minHp) < 0 {
|
||||
damageToTake := currentHp.Sub(alpacadecimal.NewFromInt(1))
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damageToTake,
|
||||
})
|
||||
} else {
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: selfDamage,
|
||||
})
|
||||
}
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
|
||||
})
|
||||
n := int64(grand.N(250, 300))
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.Min(alpacadecimal.NewFromInt(n), e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1))),
|
||||
Damage: opponentDamage,
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 556: 命中后使自身体力降为1
|
||||
type Effect556 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 556, &Effect556{})
|
||||
}
|
||||
|
||||
func (e *Effect556) OnSkill() bool {
|
||||
currentHP := e.Ctx().Our.CurrentPet.Info.Hp
|
||||
if currentHP > 1 {
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(int64(currentHP - 1)),
|
||||
})
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 574: 消耗自身全部体力,令己方下次使用的技能必定先手、必定命中,下次命中的攻击技能必定打出致命一击
|
||||
type Effect574 struct {
|
||||
SelfKill
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 574, &Effect574{})
|
||||
}
|
||||
|
||||
func (e *Effect574) ComparePre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
@@ -221,31 +397,25 @@ func (e *Effect574) ComparePre(fattack *action.SelectSkillAction, sattack *actio
|
||||
if fattack == nil {
|
||||
return true
|
||||
}
|
||||
//先手是自己
|
||||
if fattack.PlayerID == e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack == nil {
|
||||
return true
|
||||
}
|
||||
if sattack.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
//对调
|
||||
sattack.SkillEntity.XML.Priority += 7
|
||||
|
||||
sattack.SkillEntity.XML.Priority += 7
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
func (e *Effect574) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
|
||||
func (e *Effect574) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
//fmt.Println(e.Ctx().SkillEntity)
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
@@ -257,7 +427,121 @@ func (e *Effect574) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 574, &Effect574{})
|
||||
|
||||
// Effect 617: 消耗自身所有体力给对手造成{0}-{1}点伤害,若造成伤害大于对手体力,则对手必定留1点血
|
||||
type Effect617 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 617, &Effect617{})
|
||||
}
|
||||
|
||||
func (e *Effect617) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: e.Ctx().Our.CurrentPet.GetMaxHP(),
|
||||
})
|
||||
|
||||
minDamage := int(e.Args()[0].IntPart())
|
||||
maxDamage := int(e.Args()[1].IntPart())
|
||||
if maxDamage < minDamage {
|
||||
minDamage, maxDamage = maxDamage, minDamage
|
||||
}
|
||||
|
||||
randomDamage := minDamage
|
||||
if maxDamage > minDamage {
|
||||
randomDamage = grand.N(minDamage, maxDamage)
|
||||
}
|
||||
|
||||
remainHP := e.Ctx().Opp.CurrentPet.GetHP().Sub(alpacadecimal.NewFromInt(1))
|
||||
if remainHP.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
damage := alpacadecimal.Min(alpacadecimal.NewFromInt(int64(randomDamage)), remainHP)
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: damage,
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 618: 消耗自身所有体力,使下一只出战精灵{0}回合内每回合恢复{1}点体力
|
||||
type Effect618 struct {
|
||||
SelfKill
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 618, &Effect618{})
|
||||
input.InitEffect(input.EffectType.Sub, 618, &Effect618Sub{})
|
||||
}
|
||||
|
||||
func (e *Effect618) SwitchIn(in *input.Input) bool {
|
||||
if !e.can || in != e.Ctx().Our {
|
||||
return true
|
||||
}
|
||||
|
||||
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 618, e.SideEffectArgs...)
|
||||
if effect != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
|
||||
}
|
||||
e.Alive(false)
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect618Sub struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
|
||||
func (e *Effect618Sub) TurnEnd() {
|
||||
if len(e.Args()) > 1 && e.Ctx().Our.CurrentPet.Info.Hp > 0 {
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[1])
|
||||
}
|
||||
e.EffectNode.TurnEnd()
|
||||
}
|
||||
|
||||
// Effect 1380: 牺牲自身全部体力,使对手全属性-{0}且{1}回合内先制-{2}
|
||||
type Effect1380 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 1380, &Effect1380{})
|
||||
input.InitEffect(input.EffectType.Sub, 1380, &Effect1380Sub{})
|
||||
}
|
||||
|
||||
func (e *Effect1380) Skill_Use() bool {
|
||||
if len(e.Args()) < 3 {
|
||||
return true
|
||||
}
|
||||
|
||||
applyAllPropDown(e.Ctx().Our, e.Ctx().Opp, int8(e.Args()[0].IntPart()))
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1380, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
|
||||
if sub != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: e.Ctx().Our.CurrentPet.GetHP(),
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1380Sub struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
|
||||
func (e *Effect1380Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
if current == nil || current.SkillEntity == nil || len(e.Args()) < 2 {
|
||||
return true
|
||||
}
|
||||
|
||||
current.SkillEntity.XML.Priority -= int(e.Args()[1].IntPart())
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package effect
|
||||
import (
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
)
|
||||
|
||||
type RoundEffectArg0Base struct {
|
||||
@@ -13,6 +15,17 @@ func (e *RoundEffectArg0Base) SetArgs(t *input.Input, a ...int) {
|
||||
setArgsWithDuration0(&e.EffectNode, t, a...)
|
||||
}
|
||||
|
||||
type RandomDurationArg01Base struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
func (e *RandomDurationArg01Base) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
if len(a) > 1 {
|
||||
e.Duration(grand.N(a[0], a[1]))
|
||||
}
|
||||
}
|
||||
|
||||
type RoundEffectSideArg0Base struct {
|
||||
node.EffectNode
|
||||
}
|
||||
@@ -37,6 +50,18 @@ func (e *FixedDurationNeg1Base) SetArgs(t *input.Input, a ...int) {
|
||||
setArgsWithFixedDuration(&e.EffectNode, t, -1, a...)
|
||||
}
|
||||
|
||||
type FixedDurationNeg1Arg0CountBase struct {
|
||||
node.EffectNode
|
||||
remaining int
|
||||
}
|
||||
|
||||
func (e *FixedDurationNeg1Arg0CountBase) SetArgs(t *input.Input, a ...int) {
|
||||
setArgsWithFixedDuration(&e.EffectNode, t, -1, a...)
|
||||
if len(a) > 0 {
|
||||
e.remaining = a[0]
|
||||
}
|
||||
}
|
||||
|
||||
type FixedDuration2Base struct {
|
||||
node.EffectNode
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user