diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 40bd658..f1116e5 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index 51050d4..615c5f9 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.7.3cr9 +version: 3.8.0-alpha1 commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index 2aaa7c7..2e528e5 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -41,6 +41,8 @@ import org.bukkit.material.Wool; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; +import org.inventivetalent.glow.GlowAPI; +import org.inventivetalent.glow.GlowAPI.Color; import com.google.common.base.Function; import com.google.common.base.Functions; @@ -2618,50 +2620,52 @@ public class GenericFunctions { } public static void DealDamageToMob(double dmg, LivingEntity target, Entity damager, ItemStack artifact, String reason) { - if (damager!=null && (target instanceof Monster)) { - Monster m = (Monster)target; - if (damager instanceof Player) { - NewCombat.addMonsterToTargetList(m, (Player)damager); - } - TwosideKeeper.habitat_data.addNewStartingLocation(target); - } - aPlugin.API.sendEntityHurtAnimation(target); - TwosideKeeper.log("Call event with "+dmg, 5); LivingEntity shooter = NewCombat.getDamagerEntity(damager); - if (shooter!=null) { - if (!(shooter instanceof Monster) || !(target instanceof Monster)) { - TwosideKeeper.log(GenericFunctions.GetEntityDisplayName(shooter)+"->"+ - GenericFunctions.GetEntityDisplayName(target)+ChatColor.WHITE+": Damage dealt was "+dmg,2); - } - } else { - if (!(target instanceof Monster)) { - TwosideKeeper.log(reason+"->"+ - GenericFunctions.GetEntityDisplayName(target)+ChatColor.WHITE+": Damage dealt was "+dmg,2); - } - } - double oldhp=((LivingEntity)target).getHealth(); - LivingEntity le = NewCombat.getDamagerEntity(damager); - if (le!=null) { - GenericFunctions.subtractHealth(target, le, dmg, artifact); - if (artifact!=null && - GenericFunctions.isArtifactEquip(artifact) && - (le instanceof Player)) { - Player p = (Player)le; - double ratio = 1.0-NewCombat.CalculateDamageReduction(1,target,p); - AwakenedArtifact.addPotentialEXP(le.getEquipment().getItemInMainHand(), (int)((ratio*20)+5), p); - NewCombat.increaseArtifactArmorXP(p,(int)(ratio*10)+1); - } - - if (le instanceof Player) { - Player p = (Player)le; - if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { - aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1); + if (enoughTicksHavePassed(target,shooter)) { + if (damager!=null && (target instanceof Monster)) { + Monster m = (Monster)target; + if (damager instanceof Player) { + NewCombat.addMonsterToTargetList(m, (Player)damager); } - knockOffGreed(p); + TwosideKeeper.habitat_data.addNewStartingLocation(target); } + aPlugin.API.sendEntityHurtAnimation(target); + TwosideKeeper.log("Call event with "+dmg, 5); + if (shooter!=null) { + if (!(shooter instanceof Monster) || !(target instanceof Monster)) { + TwosideKeeper.log(GenericFunctions.GetEntityDisplayName(shooter)+"->"+ + GenericFunctions.GetEntityDisplayName(target)+ChatColor.WHITE+": Damage dealt was "+dmg,2); + } + } else { + if (!(target instanceof Monster)) { + TwosideKeeper.log(reason+"->"+ + GenericFunctions.GetEntityDisplayName(target)+ChatColor.WHITE+": Damage dealt was "+dmg,2); + } + } + double oldhp=((LivingEntity)target).getHealth(); + LivingEntity le = NewCombat.getDamagerEntity(damager); + if (le!=null) { + GenericFunctions.subtractHealth(target, le, dmg, artifact); + if (artifact!=null && + GenericFunctions.isArtifactEquip(artifact) && + (le instanceof Player)) { + Player p = (Player)le; + double ratio = 1.0-NewCombat.CalculateDamageReduction(1,target,p); + AwakenedArtifact.addPotentialEXP(le.getEquipment().getItemInMainHand(), (int)((ratio*20)+5), p); + NewCombat.increaseArtifactArmorXP(p,(int)(ratio*10)+1); + } + + if (le instanceof Player) { + Player p = (Player)le; + if (GenericFunctions.isEquip(p.getEquipment().getItemInMainHand())) { + aPlugin.API.damageItem(p, p.getEquipment().getItemInMainHand(), 1); + } + knockOffGreed(p); + } + } + + TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3); } - - TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3); } public static void knockOffGreed(Player p) { @@ -2805,53 +2809,78 @@ public class GenericFunctions { } public static void subtractHealth(LivingEntity entity, LivingEntity damager, double dmg, ItemStack artifact) { - if (damager instanceof Player) { - Player p = (Player)damager; - - TwosideKeeper.log("Damage goes from "+dmg+"->"+(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER),5); - entity.damage(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER,damager); - aPlugin.API.showDamage(entity, GetHeartAmount(dmg)); - - PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); - if (pd.damagelogging) { - pd.target=entity; - DecimalFormat df = new DecimalFormat("0.0"); - TwosideKeeper.updateTitle(p,ChatColor.AQUA+df.format(dmg)); - TwosideKeeper.log("In here",2); + entity.setLastDamage(0); + entity.setNoDamageTicks(0); + entity.setMaximumNoDamageTicks(0); + boolean hitallowed=enoughTicksHavePassed(entity,damager); + if (hitallowed) { + updateNoDamageTickMap(entity,damager); + if (damager instanceof Player) { + Player p = (Player)damager; + + TwosideKeeper.log("Damage goes from "+dmg+"->"+(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER),5); + entity.damage(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER,damager); + aPlugin.API.showDamage(entity, GetHeartAmount(dmg)); + + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.damagelogging) { + pd.target=entity; + DecimalFormat df = new DecimalFormat("0.0"); + TwosideKeeper.updateTitle(p,ChatColor.AQUA+df.format(dmg)); + TwosideKeeper.log("In here",2); + } else { + pd.target=entity; + TwosideKeeper.updateTitle(p); + } + //Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(damager,entity,DamageCause.CUSTOM,dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER)); } else { - pd.target=entity; - TwosideKeeper.updateTitle(p); - } - //Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(damager,entity,DamageCause.CUSTOM,dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER)); - } else { - if (entity instanceof Player) { - double dodgechance = NewCombat.CalculateDodgeChance((Player)entity); - Player p = (Player)entity; - if (!p.hasPotionEffect(PotionEffectType.GLOWING)) { - if (Math.random()<=dodgechance) { - p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f); - for (int i=0;idmg && entity instanceof Player) { + if (!AttemptRevive((Player)entity,dmg)) { + entity.setHealth(((Player)entity).getHealth()-dmg); + aPlugin.API.showDamage(entity, GetHeartAmount(dmg)); + aPlugin.API.sendEntityHurtAnimation((Player)entity); + } + } - } else { - //Use old system if we cannot get a valid damager. - if (entity.getHealth()>dmg && entity instanceof Player) { - if (!AttemptRevive((Player)entity,dmg)) { - entity.setHealth(((Player)entity).getHealth()-dmg); - aPlugin.API.showDamage(entity, GetHeartAmount(dmg)); - aPlugin.API.sendEntityHurtAnimation((Player)entity); + else { + //List drops = new ArrayList(); + //EntityDeathEvent ev = new EntityDeathEvent(entity,drops); + //Bukkit.getPluginManager().callEvent(ev); + //entity.setHealth(0); + if (entity instanceof Player && !AttemptRevive((Player)entity,Integer.MAX_VALUE)) { + entity.damage(Integer.MAX_VALUE); } - } + } + } + } + } else { + if (entity.getHealth()>dmg && entity instanceof Player) { + if (!AttemptRevive((Player)entity,dmg)) { + entity.setHealth(((Player)entity).getHealth()-dmg); + aPlugin.API.sendEntityHurtAnimation((Player)entity); + } + } else { //List drops = new ArrayList(); @@ -2860,29 +2889,52 @@ public class GenericFunctions { //entity.setHealth(0); if (entity instanceof Player && !AttemptRevive((Player)entity,Integer.MAX_VALUE)) { entity.damage(Integer.MAX_VALUE); - } } - } + } + } + } + } + } + + public static boolean enoughTicksHavePassed(LivingEntity entity, LivingEntity damager) { + if (entity instanceof Player) { + Player p = (Player)entity; + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.hitlist.containsKey(damager.getUniqueId())) { + long time = pd.hitlist.get(damager.getUniqueId()); + if (time+10dmg && entity instanceof Player) { - if (!AttemptRevive((Player)entity,dmg)) { - entity.setHealth(((Player)entity).getHealth()-dmg); - aPlugin.API.sendEntityHurtAnimation((Player)entity); - } - } - - else { - //List drops = new ArrayList(); - //EntityDeathEvent ev = new EntityDeathEvent(entity,drops); - //Bukkit.getPluginManager().callEvent(ev); - //entity.setHealth(0); - if (entity instanceof Player && !AttemptRevive((Player)entity,Integer.MAX_VALUE)) { - entity.damage(Integer.MAX_VALUE); - } - } + return true; } } + if (entity instanceof Monster) { + Monster m = (Monster)entity; + MonsterStructure md = MonsterStructure.getMonsterStructure(m); + if (md.hitlist.containsKey(damager.getUniqueId())) { + long time = md.hitlist.get(damager.getUniqueId()); + if (time+10(20/(spawnamt+1))) { TwosideKeeper.log("[Habitat]It failed.",4); return false; } @@ -56,12 +56,12 @@ public class Habitation { } if (locationhashes.containsKey(hash)) { int spawnamt = locationhashes.get(hash); - spawnamt+=5; + spawnamt+=1; locationhashes.put(hash,spawnamt); for (int x=-2;x<3;x++) { for (int z=-2;z<3;z++) { if (x!=0^z!=0) { - addKillToLocation(l.getLocation().add(x,0,z)); + addKillToLocation(l.getLocation().add(x*16,0,z*16)); } } } @@ -74,7 +74,9 @@ public class Habitation { String hash = getLocationHash(l); if (locationhashes.containsKey(hash)) { int spawnamt = locationhashes.get(hash); - spawnamt+=2; + if (Math.random()<=0.5) { + spawnamt+=1; + } locationhashes.put(hash,spawnamt); } else { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index 27ba48c..71a54fe 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -148,7 +148,7 @@ public enum ItemSet { if (temp!=null) { int tier = ItemSet.GetTier(GenericFunctions.getEquipment(ent)[i]); int detectedsets = ItemSet.GetTierSetCount(set, tier, ent); - TwosideKeeper.log("Sets: "+detectedsets, 2); + TwosideKeeper.log("Sets: "+detectedsets, 5); if (detectedsets>=5) { return true; } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/LootStructure.java b/src/sig/plugin/TwosideKeeper/HelperStructures/LootStructure.java index 5ec50d3..6894f7f 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/LootStructure.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/LootStructure.java @@ -7,6 +7,8 @@ public class LootStructure { boolean hardened_item; int amt; ArtifactItem art; + boolean set; + int minSetLevel; public LootStructure(Material mat, boolean ishardened) { this.mat=mat; @@ -33,6 +35,23 @@ public class LootStructure { this.art=art; } + public LootStructure(Material mat, boolean ishardened, int minSetLevel) { + // TODO Auto-generated constructor stub + this.mat=mat; + this.hardened_item=ishardened; + this.amt=1; + this.set=true; + this.minSetLevel=minSetLevel; + } + + public boolean isSet() { + return set; + } + + public int GetMinSetLevel() { + return minSetLevel; + } + public Material GetMaterial() { return mat; } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java index b56221a..09e80bf 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java @@ -174,7 +174,62 @@ public enum MonsterDifficulty { new LootStructure(Material.LEATHER_LEGGINGS,4), new LootStructure(Material.LEATHER_BOOTS,4), } - ); + ), + ELITE( + new LootStructure[]{ //Common Loot + new LootStructure(Material.EMERALD_BLOCK), + new LootStructure(Material.DIAMOND_BLOCK), + new LootStructure(Material.GOLD_BLOCK), + new LootStructure(Material.REDSTONE_BLOCK), + new LootStructure(Material.IRON_BLOCK), + new LootStructure(Material.LAPIS_BLOCK), + new LootStructure(Material.BOW, true), + new LootStructure(Material.FISHING_ROD, true), + new LootStructure(Material.DIAMOND_SWORD, true), + new LootStructure(Material.DIAMOND_AXE, true), + new LootStructure(Material.DIAMOND_PICKAXE, true), + new LootStructure(Material.DIAMOND_HOE, true), + new LootStructure(Material.DIAMOND_SPADE, true), + new LootStructure(Material.DIAMOND_CHESTPLATE, true), + new LootStructure(Material.DIAMOND_LEGGINGS, true), + new LootStructure(Material.DIAMOND_BOOTS, true), + new LootStructure(Material.DIAMOND_HELMET, true), + new LootStructure(Material.LEATHER_HELMET,3), + new LootStructure(Material.LEATHER_CHESTPLATE,3), + new LootStructure(Material.LEATHER_LEGGINGS,3), + new LootStructure(Material.LEATHER_BOOTS,3), + }, + new LootStructure[]{ //Rare Loot + new LootStructure(Material.BOW, true), + new LootStructure(Material.FISHING_ROD, true), + new LootStructure(Material.GOLD_SWORD, true), + new LootStructure(Material.GOLD_AXE, true), + new LootStructure(Material.GOLD_PICKAXE, true), + new LootStructure(Material.GOLD_HOE, true), + new LootStructure(Material.GOLD_SPADE, true), + new LootStructure(Material.GOLD_CHESTPLATE, true), + new LootStructure(Material.GOLD_LEGGINGS, true), + new LootStructure(Material.GOLD_BOOTS, true), + new LootStructure(Material.GOLD_HELMET, true), + new LootStructure(Material.LEATHER_HELMET,3), + new LootStructure(Material.LEATHER_CHESTPLATE,3), + new LootStructure(Material.LEATHER_LEGGINGS,3), + new LootStructure(Material.LEATHER_BOOTS,3), + }, + new LootStructure[]{ //Legendary Loot + new LootStructure(Material.PRISMARINE_SHARD), + new LootStructure(Material.POTION), + new LootStructure(Material.GOLD_SWORD, true, 1), + new LootStructure(Material.GOLD_AXE, true, 1), + new LootStructure(Material.GOLD_PICKAXE, true, 1), + new LootStructure(Material.GOLD_HOE, true, 1), + new LootStructure(Material.GOLD_SPADE, true, 1), + new LootStructure(Material.GOLD_CHESTPLATE, true, 1), + new LootStructure(Material.GOLD_LEGGINGS, true, 1), + new LootStructure(Material.GOLD_BOOTS, true, 1), + new LootStructure(Material.GOLD_HELMET, true, 1), + } + ); LootStructure[] loot_regular; LootStructure[] loot_rare; @@ -190,8 +245,12 @@ public enum MonsterDifficulty { sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,3); return null; } - + public List RandomizeDrops(double dropmult, boolean isBoss, boolean isRanger) { + return RandomizeDrops(dropmult,isBoss,false,isRanger); + } + + public List RandomizeDrops(double dropmult, boolean isBoss, boolean isElite, boolean isRanger) { TwosideKeeper.log(ChatColor.AQUA+"->Entering RandomizeDrops()", 5); List droplist = new ArrayList(); dropmult += 1; //Base dropmult is 1.0. @@ -208,7 +267,7 @@ public enum MonsterDifficulty { //First do a common roll. if (Math.random()0) { - TwosideKeeper.log(">Attempting Common roll.", 1); + TwosideKeeper.log(">Attempting Common roll.", 4); //This is a common roll. ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger); TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); @@ -218,15 +277,15 @@ public enum MonsterDifficulty { //Rare Loot roll. if (Math.random()0) { - TwosideKeeper.log(">Attempting Rare roll.", 1); + TwosideKeeper.log(">Attempting Rare roll.", 3); //This is a common roll. ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger); TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); droplist.add(gen_loot); double randomness = Math.random(); - TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 1); + TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4); if (randomness<=0.2) { - TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn an essence!", 1); + TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn an essence!", 4); switch (this) { case DANGEROUS: droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE)); @@ -237,6 +296,9 @@ public enum MonsterDifficulty { case HELLFIRE: droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE)); break; + case ELITE: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE)); + break; case NORMAL: droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE)); break; @@ -250,15 +312,15 @@ public enum MonsterDifficulty { //Legendary Loot roll. if (Math.random()0) { - TwosideKeeper.log(">Attempting Legendary roll.", 1); + TwosideKeeper.log(">Attempting Legendary roll.", 3); //This is a common roll. ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger); TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4); droplist.add(gen_loot); double randomness = Math.random(); - TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 1); + TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4); if (randomness<=0.2) { - TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Core!", 1); + TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Core!", 4); switch (this) { case DANGEROUS: droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE)); @@ -269,6 +331,9 @@ public enum MonsterDifficulty { case HELLFIRE: droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE)); break; + case ELITE: + droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE)); + break; case NORMAL: droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE)); break; @@ -278,11 +343,11 @@ public enum MonsterDifficulty { } } randomness = Math.random(); - TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 1); + TwosideKeeper.log(ChatColor.DARK_GREEN+" Randomness is "+randomness, 4); if (randomness<=0.6) { switch (this) { case NORMAL: - TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Mysterious Essence!", 1); + TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Mysterious Essence!", 4); droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE)); break; } diff --git a/src/sig/plugin/TwosideKeeper/MonsterController.java b/src/sig/plugin/TwosideKeeper/MonsterController.java index 3e99757..7a03eca 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterController.java +++ b/src/sig/plugin/TwosideKeeper/MonsterController.java @@ -68,6 +68,13 @@ public class MonsterController { ms.SetLeader(true); //Set the HP of the leader to a more proper amount. } + if (meetsConditionsToBeElite(ent)) { + Monster m = (Monster)(ent); + MonsterDifficulty md = MonsterDifficulty.ELITE; + TwosideKeeper.log(ChatColor.DARK_PURPLE+"Converting to Elite.", 2); + convertMonster(m,md); + return true; + } if (ylv>=128) { //This is a 95% chance this will despawn. if (Math.random()<=0.95 && !ent.getWorld().hasStorm() && @@ -133,6 +140,17 @@ public class MonsterController { } } + private static boolean meetsConditionsToBeElite(LivingEntity ent) { + if (Math.random()<=TwosideKeeper.ELITE_MONSTER_CHANCE && TwosideKeeper.LAST_ELITE_SPAWN+72000=75) { + TwosideKeeper.LAST_ELITE_SPAWN=TwosideKeeper.getServerTickTime(); + return true; + } + } + return false; + } + private static void RandomizeEquipment(Monster m, int lv) { /* * Lv1: Leather/Iron Armor. @@ -571,6 +589,9 @@ public class MonsterController { if (m.getCustomName().contains("Hellfire")) { return MonsterDifficulty.HELLFIRE; } else + if (m.getCustomName().contains("Elite")) { + return MonsterDifficulty.ELITE; + } else { return MonsterDifficulty.NORMAL; } @@ -608,9 +629,11 @@ public class MonsterController { } if(isZombieLeader(m)) { + m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,4)); GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers()); m.setMaxHealth(20); m.setHealth(m.getMaxHealth()); + MonsterStructure.getMonsterStructure(m).SetLeader(true); } if (!GenericFunctions.isArmoredMob(m)) { m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,1)); @@ -627,9 +650,11 @@ public class MonsterController { m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,1)); if(isZombieLeader(m)) { + m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,4)); GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers()); m.setMaxHealth(50); m.setHealth(m.getMaxHealth()); + MonsterStructure.getMonsterStructure(m).SetLeader(true); } if (!GenericFunctions.isArmoredMob(m)) { m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,3)); @@ -653,14 +678,37 @@ public class MonsterController { if (Math.random()<=0.2) {m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,99999,1));} if(isZombieLeader(m)) { + m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,4)); GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers()); m.setMaxHealth(200); m.setHealth(m.getMaxHealth()); + MonsterStructure.getMonsterStructure(m).SetLeader(true); } if (!GenericFunctions.isArmoredMob(m)) { m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,5)); } }break; + case ELITE:{ + SetupCustomName(ChatColor.DARK_PURPLE+"Elite",m); + //m.setCustomName(ChatColor.DARK_AQUA+"Dangerous Mob"); + //m.setCustomNameVisible(true); + m.setMaxHealth(m.getMaxHealth()*40.0); + m.setHealth(m.getMaxHealth()); + GlowAPI.setGlowing(m, Color.DARK_PURPLE, Bukkit.getOnlinePlayers()); + if (isAllowedToEquipItems(m)) { + m.getEquipment().clear(); + RandomizeEquipment(m,3); + } + m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,8)); + m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,99999,8)); + if (!GenericFunctions.isArmoredMob(m)) { + m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8)); + m.setMaxHealth(m.getMaxHealth()*2.0); + } + m.setCustomNameVisible(true); + m.setRemoveWhenFarAway(false); + MonsterStructure.getMonsterStructure(m).SetElite(true); + }break; default: { if (isAllowedToEquipItems(m)) { m.getEquipment().clear(); diff --git a/src/sig/plugin/TwosideKeeper/MonsterStructure.java b/src/sig/plugin/TwosideKeeper/MonsterStructure.java index 783d50b..4732bdc 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterStructure.java +++ b/src/sig/plugin/TwosideKeeper/MonsterStructure.java @@ -1,13 +1,18 @@ package sig.plugin.TwosideKeeper; +import java.util.HashMap; +import java.util.UUID; + import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Monster; public class MonsterStructure { public LivingEntity target; - public String original_name; + public String original_name=""; public Monster m; - public boolean isLeader; + public boolean isLeader=false; + public boolean isElite=false; + public HashMap hitlist = new HashMap(); public MonsterStructure(Monster m) { target=null; @@ -34,6 +39,9 @@ public class MonsterStructure { public void SetLeader(boolean leader) { this.isLeader=leader; } + public void SetElite(boolean elite) { + this.isElite=elite; + } public boolean hasOriginalName() { return !this.original_name.equalsIgnoreCase(""); @@ -50,4 +58,19 @@ public class MonsterStructure { public boolean getLeader() { return this.isLeader; } + public boolean getElite() { + return this.isElite; + } + + //Either gets a monster structure that exists or creates a new one. + public static MonsterStructure getMonsterStructure(Monster m) { + UUID id = m.getUniqueId(); + if (TwosideKeeper.monsterdata.containsKey(id)) { + return TwosideKeeper.monsterdata.get(id); + } else { + MonsterStructure newstruct = new MonsterStructure(m); + TwosideKeeper.monsterdata.put(id,newstruct); + return TwosideKeeper.monsterdata.get(id); + } + } } diff --git a/src/sig/plugin/TwosideKeeper/NewCombat.java b/src/sig/plugin/TwosideKeeper/NewCombat.java index 3797196..9e01c9c 100644 --- a/src/sig/plugin/TwosideKeeper/NewCombat.java +++ b/src/sig/plugin/TwosideKeeper/NewCombat.java @@ -428,12 +428,8 @@ public class NewCombat { if (Iterables.get(nearby, i) instanceof Monster) { Monster mm = (Monster)(Iterables.get(nearby, i)); mm.setTarget(p); - if (TwosideKeeper.monsterdata.containsKey(mm.getUniqueId())) { - MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(mm.getUniqueId()); - ms.SetTarget(p); - } else { - TwosideKeeper.monsterdata.put(mm.getUniqueId(),new MonsterStructure(m,p)); - } + MonsterStructure ms = MonsterStructure.getMonsterStructure(mm); + ms.SetTarget(p); } } } diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index 648e886..3f90a1a 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -87,6 +88,7 @@ public class PlayerStructure { public String deathloc_world = ""; public List deathloot = new ArrayList(); public double vendetta_amt = 0.0; + public HashMap hitlist = new HashMap(); public double prev_weapondmg=0.0; public double prev_buffdmg=0.0; diff --git a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java index f7bc3c3..e3076c3 100644 --- a/src/sig/plugin/TwosideKeeper/RecyclingCenter.java +++ b/src/sig/plugin/TwosideKeeper/RecyclingCenter.java @@ -167,7 +167,7 @@ public class RecyclingCenter { public void AddItemToRecyclingCenter(Item i) { //There is a % chance of it going to a recycling center. - if ((Math.random()*100<=TwosideKeeper.RECYCLECHANCE || GenericFunctions.isArtifactEquip(i.getItemStack())) && + if ((GenericFunctions.isArtifactEquip(i.getItemStack())) && IsItemAllowed(i.getItemStack())) { //Recycle allowed. Now figure out which node to go to. if (getNumberOfNodes()>0) { diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index d8bccd2..930ded4 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -73,7 +73,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.entity.AreaEffectCloudApplyEvent; +import org.bukkit.event.entity.AreaEffectCloudApplyEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.EntityChangeBlockEvent; @@ -244,8 +244,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static int WORLD_SHOP_ID=0; //The shop ID number we are on. public static int LOGGING_LEVEL=0; //The logging level the server will output in for the console. 0 = No Debug Messages. Toggled with /log. public static double ARTIFACT_RARITY=1.5; //The multiplier of artifact drops. + public static double ELITE_MONSTER_CHANCE=0.01; //The chance an elite monster will be considered. + public static double ELITE_MONSTER_AREA=0.75; //The percentage of area around the monster that has to be AIR to be considered open enough to spawn. public static ServerType SERVER_TYPE=ServerType.TEST; //The type of server this is running on. public static int COMMONITEMPCT=3; + public static long LAST_ELITE_SPAWN = 0; public static List TEMPORARYABILITIES = new ArrayList(); public static final int DODGE_COOLDOWN=100; @@ -489,6 +492,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener { getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('*', MOTD)); habitat_data.increaseHabitationLevels(); habitat_data.startinglocs.clear(); + for (int i=0;i