From 103d7c81067ed4aabf97dbe7d0a49754b1690969 Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Sat, 27 Apr 2024 20:20:01 +0800 Subject: [PATCH] fix: :bug: fort attack everyone --- logic/GameClass/GameObj/Map/Map.cs | 4 ++-- logic/Gaming/ActionManager.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/logic/GameClass/GameObj/Map/Map.cs b/logic/GameClass/GameObj/Map/Map.cs index 201b0b21..88cf3e8f 100755 --- a/logic/GameClass/GameObj/Map/Map.cs +++ b/logic/GameClass/GameObj/Map/Map.cs @@ -110,10 +110,10 @@ public static bool WormholeInteract(Wormhole gameObj, XY Pos) return (GameObj?)GameObjDict[gameObjType].Find(gameObj => GameData.IsInTheRange(gameObj.Position, Pos, range)); } - public List? ShipInTheRange(XY Pos, int range) + public List? ShipInTheRangeNotTeamID(XY Pos, int range, long teamID) { return GameObjDict[GameObjType.Ship].Cast()?.FindAll(ship => - GameData.IsInTheRange(ship.Position, Pos, range)); + (GameData.IsInTheRange(ship.Position, Pos, range) && ship.TeamID != teamID)); } public List? ShipInTheList(List PosList) { diff --git a/logic/Gaming/ActionManager.cs b/logic/Gaming/ActionManager.cs index 7fa2daec..d88b96d1 100755 --- a/logic/Gaming/ActionManager.cs +++ b/logic/Gaming/ActionManager.cs @@ -203,8 +203,8 @@ public bool Construct(Ship ship, ConstructionType constructionType) gameMap.Timer.IsGaming && !construction.HP.IsBelowMaxTimes(0.5), loopToDo: () => { - var ships = gameMap.ShipInTheRange( - construction.Position, GameData.FortRange); + var ships = gameMap.ShipInTheRangeNotTeamID( + construction.Position, GameData.FortRange, construction.TeamID); if (ships == null || ships.Count == 0) { return true;