```
feat(pet): 添加精灵进化功能并优化融合系统 - 新增PetELV方法实现精灵进化功能,支持分支进化选择 - 添加进化相关的数据结构定义 - 实现进化材料检查和扣除逻辑 - 优化宠物融合失败处理机制 fix(fight): 修复战斗系统和效果计算问题 - 修复NewSeIdx_11和effect_60中的伤害计算逻辑 - 修复战斗状态判断条件,避免非PVP模式下的错误处理 - 优化战斗回合处理流程,修复效果缓存清空时机 - 修复effect_69
This commit is contained in:
@@ -33,7 +33,7 @@ func (f *FightC) Over(c common.PlayerI, res info.EnumBattleOverReason) {
|
||||
cool.Logger.Debug(context.Background(), " 战斗chan已关闭")
|
||||
return
|
||||
}
|
||||
if f.Info.Status != info.BattleMode.FIGHT_WITH_NPC {
|
||||
if f.Info.Status != info.BattleMode.FIGHT_WITH_NPC && res == info.BattleOverReason.PlayerEscape {
|
||||
return
|
||||
}
|
||||
// case *action.EscapeAction:
|
||||
|
||||
@@ -3,8 +3,6 @@ package effect
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// 11. 受到任何攻击都会反弹1/n的伤害给对方;(a1: n)
|
||||
@@ -30,7 +28,7 @@ func (e *NewSel11) Skill_Use_ex() bool {
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Opp.SumDamage.IntPart())).Div(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[0]))),
|
||||
Damage: e.Ctx().Opp.SumDamage.Div(e.Args()[0]),
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/input"
|
||||
)
|
||||
|
||||
@@ -10,10 +11,16 @@ type NewSel41 struct {
|
||||
NewSel0
|
||||
}
|
||||
|
||||
func (e *NewSel41) Turn_End() {
|
||||
func (e *NewSel41) Compare_Pre(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) bool {
|
||||
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
|
||||
return true
|
||||
}
|
||||
|
||||
if sattack == nil { //说明有一方放弃出手,如果自身被控那也不能回血
|
||||
return true
|
||||
}
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, nil, e.Args()[0])
|
||||
|
||||
return true
|
||||
}
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.NewSel, 41, &NewSel41{})
|
||||
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -35,6 +33,6 @@ func (e *Effect60) OnSkill() bool {
|
||||
}
|
||||
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
|
||||
Type: info.DamageType.Fixed,
|
||||
Damage: alpacadecimal.NewFromInt(int64(e.SideEffectArgs[1]))})
|
||||
Damage: e.Args()[1]})
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ func init() {
|
||||
}
|
||||
|
||||
func (e *Effect69) OnSkill() bool {
|
||||
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
t := &Effect69_sub{
|
||||
EffectNode: node.EffectNode{},
|
||||
}
|
||||
|
||||
@@ -121,6 +121,9 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
}
|
||||
|
||||
f.Broadcast(func(ff *input.Input) {
|
||||
|
||||
ff.EffectCache = make([]input.Effect, 0) //先把上一回合数据清空,但是应该把本身延续类效果集成过来
|
||||
ff.Effect_Lost = make([]input.Effect, 0)
|
||||
ff.Exec(func(effect input.Effect) bool { //回合开始前
|
||||
effect.Turn_Start(firstAttack, secondAttack)
|
||||
return true
|
||||
@@ -192,10 +195,10 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
}
|
||||
|
||||
currentSkill = originalSkill
|
||||
defender.Exec(func(effect input.Effect) bool { //这个是能否使用技能
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
return effect.Action_start_ex(firstAttack, secondAttack)
|
||||
})
|
||||
// defender.Exec(func(effect input.Effect) bool { //这个是能否使用技能
|
||||
// effect.Ctx().SkillEntity = currentSkill
|
||||
// return effect.Action_start_ex(firstAttack, secondAttack)
|
||||
// })
|
||||
canUseSkill := attacker.Exec(func(effect input.Effect) bool { //这个是能否使用技能
|
||||
effect.Ctx().SkillEntity = currentSkill
|
||||
return effect.Action_start(firstAttack, secondAttack)
|
||||
@@ -360,10 +363,10 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
fighter.Player.SendPackCmd(2505, &attackValueResult)
|
||||
fighter.CanChange = 0
|
||||
})
|
||||
println("回合结束")
|
||||
//println("回合结束")
|
||||
if f.Info.Status == info.BattleMode.FIGHT_WITH_NPC {
|
||||
if f.Opp.CurrentPet.Info.Hp <= 0 {
|
||||
println("回合结束开始执行NPC动作")
|
||||
//println("回合结束开始执行NPC动作")
|
||||
f.Opp.GetAction()
|
||||
//panic("AI自动技能")
|
||||
}
|
||||
|
||||
@@ -228,8 +228,6 @@ func (our *Input) Parseskill(skill *action.SelectSkillAction) {
|
||||
return
|
||||
}
|
||||
|
||||
our.EffectCache = make([]Effect, 0) //先把上一回合数据清空,但是应该把本身延续类效果集成过来
|
||||
our.Effect_Lost = make([]Effect, 0)
|
||||
// our.Initeffectcache() //这里说明是延续的效果,每次复制出来一个新的就好了
|
||||
//i.NewEffects = make([]Effect, 0) //这里说明是新增的效果
|
||||
temparg := skill.SideEffectArgS
|
||||
|
||||
@@ -244,56 +244,60 @@ func (f *FightC) resolveRound(p1Action, p2Action action.BattleActionI) {
|
||||
return
|
||||
}
|
||||
|
||||
// fmt.Println("开始结算回合")
|
||||
|
||||
// 动作优先级排序
|
||||
b1, b2 := f.Compare(p1Action, p2Action)
|
||||
|
||||
switch a := b1.(type) {
|
||||
|
||||
switch actionType := b1.(type) {
|
||||
case *action.ActiveSwitchAction:
|
||||
|
||||
if f.GetInputByAction(a, false).CurrentPet.Info.Hp <= 0 {
|
||||
f.GetInputByAction(a, false).CurrentPet.Info.Hp = 1
|
||||
}
|
||||
if b2k, ok := b2.(*action.SelectSkillAction); ok {
|
||||
if b2k.SkillEntity != nil {
|
||||
if b2k.CD != nil {
|
||||
f.waittime = *b2k.CD
|
||||
}
|
||||
}
|
||||
f.enterturn(b2.(*action.SelectSkillAction), nil)
|
||||
} else {
|
||||
|
||||
f.enterturn(nil, nil)
|
||||
}
|
||||
f.handleActiveSwitchAction(actionType, b2)
|
||||
|
||||
case *action.UseItemAction:
|
||||
f.handleItemAction(a)
|
||||
if f.GetInputByAction(a, false).CurrentPet.Info.Hp <= 0 {
|
||||
f.GetInputByAction(a, false).CurrentPet.Info.Hp = 1
|
||||
}
|
||||
if b2k, ok := b2.(*action.SelectSkillAction); ok {
|
||||
if b2k.SkillEntity != nil {
|
||||
if b2k.CD != nil {
|
||||
f.waittime = *b2k.CD
|
||||
}
|
||||
}
|
||||
|
||||
f.enterturn(b2.(*action.SelectSkillAction), nil)
|
||||
} else {
|
||||
if a1, ok := b2.(*action.UseItemAction); ok {
|
||||
f.handleItemAction(a1)
|
||||
|
||||
}
|
||||
f.enterturn(nil, nil)
|
||||
}
|
||||
f.handleUseItemAction(actionType, b2)
|
||||
|
||||
default:
|
||||
f.handleSkillActions(b1, b2)
|
||||
}
|
||||
}
|
||||
|
||||
// handleActiveSwitchAction 处理主动切换精灵动作
|
||||
func (f *FightC) handleActiveSwitchAction(switchAction *action.ActiveSwitchAction, otherAction action.BattleActionI) {
|
||||
input := f.GetInputByAction(switchAction, false)
|
||||
if input.CurrentPet.Info.Hp <= 0 {
|
||||
input.CurrentPet.Info.Hp = 1
|
||||
}
|
||||
|
||||
if skillAction, ok := otherAction.(*action.SelectSkillAction); ok {
|
||||
if skillAction.SkillEntity != nil && skillAction.CD != nil {
|
||||
f.waittime = *skillAction.CD
|
||||
}
|
||||
f.enterturn(skillAction, nil)
|
||||
} else {
|
||||
f.enterturn(nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
// handleUseItemAction 处理使用道具动作
|
||||
func (f *FightC) handleUseItemAction(itemAction *action.UseItemAction, otherAction action.BattleActionI) {
|
||||
f.handleItemAction(itemAction)
|
||||
|
||||
input := f.GetInputByAction(itemAction, false)
|
||||
if input.CurrentPet.Info.Hp <= 0 {
|
||||
input.CurrentPet.Info.Hp = 1
|
||||
}
|
||||
|
||||
if skillAction, ok := otherAction.(*action.SelectSkillAction); ok {
|
||||
if skillAction.SkillEntity != nil && skillAction.CD != nil {
|
||||
f.waittime = *skillAction.CD
|
||||
}
|
||||
f.enterturn(skillAction, nil)
|
||||
} else {
|
||||
if otherItemAction, ok := otherAction.(*action.UseItemAction); ok {
|
||||
f.handleItemAction(otherItemAction)
|
||||
}
|
||||
f.enterturn(nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
// 使用道具的逻辑封装
|
||||
func (f *FightC) handleItemAction(a *action.UseItemAction) {
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ type EffectNode struct {
|
||||
|
||||
func (e *EffectNode) Alive(t ...bool) bool {
|
||||
if len(t) > 0 {
|
||||
println("效果失效", e.id.GetEffectType(), e.ID().Suffix(), t[0])
|
||||
e.alive = t[0]
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ func (e *EffectNode) ID(t ...input.EffectIDCombiner) input.EffectIDCombiner {
|
||||
func (e *EffectNode) Hit(t ...bool) bool {
|
||||
|
||||
if len(t) > 0 {
|
||||
println("效果命中", e.id.GetEffectType(), e.id.Suffix(), t[0])
|
||||
// println("效果命中", e.id.GetEffectType(), e.id.Suffix(), t[0])
|
||||
e.hit = t[0]
|
||||
}
|
||||
|
||||
|
||||
@@ -35,3 +35,12 @@ type S2C_50001 struct {
|
||||
type S2C_9756 struct {
|
||||
UseEV uint32 //用掉的学习力
|
||||
}
|
||||
|
||||
// C2S_PET_EVOLVTION 精灵进化相关的客户端到服务端的消息结构
|
||||
type C2S_PET_EVOLVTION struct {
|
||||
Head common.TomeeHeader `cmd:"2314" struc:"skip"`
|
||||
CacthTime uint32 // 精灵的捕捉时间
|
||||
Index uint32 // 进化的分支索引。0代表没选择进化,1就是第一种进化形态,2就是其他分支进化形态
|
||||
// 如果没有分支进化,只有一种进化形态,Index只能为1
|
||||
// 后端直接判断进化条件的材料,执行进化并扣除材料
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ type C2S_PetFusion struct {
|
||||
Auxcatchtime uint32 `json:"auxcatchtime" msgpack:"auxcatchtime"` // 副精灵的时间戳
|
||||
Item1 [4]uint32 `json:"item1" msgpack:"item1"` // 物品序号1
|
||||
|
||||
GoldItem1 uint32 `json:"gold_item1" msgpack:"gold_item1"` // 0代表未放置 金豆物品1(C#:gold_item1)
|
||||
GoldItem2 uint32 `json:"gold_item2" msgpack:"gold_item2"` // 0代表未放置 金豆物品2(C#:gold_item2)
|
||||
GoldItem1 [2]uint32 `json:"gold_item1" msgpack:"gold_item1"` // 0代表未放置 金豆物品1(C#:gold_item1)
|
||||
|
||||
}
|
||||
|
||||
// PetFusionInfo 精灵融合结果详情(后端回包嵌套结构体)
|
||||
|
||||
Reference in New Issue
Block a user