style: 清理代码注释和格式

This commit is contained in:
xinian
2026-04-04 05:12:30 +08:00
committed by cnb
parent 31d274dd9d
commit b62b4af628
31 changed files with 863 additions and 195 deletions

View File

@@ -98,6 +98,7 @@ func (e *Effect1610Sub) SkillHit_ex() bool {
return true
}
e.Ctx().SkillEntity.SetNoSide()
e.Ctx().SkillEntity.AttackTime = 0
return true
}

View File

@@ -0,0 +1,211 @@
package effect
import (
element "blazing/common/data/Element"
"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 1614: {0}回合内对手使用攻击技能后{1}%令对手{2},未触发则令对手全属性-{3}
type Effect1614 struct{ node.EffectNode }
func (e *Effect1614) Skill_Use() bool {
if len(e.Args()) < 4 || e.Ctx().Opp == nil {
return true
}
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1614, e.SideEffectArgs...)
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1614Sub struct {
RoundEffectSideArg0Base
attempted bool
triggered bool
}
func (e *Effect1614Sub) Skill_Use() bool {
if e.triggered || e.attempted || len(e.Args()) < 4 {
return true
}
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS {
return true
}
e.attempted = true
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
if addStatusByID(e.Ctx().Opp, e.Ctx().Our, int(e.Args()[2].IntPart())) {
e.triggered = true
e.Alive(false)
}
}
return true
}
func (e *Effect1614Sub) TurnEnd() {
if e.Duration() == 1 && !e.triggered && len(e.Args()) >= 4 {
applyAllPropDown(e.Ctx().Opp, e.Ctx().Our, int8(e.Args()[3].IntPart()))
}
e.EffectNode.TurnEnd()
}
// Effect 1616: 当回合使用的技能克制对手时获得本系属性加成
type Effect1616 struct{ node.EffectNode }
func (e *Effect1616) Damage_Mul(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.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
return true
}
mul, err := element.Calculator.GetOffensiveMultiplier(e.Ctx().SkillEntity.GetType().ID, e.Ctx().Opp.CurPet[0].GetType().ID)
if err != nil || mul <= 1 {
return true
}
zone.Damage = zone.Damage.Mul(hundred.Add(alpacadecimal.NewFromInt(20))).Div(hundred)
return true
}
// Effect 1617: {0}回合内受到攻击后{1}%使对手{2},未触发则自身全属性+{3}
type Effect1617 struct{ node.EffectNode }
func (e *Effect1617) Skill_Use() bool {
if len(e.Args()) < 4 || e.Ctx().Opp == nil {
return true
}
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 1617, e.SideEffectArgs...)
if sub != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1617Sub struct {
RoundEffectSideArg0Base
attempted bool
triggered bool
}
func (e *Effect1617Sub) Skill_Use() bool {
if e.triggered || e.attempted || len(e.Args()) < 4 {
return true
}
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS {
return true
}
e.attempted = true
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
if addStatusByID(e.Ctx().Opp, e.Ctx().Our, int(e.Args()[2].IntPart())) {
e.triggered = true
e.Alive(false)
}
}
return true
}
func (e *Effect1617Sub) TurnEnd() {
if e.Duration() == 1 && !e.triggered && len(e.Args()) >= 4 {
applyAllPropUp(e.Ctx().Opp, int8(e.Args()[3].IntPart()))
}
e.EffectNode.TurnEnd()
}
// Effect 1618: {0}回合内每回合结束时令对手随机{1}个技能PP值归零
type Effect1618 struct{ node.EffectNode }
func (e *Effect1618) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Opp == nil {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1618, e.SideEffectArgs...)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1618Sub struct{ RoundEffectArg0Base }
func (e *Effect1618Sub) TurnEnd() {
if e.Duration() > 0 && len(e.Args()) >= 2 && e.Ctx().Opp != nil {
count := int(e.Args()[1].IntPart())
zeroRandomSkillPP(e.Ctx().Opp, count)
}
e.EffectNode.TurnEnd()
}
// Effect 1619: 50%复制对手当回合释放的技能未触发则恢复自身最大体力的1/2且令对手全属性-1
type Effect1619 struct {
node.EffectNode
copyAttempted bool
copySucceeded bool
fallbackApplied bool
}
func (e *Effect1619) ActionStart(fattack, sattack *action.SelectSkillAction) bool {
if e.copyAttempted || e.Ctx().Opp == nil {
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil {
return true
}
opponent := actionByPlayer(fattack, sattack, e.Ctx().Opp.UserID)
if opponent == nil || opponent.SkillEntity == nil || opponent.SkillEntity.Category() == info.Category.STATUS {
return true
}
e.copyAttempted = true
if ok, _, _ := e.Input.Player.Roll(50, 100); !ok {
return true
}
clone := cloneSkillEntity(opponent.SkillEntity)
if clone == nil {
return true
}
current.SkillEntity = clone
e.copySucceeded = true
return true
}
func (e *Effect1619) Skill_Use() bool {
if !e.copyAttempted || e.copySucceeded || e.fallbackApplied || e.Ctx().Opp == nil || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil {
return true
}
heal := e.Ctx().Our.CurPet[0].GetMaxHP().Div(alpacadecimal.NewFromInt(2))
if heal.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Our.Heal(
e.Ctx().Our,
&action.SelectSkillAction{BaseAction: action.BaseAction{PlayerID: e.Ctx().Our.UserID}},
heal,
)
}
applyAllPropDown(e.Ctx().Opp, e.Ctx().Our, 1)
e.fallbackApplied = true
return true
}
func (e *Effect1619) TurnEnd() {
e.copyAttempted = false
e.copySucceeded = false
e.fallbackApplied = false
e.EffectNode.TurnEnd()
}
func init() {
input.InitEffect(input.EffectType.Skill, 1614, &Effect1614{})
input.InitEffect(input.EffectType.Sub, 1614, &Effect1614Sub{})
input.InitEffect(input.EffectType.Skill, 1616, &Effect1616{})
input.InitEffect(input.EffectType.Skill, 1617, &Effect1617{})
input.InitEffect(input.EffectType.Sub, 1617, &Effect1617Sub{})
input.InitEffect(input.EffectType.Skill, 1618, &Effect1618{})
input.InitEffect(input.EffectType.Sub, 1618, &Effect1618Sub{})
input.InitEffect(input.EffectType.Skill, 1619, &Effect1619{})
}

View File

@@ -110,9 +110,9 @@ func (e *Effect1622Sub) SkillHit_ex() bool {
if count <= 0 || percent <= 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 16221, count, percent)
sub := e.Ctx().Opp.InitEffect(input.EffectType.Sub, 16221, count, percent)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
e.Ctx().Opp.AddEffect(e.Ctx().Opp, sub)
}
return true
}

View File

@@ -0,0 +1,267 @@
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 1625: 造成的伤害高于{0}则{1}%令自身全属性+{2}
type Effect1625 struct{ node.EffectNode }
func (e *Effect1625) Skill_Use() bool {
if len(e.Args()) < 3 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) <= 0 {
return true
}
if ok, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100); ok {
applyAllPropUp(e.Ctx().Our, int8(e.Args()[2].IntPart()))
}
return true
}
// Effect 1626: 后出手时将当回合护盾所承受的伤害值以百分比伤害的形式{0}%反弹给对手
type Effect1626 struct{ node.EffectNode }
func (e *Effect1626) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || fattack == nil || fattack.PlayerID == e.Ctx().Our.UserID || len(e.Args()) == 0 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1626, int(e.Args()[0].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1626Sub struct {
FixedDuration1Base
absorbed alpacadecimal.Decimal
}
func (e *Effect1626Sub) Damage_Shield(zone *info.DamageZone) bool {
if zone == nil || zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
absorbed := alpacadecimal.Min(e.Ctx().Our.CurrentShield(), zone.Damage)
if absorbed.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.absorbed = e.absorbed.Add(absorbed)
return true
}
func (e *Effect1626Sub) TurnEnd() {
if len(e.Args()) > 0 && e.absorbed.Cmp(alpacadecimal.Zero) > 0 {
damage := e.absorbed.Mul(e.Args()[0]).Div(hundred)
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Percent, Damage: damage})
}
}
e.EffectNode.TurnEnd()
}
// Effect 1627: {0}回合做{1}-{2}次攻击,若本回合攻击次数达到最大则必定秒杀对手
type Effect1627 struct{ node.EffectNode }
func (e *Effect1627) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1627, e.SideEffectArgs...)
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1627Sub struct {
RoundEffectArg0Base
ohko bool
}
func (e *Effect1627Sub) SkillHit() bool {
e.ohko = false
if len(e.Args()) < 3 || 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
}
hits := minHits
if maxHits > minHits {
hits += grand.Intn(maxHits - minHits + 1)
}
if hits > 1 {
e.Ctx().SkillEntity.AttackTime += uint32(hits - 1)
}
e.ohko = hits == maxHits
return true
}
func (e *Effect1627Sub) OnSkill() bool {
if !e.ohko || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil || e.Ctx().Opp.CurPet[0].Info.Hp == 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Opp.CurPet[0].GetHP(),
})
return true
}
// Effect 1628: 每次使用该技能击败对手则恢复自身全部体力,同时重置该技能使用次数并使该技能攻击威力提升{0}点,未击败对手时令自身下回合攻击技能先制+{1}
type Effect1628 struct {
node.EffectNode
bonusPower int
}
func (e *Effect1628) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
if old := t.GetEffect(input.EffectType.Skill, 1628); old != nil {
if prev, ok := old.(*Effect1628); ok {
e.bonusPower = prev.bonusPower
}
}
}
func (e *Effect1628) SkillHit() bool {
if e.bonusPower == 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
e.Ctx().SkillEntity.XML.Power += e.bonusPower
return true
}
func (e *Effect1628) Skill_Use() bool {
if len(e.Args()) < 2 || e.Ctx().Our == nil || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp == nil || e.Ctx().Opp.CurPet[0] == nil {
return true
}
if e.Ctx().Opp.CurPet[0].Info.Hp == 0 {
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.CurPet[0].GetMaxHP())
if e.Ctx().SkillEntity != nil && e.Ctx().SkillEntity.Info != nil {
e.Ctx().SkillEntity.Info.PP = uint32(e.Ctx().SkillEntity.XML.MaxPP)
}
e.bonusPower += int(e.Args()[0].IntPart())
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1628, int(e.Args()[1].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1628Sub struct {
node.EffectNode
remaining int
priority int
}
func (e *Effect1628Sub) 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 *Effect1628Sub) 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 1629: {0}基础速度值{1}{2}则自身下回合先制+{3}
type Effect1629 struct{ node.EffectNode }
func (e *Effect1629) Skill_Use() bool {
if len(e.Args()) < 4 {
return true
}
compareTarget := e.Ctx().Our
if int(e.Args()[1].IntPart()) != 0 {
compareTarget = e.Ctx().Opp
}
if compareTarget == nil || compareTarget.CurPet[0] == nil {
return true
}
speed := alpacadecimal.NewFromInt(int64(compareTarget.CurPet[0].PetInfo.Spd))
if !effectCompareByMode(int(e.Args()[2].IntPart()), speed, e.Args()[0]) {
return true
}
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1629, int(e.Args()[3].IntPart()))
if sub != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
}
return true
}
type Effect1629Sub struct {
node.EffectNode
remaining int
priority int
}
func (e *Effect1629Sub) 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 *Effect1629Sub) 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 {
return true
}
current.SkillEntity.XML.Priority += e.priority
e.remaining--
if e.remaining <= 0 {
e.Alive(false)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 1625, &Effect1625{})
input.InitEffect(input.EffectType.Skill, 1626, &Effect1626{})
input.InitEffect(input.EffectType.Sub, 1626, &Effect1626Sub{})
input.InitEffect(input.EffectType.Skill, 1627, &Effect1627{})
input.InitEffect(input.EffectType.Sub, 1627, &Effect1627Sub{})
input.InitEffect(input.EffectType.Skill, 1628, &Effect1628{})
input.InitEffect(input.EffectType.Sub, 1628, &Effect1628Sub{})
input.InitEffect(input.EffectType.Skill, 1629, &Effect1629{})
input.InitEffect(input.EffectType.Sub, 1629, &Effect1629Sub{})
}

View File

@@ -27,7 +27,7 @@ func (e *Effect1630) ComparePre(fattack, sattack *action.SelectSkillAction) bool
if current == nil || current.SkillEntity == nil || oppAction == nil || oppAction.SkillEntity == nil {
return true
}
if oppAction.SkillEntity.Category() == info.Category.STATUS || current.SkillEntity.Category() == info.Category.STATUS {
if oppAction.SkillEntity.Category() == info.Category.STATUS {
return true
}
current.SkillEntity.XML.Priority = math.MaxInt
@@ -36,7 +36,7 @@ func (e *Effect1630) ComparePre(fattack, sattack *action.SelectSkillAction) bool
}
func (e *Effect1630) OnSkill() bool {
if !e.armed || len(e.Args()) < 2 || e.Ctx().Opp == nil {
if !e.armed || len(e.Args()) < 2 || e.Ctx().Opp == nil || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.AttackTime == 0 {
return true
}
chance := int(e.Args()[0].IntPart())
@@ -181,7 +181,7 @@ func (e *Effect1634) ComparePre(fattack, sattack *action.SelectSkillAction) bool
return true
}
current := actionByPlayer(fattack, sattack, e.Ctx().Our.UserID)
if current == nil || current.SkillEntity == nil || current.SkillEntity.Category() == info.Category.STATUS {
if current == nil || current.SkillEntity == nil {
return true
}
current.SkillEntity.XML.Priority = math.MaxInt

View File

@@ -1073,11 +1073,21 @@ var effectInfoByID = map[int]string{
1611: "攻击命中后5%的概率汲取泰坦源脉的力量本次攻击造成5倍伤害且战斗结束后获得5000泰坦之灵每日上限50000",
1612: "{0}回合内受到的伤害低于{1}时{2}%令对手{3},未触发则附加{4}点固定伤害",
1613: "自身不处于能力提升状态则吸取对手{0}点体力,若先出手则额外吸取{1}点体力",
1614: "{0}回合内对手使用攻击技能后{1}%令对手{2},未触发则令对手全属性-{3}",
1616: "当回合使用的技能克制对手时获得本系属性加成",
1617: "{0}回合内受到攻击后{1}%使对手{2},未触发则自身全属性+{3}",
1618: "{0}回合内每回合结束时令对手随机{1}个技能PP值归零",
1619: "50%复制对手当回合释放的技能未触发则恢复自身最大体力的1/2且令对手全属性-1",
1620: "对手基础速度值高于{0}则下回合先制-1",
1621: "{0}%令对手所有技能PP值-{1},自身满体力时效果翻倍",
1622: "{0}回合内每回合{1}%对手属性技能无效,未触发则下{2}次受到的攻击伤害减少{3}%",
1623: "若对手是{0}精灵则下{1}回合对手受到的伤害提高{2}%",
1624: "对手不处于异常状态时随机附加{0}种异常状态",
1625: "造成的伤害高于{0}则{1}%令自身全属性+{2}",
1626: "后出手时将当回合护盾所承受的伤害值以百分比伤害的形式{0}%反弹给对手",
1627: "{0}回合做{1}-{2}次攻击,若本回合攻击次数达到最大则必定秒杀对手",
1628: "每次使用该技能击败对手则恢复自身全部体力,同时重置该技能使用次数并使该技能攻击威力提升{0}点,未击败对手时令自身下回合攻击技能先制+{1}",
1629: "{0}基础速度值{1}{2}则自身下回合先制+{3}",
1670: "{0}%令对手{1},对手为自身天敌时概率提升{2}%,未触发则消除对手回合类效果",
1671: "造成的攻击伤害不低于{0},若对手处于能力提升状态则造成的攻击伤害不低于{1}",
1672: "出手时若自身未满体力则吸取对手{0}点体力",