add summon unit & maze buff & refactor battle

This commit is contained in:
Naruse
2025-04-16 21:31:18 +08:00
parent f0e41e3258
commit cfd9f3cb99
11 changed files with 164 additions and 42 deletions

View File

@@ -1,23 +1,30 @@
from dataclasses import dataclass, field
from dataclasses import dataclass
from game_server.resource.base_resource import BaseResource, T
from game_server.resource.decorators import GameResource
from game_server.resource.configdb.avatar_skill_tree_config import AvatarSkillTreeConfig
from game_server.resource.configdb.maze_buff_config import MazeBuffConfig
@dataclass
@GameResource("resources/ExcelOutput/AvatarConfig.json")
class AvatarConfig(BaseResource):
AvatarID: int
AvatarSkills: dict[int, int]
MazeBuffs: dict[int,int] # ID and LvMax
def on_load(self: T) -> bool:
from game_server.resource import ResourceManager
self.AvatarSkills = {}
self.MazeBuffs = {}
skill_tree_config = ResourceManager.instance().find_all_by_index(
AvatarSkillTreeConfig, self.AvatarID
)
for data in ResourceManager.instance().values(MazeBuffConfig):
if str(data.ID).startswith(str(self.AvatarID)):
self.MazeBuffs[data.ID] = data.LvMax
for skill in skill_tree_config:
skill_id = skill.PointID
skill_level = skill.MaxLevel

View File

@@ -0,0 +1,13 @@
from dataclasses import dataclass
from game_server.resource.base_resource import BaseResource
from game_server.resource.decorators import GameResource, LoadPriority
from game_server.game.enums.scene.game_mode_type import GameModeTypeEnum
@dataclass
@GameResource("resources/ExcelOutput/MazeBuff.json",load_priority=LoadPriority.HIGH)
class MazeBuffConfig(BaseResource):
ID: int
LvMax: int
def get_index(self) -> str:
return str(self.ID)

View File

@@ -0,0 +1,16 @@
from dataclasses import dataclass
from game_server.resource.base_resource import BaseResource
from game_server.resource.decorators import GameResource
@dataclass
@GameResource("resources/ExcelOutput/SummonUnitData.json")
class SummonUnitData(BaseResource):
ID: int
JsonPath: str
DestroyOnEnterBattle: bool
RemoveMazeBuffOnDestroy: bool
IsClient: bool
def get_index(self) -> str:
return str(self.ID)