Skip to content

Commit

Permalink
style: 🎨 change to THUAI7.ConstructionState | None
Browse files Browse the repository at this point in the history
  • Loading branch information
sigureling committed May 16, 2024
1 parent d2c5e55 commit b73242a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CAPI/python/PyAPI/API.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]:
def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
return self.__logic.GetPlaceType(cellX, cellY)

def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.Construction:
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None:
return self.__logic.GetConstructionState(cellX, cellY)

def GetWormholeHp(self, cellX: int, cellY: int) -> int:
Expand Down Expand Up @@ -190,7 +190,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]:
def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
return self.__logic.GetPlaceType(cellX, cellY)

def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.Construction:
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None:
return self.__logic.GetConstructionState(cellX, cellY)

def GetWormholeHp(self, cellX: int, cellY: int) -> int:
Expand Down
4 changes: 2 additions & 2 deletions CAPI/python/PyAPI/DebugAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]:
def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
return self.__logic.GetPlaceType(cellX, cellY)

def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.Construction:
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None:
return self.__logic.GetConstructionState(cellX, cellY)

def GetWormholeHp(self, cellX: int, cellY: int) -> int:
Expand Down Expand Up @@ -465,7 +465,7 @@ def GetFullMap(self) -> List[List[THUAI7.PlaceType]]:
def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
return self.__logic.GetPlaceType(cellX, cellY)

def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.Construction:
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None:
return self.__logic.GetConstructionState(cellX, cellY)

def GetWormholeHp(self, cellX: int, cellY: int) -> int:
Expand Down
6 changes: 3 additions & 3 deletions CAPI/python/PyAPI/Interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
pass

@abstractmethod
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.Construction:
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None:
pass

@abstractmethod
Expand Down Expand Up @@ -247,7 +247,7 @@ def GetPlaceType(self, cellX: int, cellY: int) -> THUAI7.PlaceType:
pass

@abstractmethod
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.Construction:
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None:
"""获取当前建筑状态
:param cellX: X坐标, 单位Cell
Expand Down Expand Up @@ -415,7 +415,7 @@ def Produce(self) -> Future[bool]:
pass

@abstractmethod
def Rebuild(self, constructionType: THUAI7.ConstructionType) -> Future[bool]:
def Rebuild(self, constructionType: THUAI7.ConstructionStateType) -> Future[bool]:
"""发出重建指令
- 需要接近待重建 `Construction`
Expand Down
8 changes: 4 additions & 4 deletions CAPI/python/PyAPI/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,21 @@ def GetPlayerGUIDs(self) -> List[int]:
with self.__mtxState:
return copy.deepcopy(self.__currentState.guids)

def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.Construction:
def GetConstructionState(self, cellX: int, cellY: int) -> THUAI7.ConstructionState | None:
with self.__mtxState:
self.__logger.debug("Called GetConstructionState")
if (cellX, cellY) in self.__currentState.mapInfo.factoryState:
return THUAI7.Construction(
return THUAI7.ConstructionState(
self.__currentState.mapInfo.factoryState[(cellX, cellY)],
THUAI7.ConstructionType.Factory,
)
elif (cellX, cellY) in self.__currentState.mapInfo.communityState:
return THUAI7.Construction(
return THUAI7.ConstructionState(
self.__currentState.mapInfo.communityState[(cellX, cellY)],
THUAI7.ConstructionType.Community,
)
elif (cellX, cellY) in self.__currentState.mapInfo.fortState:
return THUAI7.Construction(
return THUAI7.ConstructionState(
self.__currentState.mapInfo.fortState[(cellX, cellY)],
THUAI7.ConstructionType.Fort,
)
Expand Down
2 changes: 1 addition & 1 deletion CAPI/python/PyAPI/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def __init__(self):
self.teamID: int = 0
self.guid: int = 0

class Construction:
class ConstructionState:
def __init__(self,teamID,HP,type:ConstructionType):
self.teamID=teamID
self.hp=HP
Expand Down

0 comments on commit b73242a

Please sign in to comment.