add summon unit & maze buff & refactor battle
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import numpy as np
|
||||
|
||||
from game_server.resource.configdb.avatar_config import AvatarConfig
|
||||
from game_server.resource.configdb.stage_config import StageConfig
|
||||
from game_server.resource import ResourceManager
|
||||
from rail_proto.lib import (
|
||||
@@ -9,7 +11,8 @@ from rail_proto.lib import (
|
||||
SceneBattleInfo,
|
||||
SceneMonsterWave,
|
||||
SceneMonster,
|
||||
SceneEntityInfo
|
||||
SceneEntityInfo,
|
||||
BattleBuff, Avatar,
|
||||
)
|
||||
|
||||
class BattleManager:
|
||||
@@ -51,6 +54,20 @@ class BattleManager:
|
||||
for index, monster_list in enumerate(self.stages)
|
||||
]
|
||||
|
||||
def GetMazeBuffs(self, msg: SceneCastSkillCsReq)-> list[BattleBuff]:
|
||||
buffs = []
|
||||
for index, avatar_id in enumerate(self.player.lineup_manager.get(self.player.data.cur_lineup, None).avatar_list):
|
||||
if avatar_id == 1407 and msg.attacked_by_entity_id >> 20 != 1407 or avatar_id == 1407 and msg.attacked_by_entity_id >> 20 == 1407 and msg.skill_index == 0:
|
||||
continue
|
||||
for buff,lv in ResourceManager.instance().find_by_index(AvatarConfig,avatar_id).MazeBuffs.items():
|
||||
buffs.append(BattleBuff(
|
||||
id=buff,
|
||||
level=lv,
|
||||
owner_index=index,
|
||||
wave_flag=0xffffffff
|
||||
))
|
||||
return buffs
|
||||
|
||||
def EnterBattle(self, msg: SceneCastSkillCsReq, targets: list[int]) -> SceneCastSkillScRsp:
|
||||
self.stages: list[StageConfig] = []
|
||||
for entity_id in targets:
|
||||
@@ -74,7 +91,8 @@ class BattleManager:
|
||||
stage_id=self.stage_id,
|
||||
battle_id=self.battle_id,
|
||||
battle_avatar_list=self.GetBattleLineup(),
|
||||
monster_wave_list=self.GetBattleMonster()
|
||||
monster_wave_list=self.GetBattleMonster(),
|
||||
buff_list=self.GetMazeBuffs(msg)
|
||||
)
|
||||
)
|
||||
return SceneCastSkillScRsp()
|
||||
Reference in New Issue
Block a user