From 1b92fa76e1fa815bb17ad4baad3c2ee7615deeb2 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 9 Sep 2023 21:48:22 -0500 Subject: [PATCH] characters that attack city friendly buildings are added to cityOutlaws --- src/engine/gameManager/CombatManager.java | 7 ------- src/engine/objects/Building.java | 9 +++++++++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 895a1e76..9f0e1843 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -605,13 +605,6 @@ public enum CombatManager { defense = 0; - Building building = (Building) target; - - City playerCity = ZoneManager.getCityAtLocation(building.getLoc()); - if(playerCity != null){ - if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID())) - playerCity.cityOutlaws.add(attacker.getObjectUUID()); - } } else { AbstractCharacter tar = (AbstractCharacter) target; defense = tar.getDefenseRating(); diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index d625234c..cf2aaf2c 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -537,6 +537,15 @@ public class Building extends AbstractWorldObject { if (value < 0) Mine.SendMineAttackMessage(this); + City playerCity = ZoneManager.getCityAtLocation(this.loc); + if(playerCity != null){ + if(this.getGuild().getNation().equals(playerCity.getTOL().getGuild().getNation())){ + //friendly building has been attacked, add attacker to city outlaw list + if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID())) + playerCity.cityOutlaws.add(attacker.getObjectUUID()); + } + } + return newHealth - oldHealth;