From 48804826e06fc1d9b2060671b17792f735e45512 Mon Sep 17 00:00:00 2001 From: Parsa Mohammadian Date: Thu, 1 Sep 2022 13:46:51 +0430 Subject: [PATCH] Update game view due to game changes --- .../ir/sharif/aic/hideandseek/core/models/GameConfig.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/ir/sharif/aic/hideandseek/core/models/GameConfig.java b/src/main/java/ir/sharif/aic/hideandseek/core/models/GameConfig.java index 9f70f49..6cc8318 100644 --- a/src/main/java/ir/sharif/aic/hideandseek/core/models/GameConfig.java +++ b/src/main/java/ir/sharif/aic/hideandseek/core/models/GameConfig.java @@ -78,7 +78,7 @@ public List findVisibleAgentsByViewerAndTurn(Agent viewer, Turn turn) { if (agent.equals(viewer)) continue; var agentNode = graphMap.getNodeById(agent.getNodeId()); - if (agent.is(AgentType.POLICE) || agent.is(AgentType.BATMAN)) + if ((agent.is(AgentType.POLICE) || agent.is(AgentType.BATMAN)) && agent.getTeam().equals(viewer.getTeam())) visibleAgents.add(agent); else if (agent.is(AgentType.THIEF)) { if (currentNode.getVisibleRadiusXPoliceThief().contains(agentNode)) @@ -117,7 +117,7 @@ private void getPoliceAndBatmanNormalView(Agent viewer, List visibleAgent for (Agent agent : agentMap.values()) { if (agent.equals(viewer)) continue; - if (agent.is(AgentType.POLICE) || agent.is(AgentType.BATMAN)) + if ((agent.is(AgentType.POLICE) || agent.is(AgentType.BATMAN)) && agent.getTeam().equals(viewer.getTeam())) visibleAgents.add(agent); } } @@ -126,6 +126,8 @@ private void getThiefAndJokerView(Agent viewer, List visibleAgents, Node for (Agent agent : agentMap.values()) { if (agent.equals(viewer)) continue; + if ((agent.is(AgentType.THIEF) || agent.is(AgentType.JOKER)) && agent.getTeam().equals(viewer.getTeam())) + visibleAgents.add(agent); if (agent.is(AgentType.POLICE)) visibleAgents.add(agent); else if (agent.is(AgentType.BATMAN)) {