diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 42200004..1bc0d00a 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -667,13 +667,15 @@ public enum LootManager { } } - public static void GenerateStrongholdLoot(Mob mob, boolean commander) { + public static void GenerateStrongholdLoot(Mob mob, boolean commander, boolean epic) { mob.getCharItemManager().clearInventory(); int multiplier = 1; if (commander) multiplier = 2; + if(epic) + multiplier = 10; int high = 125000; int low = 50000; @@ -708,51 +710,58 @@ public enum LootManager { } //special commander drop chances - if (commander) { + if (commander) + GenerateCommanderLoot(mob); + //special epic drop chances + if (epic) { + GenerateCommanderLoot(mob); + GenerateCommanderLoot(mob); + } + } - //present chance - if (ThreadLocalRandom.current().nextInt(100) < 25) - DropPresent(mob); + public static void GenerateCommanderLoot(Mob mob){ + //present chance + if (ThreadLocalRandom.current().nextInt(100) < 25) + DropPresent(mob); - //present chance - if (ThreadLocalRandom.current().nextInt(100) < 25) - DropPresent(mob); + //present chance + if (ThreadLocalRandom.current().nextInt(100) < 25) + DropPresent(mob); - //chance for glass - if (ThreadLocalRandom.current().nextInt(100) < 75) { - int glassID = rollRandomItem(126); - ItemBase glassItem = ItemBase.getItemBase(glassID); - if (glassItem != null) { - MobLoot toAdd2 = new MobLoot(mob, glassItem, true); + //chance for glass + if (ThreadLocalRandom.current().nextInt(100) < 75) { + int glassID = rollRandomItem(126); + ItemBase glassItem = ItemBase.getItemBase(glassID); + if (glassItem != null) { + MobLoot toAdd2 = new MobLoot(mob, glassItem, true); - if (toAdd2 != null) - mob.getCharItemManager().addItemToInventory(toAdd2); - } + if (toAdd2 != null) + mob.getCharItemManager().addItemToInventory(toAdd2); } + } - //chance for disc - if (ThreadLocalRandom.current().nextInt(100) < 75) { - int discID = rollRandomItem(3202); - ItemBase discItem = ItemBase.getItemBase(discID); - if (discItem != null) { - MobLoot toAdd3 = new MobLoot(mob, discItem, true); + //chance for disc + if (ThreadLocalRandom.current().nextInt(100) < 75) { + int discID = rollRandomItem(3202); + ItemBase discItem = ItemBase.getItemBase(discID); + if (discItem != null) { + MobLoot toAdd3 = new MobLoot(mob, discItem, true); - if (toAdd3 != null) - mob.getCharItemManager().addItemToInventory(toAdd3); - } + if (toAdd3 != null) + mob.getCharItemManager().addItemToInventory(toAdd3); } + } - //chance for stat rune - if (ThreadLocalRandom.current().nextInt(100) < 75) { - int runeID = rollRandomItem(3201); - ItemBase runeItem = ItemBase.getItemBase(runeID); - if (runeItem != null) { - MobLoot toAdd4 = new MobLoot(mob, runeItem, true); + //chance for stat rune + if (ThreadLocalRandom.current().nextInt(100) < 75) { + int runeID = rollRandomItem(3201); + ItemBase runeItem = ItemBase.getItemBase(runeID); + if (runeItem != null) { + MobLoot toAdd4 = new MobLoot(mob, runeItem, true); - if (toAdd4 != null) - mob.getCharItemManager().addItemToInventory(toAdd4); - } + if (toAdd4 != null) + mob.getCharItemManager().addItemToInventory(toAdd4); } } } diff --git a/src/engine/gameManager/StrongholdManager.java b/src/engine/gameManager/StrongholdManager.java index 7e025215..0d956d7d 100644 --- a/src/engine/gameManager/StrongholdManager.java +++ b/src/engine/gameManager/StrongholdManager.java @@ -74,7 +74,7 @@ public class StrongholdManager { guard.spawnTime = 1000000000; guard.BehaviourType = Enum.MobBehaviourType.Aggro; mine.strongholdMobs.add(guard); - LootManager.GenerateStrongholdLoot(guard,false); + LootManager.GenerateStrongholdLoot(guard,false,false); guard.healthMax = 12500; guard.setHealth(guard.healthMax); guard.maxDamageHandOne = 1550; @@ -84,6 +84,7 @@ public class StrongholdManager { guard.setFirstName("Elite Guardian"); InterestManager.setObjectDirty(guard); guard.StrongholdGuardian = true; + guard.stronghold = mine; } } //create stronghold commander @@ -106,7 +107,7 @@ public class StrongholdManager { commander.mobPowers.put(429413547,40); // grasp of thurin commander.StrongholdCommander = true; mine.strongholdMobs.add(commander); - LootManager.GenerateStrongholdLoot(commander,true); + LootManager.GenerateStrongholdLoot(commander,true, false); commander.healthMax = 50000; commander.setHealth(commander.healthMax); commander.maxDamageHandOne = 3500; @@ -115,6 +116,7 @@ public class StrongholdManager { commander.defenseRating = 3500; commander.setFirstName("Guardian Commander"); InterestManager.setObjectDirty(commander); + commander.stronghold = mine; } mine.setActive(true); @@ -250,4 +252,55 @@ public class StrongholdManager { } return 0; } + + public static void CheckToEndStronghold(Mine mine) { + if (!mine.isStronghold) + return; + + boolean stillAlive = false; + for (Mob mob : mine.strongholdMobs) + if (mob.isAlive()) + stillAlive = true; + + if (!stillAlive) { + // Epic encounter + + Building tower = BuildingManager.getBuilding(mine.getBuildingID()); + if (tower == null) + return; + + Zone mineZone = ZoneManager.findSmallestZone(tower.loc); + + Vector3fImmutable loc = tower.loc; + MobBase commanderBase = MobBase.getMobBase(getStrongholdCommanderID(tower.meshUUID)); + Mob commander = Mob.createMob(commanderBase.getLoadID(), loc, Guild.getErrantGuild(), true, mineZone, null, 0, commanderBase.getFirstName(), 75); + if (commander != null) { + commander.parentZone = mine.getParentZone(); + commander.bindLoc = loc; + commander.setLoc(loc); + commander.equipmentSetID = getStrongholdMobEquipSetID(commander.getMobBaseID()); + commander.runAfterLoad(); + commander.setLevel((short) 75); + commander.setResists(new Resists("Elite")); + commander.spawnTime = 1000000000; + commander.BehaviourType = Enum.MobBehaviourType.Aggro; + commander.mobPowers.clear(); + commander.mobPowers.put(563107033, 40); //grounding shot + commander.mobPowers.put(429032838, 40); // gravechill + commander.mobPowers.put(429413547, 40); // grasp of thurin + mine.strongholdMobs.add(commander); + LootManager.GenerateStrongholdLoot(commander, true, false); + commander.healthMax = 250000; + commander.setHealth(commander.healthMax); + commander.maxDamageHandOne = 5000; + commander.minDamageHandOne = 2500; + commander.atrHandOne = 5000; + commander.defenseRating = 3500; + commander.setFirstName("Epic Commander"); + InterestManager.setObjectDirty(commander); + commander.stronghold = mine; + commander.StrongholdEpic = true; + } + } + } } diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index cc24fe7e..72d3c0e5 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -66,6 +66,8 @@ public class Mine extends AbstractGameObject { public ArrayList strongholdMobs; public HashMap oldBuildings; + public Mob epicEncounter = null; + /** * ResultSet Constructor */ diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 4e9e7f6b..eaea2183 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -105,6 +105,10 @@ public class Mob extends AbstractIntelligenceAgent { public boolean StrongholdGuardian = false; + public Mine stronghold = null; + + public boolean StrongholdEpic = false; + /** * No Id Constructor @@ -1291,8 +1295,12 @@ public class Mob extends AbstractIntelligenceAgent { Dispatch dispatch; try { - if(this.StrongholdGuardian || this.StrongholdCommander) + if(this.StrongholdGuardian || this.StrongholdCommander) { ChatManager.chatSystemChannel(this.parentZone.getName() + "'s Stronghold Is Under Attack!"); + StrongholdManager.CheckToEndStronghold(this.stronghold); + } + if(this.StrongholdEpic) + StrongholdManager.EndStronghold(this.stronghold); //resync corpses //this.setLoc(this.getMovementLoc()); if (this.isSiege) { @@ -1482,7 +1490,7 @@ public class Mob extends AbstractIntelligenceAgent { } catch (Exception e) { Logger.error(e.getMessage()); } - if(this.StrongholdCommander || this.StrongholdGuardian){ + if(this.StrongholdCommander || this.StrongholdGuardian || this.StrongholdEpic){ this.setResists(new Resists("Elite")); return; } @@ -1496,6 +1504,9 @@ public class Mob extends AbstractIntelligenceAgent { } else if(this.StrongholdGuardian){ this.healthMax = 12500; return; + } else if(this.StrongholdEpic){ + this.healthMax = 250000; + return; } float h; @@ -1567,6 +1578,12 @@ public class Mob extends AbstractIntelligenceAgent { this.atrHandOne = 1800; this.defenseRating = 2200; return; + } else if(this.StrongholdEpic){ + this.maxDamageHandOne = 5000; + this.minDamageHandOne = 2500; + this.atrHandOne = 5000; + this.defenseRating = 3500; + return; } if (this.charItemManager == null || this.equip == null) { Logger.error("Player " + currentID + " missing skills or equipment");