AI实现多个特性

This commit is contained in:
2026-01-01 01:59:37 +08:00
parent 3347200b72
commit 2081331cbd
36 changed files with 1066 additions and 21 deletions

View File

@@ -0,0 +1,30 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 402. n%几率附加m点固定伤害a1: n, a2: m
type NewSel402 struct {
NewSel0
}
func (e *NewSel402) Damage_ADD(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// n%几率触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
// 附加m点固定伤害
t.Damage = t.Damage.Add(e.Args()[1])
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 402, &NewSel402{})
}

View File

@@ -0,0 +1,45 @@
package effect
import (
"blazing/logic/service/fight/input"
)
// 403. n%几率令对手m回合内每回合减少r点体力a1: n, a2: m, a3: r
// TODO: 需要实现一个持续伤害的状态效果
type NewSel403 struct {
NewSel0
}
func (e *NewSel403) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// n%几率触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
// 创建持续伤害的状态效果
// 这里使用ID 0来创建自定义持续效果m回合
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, 0)
if statusEffect == nil {
return true
}
// 设置参数:回合数=a2每回合扣血=a3
statusEffect.SetArgs(e.Ctx().Opp,
int(e.Args()[1].IntPart()), // 持续回合数
int(e.Args()[2].IntPart()), // 每回合减少的体力
)
// 给对手添加状态
e.Ctx().Opp.AddEffect(e.Ctx().Opp, statusEffect)
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 403, &NewSel403{})
}

View File

@@ -0,0 +1,32 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 404. n%几率受到攻击伤害减半a1: n
type NewSel404 struct {
NewSel0
}
func (e *NewSel404) Damage_DIV_ex(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// n%几率触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
// 受到伤害减半
t.Damage = t.Damage.Div(alpacadecimal.NewFromInt(2))
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 404, &NewSel404{})
}

View File

@@ -0,0 +1,30 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
)
// 405. n%几率令本次攻击先制+1a1: n
type NewSel405 struct {
NewSel0
}
func (e *NewSel405) Action_start_ex(fattack, sattack *action.SelectSkillAction) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// n%几率触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success && e.Ctx().SkillEntity != nil {
// 先制+1提升优先级
e.Ctx().SkillEntity.AttackTime = e.Ctx().SkillEntity.AttackTime + 1
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 405, &NewSel405{})
}

View File

@@ -0,0 +1,32 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 406. n%几率完全阻挡一次攻击a1: n
type NewSel406 struct {
NewSel0
}
func (e *NewSel406) Damage_DIV_ex(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// n%几率触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if success {
// 完全阻挡这次攻击设置伤害为0
t.Damage = alpacadecimal.NewFromInt(0)
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 406, &NewSel406{})
}

View File

@@ -0,0 +1,38 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 407. 对手处于某一异常状态时n%几率威力翻倍a1: 异常状态类型, a2: n
type NewSel407 struct {
NewSel0
}
func (e *NewSel407) Damage_ADD(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查对手是否处于指定异常状态
statusType := info.EnumPetStatus(e.Args()[0].IntPart())
if !e.Ctx().Opp.StatEffect_Exist(statusType) {
return true
}
// n%几率触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if success {
// 威力翻倍
t.Damage = t.Damage.Mul(alpacadecimal.NewFromInt(2))
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 407, &NewSel407{})
}

View File

@@ -0,0 +1,27 @@
package effect
import (
"blazing/logic/service/fight/input"
)
// 408. 给对手造成伤害时附带消除能力强化效果PVP无效
type NewSel408 struct {
NewSel0
}
// TODO: 实现消除能力强化效果的核心逻辑
func (e *NewSel408) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// TODO: 需要判断是否是PVP战斗
// 消除对手的能力强化效果
// 这里需要调用相应的方法来消除对手的能力提升
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 408, &NewSel408{})
}

View File

@@ -0,0 +1,41 @@
package effect
import (
"blazing/logic/service/fight/input"
)
// 409. 致命一击时n%几率令对手进入某一种异常状态a1: n, a2: 异常状态类型)
// TODO: 需要了解如何判断致命一击
type NewSel409 struct {
NewSel0
}
func (e *NewSel409) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// TODO: 检查是否是致命一击
// 目前没有找到相应的API可能需要在Ctx或其他地方添加isCrit标记
// n%几率触发
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
}
// 给对手添加状态
e.Ctx().Opp.AddEffect(e.Ctx().Opp, statusEffect)
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 409, &NewSel409{})
}

View File

@@ -2,12 +2,42 @@ package effect
import (
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 46. 若自身5回合内体力被降到0会余下1点体力并且体力全恢复恢复后回合数重新计算。
// TODO: 实现若自身5回合内体力被降到0会余下1点体力并且体力全恢复恢复后回合数重新计算。的核心逻辑
// TODO: 需要了解如何实现体力归零时的保命和恢复效果
type NewSel46 struct {
NewSel0
// 记录上次恢复后的回合数
lastRecoveryRound uint32
}
func (e *NewSel46) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 获取当前回合数
r := e.Ctx().Our.FightC.GetOverInfo()
// 检查是否在5回合内
if r.Round-e.lastRecoveryRound <= 5 {
// 检查体力是否被降到0
if e.Ctx().Our.CurrentPet.Info.Hp <= 0 {
// 体力降到0保留1点体力恢复满
e.Ctx().Our.Heal(e.Ctx().Our, nil, alpacadecimal.NewFromInt(1))
e.Ctx().Our.Heal(e.Ctx().Our, nil, e.Ctx().Our.CurrentPet.GetMaxHP().Sub(alpacadecimal.NewFromInt(1)))
// 更新恢复后的回合数
e.lastRecoveryRound = r.Round
}
}
return true
}
func init() {

View File

@@ -1,15 +1,41 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 48. 对方某种攻击类型无效a1: 攻击类型)
// TODO: 实现对方某种攻击类型无效a1: 攻击类型)的核心逻辑
type NewSel48 struct {
NewSel0
}
func (e *NewSel48) Damage_DIV_ex(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查对手是否使用了指定攻击类型
if e.Ctx().SkillEntity == nil {
return true
}
// 检查攻击类型是否匹配攻击类型1=物理攻击3=特殊攻击)
attackCategory := int(e.Args()[0].IntPart())
if e.Ctx().SkillEntity.Category() == info.Category.PHYSICAL && attackCategory == 1 {
// 物理攻击无效
t.Damage = alpacadecimal.NewFromInt(0)
} else if e.Ctx().SkillEntity.Category() == info.Category.SPECIAL && attackCategory == 3 {
// 特殊攻击无效
t.Damage = alpacadecimal.NewFromInt(0)
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 48, &NewSel48{})
}

View File

@@ -1,13 +1,77 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 49. 受到物理攻击或特殊攻击后下n回合受物理攻击或特殊攻击伤害减免m%a1: n, a2: m
// TODO: 实现受到物理攻击或特殊攻击后下n回合受物理攻击或特殊攻击伤害减免m%a1: n, a2: m的核心逻辑
// TODO: 需要记录受到的攻击类型并实现持续减伤效果
type NewSel49 struct {
NewSel0
// 记录受到攻击的类型1=物理攻击2=特殊攻击
attackType int
// 记录剩余减伤回合数
remainingTurns int
}
func (e *NewSel49) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 记录受到攻击的类型
if e.Ctx().SkillEntity == nil {
return true
}
if e.Ctx().SkillEntity.Category() == info.Category.PHYSICAL {
e.attackType = 1
e.remainingTurns = int(e.Args()[0].IntPart())
} else if e.Ctx().SkillEntity.Category() == info.Category.SPECIAL {
e.attackType = 2
e.remainingTurns = int(e.Args()[0].IntPart())
}
return true
}
func (e *NewSel49) Damage_DIV_ex(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查是否还有减伤效果
if e.remainingTurns <= 0 {
return true
}
// 检查攻击类型是否匹配
if e.Ctx().SkillEntity == nil {
return true
}
attackCategory := e.Ctx().SkillEntity.Category()
if (e.attackType == 1 && attackCategory == info.Category.PHYSICAL) ||
(e.attackType == 2 && attackCategory == info.Category.SPECIAL) {
// 减免m%伤害
percent := alpacadecimal.NewFromInt(100).Sub(e.Args()[1])
t.Damage = t.Damage.Mul(percent).Div(alpacadecimal.NewFromInt(100))
}
return true
}
func (e *NewSel49) Turn_End() {
// 每回合减少减伤效果剩余回合数
if e.remainingTurns > 0 {
e.remainingTurns--
}
}
func init() {

View File

@@ -5,11 +5,25 @@ import (
)
// 501. g1. 最后一个死 (只要有队友没死, 则自己又恢复hp和pp)
// TODO: 实现g1. 最后一个死 (只要有队友没死, 则自己又恢复hp和pp)的核心逻辑
// TODO: 需要了解如何判断队友状态并恢复HP和PP
type NewSel501 struct {
NewSel0
}
func (e *NewSel501) SwitchOut(in *input.Input) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// TODO: 检查是否有队友还活着
// 如果有队友活着恢复自身HP和PP
// e.Ctx().Our.Heal(e.Ctx().Our, nil, e.Ctx().Our.CurrentPet.GetMaxHP())
// TODO: 恢复PP值的方法
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 501, &NewSel501{})
}

View File

@@ -0,0 +1,28 @@
package effect
import (
"blazing/logic/service/fight/input"
)
// 502. g2. 如果自身死亡, 恢复队友所有体力和PP值
// TODO: 实现恢复队友所有体力和PP值的核心逻辑
type NewSel502 struct {
NewSel0
}
// TODO: 需要找到精灵死亡时的回调接口
func (e *NewSel502) SwitchOut(in *input.Input) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// TODO: 检查精灵是否死亡HP为0
// 如果死亡恢复队友所有体力和PP值
// 需要遍历队友的精灵并调用相应的方法
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 502, &NewSel502{})
}

View File

@@ -1,15 +1,27 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
)
// 503. g3. 群体攻击技能可额外增加一个目标(最多不超过5个目标)
// TODO: 实现g3. 群体攻击技能可额外增加一个目标(最多不超过5个目标)的核心逻辑
// TODO: 需要了解如何修改群体攻击技能的目标数量
type NewSel503 struct {
NewSel0
}
func (e *NewSel503) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// TODO: 检查技能是否是群体攻击技能
// 如果是群体攻击增加一个目标最多不超过5个
// 需要了解技能的目标数量限制机制
}
func init() {
input.InitEffect(input.EffectType.NewSel, 503, &NewSel503{})
}

View File

@@ -1,15 +1,45 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 52. 第3n+1回合免疫特殊攻击第3n+2回合免疫物理攻击第3n+3回合免疫属性攻击
// TODO: 实现第3n+1回合免疫特殊攻击第3n+2回合免疫物理攻击第3n+3回合免疫属性攻击的核心逻辑
type NewSel52 struct {
NewSel0
}
func (e *NewSel52) Damage_DIV_ex(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 获取当前回合数
r := e.Ctx().Our.FightC.GetOverInfo()
roundMod := r.Round % 3
// 第3n+1回合免疫特殊攻击第3n+2回合免疫物理攻击
if e.Ctx().SkillEntity == nil {
return true
}
// 检查攻击类型
if roundMod == 1 && e.Ctx().SkillEntity.Category() == info.Category.SPECIAL {
// 第3n+1回合免疫特殊攻击伤害为0
t.Damage = alpacadecimal.NewFromInt(0)
} else if roundMod == 2 && e.Ctx().SkillEntity.Category() == info.Category.PHYSICAL {
// 第3n+2回合免疫物理攻击伤害为0
t.Damage = alpacadecimal.NewFromInt(0)
}
// 第3n+3回合免疫属性攻击这里暂时没有明确的属性类型可能需要更复杂的处理
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 52, &NewSel52{})
}

View File

@@ -2,14 +2,34 @@ package effect
import (
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 53. 敌我双方每回合恢复n%HP不超过最大血量a1: n
// TODO: 实现敌我双方每回合恢复n%HP不超过最大血量a1: n的核心逻辑
type NewSel53 struct {
NewSel0
}
func (e *NewSel53) Turn_End() {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 计算恢复的HP量
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
healAmount := maxHP.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
// 恢复我方HP
e.Ctx().Our.Heal(e.Ctx().Our, nil, healAmount)
// 恢复敌方HP
oppMaxHP := e.Ctx().Opp.CurrentPet.GetMaxHP()
oppHealAmount := oppMaxHP.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
e.Ctx().Opp.Heal(e.Ctx().Opp, nil, oppHealAmount)
}
func init() {
input.InitEffect(input.EffectType.NewSel, 53, &NewSel53{})
}

View File

@@ -1,15 +1,34 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 54. 每回合结束后敌我双方扣除n体力值a1: n
// TODO: 实现每回合结束后敌我双方扣除n体力值a1: n的核心逻辑
type NewSel54 struct {
NewSel0
}
func (e *NewSel54) Turn_End() {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 扣除我方体力
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})
// 扣除敌方体力
e.Ctx().Opp.Damage(e.Ctx().Opp, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})
}
func init() {
input.InitEffect(input.EffectType.NewSel, 54, &NewSel54{})
}

View File

@@ -1,15 +1,26 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 55. 每回合敌我双方造成的伤害为原来的n倍a1: n
// TODO: 实现每回合敌我双方造成的伤害为原来的n倍a1: n的核心逻辑
type NewSel55 struct {
NewSel0
}
func (e *NewSel55) Damage_ADD(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 伤害乘以n倍
t.Damage = t.Damage.Mul(e.Args()[0])
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 55, &NewSel55{})
}

View File

@@ -1,15 +1,32 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 56. 第n回合秒杀敌人a1: 回合数)
// TODO: 实现第n回合秒杀敌人a1: 回合数)的核心逻辑
type NewSel56 struct {
NewSel0
}
func (e *NewSel56) Turn_End() {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 获取当前回合数
r := e.Ctx().Our.FightC.GetOverInfo()
if r.Round == uint32(e.Args()[0].IntPart()) {
// 秒杀对方将其体力降为0
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Ctx().Opp.CurrentPet.GetHP(),
})
}
}
func init() {
input.InitEffect(input.EffectType.NewSel, 56, &NewSel56{})
}

View File

@@ -1,15 +1,34 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 57. 如果对方存在某异常状态则自己攻击的致命一击率提高n/16a1: 异常状态类型, a2: n
// TODO: 实现如果对方存在某异常状态则自己攻击的致命一击率提高n/16a1: 异常状态类型, a2: n的核心逻辑
type NewSel57 struct {
NewSel0
}
func (e *NewSel57) Damage_ADD(*info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查对手是否处于指定异常状态
statusType := info.EnumPetStatus(e.Args()[0].IntPart())
if !e.Ctx().Opp.StatEffect_Exist(statusType) {
return true
}
// 提高致命一击率n/16
if e.Ctx().SkillEntity != nil {
e.Ctx().SkillEntity.CritRate += int(e.Args()[1].IntPart() / 16)
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 57, &NewSel57{})
}

View File

@@ -1,13 +1,63 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 59. 按一定条件触发魔王的附身触发时受到伤害时n回合内反弹m%伤害给玩家a1: 持续回合数, a2: 反弹百分比)
// TODO: 实现按一定条件触发魔王的附身触发时受到伤害时n回合内反弹m%伤害给玩家a1: 持续回合数, a2: 反弹百分比)的核心逻辑
// 59. 按一定条件触发魔王的附身触发时受到伤害时n回合内反弹m%伤害给玩家
type NewSel59 struct {
NewSel0
// 记录反弹效果的剩余回合数
reflectTurns int
}
// TODO: 需要了解魔王的附身触发条件
func (e *NewSel59) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// TODO: 这里需要根据某个条件触发魔王的附身
// 触发后,设置反弹效果的回合数和百分比
// e.reflectTurns = int(e.Args()[0].IntPart())
return true
}
func (e *NewSel59) Damage_SUB_ex(t *info.DamageZone) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查是否处于反弹效果中
if e.reflectTurns > 0 {
// 反弹m%伤害给对手
reflectDamage := t.Damage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: reflectDamage,
})
}
return true
}
func (e *NewSel59) Turn_End() {
// 魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 减少反弹效果剩余回合数
if e.reflectTurns > 0 {
e.reflectTurns--
}
}
func init() {

View File

@@ -1,15 +1,36 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 69. 目标为n性别时所有攻击伤害增加m%a1: n, a2: m
// TODO: 实现目标为n性别时所有攻击伤害增加m%a1: n, a2: m的核心逻辑
type NewSel69 struct {
NewSel0
}
func (e *NewSel69) Damage_ADD(t *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
// 检查对手性别
if e.Ctx().Opp.CurrentPet.Info.Gender != int(e.Args()[0].IntPart()) {
return true
}
// 增加伤害百分比
t.Damage = t.Damage.Add(t.Damage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100)))
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 69, &NewSel69{})
}

View File

@@ -1,15 +1,32 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 70. 对手的能力提升效果会同时作用到自己身上
// TODO: 实现对手的能力提升效果会同时作用到自己身上的核心逻辑
type NewSel70 struct {
NewSel0
}
func (e *NewSel70) Prop_Befer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool {
// 只有对手提升能力时触发,且对手提升的技能是给自己用的
if in != e.Ctx().Our || e.Ctx().Opp != e.Ctx().Our {
return true
}
// 只处理能力增加时的情况
if ptype != info.AbilityOpType.ADD {
return true
}
// 将对手的能力提升同时加给自己
e.Ctx().Our.SetProp(e.Ctx().Our, prop, level, ptype)
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 70, &NewSel70{})
}

View File

@@ -1,15 +1,30 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 71. 每回合结束时对手降低n体力自身恢复m体力a1: n, a2: m
// TODO: 实现每回合结束时对手降低n体力自身恢复m体力a1: n, a2: m的核心逻辑
type NewSel71 struct {
NewSel0
}
func (e *NewSel71) Turn_End() {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 每回合结束后对手降低n体力受到伤害
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})
// 每回合结束后自身的恢复m体力
e.Ctx().Our.Heal(e.Ctx().Our, nil, e.Args()[1])
}
func init() {
input.InitEffect(input.EffectType.NewSel, 71, &NewSel71{})
}

View File

@@ -1,15 +1,30 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
)
// 72. 受到的伤害低于n时则在受到伤害后恢复自身n点体力值a1: n
// TODO: 实现受到的伤害低于n时则在受到伤害后恢复自身n点体力值a1: n的核心逻辑
type NewSel72 struct {
NewSel0
}
func (e *NewSel72) Skill_Useed() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查受到的伤害是否低于阈值
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) == -1 || e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) == 0 {
// 恢复指定点数的体力
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0])
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 72, &NewSel72{})
}

View File

@@ -1,15 +1,30 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 73. 给对方造成的伤害会恢复自身n%体力;a1: n
// TODO: 实现给对方造成的伤害会恢复自身n%体力;a1: n的核心逻辑
type NewSel73 struct {
NewSel0
}
func (e *NewSel73) Skill_Useed() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 恢复造成伤害的百分比
healAmount := e.Ctx().Opp.SumDamage.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
e.Input.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 73, &NewSel73{})
}

View File

@@ -1,15 +1,45 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 74. 每次物理或特殊攻击命中对手后有百分之n的概率给对手叠加一层衰弱a1: n
// TODO: 实现每次物理或特殊攻击命中对手后有百分之n的概率给对手叠加一层衰弱a1: n的核心逻辑
type NewSel74 struct {
NewSel0
}
func (e *NewSel74) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
// 只处理物理或特殊攻击
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
// 检查概率是否触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
// 给对手叠加衰弱状态(假设衰弱状态为特殊状态)
// 这里用99表示衰弱状态实际应根据游戏定义调整
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, 99)
if statusEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Opp, statusEffect)
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 74, &NewSel74{})
}

View File

@@ -2,14 +2,31 @@ package effect
import (
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 75. 每回合敌方恢复m%HP, 我方恢复n%HP不超过最大血量a1: m, a2: n
// TODO: 实现每回合敌方恢复m%HP, 我方恢复n%HP不超过最大血量a1: m, a2: n的核心逻辑
type NewSel75 struct {
NewSel0
}
func (e *NewSel75) Turn_End() {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 敌方恢复m%HP
oppMaxHP := e.Ctx().Opp.CurrentPet.GetMaxHP()
oppHealAmount := oppMaxHP.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
e.Ctx().Opp.Heal(e.Ctx().Opp, nil, oppHealAmount)
// 我方恢复n%HP
ourMaxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
ourHealAmount := ourMaxHP.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
e.Ctx().Our.Heal(e.Ctx().Our, nil, ourHealAmount)
}
func init() {
input.InitEffect(input.EffectType.NewSel, 75, &NewSel75{})
}

View File

@@ -0,0 +1,32 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 76. 减少自身n%的攻击伤害, 就是打对手的伤害a1: n
type NewSel76 struct {
NewSel0
}
func (e *NewSel76) Damage_SUB(t *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
// 减少自身攻击伤害的百分比
reduction := t.Damage.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
t.Damage = t.Damage.Sub(reduction)
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 76, &NewSel76{})
}

View File

@@ -0,0 +1,27 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 77. 每回合损失对手n点体力a1: n
type NewSel77 struct {
NewSel0
}
func (e *NewSel77) Turn_End() {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 每回合结束后对对手造成固定伤害
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[0],
})
}
func init() {
input.InitEffect(input.EffectType.NewSel, 77, &NewSel77{})
}

View File

@@ -0,0 +1,47 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 78. 受到特殊攻击伤害时以n%的概率使对方进入异常状态a1: spec_stat_type, a2: n百分比
type NewSel78 struct {
NewSel0
}
func (e *NewSel78) Action_end_ex() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
// 只对手使用特殊攻击时触发
if e.Ctx().SkillEntity.Category() != info.Category.SPECIAL {
return true
}
// 检查概率是否触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[1].IntPart()), 100)
if !success {
return true
}
// 获取状态效果实例并设置参数
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(e.Args()[0].IntPart()))
if statusEffect == nil {
return true
}
// 给对手添加状态
e.Ctx().Opp.AddEffect(e.Ctx().Opp, statusEffect)
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 78, &NewSel78{})
}

View File

@@ -0,0 +1,48 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
// 79. 受到超过n的伤害时下一招威力翻倍a1: n
type NewSel79 struct {
NewSel0
triggered bool
}
func (e *NewSel79) Damage_DIV_ex(t *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查受到的伤害是否超过阈值
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 {
// 标记本回合已触发,下次攻击威力翻倍
e.triggered = true
}
return true
}
func (e *NewSel79) Action_start(a, b *action.SelectSkillAction) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if e.Ctx().SkillEntity == nil {
return true
}
// 如果上一回合被触发过,本回合攻击威力翻倍
if e.triggered {
e.Ctx().SkillEntity.Power = e.Ctx().SkillEntity.Power * 2
e.triggered = false
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 79, &NewSel79{})
}

View File

@@ -0,0 +1,30 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
)
// 80. 受到超过n的伤害时恢复m体力a1: n, a2: m
type NewSel80 struct {
NewSel0
}
func (e *NewSel80) Skill_Useed() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查受到的伤害是否超过阈值
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 {
// 恢复指定点数的体力
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[1])
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 80, &NewSel80{})
}

View File

@@ -0,0 +1,57 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 81. 体力低于n%时每次受到伤害都会使自身进入山神守护状态接下来m回合受到伤害减免90%a1: n, a2: m
type NewSel81 struct {
NewSel0
damageReduceTurns int
}
func (e *NewSel81) Damage_DIV_ex(t *info.DamageZone) bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查当前是否处于山神守护状态
if e.damageReduceTurns > 0 {
// 减免90%伤害
reduction := t.Damage.Mul(alpacadecimal.NewFromInt(90)).Div(alpacadecimal.NewFromInt(100))
t.Damage = t.Damage.Sub(reduction)
return true
}
// 计算当前体力百分比
currentHP := e.Ctx().Our.CurrentPet.GetHP()
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
hpPercent := currentHP.Mul(alpacadecimal.NewFromInt(100)).Div(maxHP)
// 检查是否低于阈值
if hpPercent.Cmp(e.Args()[0]) == -1 {
// 进入山神守护状态持续m回合
e.damageReduceTurns = int(e.Args()[1].IntPart())
}
return true
}
func (e *NewSel81) Turn_End() {
// 魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 减少山神守护状态回合数
if e.damageReduceTurns > 0 {
e.damageReduceTurns--
}
}
func init() {
input.InitEffect(input.EffectType.NewSel, 81, &NewSel81{})
}

View File

@@ -0,0 +1,38 @@
package effect
import (
"blazing/logic/service/fight/input"
)
// 82. 每躲避一次攻击该回合结束后会回复n体力a1: n
type NewSel82 struct {
NewSel0
dodgedThisTurn bool
}
func (e *NewSel82) Miss() {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 标记本回合已躲避
e.dodgedThisTurn = true
}
func (e *NewSel82) Turn_End() {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return
}
// 如果本回合躲避了攻击,恢复指定体力
if e.dodgedThisTurn {
e.Ctx().Our.Heal(e.Ctx().Our, nil, e.Args()[0])
e.dodgedThisTurn = false
}
}
func init() {
input.InitEffect(input.EffectType.NewSel, 82, &NewSel82{})
}

View File

@@ -1,15 +1,36 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 83. 受到超过n的伤害时反弹m%伤害a1: n, a2: m
// TODO: 实现受到超过n的伤害时反弹m%伤害a1: n, a2: m的核心逻辑
type NewSel83 struct {
NewSel0
}
func (e *NewSel83) Skill_Useed() bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
// 检查受到的伤害是否超过阈值
if e.Ctx().Our.SumDamage.Cmp(e.Args()[0]) > 0 {
// 反弹m%伤害
reflectDamage := e.Ctx().Our.SumDamage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: reflectDamage,
})
}
return true
}
func init() {
input.InitEffect(input.EffectType.NewSel, 83, &NewSel83{})
}