feat: 实现失明状态并新增技能效果描述
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-03-29 01:17:18 +08:00
committed by cnb
parent 856844e845
commit 03a28c968b
350 changed files with 13078 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 139: 50%威力301-350、30%威力101-300,20%威力5-100
type Effect139 struct {
node.EffectNode
}
func (e *Effect139) SkillHit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
randVal := grand.Intn(100)
switch {
case randVal < 50:
e.Ctx().SkillEntity.XML.Power = grand.N(301, 350)
case randVal < 80:
e.Ctx().SkillEntity.XML.Power = grand.N(101, 300)
default:
e.Ctx().SkillEntity.XML.Power = grand.N(5, 100)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 139, &Effect139{})
}

View File

@@ -0,0 +1,110 @@
package effect
import (
"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 600: 若对手是{0}则造成伤害提升{1}%,若对手不是{0},则有{2}%概率使对手{3}
type Effect600 struct {
node.EffectNode
}
func (e *Effect600) SkillHit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().Opp.CurrentPet.Info.Gender == int(e.Args()[0].IntPart()) {
bonusPercent := e.Args()[1]
e.Ctx().SkillEntity.XML.Power += int(alpacadecimal.NewFromInt(int64(e.Ctx().SkillEntity.XML.Power)).Mul(bonusPercent).Div(alpacadecimal.NewFromInt(100)).IntPart())
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[2].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[3].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
// Effect 603: {0}%概率使对手陷入{1}状态{2}回合
type Effect603 struct {
node.EffectNode
}
func (e *Effect603) OnSkill() bool {
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect == nil {
return true
}
statusEffect.Duration(int(e.Args()[2].IntPart()))
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
return true
}
// Effect 604: 威力随机,随机范围{0}-{1},连续使用每次威力提升{2},最高提升至{3}
type Effect604 struct {
AddLvelEffect
}
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())
return e.AddLvelEffect.SkillHit()
}
// Effect 605: 自身体力{0}对手时附加{1}值{2}%的百分比伤害
type Effect605 struct {
node.EffectNode
}
func (e *Effect605) OnSkill() bool {
ourHP := e.Ctx().Our.CurrentPet.GetHP()
oppHP := e.Ctx().Opp.CurrentPet.GetHP()
mode := int(e.Args()[0].IntPart())
if (mode == 0 && ourHP.Cmp(oppHP) <= 0) || (mode == 1 && ourHP.Cmp(oppHP) >= 0) {
return true
}
var base alpacadecimal.Decimal
switch int(e.Args()[1].IntPart()) {
case 0:
base = e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Ctx().Our.CurrentPet.GetHP())
case 1:
base = e.Ctx().Our.CurrentPet.GetMaxHP()
case 2:
base = e.Ctx().Our.CurrentPet.GetHP()
default:
return true
}
damage := base.Mul(e.Args()[2]).Div(alpacadecimal.NewFromInt(100))
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{Type: info.DamageType.Fixed, Damage: damage})
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 600, &Effect600{})
input.InitEffect(input.EffectType.Skill, 603, &Effect603{})
input.InitEffect(input.EffectType.Skill, 604, &Effect604{})
input.InitEffect(input.EffectType.Skill, 605, &Effect605{})
}

View File

@@ -0,0 +1,94 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// Effect 606: 若体力{0}对手,技能威力翻倍
type Effect606 struct {
node.EffectNode
}
func (e *Effect606) SkillHit() bool {
if e.Ctx().SkillEntity == nil {
return true
}
ourHP := e.Ctx().Our.CurrentPet.GetHP()
oppHP := e.Ctx().Opp.CurrentPet.GetHP()
mode := int(e.Args()[0].IntPart())
if (mode == 0 && ourHP.Cmp(oppHP) > 0) || (mode == 1 && ourHP.Cmp(oppHP) < 0) {
e.Ctx().SkillEntity.XML.Power *= 2
}
return true
}
// Effect 608: 若对手体力低于1/2该技能先制额外+1
type Effect608 struct {
node.EffectNode
}
func (e *Effect608) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if sattack == nil || sattack.PlayerID != e.Ctx().Our.UserID || sattack.SkillEntity == nil {
return true
}
oppHP := e.Ctx().Opp.CurrentPet.GetHP()
oppMaxHP := e.Ctx().Opp.CurrentPet.GetMaxHP()
if oppHP.Mul(e.Args()[0]).Cmp(oppMaxHP) < 0 {
sattack.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
}
return true
}
// Effect 612: {0}%概率攻击{1}次
type Effect612 struct {
node.EffectNode
}
func (e *Effect612) Damage_Mul(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
zone.Damage = zone.Damage.Mul(e.Args()[1])
return true
}
// Effect 614: {0}回合内若对手使用攻击技能则对手{1}
type Effect614 struct {
RoundEffectArg0Base
}
func (e *Effect614) Skill_Use_ex() bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[1].IntPart()))
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 606, &Effect606{})
input.InitEffect(input.EffectType.Skill, 608, &Effect608{})
input.InitEffect(input.EffectType.Skill, 612, &Effect612{})
input.InitEffect(input.EffectType.Skill, 614, &Effect614{})
}

View File

@@ -0,0 +1,165 @@
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 851: 使对手随机进入害怕、失明、烧伤、冻伤、中毒其中{0}种异常状态
type Effect851 struct {
node.EffectNode
}
func (e *Effect851) OnSkill() bool {
count := int(e.Args()[0].IntPart())
statusTypes := []int{
int(info.PetStatus.Fear),
int(info.PetStatus.Blind),
int(info.PetStatus.Burned),
int(info.PetStatus.Frozen),
int(info.PetStatus.Poisoned),
}
if count <= 0 {
return true
}
if count > len(statusTypes) {
count = len(statusTypes)
}
indices := grand.Perm(len(statusTypes))
for _, idx := range indices[:count] {
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, statusTypes[idx])
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
}
}
return true
}
// Effect 852: 附加自身最大体力{0}%的百分比伤害并恢复等量体力恢复体力时若自身体力低于最大体力的1/{1}则恢复效果和百分比伤害翻倍
type Effect852 struct {
node.EffectNode
}
func (e *Effect852) Skill_Use() bool {
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
amount := maxHP.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
thresholdDivisor := e.Args()[1]
if thresholdDivisor.Cmp(alpacadecimal.Zero) > 0 {
threshold := maxHP.Div(thresholdDivisor)
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 {
amount = amount.Mul(alpacadecimal.NewFromInt(2))
}
}
if amount.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: amount,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, amount)
return true
}
// Effect 853: 附加自身最大体力值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%
type Effect853 struct {
AddLvelEffect
}
func (e *Effect853) Skill_Use() bool {
percent := e.GetADD(e.Args()[0], e.Args()[1], e.Args()[2])
base := e.Ctx().Our.CurrentPet.GetMaxHP().Add(e.Ctx().Our.GetProp(4))
damage := base.Mul(percent).Div(alpacadecimal.NewFromInt(100))
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
return true
}
// Effect 854: 令对手下1次使用的威力高于{0}的攻击技能无效
type Effect854 struct {
node.EffectNode
}
func (e *Effect854) Skill_Use() bool {
addSubEffect(e.Ctx().Our, e.Ctx().Opp, &e.EffectNode, &Effect854Sub{}, -1)
return true
}
type Effect854Sub struct {
FixedDuration1Base
}
func (e *Effect854Sub) ActionStart(a, b *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if e.Ctx().SkillEntity.XML.Power <= int(e.Args()[0].IntPart()) {
return true
}
e.Ctx().SkillEntity.SetMiss()
e.Alive(false)
return true
}
// Effect 855: 将下次受到的伤害{0}%反馈给对手
type Effect855 struct {
node.EffectNode
}
func (e *Effect855) Skill_Use() bool {
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect855Sub{}, -1)
return true
}
type Effect855Sub struct {
FixedDuration1Base
}
func (e *Effect855Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
reflectDamage := zone.Damage.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
if reflectDamage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: reflectDamage,
})
e.Alive(false)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 851, &Effect851{})
input.InitEffect(input.EffectType.Skill, 852, &Effect852{})
input.InitEffect(input.EffectType.Skill, 853, &Effect853{})
input.InitEffect(input.EffectType.Skill, 854, &Effect854{})
input.InitEffect(input.EffectType.Skill, 855, &Effect855{})
}

View File

@@ -346,6 +346,15 @@ var effectInfoByID = map[int]string{
611: "下{0}回合自身使用攻击技能则附加{1}点固定伤害",
613: "{0}回合内自身令对手使用的{1}系攻击技能无效",
609: "若对手{0},技能威力翻倍",
600: "若对手是{0}则造成伤害提升{1}%,若对手不是{0},则有{2}%概率使对手{3}",
603: "{0}%概率使对手陷入{1}状态{2}回合",
604: "威力随机,随机范围{0}-{1},连续使用每次威力提升{2},最高提升至{3}",
605: "自身体力{0}对手时附加{1}值{2}%的百分比伤害",
606: "若体力{0}对手,技能威力翻倍",
608: "若对手体力低于1/2该技能先制额外+1",
612: "{0}%概率攻击{1}次",
614: "{0}回合内若对手使用攻击技能则对手{1}",
139: "50%威力301-350、30%威力101-300,20%威力5-100",
620: "{0}回合内致命一击率上升{1}/16",
626: "随机使自己{0}项能力+{1}",
680: "先出手时{0}%使对手{1}{2}回合",
@@ -358,6 +367,11 @@ var effectInfoByID = map[int]string{
687: "若对手{0},则对对方造成伤害的{1}%恢复自身体力",
688: "{0}回合内抵挡受到的攻击",
689: "若造成的伤害高于{0}则恢复自身1/{1}最大体力",
851: "使对手随机进入害怕、失明、烧伤、冻伤、中毒其中{0}种异常状态",
852: "附加自身最大体力{0}%的百分比伤害并恢复等量体力恢复体力时若自身体力低于最大体力的1/{1}则恢复效果和百分比伤害翻倍",
853: "附加自身最大体力值与速度值总和{0}%的百分比伤害,每次使用增加{1}%,最高{2}%",
854: "令对手下1次使用的威力高于{0}的攻击技能无效",
855: "将下次受到的伤害{0}%反馈给对手",
690: "下{0}回合,能力提升状态消失则对手使用属性技能失效",
776: "下{0}回合自身造成的攻击伤害翻倍",
1044: "吸取对手能力提升状态,吸取成功则下{0}回合造成的伤害翻倍",

View File

@@ -197,6 +197,19 @@ func (e *Confused) ActionStart(fattack *action.SelectSkillAction, sattack *actio
}
type Blind struct {
BaseStatus
}
func (e *Blind) ActionStart(fattack, sattack *action.SelectSkillAction) bool {
if e.Ctx().SkillEntity == nil {
return true
}
e.Ctx().SkillEntity.Accuracy = e.Ctx().SkillEntity.Accuracy.Mul(alpacadecimal.NewFromFloat(0.5))
return true
}
type Weakened struct {
BaseStatus
}
@@ -236,6 +249,7 @@ func init() {
input.InitEffect(input.EffectType.Status, int(info.PetStatus.Burned), &Burned{}) // 烧伤
input.InitEffect(input.EffectType.Status, int(info.PetStatus.Weakened), &Weakened{}) // 衰弱
input.InitEffect(input.EffectType.Status, int(info.PetStatus.Confused), &Confused{}) // 混乱
input.InitEffect(input.EffectType.Status, int(info.PetStatus.Blind), &Blind{}) // 失明
input.InitEffect(input.EffectType.Status, int(info.PetStatus.Flammable), &Flammable{}) // 易燃
// 批量注册不能行动的状态
nonActingStatuses := []info.EnumPetStatus{

View File

@@ -171,8 +171,8 @@ var PetStatus = enum.New[struct {
ImmuneToAbnormal EnumPetStatus `enum:"18"`
// 瘫痪:完全无法行动,比麻痹效果更强,无概率解除
Paralyzed EnumPetStatus `enum:"19"`
// 失明(预留):命中概率大幅降低,技能命中率下降
// Blind EnumBattleStatus `enum:"20"`
// 失明:命中概率大幅降低,技能命中率下降
Blind EnumPetStatus `enum:"20"`
}]()
// 枚举类型别名(根据实际枚举库要求定义)