refactor: 重构战斗效果逻辑实现
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 @@
|
||||
# Task 186: Effects 1543-1547
|
||||
|
||||
## 目标
|
||||
|
||||
- 补齐以下 5 个(或最后一组不足 5 个)当前判定未实现的 skill effect。
|
||||
- 实现位置优先放在 `logic/service/fight/effect/`。
|
||||
- 如 effect 需要展示说明,同步更新 `logic/service/fight/effect/effect_info_map.go`。
|
||||
- 完成后至少执行:`cd /workspace/logic && go test ./service/fight/effect`。
|
||||
|
||||
## Effect 列表
|
||||
|
||||
### Effect 1543
|
||||
- `argsNum`: `0`
|
||||
- `info`: `当回合击败对手则不消耗蓄力层数`
|
||||
|
||||
### Effect 1544
|
||||
- `argsNum`: `0`
|
||||
- `info`: `对手存在护盾时先制+1`
|
||||
|
||||
### Effect 1545
|
||||
- `argsNum`: `0`
|
||||
- `info`: `消除对手所有护盾效果,消除成功则为自身附加等量的护盾值`
|
||||
|
||||
### Effect 1546
|
||||
- `argsNum`: `3`
|
||||
- `info`: `1回合做{0}-{1}次攻击,自身每存在1层蓄力则连击上限次数额外增加{2}次`
|
||||
|
||||
### Effect 1547
|
||||
- `argsNum`: `0`
|
||||
- `info`: `自身每存在3层蓄力先制额外+1`
|
||||
|
||||
## 备注
|
||||
|
||||
- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。
|
||||
- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。
|
||||
@@ -1,35 +0,0 @@
|
||||
# Task 187: Effects 1548-1552
|
||||
|
||||
## 目标
|
||||
|
||||
- 补齐以下 5 个(或最后一组不足 5 个)当前判定未实现的 skill effect。
|
||||
- 实现位置优先放在 `logic/service/fight/effect/`。
|
||||
- 如 effect 需要展示说明,同步更新 `logic/service/fight/effect/effect_info_map.go`。
|
||||
- 完成后至少执行:`cd /workspace/logic && go test ./service/fight/effect`。
|
||||
|
||||
## Effect 列表
|
||||
|
||||
### Effect 1548
|
||||
- `argsNum`: `1`
|
||||
- `info`: `当回合未击败对手则使自身下回合受到的伤害降低{0}%`
|
||||
|
||||
### Effect 1549
|
||||
- `argsNum`: `1`
|
||||
- `info`: `后出手时下回合攻击技能先制+{0}`
|
||||
|
||||
### Effect 1550
|
||||
- `argsNum`: `0`
|
||||
- `info`: `减少自身最大体力的1/2(最多减少至1)并附加减少量2/3的真实伤害,自身的蓄力层数≥8层时不减少自身体力`
|
||||
|
||||
### Effect 1551
|
||||
- `argsNum`: `2`
|
||||
- `info`: `{0}%消耗自身全部体力,{1}%消耗敌方全部体力,若自身触发效果则消除敌方所有PP值,若敌方触发效果则消除自身所有PP值,均未触发则恢复自身全部体力`
|
||||
|
||||
### Effect 1552
|
||||
- `argsNum`: `0`
|
||||
- `info`: `集结天幕四龙之神力,使自身下2回合攻击必定先手、必定命中、必定致命`
|
||||
|
||||
## 备注
|
||||
|
||||
- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。
|
||||
- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。
|
||||
@@ -1,37 +0,0 @@
|
||||
# Task 191: Effects 1568-1572
|
||||
|
||||
## 目标
|
||||
|
||||
- 补齐以下 5 个(或最后一组不足 5 个)当前判定未实现的 skill effect。
|
||||
- 实现位置优先放在 `logic/service/fight/effect/`。
|
||||
- 如 effect 需要展示说明,同步更新 `logic/service/fight/effect/effect_info_map.go`。
|
||||
- 完成后至少执行:`cd /workspace/logic && go test ./service/fight/effect`。
|
||||
|
||||
## Effect 列表
|
||||
|
||||
### Effect 1568
|
||||
- `argsNum`: `0`
|
||||
- `info`: `无视对手护盾效果`
|
||||
|
||||
### Effect 1569
|
||||
- `argsNum`: `5`
|
||||
- `info`: `{0}%令对手{1},若触发则自身下{2}次攻击技能造成的伤害提升100%,若未触发则令自身{3}且免疫下{4}次受到的攻击`
|
||||
- `param`: `1,1,1|1,3,3`
|
||||
|
||||
### Effect 1570
|
||||
- `argsNum`: `3`
|
||||
- `info`: `出手时若自身体力高于对手则{0}%令对手{1},未触发则附加对手最大体力1/{2}的百分比伤害`
|
||||
- `param`: `1,1,1`
|
||||
|
||||
### Effect 1571
|
||||
- `argsNum`: `0`
|
||||
- `info`: `使自身随机获得圣念状态或邪念状态,若已拥有则切换为另外一种状态`
|
||||
|
||||
### Effect 1572
|
||||
- `argsNum`: `0`
|
||||
- `info`: `3回合内每回合80%闪避对手攻击,自身为圣念状态则回合数延长1回合,自身为邪念状态则闪避率提升至100%`
|
||||
|
||||
## 备注
|
||||
|
||||
- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。
|
||||
- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。
|
||||
@@ -1,36 +0,0 @@
|
||||
# Task 192: Effects 1573-1577
|
||||
|
||||
## 目标
|
||||
|
||||
- 补齐以下 5 个(或最后一组不足 5 个)当前判定未实现的 skill effect。
|
||||
- 实现位置优先放在 `logic/service/fight/effect/`。
|
||||
- 如 effect 需要展示说明,同步更新 `logic/service/fight/effect/effect_info_map.go`。
|
||||
- 完成后至少执行:`cd /workspace/logic && go test ./service/fight/effect`。
|
||||
|
||||
## Effect 列表
|
||||
|
||||
### Effect 1573
|
||||
- `argsNum`: `0`
|
||||
- `info`: `自身为圣念状态时下2回合受到的攻击伤害减少50%,自身为邪念状态时下2回合造成的攻击伤害提升50%`
|
||||
|
||||
### Effect 1574
|
||||
- `argsNum`: `3`
|
||||
- `info`: `附加自身攻击值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%`
|
||||
|
||||
### Effect 1575
|
||||
- `argsNum`: `2`
|
||||
- `info`: `下{0}回合后出手则对手{1}`
|
||||
- `param`: `1,1,1`
|
||||
|
||||
### Effect 1576
|
||||
- `argsNum`: `1`
|
||||
- `info`: `消耗自身全部体力,使对手{0}回合内无法通过自身技能恢复体力`
|
||||
|
||||
### Effect 1577
|
||||
- `argsNum`: `5`
|
||||
- `info`: `{0}回合做{1}-{2}次攻击,当前技能PP值小于{3}时连击上限为{4}`
|
||||
|
||||
## 备注
|
||||
|
||||
- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。
|
||||
- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。
|
||||
@@ -1,36 +0,0 @@
|
||||
# Task 193: Effects 1578-1582
|
||||
|
||||
## 目标
|
||||
|
||||
- 补齐以下 5 个(或最后一组不足 5 个)当前判定未实现的 skill effect。
|
||||
- 实现位置优先放在 `logic/service/fight/effect/`。
|
||||
- 如 effect 需要展示说明,同步更新 `logic/service/fight/effect/effect_info_map.go`。
|
||||
- 完成后至少执行:`cd /workspace/logic && go test ./service/fight/effect`。
|
||||
|
||||
## Effect 列表
|
||||
|
||||
### Effect 1578
|
||||
- `argsNum`: `2`
|
||||
- `info`: `出手时自身护盾值高于{0}则自身下回合攻击技能先制+{1}`
|
||||
|
||||
### Effect 1579
|
||||
- `argsNum`: `2`
|
||||
- `info`: `出手时自身护盾值低于{0}则下回合属性技能先制+{1}`
|
||||
|
||||
### Effect 1580
|
||||
- `argsNum`: `2`
|
||||
- `info`: `出手时对手体力高于最大体力的1/{0}则造成伤害的{1}%恢复自身体力`
|
||||
|
||||
### Effect 1581
|
||||
- `argsNum`: `2`
|
||||
- `info`: `出手时对手体力低于最大体力的1/{0}则造成的伤害提升{1}%`
|
||||
|
||||
### Effect 1582
|
||||
- `argsNum`: `5`
|
||||
- `info`: `{0}%令对手{1},{2}%令自身{3},均未触发则为自身附加{4}点护盾`
|
||||
- `param`: `1,1,1|1,3,3`
|
||||
|
||||
## 备注
|
||||
|
||||
- 该清单按当前仓库静态注册结果生成;如果某个 effect 实际通过其他模块或运行时路径实现,需要先复核后再落代码。
|
||||
- 对 `201`、`445` 这类占位 effect,优先补核心逻辑或补充明确的不可实现说明。
|
||||
@@ -29,13 +29,13 @@ func getChargeRecord(in *input.Input) *chargeRecord {
|
||||
return value.(*chargeRecord)
|
||||
}
|
||||
|
||||
func (c *chargeRecord) addLayers(delta int) {
|
||||
func (c *chargeRecord) getLayers() int {
|
||||
if c == nil {
|
||||
return 0
|
||||
}
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.layers += delta
|
||||
if c.layers < 0 {
|
||||
c.layers = 0
|
||||
}
|
||||
return c.layers
|
||||
}
|
||||
|
||||
func (c *chargeRecord) setSkipConsume(skip bool) {
|
||||
@@ -47,51 +47,24 @@ func (c *chargeRecord) setSkipConsume(skip bool) {
|
||||
c.mu.Unlock()
|
||||
}
|
||||
|
||||
func (c *chargeRecord) getLayers() int {
|
||||
if c == nil {
|
||||
return 0
|
||||
}
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
return c.layers
|
||||
}
|
||||
|
||||
func (c *chargeRecord) shouldSkipConsume() bool {
|
||||
if c == nil {
|
||||
return false
|
||||
}
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
skip := c.skipConsume
|
||||
c.skipConsume = false
|
||||
return skip
|
||||
}
|
||||
|
||||
// Effect 1543: 当回合击败对手则不消耗蓄力层数
|
||||
type Effect1543 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
type Effect1543 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1543) TurnEnd() {
|
||||
if e.Ctx().Opp != nil && e.Ctx().Opp.CurrentPet != nil && e.Ctx().Opp.CurrentPet.Info.Hp == 0 {
|
||||
setChargeSkip(e.Ctx().Our)
|
||||
func (e *Effect1543) Skill_Use() bool {
|
||||
if e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp > 0 {
|
||||
return true
|
||||
}
|
||||
e.EffectNode.TurnEnd()
|
||||
}
|
||||
|
||||
func setChargeSkip(our *input.Input) {
|
||||
if rec := getChargeRecord(our); rec != nil {
|
||||
if rec := getChargeRecord(e.Ctx().Our); rec != nil {
|
||||
rec.setSkipConsume(true)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1544: 对手存在护盾时先制+1
|
||||
type Effect1544 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
type Effect1544 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1544) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if e.Ctx().Opp == nil || e.Ctx().Opp.CurrentShield().Cmp(alpacadecimal.Zero) <= 0 {
|
||||
if e.Ctx().Opp == nil || !e.Ctx().Opp.HasShield() {
|
||||
return true
|
||||
}
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
@@ -103,69 +76,73 @@ func (e *Effect1544) ComparePre(fattack, sattack *action.SelectSkillAction) bool
|
||||
}
|
||||
|
||||
// Effect 1545: 消除对手所有护盾效果,消除成功则为自身附加等量的护盾值
|
||||
type Effect1545 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
type Effect1545 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1545) Skill_Use() bool {
|
||||
if e.Ctx().Opp == nil || e.Ctx().Our == nil {
|
||||
if e.Ctx().Our == nil || e.Ctx().Opp == nil {
|
||||
return true
|
||||
}
|
||||
shield := e.Ctx().Opp.ConsumeAllShield()
|
||||
if shield.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Our.AddShield(shield)
|
||||
if shield.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
e.Ctx().Our.AddShield(shield)
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1546: 1回合做{0}-{1}次攻击,自身每存在1层蓄力则连击上限次数额外增加{2}次
|
||||
type Effect1546 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
type Effect1546 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1546) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || len(e.Args()) < 3 {
|
||||
if len(e.Args()) < 3 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
min := int(e.Args()[0].IntPart())
|
||||
max := int(e.Args()[1].IntPart())
|
||||
if max < min {
|
||||
min, max = max, min
|
||||
|
||||
minHits := int(e.Args()[0].IntPart())
|
||||
maxHits := int(e.Args()[1].IntPart())
|
||||
if minHits <= 0 {
|
||||
minHits = 1
|
||||
}
|
||||
if max < 1 {
|
||||
max = 1
|
||||
}
|
||||
hits := min
|
||||
if max > min {
|
||||
hits += grand.Intn(max - min + 1)
|
||||
if maxHits < minHits {
|
||||
maxHits = minHits
|
||||
}
|
||||
|
||||
if rec := getChargeRecord(e.Ctx().Our); rec != nil {
|
||||
hits += rec.getLayers() * int(e.Args()[2].IntPart())
|
||||
maxHits += rec.getLayers() * int(e.Args()[2].IntPart())
|
||||
}
|
||||
if hits <= 0 {
|
||||
hits = 1
|
||||
if maxHits < minHits {
|
||||
maxHits = minHits
|
||||
}
|
||||
e.Ctx().SkillEntity.AttackTime = uint32(hits)
|
||||
|
||||
hits := minHits
|
||||
if maxHits > minHits {
|
||||
hits += grand.Intn(maxHits - minHits + 1)
|
||||
}
|
||||
if hits <= 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().SkillEntity.AttackTime += uint32(hits - 1)
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1547: 自身每存在3层蓄力先制额外+1
|
||||
type Effect1547 struct {
|
||||
node.EffectNode
|
||||
}
|
||||
type Effect1547 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1547) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if e.Ctx().SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
if current == nil || current.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
layers := getChargeRecord(e.Ctx().Our).getLayers()
|
||||
if layers <= 0 {
|
||||
|
||||
layers := 0
|
||||
if rec := getChargeRecord(e.Ctx().Our); rec != nil {
|
||||
layers = rec.getLayers()
|
||||
}
|
||||
if layers < 3 {
|
||||
return true
|
||||
}
|
||||
|
||||
current.SkillEntity.XML.Priority += layers / 3
|
||||
return true
|
||||
}
|
||||
|
||||
215
logic/service/fight/effect/1548_1552.go
Normal file
215
logic/service/fight/effect/1548_1552.go
Normal file
@@ -0,0 +1,215 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"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 1548: 当回合未击败对手则使自身下回合受到的伤害降低{0}%
|
||||
type Effect1548 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1548) Skill_Use() bool {
|
||||
if len(e.Args()) == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
|
||||
return true
|
||||
}
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1548, int(e.Args()[0].IntPart()))
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1548Sub struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1548Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(1)
|
||||
e.CanStack(false)
|
||||
}
|
||||
|
||||
func (e *Effect1548Sub) DamageDivEx(zone *info.DamageZone) bool {
|
||||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) == 0 {
|
||||
return true
|
||||
}
|
||||
zone.Damage = zone.Damage.Mul(hundred.Sub(e.Args()[0])).Div(hundred)
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1549: 后出手时下回合攻击技能先制+{0}
|
||||
type Effect1549 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1549) Skill_Use() bool {
|
||||
if len(e.Args()) == 0 || e.IsFirst() {
|
||||
return true
|
||||
}
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1549, int(e.Args()[0].IntPart()))
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1549Sub struct {
|
||||
node.EffectNode
|
||||
remaining int
|
||||
priority int
|
||||
}
|
||||
|
||||
func (e *Effect1549Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(-1)
|
||||
e.CanStack(false)
|
||||
e.remaining = 1
|
||||
if len(a) > 0 {
|
||||
e.priority = a[0]
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Effect1549Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if 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 += e.priority
|
||||
e.remaining--
|
||||
if e.remaining <= 0 {
|
||||
e.Alive(false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1550: 减少自身最大体力的1/2(最多减少至1)并附加减少量2/3的真实伤害,自身的蓄力层数≥8层时不减少自身体力
|
||||
type Effect1550 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1550) Skill_Use() bool {
|
||||
if e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
layers := 0
|
||||
if rec := getChargeRecord(e.Ctx().Our); rec != nil {
|
||||
layers = rec.getLayers()
|
||||
}
|
||||
if layers >= 8 {
|
||||
return true
|
||||
}
|
||||
|
||||
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
|
||||
loss := maxHP.Div(alpacadecimal.NewFromInt(2))
|
||||
if loss.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
newMax := maxHP.Sub(loss)
|
||||
if newMax.Cmp(alpacadecimal.NewFromInt(1)) < 0 {
|
||||
loss = maxHP.Sub(alpacadecimal.NewFromInt(1))
|
||||
newMax = alpacadecimal.NewFromInt(1)
|
||||
}
|
||||
if loss.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.CurrentPet.Info.MaxHp = uint32(newMax.IntPart())
|
||||
if e.Ctx().Our.CurrentPet.Info.Hp > e.Ctx().Our.CurrentPet.Info.MaxHp {
|
||||
e.Ctx().Our.CurrentPet.Info.Hp = e.Ctx().Our.CurrentPet.Info.MaxHp
|
||||
}
|
||||
|
||||
damage := loss.Mul(alpacadecimal.NewFromInt(2)).Div(alpacadecimal.NewFromInt(3))
|
||||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.True,
|
||||
Damage: damage,
|
||||
})
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1551: {0}%消耗自身全部体力,{1}%消耗敌方全部体力,若自身触发效果则消除敌方所有PP值,若敌方触发效果则消除自身所有PP值,均未触发则恢复自身全部体力
|
||||
type Effect1551 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1551) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
selfTriggered, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
||||
oppTriggered, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||||
|
||||
if selfTriggered {
|
||||
damage := e.Ctx().Our.CurrentPet.GetHP()
|
||||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
|
||||
}
|
||||
zeroAllSkillPP(e.Ctx().Opp)
|
||||
}
|
||||
|
||||
if oppTriggered {
|
||||
damage := e.Ctx().Opp.CurrentPet.GetHP()
|
||||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
|
||||
}
|
||||
zeroAllSkillPP(e.Ctx().Our)
|
||||
}
|
||||
|
||||
if selfTriggered || oppTriggered {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().Our.Heal(
|
||||
e.Ctx().Our,
|
||||
&action.SelectSkillAction{BaseAction: action.BaseAction{PlayerID: e.Ctx().Our.UserID}},
|
||||
e.Ctx().Our.CurrentPet.GetMaxHP(),
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1552: 集结天幕四龙之神力,使自身下2回合攻击必定先手、必定命中、必定致命
|
||||
type Effect1552 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1552) Skill_Use() bool {
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1552)
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1552Sub struct{ FixedDuration2Base }
|
||||
|
||||
func (e *Effect1552Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
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 = math.MaxInt
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1552Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
e.Ctx().SkillEntity.XML.MustHit = 1
|
||||
e.Ctx().SkillEntity.XML.CritRate = 16
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 1548, &Effect1548{})
|
||||
input.InitEffect(input.EffectType.Sub, 1548, &Effect1548Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1549, &Effect1549{})
|
||||
input.InitEffect(input.EffectType.Sub, 1549, &Effect1549Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1550, &Effect1550{})
|
||||
input.InitEffect(input.EffectType.Skill, 1551, &Effect1551{})
|
||||
input.InitEffect(input.EffectType.Skill, 1552, &Effect1552{})
|
||||
input.InitEffect(input.EffectType.Sub, 1552, &Effect1552Sub{})
|
||||
}
|
||||
@@ -1,19 +1,20 @@
|
||||
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 {
|
||||
func (e *Effect1568) SkillHit() bool {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1568)
|
||||
if sub != nil {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||||
@@ -23,6 +24,12 @@ func (e *Effect1568) Skill_Use() bool {
|
||||
|
||||
type Effect1568Sub struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1568Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(1)
|
||||
e.CanStack(false)
|
||||
}
|
||||
|
||||
func (e *Effect1568Sub) Damage_Shield(zone *info.DamageZone) bool {
|
||||
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
@@ -42,19 +49,15 @@ func (e *Effect1568Sub) SwitchOut(in *input.Input) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1569: {0}%令对手{1},触发时自身下{2}次攻击伤害翻倍,未触发则自身{3}且免疫下{4}次攻击
|
||||
// Effect 1569: {0}%令对手{1},若触发则自身下{2}次攻击技能造成的伤害提升100%,若未触发则令自身{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()))
|
||||
if ok && addStatusByID(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)
|
||||
@@ -62,10 +65,10 @@ func (e *Effect1569) Skill_Use() bool {
|
||||
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)
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(e.Args()[3].IntPart()))
|
||||
immune := e.Ctx().Our.InitEffect(input.EffectType.Skill, 570, int(e.Args()[4].IntPart()))
|
||||
if immune != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, immune)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -73,22 +76,22 @@ func (e *Effect1569) Skill_Use() bool {
|
||||
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)
|
||||
e.CanStack(false)
|
||||
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 {
|
||||
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(2))
|
||||
@@ -99,48 +102,28 @@ func (e *Effect1569Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||||
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 {
|
||||
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp.CurrentPet == nil {
|
||||
if e.Ctx().Our.CurrentPet.GetHP().Cmp(e.Ctx().Opp.CurrentPet.GetHP()) <= 0 {
|
||||
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)
|
||||
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()))
|
||||
addStatusByID(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])
|
||||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Percent,
|
||||
Damage: damage,
|
||||
@@ -148,87 +131,59 @@ func (e *Effect1570) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1571: 使自身随机获得圣念状态或邪念状态,若已拥有则切换旨在另一个状态
|
||||
// Effect 1571: 使自身随机获得圣念状态或邪念状态,若已拥有则切换为另外一种状态
|
||||
type Effect1571 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1571) Skill_Use() bool {
|
||||
if e.Ctx().Our == nil {
|
||||
if holy := e.Ctx().Our.GetEffect(input.EffectType.Status, int(petStatus2077Holy)); holy != nil && holy.Alive() {
|
||||
holy.Alive(false)
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(petStatus2077Evil))
|
||||
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)
|
||||
if evil := e.Ctx().Our.GetEffect(input.EffectType.Status, int(petStatus2077Evil)); evil != nil && evil.Alive() {
|
||||
evil.Alive(false)
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(petStatus2077Holy))
|
||||
return true
|
||||
}
|
||||
if ok, _, _ := e.Input.Player.Roll(50, 100); ok {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Our, int(petStatus2077Holy))
|
||||
} else {
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Our, 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回合内每回合闪避对手攻击,自身状态调整持续与命中率
|
||||
// Effect 1572: 3回合内每回合80%闪避对手攻击,自身为圣念状态则回合数延长1回合,自身为邪念状态则闪避率提升至100%
|
||||
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)) {
|
||||
if e.Ctx().Our.StatEffect_Exist(petStatus2077Holy) {
|
||||
duration++
|
||||
}
|
||||
if e.Ctx().Our.StatEffect_Exist(int(petStatus2077Evil)) {
|
||||
if e.Ctx().Our.StatEffect_Exist(petStatus2077Evil) {
|
||||
chance = 100
|
||||
}
|
||||
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1572, chance)
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1572, duration, chance)
|
||||
if sub != nil {
|
||||
sub.Duration(duration)
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||||
e.Ctx().Our.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]
|
||||
}
|
||||
}
|
||||
type Effect1572Sub struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1572Sub) SkillHit_ex() bool {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
if len(e.Args()) < 2 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
if e.chance >= 100 {
|
||||
if e.Ctx().SkillEntity.AttackTime == 2 {
|
||||
return true
|
||||
}
|
||||
ok, _, _ := e.Input.Player.Roll(e.chance, 100)
|
||||
ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
|
||||
if ok {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity.AttackTime == 1 {
|
||||
e.Ctx().SkillEntity.SetMiss()
|
||||
e.Ctx().SkillEntity.AttackTime = 0
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -10,99 +10,85 @@ import (
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
)
|
||||
|
||||
const (
|
||||
statusSaintEffect = 3001
|
||||
statusDemonEffect = 3002
|
||||
)
|
||||
|
||||
var hundred = alpacadecimal.NewFromInt(100)
|
||||
|
||||
func isStatusActive(target *input.Input, statusID int) bool {
|
||||
if target == nil || statusID <= 0 {
|
||||
return false
|
||||
}
|
||||
eff := target.GetEffect(input.EffectType.Status, statusID)
|
||||
return eff != nil && eff.Alive()
|
||||
}
|
||||
|
||||
func addStatusByID(owner, target *input.Input, statusID int) bool {
|
||||
if owner == nil || target == nil || statusID <= 0 {
|
||||
return false
|
||||
}
|
||||
eff := owner.InitEffect(input.EffectType.Status, statusID)
|
||||
if eff == nil {
|
||||
return false
|
||||
}
|
||||
target.AddEffect(owner, eff)
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1573: 自身为圣念状态时下2回合受到的攻击伤害减少50%,自身为邪念状态时下2回合造成的攻击伤害提升50%
|
||||
type Effect1573 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1573) DamageDivEx(zone *info.DamageZone) bool {
|
||||
if zone == nil || zone.Type != info.DamageType.Red {
|
||||
func (e *Effect1573) Skill_Use() bool {
|
||||
mode := 0
|
||||
if e.Ctx().Our.StatEffect_Exist(petStatus2077Holy) {
|
||||
mode = 1
|
||||
} else if e.Ctx().Our.StatEffect_Exist(petStatus2077Evil) {
|
||||
mode = 2
|
||||
}
|
||||
if mode == 0 {
|
||||
return true
|
||||
}
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1573, mode)
|
||||
if sub != nil {
|
||||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1573Sub struct {
|
||||
FixedDuration2Base
|
||||
mode int
|
||||
}
|
||||
|
||||
func (e *Effect1573Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.FixedDuration2Base.SetArgs(t, a...)
|
||||
if len(a) > 0 {
|
||||
e.mode = a[0]
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Effect1573Sub) DamageDivEx(zone *info.DamageZone) bool {
|
||||
if e.mode != 1 || zone == nil || zone.Type != info.DamageType.Red {
|
||||
return true
|
||||
}
|
||||
if hasSaint := isStatusActive(e.Ctx().Our, statusSaintEffect); hasSaint {
|
||||
zone.Damage = zone.Damage.Div(alpacadecimal.NewFromInt(2))
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1573Sub) Damage_Mul(zone *info.DamageZone) bool {
|
||||
if e.mode != 2 || zone == nil || zone.Type != info.DamageType.Red {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
if isStatusActive(e.Ctx().Our, statusDemonEffect) {
|
||||
zone.Damage = zone.Damage.Mul(alpacadecimal.NewFromInt(3)).Div(alpacadecimal.NewFromInt(2))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1574: 附加自身攻击值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%
|
||||
type Effect1574 struct {
|
||||
node.EffectNode
|
||||
currentPercent alpacadecimal.Decimal
|
||||
increment alpacadecimal.Decimal
|
||||
maxPercent alpacadecimal.Decimal
|
||||
bonus int
|
||||
}
|
||||
|
||||
func (e *Effect1574) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
if len(a) >= 1 {
|
||||
e.currentPercent = alpacadecimal.NewFromInt(int64(a[0]))
|
||||
}
|
||||
if len(a) >= 2 {
|
||||
e.increment = alpacadecimal.NewFromInt(int64(a[1]))
|
||||
}
|
||||
if len(a) >= 3 {
|
||||
e.maxPercent = alpacadecimal.NewFromInt(int64(a[2]))
|
||||
}
|
||||
if e.maxPercent.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
e.maxPercent = alpacadecimal.NewFromInt(100)
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Effect1574) DamageAdd(zone *info.DamageZone) bool {
|
||||
if zone == nil || zone.Type != info.DamageType.Red || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
return true
|
||||
}
|
||||
if e.currentPercent.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
func (e *Effect1574) OnSkill() bool {
|
||||
if len(e.Args()) < 3 || e.Ctx().Our == nil || e.Ctx().Opp == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
sum := e.Ctx().Our.GetProp(0).Add(e.Ctx().Our.GetProp(4))
|
||||
if sum.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
percent := int(e.Args()[0].IntPart()) + e.bonus
|
||||
maxPercent := int(e.Args()[2].IntPart())
|
||||
if percent > maxPercent {
|
||||
percent = maxPercent
|
||||
}
|
||||
if percent <= 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
extra := sum.Mul(e.currentPercent).Div(hundred)
|
||||
if extra.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
zone.Damage = zone.Damage.Add(extra)
|
||||
|
||||
if e.increment.Cmp(alpacadecimal.Zero) > 0 && e.currentPercent.Cmp(e.maxPercent) < 0 {
|
||||
e.currentPercent = e.currentPercent.Add(e.increment)
|
||||
if e.currentPercent.Cmp(e.maxPercent) > 0 {
|
||||
e.currentPercent = e.maxPercent
|
||||
}
|
||||
damage := e.Ctx().Our.GetProp(0).Add(e.Ctx().Our.GetProp(4)).Mul(alpacadecimal.NewFromInt(int64(percent))).Div(hundred)
|
||||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Percent,
|
||||
Damage: damage,
|
||||
})
|
||||
}
|
||||
e.bonus += int(e.Args()[1].IntPart())
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -126,22 +112,19 @@ type Effect1575Sub struct {
|
||||
}
|
||||
|
||||
func (e *Effect1575Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.Duration(-1)
|
||||
e.RoundEffectArg0Base.SetArgs(t, a...)
|
||||
e.CanStack(false)
|
||||
if len(a) >= 1 {
|
||||
e.Duration(a[0])
|
||||
}
|
||||
if len(a) >= 2 {
|
||||
if len(a) > 1 {
|
||||
e.statusID = a[1]
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Effect1575Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
|
||||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
||||
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
|
||||
if current == nil || current.SkillEntity == nil {
|
||||
return true
|
||||
}
|
||||
if e.IsFirst() {
|
||||
if e.Duration() > 1 || e.IsFirst() {
|
||||
return true
|
||||
}
|
||||
addStatusByID(e.Ctx().Our, e.Ctx().Opp, e.statusID)
|
||||
@@ -153,17 +136,12 @@ func (e *Effect1575Sub) ComparePre(fattack, sattack *action.SelectSkillAction) b
|
||||
type Effect1576 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1576) Skill_Use() bool {
|
||||
if e.Ctx().Our == nil || e.Ctx().Opp == nil || e.Ctx().Our.CurrentPet == nil {
|
||||
if len(e.Args()) == 0 || e.Ctx().Our == nil || e.Ctx().Our.CurrentPet == nil || e.Ctx().Opp == nil {
|
||||
return true
|
||||
}
|
||||
damage := e.Ctx().Our.CurrentPet.GetHP()
|
||||
if damage.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
if damage.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
|
||||
|
||||
if len(e.Args()) == 0 {
|
||||
return true
|
||||
}
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1576, int(e.Args()[0].IntPart()))
|
||||
if sub != nil {
|
||||
@@ -172,16 +150,13 @@ func (e *Effect1576) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type Effect1576Sub struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
type Effect1576Sub struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1576Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
|
||||
if value == nil || *value <= 0 {
|
||||
return true
|
||||
}
|
||||
skill, ok := ac.(*action.SelectSkillAction)
|
||||
if !ok || skill.GetPlayerID() != e.Ctx().Opp.Player.GetInfo().UserID {
|
||||
if _, ok := ac.(*action.SelectSkillAction); !ok || ac.GetPlayerID() != e.Ctx().Our.UserID {
|
||||
return true
|
||||
}
|
||||
*value = 0
|
||||
@@ -189,9 +164,7 @@ func (e *Effect1576Sub) Heal_Pre(ac action.BattleActionI, value *int) bool {
|
||||
}
|
||||
|
||||
// Effect 1577: {0}回合做{1}-{2}次攻击,当前技能PP值小于{3}时连击上限为{4}
|
||||
type Effect1577 struct {
|
||||
RoundEffectArg0Base
|
||||
}
|
||||
type Effect1577 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1577) Skill_Use() bool {
|
||||
if len(e.Args()) < 5 {
|
||||
@@ -204,40 +177,51 @@ func (e *Effect1577) Skill_Use() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1577) SkillHit() bool {
|
||||
type Effect1577Sub struct{ RoundEffectArg0Base }
|
||||
|
||||
func (e *Effect1577Sub) SkillHit() bool {
|
||||
if len(e.Args()) < 5 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
minHits := int(e.Args()[1].IntPart())
|
||||
maxHits := int(e.Args()[2].IntPart())
|
||||
if minHits <= 0 {
|
||||
minHits = 1
|
||||
}
|
||||
if maxHits < minHits {
|
||||
maxHits = minHits
|
||||
}
|
||||
times := minHits
|
||||
if maxHits > minHits {
|
||||
times = minHits + grand.Intn(maxHits-minHits+1)
|
||||
|
||||
if skill := e.Ctx().SkillEntity.Info; skill != nil && int(skill.PP) < int(e.Args()[3].IntPart()) {
|
||||
ppCap := int(e.Args()[4].IntPart())
|
||||
if ppCap > 0 && ppCap < maxHits {
|
||||
maxHits = ppCap
|
||||
}
|
||||
if skill := e.Ctx().SkillEntity.Info; skill != nil {
|
||||
threshold := e.Args()[3].IntPart()
|
||||
if threshold >= 0 && int(skill.PP) <= int(threshold) {
|
||||
times = int(e.Args()[4].IntPart())
|
||||
if maxHits < minHits {
|
||||
maxHits = minHits
|
||||
}
|
||||
}
|
||||
if times <= 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
e.Ctx().SkillEntity.AttackTime += uint32(times - 1)
|
||||
hits := minHits
|
||||
if maxHits > minHits {
|
||||
hits += grand.Intn(maxHits - minHits + 1)
|
||||
}
|
||||
if hits <= 1 {
|
||||
return true
|
||||
}
|
||||
e.Ctx().SkillEntity.AttackTime += uint32(hits - 1)
|
||||
return true
|
||||
}
|
||||
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 1573, &Effect1573{})
|
||||
input.InitEffect(input.EffectType.Sub, 1573, &Effect1573Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1574, &Effect1574{})
|
||||
input.InitEffect(input.EffectType.Skill, 1575, &Effect1575{})
|
||||
input.InitEffect(input.EffectType.Sub, 1575, &Effect1575Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1576, &Effect1576{})
|
||||
input.InitEffect(input.EffectType.Sub, 1576, &Effect1576Sub{})
|
||||
input.InitEffect(input.EffectType.Skill, 1577, &Effect1577{})
|
||||
input.InitEffect(input.EffectType.Sub, 1577, &Effect1577Sub{})
|
||||
}
|
||||
|
||||
@@ -9,29 +9,11 @@ import (
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
var hundred = alpacadecimal.NewFromInt(100)
|
||||
|
||||
func applyStatusByID(owner, target *input.Input, statusID int) bool {
|
||||
if owner == nil || target == nil || statusID <= 0 {
|
||||
return false
|
||||
}
|
||||
eff := owner.InitEffect(input.EffectType.Status, statusID)
|
||||
if eff == nil {
|
||||
return false
|
||||
}
|
||||
target.AddEffect(owner, eff)
|
||||
return true
|
||||
}
|
||||
|
||||
// Effect 1578: 出手时自身护盾值高于{0}则自身下回合攻击技能先制+{1}
|
||||
type Effect1578 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1578) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 || e.Ctx().Our == nil {
|
||||
return true
|
||||
}
|
||||
shield := e.Ctx().Our.CurrentShield()
|
||||
if shield.Cmp(e.Args()[0]) <= 0 {
|
||||
if len(e.Args()) < 2 || e.Ctx().Our == nil || e.Ctx().Our.CurrentShield().Cmp(e.Args()[0]) <= 0 {
|
||||
return true
|
||||
}
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1578, int(e.Args()[1].IntPart()))
|
||||
@@ -42,17 +24,17 @@ func (e *Effect1578) Skill_Use() bool {
|
||||
}
|
||||
|
||||
type Effect1578Sub struct {
|
||||
RoundEffectArg0Base
|
||||
node.EffectNode
|
||||
remaining int
|
||||
priority int
|
||||
}
|
||||
|
||||
func (e *Effect1578Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
if len(a) > 0 {
|
||||
e.Duration(-1)
|
||||
e.CanStack(false)
|
||||
e.remaining = 1
|
||||
}
|
||||
if len(a) > 1 {
|
||||
if len(a) > 0 {
|
||||
e.priority = a[0]
|
||||
}
|
||||
}
|
||||
@@ -78,10 +60,7 @@ func (e *Effect1578Sub) ComparePre(fattack, sattack *action.SelectSkillAction) b
|
||||
type Effect1579 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1579) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 || e.Ctx().Our == nil {
|
||||
return true
|
||||
}
|
||||
if e.Ctx().Our.CurrentShield().Cmp(e.Args()[0]) >= 0 {
|
||||
if len(e.Args()) < 2 || e.Ctx().Our == nil || e.Ctx().Our.CurrentShield().Cmp(e.Args()[0]) >= 0 {
|
||||
return true
|
||||
}
|
||||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1579, int(e.Args()[1].IntPart()))
|
||||
@@ -92,17 +71,17 @@ func (e *Effect1579) Skill_Use() bool {
|
||||
}
|
||||
|
||||
type Effect1579Sub struct {
|
||||
RoundEffectArg0Base
|
||||
node.EffectNode
|
||||
remaining int
|
||||
priority int
|
||||
}
|
||||
|
||||
func (e *Effect1579Sub) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
if len(a) > 0 {
|
||||
e.Duration(-1)
|
||||
e.CanStack(false)
|
||||
e.remaining = 1
|
||||
}
|
||||
if len(a) > 1 {
|
||||
if len(a) > 0 {
|
||||
e.priority = a[0]
|
||||
}
|
||||
}
|
||||
@@ -127,33 +106,35 @@ func (e *Effect1579Sub) ComparePre(fattack, sattack *action.SelectSkillAction) b
|
||||
// Effect 1580: 出手时对手体力高于最大体力的1/{0}则造成伤害的{1}%恢复自身体力
|
||||
type Effect1580 struct {
|
||||
node.EffectNode
|
||||
shouldHeal bool
|
||||
active bool
|
||||
}
|
||||
|
||||
func (e *Effect1580) SkillHit() bool {
|
||||
e.active = false
|
||||
if len(e.Args()) < 2 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
if e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
threshold := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||||
e.active = e.Ctx().Opp.CurrentPet.GetHP().Cmp(threshold) > 0
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1580) Skill_Use() bool {
|
||||
if len(e.Args()) < 2 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil {
|
||||
if !e.active || len(e.Args()) < 2 || e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
maxThreshold := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||||
if e.Ctx().Opp.CurrentPet.GetHP().Cmp(maxThreshold) <= 0 {
|
||||
return true
|
||||
}
|
||||
e.shouldHeal = true
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect1580) DamageAdd(zone *info.DamageZone) bool {
|
||||
if !e.shouldHeal || zone == nil || zone.Type != info.DamageType.Red || e.Ctx().Our == nil {
|
||||
return true
|
||||
}
|
||||
if len(e.Args()) < 2 {
|
||||
return true
|
||||
}
|
||||
heal := zone.Damage.Mul(e.Args()[1]).Div(hundred)
|
||||
heal := e.Ctx().Our.SumDamage.Mul(e.Args()[1]).Div(hundred)
|
||||
if heal.Cmp(alpacadecimal.Zero) > 0 {
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||||
e.Ctx().Our.Heal(
|
||||
e.Ctx().Our,
|
||||
&action.SelectSkillAction{BaseAction: action.BaseAction{PlayerID: e.Ctx().Our.UserID}},
|
||||
heal,
|
||||
)
|
||||
}
|
||||
e.shouldHeal = false
|
||||
e.active = false
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -164,6 +145,9 @@ func (e *Effect1581) Damage_Mul(zone *info.DamageZone) bool {
|
||||
if zone == nil || zone.Type != info.DamageType.Red || len(e.Args()) < 2 || e.Ctx().Opp == nil || e.Ctx().Opp.CurrentPet == nil || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS || e.Ctx().SkillEntity.AttackTime == 0 {
|
||||
return true
|
||||
}
|
||||
if e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
||||
return true
|
||||
}
|
||||
threshold := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||||
if e.Ctx().Opp.CurrentPet.GetHP().Cmp(threshold) >= 0 {
|
||||
return true
|
||||
@@ -176,17 +160,20 @@ func (e *Effect1581) Damage_Mul(zone *info.DamageZone) bool {
|
||||
type Effect1582 struct{ node.EffectNode }
|
||||
|
||||
func (e *Effect1582) Skill_Use() bool {
|
||||
if len(e.Args()) < 5 || e.Ctx().Our == nil {
|
||||
if len(e.Args()) < 5 {
|
||||
return true
|
||||
}
|
||||
|
||||
opponentTriggered := false
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100); ok {
|
||||
opponentTriggered = applyStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
opponentTriggered = addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
||||
}
|
||||
|
||||
selfTriggered := false
|
||||
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100); ok {
|
||||
selfTriggered = applyStatusByID(e.Ctx().Our, e.Ctx().Our, int(e.Args()[3].IntPart()))
|
||||
selfTriggered = addStatusByID(e.Ctx().Our, e.Ctx().Our, int(e.Args()[3].IntPart()))
|
||||
}
|
||||
|
||||
if opponentTriggered || selfTriggered {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -997,6 +997,16 @@ var effectInfoByID = map[int]string{
|
||||
1540: "自身体力高于最大体力的1/{0}时吸取对手{1}点体力",
|
||||
1541: "使自身下{0}回合获得孤雷风暴效果",
|
||||
1542: "吸取对手能力提升状态,吸取成功则令对手{0},若对手不处于能力提升状态则令对手全属性-{1}",
|
||||
1543: "当回合击败对手则不消耗蓄力层数",
|
||||
1544: "对手存在护盾时先制+1",
|
||||
1545: "消除对手所有护盾效果,消除成功则为自身附加等量的护盾值",
|
||||
1546: "1回合做{0}-{1}次攻击,自身每存在1层蓄力则连击上限次数额外增加{2}次",
|
||||
1547: "自身每存在3层蓄力先制额外+1",
|
||||
1548: "当回合未击败对手则使自身下回合受到的伤害降低{0}%",
|
||||
1549: "后出手时下回合攻击技能先制+{0}",
|
||||
1550: "减少自身最大体力的1/2(最多减少至1)并附加减少量2/3的真实伤害,自身的蓄力层数≥8层时不减少自身体力",
|
||||
1551: "{0}%消耗自身全部体力,{1}%消耗敌方全部体力,若自身触发效果则消除敌方所有PP值,若敌方触发效果则消除自身所有PP值,均未触发则恢复自身全部体力",
|
||||
1552: "集结天幕四龙之神力,使自身下2回合攻击必定先手、必定命中、必定致命",
|
||||
1553: "自身体力高于最大体力的1/{0}时攻击后附加造成伤害值{1}%的百分比伤害",
|
||||
1554: "若自身当前体力低于最大体力的1/{0}则令自身{1}且免疫下{2}次受到的攻击",
|
||||
1555: "对手不处于能力提升时令对手所有技能PP值-{0}",
|
||||
@@ -1008,15 +1018,25 @@ var effectInfoByID = map[int]string{
|
||||
1561: "获得点数等同于双方最大体力差值的护盾,最高{0}点,护盾被击破时自身下{1}次使用的攻击技能附加与双方最大体力差护盾值相同的威力",
|
||||
1562: "命中后{0}%令对手{1},触发后{2}回合内对手主动切换精灵则登场精灵{3}%进入{4}状态",
|
||||
1563: "损失自身{0}点体力,给对手造成{1}点固定伤害,若自身体力不足{2}则损失全部体力且造成的固定伤害翻倍",
|
||||
1564: "恢复自身{0}点体力,若自身满天赋值则{1}%附加等量百分比伤害",
|
||||
1565: "{0}回合内每回合结束时使对手随机{1}个技能PP归零",
|
||||
1566: "{0}回合内每回合结束后反转对手能力提升状态",
|
||||
1567: "获得海洋的祝福:使自身下2回合先制+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}回合内每回合结束后反转对手能力提升状态",
|
||||
1567: "获得海洋的祝福:使自身下2回合先制+2且攻击必定命中、必定致命",
|
||||
1573: "自身为圣念状态时下2回合受到的攻击伤害减少50%,自身为邪念状态时下2回合造成的攻击伤害提升50%",
|
||||
1574: "附加自身攻击值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%",
|
||||
1575: "下{0}回合后出手则对手{1}",
|
||||
1576: "消耗自身全部体力,使对手{0}回合内无法通过自身技能恢复体力",
|
||||
1577: "{0}回合做{1}-{2}次攻击,当前技能PP值小于{3}时连击上限为{4}",
|
||||
1578: "出手时自身护盾值高于{0}则自身下回合攻击技能先制+{1}",
|
||||
1579: "出手时自身护盾值低于{0}则下回合属性技能先制+{1}",
|
||||
1580: "出手时对手体力高于最大体力的1/{0}则造成伤害的{1}%恢复自身体力",
|
||||
1581: "出手时对手体力低于最大体力的1/{0}则造成的伤害提升{1}%",
|
||||
1582: "{0}%令对手{1},{2}%令自身{3},均未触发则为自身附加{4}点护盾",
|
||||
1605: "{0}%令对手{1}",
|
||||
1670: "{0}%令对手{1},对手为自身天敌时概率提升{2}%,未触发则消除对手回合类效果",
|
||||
1671: "造成的攻击伤害不低于{0},若对手处于能力提升状态则造成的攻击伤害不低于{1}",
|
||||
|
||||
Reference in New Issue
Block a user