Merge branch 'main' of github.com:72wo/blazing

This commit is contained in:
2025-11-12 21:46:25 +08:00
13 changed files with 57 additions and 52 deletions

View File

@@ -46,10 +46,12 @@ func (our *Input) CalculateCrit(opp *Input, skill *info.SkillEntity) {
}
// 恢复血量
func (our *Input) Heal(ac action.BattleActionI, value decimal.Decimal) {
func (our *Input) Heal(in *Input, ac action.BattleActionI, value decimal.Decimal) {
//使用道具回血
if _, ok := ac.(*action.UseItemAction); !ok && ac != nil {
if _, ok := ac.(*action.UseItemAction); !ok &&
ac != nil &&
in == our {
our.AttackValue.GainHp = int32(value.IntPart()) //道具有专门的回血包
}
@@ -94,41 +96,41 @@ func (our *Input) DelPP(value int) {
// /红伤只允许调用一次来保持锁伤
// 这个方法是对对方造成伤害
// 伤害落实 // 血量扣减节点比如触发回神,反弹也在这里实现
func (our *Input) Damage(sub *info.DamageZone) {
// sub := deep.MustCopy(ctx.DamageZone) //拷贝伤害,避免直接上下文传递,便于附加伤害
// sub := ctx.DamageZone
//sub.BeforeADD = sub.Damage
ok := our.Exec(func(t Effect) bool {
t.Ctx().DamageZone = sub
t.Damage_ADD() //红伤落实前,我方增伤
return true
})
//sub.BeforeMul = sub.Damage
if ok {
ok = our.Exec(func(t Effect) bool {
func (our *Input) Damage(in *Input, sub *info.DamageZone) {
// 对方对我方造成,需要吃到对方的加成
var ok bool
if our != in {
ok = our.Opp.Exec(func(t Effect) bool {
t.Ctx().DamageZone = sub
t.Damage_Mul() //红伤落实前,我方增伤
t.Damage_ADD() //红伤落实前,我方增伤
return true
})
}
//sub.BeforeFloor = sub.Damage
if ok {
ok = our.Exec(func(t Effect) bool {
t.Ctx().DamageZone = sub
t.Damage_Floor() //红伤落实,内部有befer
return true
})
//sub.BeforeMul = sub.Damage
if ok {
ok = our.Opp.Exec(func(t Effect) bool {
t.Ctx().DamageZone = sub
t.Damage_Mul() //红伤落实前,我方增伤
return true
})
}
//sub.BeforeFloor = sub.Damage
if ok {
ok = our.Opp.Exec(func(t Effect) bool {
t.Ctx().DamageZone = sub
t.Damage_Floor() //红伤落实,内部有befer
return true
})
}
}
// sub.BeforeMul = sub.Damage
if ok {
ok = our.Opp.Exec(func(t Effect) bool {
ok = our.Exec(func(t Effect) bool {
t.Ctx().DamageZone = sub
t.Damage_DIV_ex() //红伤落实,内部有befer
@@ -138,7 +140,7 @@ func (our *Input) Damage(sub *info.DamageZone) {
//sub.BeforeSUB = sub.Damage
if ok {
ok = our.Opp.Exec(func(t Effect) bool {
ok = our.Exec(func(t Effect) bool {
t.Ctx().DamageZone = sub
t.Damage_SUB_ex()
@@ -148,7 +150,7 @@ func (our *Input) Damage(sub *info.DamageZone) {
}
// sub.BeforeLock = sub.Damage
if ok {
if ok && in != our {
ok = our.Opp.Exec(func(t Effect) bool {
t.Damage_Lock()
@@ -158,7 +160,7 @@ func (our *Input) Damage(sub *info.DamageZone) {
}
//sub.BeforeLocked = sub.Damage
if ok {
our.Opp.Exec(func(t Effect) bool {
our.Exec(func(t Effect) bool {
t.Damage_Lock_ex()
@@ -167,15 +169,15 @@ func (our *Input) Damage(sub *info.DamageZone) {
}
if sub.Type == info.DamageType.Red { //红才会产生造成伤害
our.DamageZone.Damage = sub.Damage // 叠加总伤害
our.AttackValue.LostHp = uint32(our.DamageZone.Damage.IntPart()) //红伤落实
our.Opp.DamageZone.Damage = sub.Damage // 叠加总伤害
our.Opp.AttackValue.LostHp = uint32(our.Opp.DamageZone.Damage.IntPart()) //红伤落实
}
if uint32(our.DamageZone.Damage.IntPart()) > our.Opp.CurrentPet.Info.Hp {
if uint32(our.Opp.DamageZone.Damage.IntPart()) > our.CurrentPet.Info.Hp {
our.Opp.CurrentPet.Info.Hp = 0
our.CurrentPet.Info.Hp = 0
} else {
our.Opp.CurrentPet.Info.Hp = our.Opp.CurrentPet.Info.Hp - uint32(our.DamageZone.Damage.IntPart())
our.CurrentPet.Info.Hp = our.CurrentPet.Info.Hp - uint32(our.Opp.DamageZone.Damage.IntPart())
}
//todo 待实现死亡effet

View File

@@ -32,8 +32,8 @@ type Effect interface {
Skill_Use_ex() bool //技能PP减少节点
Skill_Useed() bool //技能PP减少节点
//OnDefeat(opp *Input) bool // 精灵被击败时触发
OnSwitchIn() bool // 精灵出战 / 上场时触发
OnSwitchOut() bool // 精灵下场时触发
OnSwitch(in *Input,) bool // 精灵出战 / 上场时触发
//OnSwitchOut() bool // 精灵下场时触发
// OnOwnerSwitchIn() bool // 所属玩家精灵出战时触发
// OnOwnerSwitchOut() bool // 所属玩家精灵下场时触发