diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 562695ae..dcbe7553 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -681,6 +681,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject { if (this.resists == null && !this.getObjectType().equals(GameObjectType.Mob)) return Resists.getResists(0); + if(this.getObjectType().equals(GameObjectType.Mob)){ + return ((Mob)this).mobResists; + } + return this.resists; } diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 77459fef..a3656bb9 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -43,6 +43,7 @@ import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup; public class Mob extends AbstractIntelligenceAgent { + public Resists mobResists = null; private static int staticID = 0; public static ArrayList disciplineDroppers = new ArrayList<>(); public static HashMap dynamic_pets = new HashMap<>(); @@ -172,7 +173,7 @@ public class Mob extends AbstractIntelligenceAgent { } public static void setResistsForMob(Mob mob){ - mob.resists = new Resists("Generic"); + Resists resists = new Resists("Generic"); Zone parentMacro = null; for(Zone zone : ZoneManager.getAllZonesIn(mob.loc)){ if(zone.isMacroZone() == false) @@ -186,142 +187,115 @@ public class Mob extends AbstractIntelligenceAgent { case "Kralgaar Holm": case "Ecklund Wilds": case "Aurrochs Skrae": - mob.getResists().addResists(Resists.getResists(28)); + resists.addResists(Resists.getResists(28)); break; //Desert Generics case "Leth'khalivar Desert": case "Kharsoom": case "Vale of Nar Addad": case "The Blood Sands": - mob.getResists().addResists(Resists.getResists(2)); + resists.addResists(Resists.getResists(2)); break; //Swamp Generics case "Thollok Marsh": case "The Black Bog": case "Sevaath Mere": - mob.getResists().addResists(Resists.getResists(8)); + resists.addResists(Resists.getResists(8)); break; //Oblivion Generics case "Plain of Ashes": case "Bone Marches": case "The Doomplain": case "Greensward Pyre": - mob.getResists().addResists(Resists.getResists(4)); + resists.addResists(Resists.getResists(4)); break; //Maelstrom Generics case "Pandemonium": case "Western Battleground": - mob.getResists().addResists(Resists.getResists(32)); + resists.addResists(Resists.getResists(32)); break; } } switch(mob.mobBase.raceType){ case "Aelfborn": - mob.getResists().addResists(Resists.getResists(0)); - break; - case "All": - mob.getResists().addResists(Resists.getResists(0)); - break; + case "NPC": + case "Rat": + case "Reptile": + case "Grave": + case "Human": + case "Goblin": + case "CSR": + case "Construct": + case "Celestial": case "Animal": - mob.getResists().addResists(Resists.getResists(0)); + case "All": + case "SiegeEngineer": + resists.addResists(new Resists("Generic")); break; case "Aracoix": - mob.getResists().addResists(Resists.getResists(22)); - break; - case "Celestial": - mob.getResists().addResists(Resists.getResists(0)); + resists.addResists(Resists.getResists(22)); break; case "Centaur": - mob.getResists().addResists(Resists.getResists(24)); - break; - case "Construct": - mob.getResists().addResists(Resists.getResists(0)); - break; - case "CSR": - mob.getResists().addResists(Resists.getResists(0)); + resists.addResists(Resists.getResists(24)); break; case "Dragon": - mob.getResists().addResists(Resists.getResists(10)); + resists.addResists(Resists.getResists(10)); break; case "Dwarf": - mob.getResists().addResists(Resists.getResists(25)); + resists.addResists(Resists.getResists(25)); break; case "Elf": - mob.getResists().addResists(Resists.getResists(5)); + resists.addResists(Resists.getResists(5)); break; case "Giant": - mob.getResists().addResists(Resists.getResists(34)); - break; - case "Goblin": - mob.getResists().addResists(Resists.getResists(0)); - break; - case "Grave": - mob.getResists().addResists(Resists.getResists(0)); + resists.addResists(Resists.getResists(34)); break; case "HalfGiant": - mob.getResists().addResists(Resists.getResists(6)); - break; - case "Human": - mob.getResists().addResists(Resists.getResists(0)); + resists.addResists(Resists.getResists(6)); break; case "Infernal": - mob.getResists().addResists(Resists.getResists(18)); + resists.addResists(Resists.getResists(18)); break; case "Insect": - mob.getResists().addResists(Resists.getResists(19)); + case "Pet": + case "Summoned": + resists.addResists(Resists.getResists(19)); break; case "Irekei": - mob.getResists().addResists(Resists.getResists(12)); + resists.addResists(Resists.getResists(12)); break; case "Minotaur": - mob.getResists().addResists(Resists.getResists(13)); + resists.addResists(Resists.getResists(13)); break; case "Monster": - mob.getResists().addResists(Resists.getResists(35)); + resists.addResists(Resists.getResists(35)); break; case "NecroPet": - mob.getResists().addResists(Resists.getResists(23)); - break; - case "NPC": - mob.getResists().addResists(Resists.getResists(0)); - break; - case "Pet": - mob.getResists().addResists(Resists.getResists(19)); + resists.addResists(Resists.getResists(23)); break; case "Plant": - mob.getResists().addResists(Resists.getResists(36)); - break; - case "Rat": - mob.getResists().addResists(Resists.getResists(0)); - break; - case "Reptile": - mob.getResists().addResists(Resists.getResists(0)); + resists.addResists(Resists.getResists(36)); break; case "Shade": - mob.getResists().addResists(Resists.getResists(26)); + resists.addResists(Resists.getResists(26)); break; case "Siege": - mob.getResists().addResists(Resists.getResists(38)); - break; - case "Summoned": - mob.getResists().addResists(Resists.getResists(19)); + resists.addResists(Resists.getResists(38)); break; case "Troll": - mob.getResists().addResists(Resists.getResists(33)); + resists.addResists(Resists.getResists(33)); break; case "Undead": - mob.getResists().addResists(Resists.getResists(27)); + resists.addResists(Resists.getResists(27)); break; case "Nephilim": - mob.getResists().addResists(Resists.getResists(7)); + resists.addResists(Resists.getResists(7)); break; case "Vampire": - mob.getResists().addResists(Resists.getResists(11)); - break; - case "SiegeEngineer": - mob.getResists().addResists(Resists.getResists(0)); + resists.addResists(Resists.getResists(11)); break; } + mob.mobResists = resists; } public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException { diff --git a/src/engine/objects/Resists.java b/src/engine/objects/Resists.java index 9ba01ca1..d27489eb 100644 --- a/src/engine/objects/Resists.java +++ b/src/engine/objects/Resists.java @@ -217,7 +217,7 @@ public class Resists { } //failed, may want to debug this - return null; + return new Resists("Generic"); } /**