战斗修改
This commit is contained in:
@@ -13,26 +13,26 @@ type Effect interface {
|
||||
Skill_PreUse(ctx Ctx) // 技能命中前触发//预处理受击技能 被攻击方效果,比如受击时无效技能这样
|
||||
OnSkill(ctx Ctx) // 触发on miss onhit
|
||||
|
||||
CanSkill(ctx Ctx) bool //使用技能 可以取消用技能节点 技能无效节点锁定伤害加上
|
||||
Skill_Can(ctx Ctx) bool //使用技能 可以取消用技能节点 技能无效节点锁定伤害加上
|
||||
Damage_ADD(ctx Ctx) bool // 攻击前触发 ,这时候就是+区间
|
||||
Damage_Mul(ctx Ctx) bool // 攻击触发
|
||||
|
||||
Damage_Floor(ctx Ctx) bool // 保底伤害
|
||||
Damage_DIV(ctx Ctx) bool //受击前触发 这时候就是百分比减伤区间
|
||||
Damage_SUB(ctx Ctx) bool // 受击触发 这时候就是点数减伤
|
||||
Damage_Lock(ctx Ctx) bool //锁定伤害
|
||||
|
||||
Damage_Floor(ctx Ctx) bool // 保底伤害
|
||||
Damage_DIV(ctx Ctx) bool //受击前触发 这时候就是百分比减伤区间
|
||||
Damage_SUB(ctx Ctx) bool // 受击触发 这时候就是点数减伤
|
||||
Damage_Lock(ctx Ctx) bool //锁定伤害
|
||||
Damage_Locked(ctx Ctx) bool //被动方锁定伤害
|
||||
Damage_Shield(ctx Ctx) bool // 护盾值变化时触发
|
||||
Damage_Use(ctx Ctx) bool // 伤害作用
|
||||
Skill_SubPP(ctx Ctx) bool //技能PP减少节点
|
||||
|
||||
OnDefeat(opp *Input) bool // 精灵被击败时触发
|
||||
//Damage_Use(ctx Ctx) bool // 伤害作用
|
||||
Skill_Use(ctx Ctx) bool //技能PP减少节点
|
||||
Skill_Useed(ctx Ctx) bool //技能PP减少节点
|
||||
//OnDefeat(opp *Input) bool // 精灵被击败时触发
|
||||
OnSwitchIn(ctx Ctx) bool // 精灵出战 / 上场时触发
|
||||
OnSwitchOut(ctx Ctx) bool // 精灵下场时触发
|
||||
OnOwnerSwitchIn(ctx Ctx) bool // 所属玩家精灵出战时触发
|
||||
OnOwnerSwitchOut(ctx Ctx) bool // 所属玩家精灵下场时触发
|
||||
|
||||
TurnEnd(ctx Ctx) //闪避率计算,,实际上是修改命中的判断
|
||||
Turn_End(ctx Ctx) //回合结束计算
|
||||
PreBattleEnd(ctx Ctx) bool //战斗结束前
|
||||
OnBattleEnd(ctx Ctx) bool //战斗结束
|
||||
Prop_Befer(in *Input, prop, level int8, ptype info.EnumAbilityOpType) bool //锁定属性
|
||||
@@ -40,8 +40,8 @@ type Effect interface {
|
||||
SetArgs(input *Input, param ...int)
|
||||
|
||||
// 治疗相关触发
|
||||
Heal_Pre(*action.BaseAction) bool // 治疗前触发 回复翻倍效果
|
||||
Heal(*action.BaseAction) bool // 治疗生效时触发 药剂反噬
|
||||
Heal_Pre(action.BattleActionI) bool // 治疗前触发 回复翻倍效果
|
||||
Heal(action.BattleActionI) bool // 治疗生效时触发 药剂反噬
|
||||
|
||||
//回合数,然后次数另外维护
|
||||
Duration(...int) int
|
||||
|
||||
@@ -3,6 +3,7 @@ package input
|
||||
import (
|
||||
element "blazing/common/data/Element"
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"fmt"
|
||||
|
||||
@@ -41,12 +42,20 @@ func (u *Input) UseSkill(opp *Input, skill *info.SkillEntity) {
|
||||
|
||||
}
|
||||
|
||||
// 恢复血量
|
||||
func (u *Input) Heal(ac action.BattleActionI, value decimal.Decimal) {
|
||||
|
||||
u.CurrentPet.Info.Hp += uint32(value.IntPart())
|
||||
|
||||
}
|
||||
|
||||
// 伤害落实 // 血量扣减节点比如触发回神,反弹也在这里实现
|
||||
func (u *Input) Damage(ctx Ctx) {
|
||||
ctx.Input.DamageZone.BeforeADD = ctx.DamageZone.Damage
|
||||
ok := ctx.Input.Exec(func(t Effect) bool {
|
||||
|
||||
t.Damage_ADD(ctx) //红伤落实前,我方增伤
|
||||
tctx := ctx
|
||||
tctx.Input = u
|
||||
t.Damage_ADD(tctx) //红伤落实前,我方增伤
|
||||
|
||||
return true
|
||||
})
|
||||
@@ -54,14 +63,25 @@ func (u *Input) Damage(ctx Ctx) {
|
||||
ctx.Input.DamageZone.BeforeMul = ctx.DamageZone.Damage
|
||||
if ok {
|
||||
ok = ctx.Input.Exec(func(t Effect) bool {
|
||||
tctx := ctx
|
||||
tctx.Input = u
|
||||
t.Damage_Mul(tctx) //红伤落实前,我方增伤
|
||||
|
||||
t.Damage_Mul(ctx) //红伤落实前,我方增伤
|
||||
return true
|
||||
})
|
||||
}
|
||||
ctx.Input.DamageZone.BeforeFloor = ctx.DamageZone.Damage
|
||||
if ok {
|
||||
ok = ctx.Exec(func(t Effect) bool {
|
||||
tctx := ctx
|
||||
tctx.Input = u
|
||||
t.Damage_Floor(tctx) //红伤落实,内部有befer
|
||||
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
ctx.Input.DamageZone.BeforeMul = ctx.DamageZone.Damage //反弹伤害记录
|
||||
ctx.Input.DamageZone.BeforeMul = ctx.DamageZone.Damage
|
||||
if ok {
|
||||
ok = u.Exec(func(t Effect) bool {
|
||||
|
||||
@@ -82,16 +102,27 @@ func (u *Input) Damage(ctx Ctx) {
|
||||
}
|
||||
|
||||
ctx.Input.DamageZone.BeforeLock = ctx.DamageZone.Damage
|
||||
if ok {
|
||||
ok = ctx.Input.Exec(func(t Effect) bool {
|
||||
tctx := ctx
|
||||
tctx.Input = u
|
||||
t.Damage_Lock(tctx)
|
||||
|
||||
return true
|
||||
})
|
||||
}
|
||||
ctx.Input.DamageZone.BeforeLocked = ctx.DamageZone.Damage
|
||||
if ok {
|
||||
ok = u.Exec(func(t Effect) bool {
|
||||
|
||||
t.Damage_Lock(ctx)
|
||||
t.Damage_Locked(ctx)
|
||||
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
if ctx.DamageZone.Type == info.DamageType.Red {
|
||||
if ctx.DamageZone.Type == info.DamageType.Red { //红才会产生造成伤害
|
||||
ctx.Input.DamageZone.Damage = ctx.DamageZone.Damage
|
||||
ctx.AttackValue.LostHp = uint32(ctx.DamageZone.Damage.IntPart()) //红伤落实
|
||||
}
|
||||
|
||||
@@ -99,7 +130,7 @@ func (u *Input) Damage(ctx Ctx) {
|
||||
|
||||
u.CurrentPet.Info.Hp = 0
|
||||
} else {
|
||||
u.CurrentPet.Info.Hp = u.CurrentPet.Info.Hp - ctx.AttackValue.LostHp
|
||||
u.CurrentPet.Info.Hp = u.CurrentPet.Info.Hp - uint32(ctx.DamageZone.Damage.IntPart())
|
||||
}
|
||||
|
||||
//todo 待实现死亡effet
|
||||
|
||||
@@ -20,12 +20,14 @@ type Input struct {
|
||||
// info.BattleActionI
|
||||
Effects *utils.OrderedMap[int, Effect] //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
||||
DamageZone struct {
|
||||
Damage decimal.Decimal //伤害
|
||||
BeforeADD decimal.Decimal //攻击伤害
|
||||
BeforeMul decimal.Decimal
|
||||
BeforeDiv decimal.Decimal
|
||||
BeforeSUB decimal.Decimal
|
||||
BeforeLock decimal.Decimal //锁伤 先锁受击方,再锁攻击方 受击方免疫也是这么锁 免疫等于锁0
|
||||
Damage decimal.Decimal //伤害
|
||||
BeforeADD decimal.Decimal //攻击伤害
|
||||
BeforeMul decimal.Decimal
|
||||
BeforeFloor decimal.Decimal
|
||||
BeforeDiv decimal.Decimal
|
||||
BeforeSUB decimal.Decimal
|
||||
BeforeLock decimal.Decimal //锁伤 先锁受击方,再锁攻击方 受击方免疫也是这么锁 免疫等于锁0
|
||||
BeforeLocked decimal.Decimal
|
||||
//BeforePost decimal.Decimal
|
||||
|
||||
//OldAttack int //攻击伤害被挡前伤害记录
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"blazing/modules/blazing/model"
|
||||
"reflect"
|
||||
|
||||
"github.com/barkimedes/go-deepcopy"
|
||||
"github.com/brunoga/deep"
|
||||
"github.com/tnnmigga/enum"
|
||||
)
|
||||
|
||||
@@ -31,7 +31,9 @@ func Geteffect(etype EnumEffectType, id int) *EffectID {
|
||||
ret, ok := NodeM[id+int(etype)]
|
||||
if ok {
|
||||
//todo 获取前GetEffect
|
||||
eff, _ := deepcopy.Anything(ret)
|
||||
|
||||
eff := deep.MustCopy(ret)
|
||||
|
||||
return &EffectID{
|
||||
ID: id + int(etype),
|
||||
Effect: eff.(Effect),
|
||||
|
||||
Reference in New Issue
Block a user