diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 3051f46..d74b48a 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index de63f4f..f25cc9c 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.7.3ar3 +version: 3.7.3b commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java index f962b40..38f2fa5 100644 --- a/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java +++ b/src/sig/plugin/TwosideKeeper/AwakenedArtifact.java @@ -80,7 +80,7 @@ public class AwakenedArtifact { item = setEXP(item,totalval%1000); item = addAP(item,1); double potentialred = 10.0d; - potentialred/=1+(GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact)/100d); + potentialred *= 1 - GenericFunctions.getAbilityValue(ArtifactAbility.PRESERVATION, artifact)/100d; TwosideKeeper.log("Potential reduction is reduced by "+(10-potentialred), 4); if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, item)) { if (ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, item)>1) { diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java index 248d88d..b634eb1 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ArtifactAbility.java @@ -106,17 +106,19 @@ public enum ArtifactAbility { new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1,UpgradePath.SCYTHE), DEATHMARK("Death Mark","Applies a Death Mark stack to enemies hit. Death mark stacks last for 5 seconds, and refresh on each hit.\n\nMarks can be detonated at any time by right-clicking. Each death mark stack applied deals [VAL] true damage.",new double[]{0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0}, new double[]{0.6,0.575,0.55,0.525,0.5,0.475,0.45,0.425,0.4,0.375},100,10,UpgradePath.SCYTHE), - + CRIPPLE("Cripple","Every 10 death marks applied on a monster increases damage dealt from all damage sources by [VAL]%.",new double[]{1,2,3,4,5,6,7,8,10,12}, + new double[]{0.3,0.3,0.27,0.27,0.24,0.24,0.21,0.21,0.18,0.18},100,10,UpgradePath.SCYTHE), + //General abilities AUTOREPAIR("Auto Repair","1% chance every second to repair [VAL] durability to the artifact item\n\nThe item must be sitting in your hotbar or must be equipped for this ability to work. This ability is less effective with no sunlight!",new double[]{3,3.5,4,4.5,5,5.5,6,6.5,7,7.5}, new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},10,1,UpgradePath.ALL), - GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Greed per level up.",new double[]{50,55,60,65,70,75,80,85,90,95}, - new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,10,UpgradePath.ALL), + GREED("Greed","Increases Drop rate by [VAL]% . Health is halved, health regeneration is halved. Each hit has a [GREEDCHANCE]% chance to consume the Greed buff.\n\n"+ChatColor.RED+"Costs 1 Artifact Level.",new double[]{1,2,3,4,5,7,9,11,13,15}, + new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},10,10,UpgradePath.ALL), /*GROWTH("Growth",ChatColor.GRAY+"[Unimplemented] Increases artifact EXP gained by [VAL]% . Health is halved, health regeneration is halved, and damage reduction is halved. Consumes one level of Growth per level up.",new double[]{100,100,100,100,100,100,100,100,100,100}, new double[]{2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0,2.0},100,1000,UpgradePath.ALL),*/ REMOVE_CURSE("Remove Curse",ChatColor.GRAY+"[Unimplemented] Removes a level of a curse from the Artifact.",new double[]{-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0}, new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},1,1000,UpgradePath.ALL), - PRESERVATION("Preservation","Potential decays [VAL]% slower.",new double[]{1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,7.0}, + PRESERVATION("Preservation","Potential decays [VAL]% slower.",new double[]{1.0,1.25,1.5,1.75,2.0,2.5,3.0,3.5,4.0,5.0}, new double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0},20,1,UpgradePath.ALL), EXP_MULT("Mega XP",ChatColor.GRAY+"[Unimplemented] Increases experience dropped from monsters by [VAL]% .",new double[]{5,5,5,5,5,5,5,5,5,5}, new double[]{1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0},100,1000,UpgradePath.ALL), @@ -426,6 +428,10 @@ public enum ArtifactAbility { item = applyEnchantment(ability,level+1,item); AwakenedArtifact.addAP(item, -1); p.sendMessage(ChatColor.AQUA+"Successfully applied "+ChatColor.BLUE+ability.GetName()+" "+(level+1)+ChatColor.AQUA+" to your artifact!"); + if (ability==ArtifactAbility.GREED) { + //Remove a level from using Greed. + AwakenedArtifact.setLV(item, AwakenedArtifact.getLV(item)-1, p); + } int apamt = AwakenedArtifact.getAP(item); if (apamt>0) { TextComponent tc = new TextComponent(" You have "+ChatColor.GREEN+apamt+ChatColor.WHITE+" ability point"+((apamt==1)?"":"s")+" remaining!"); @@ -583,6 +589,7 @@ public enum ArtifactAbility { msg=msg.replace("[FATALDMG]", ChatColor.BLUE+df.format(120*abilitylv)+ChatColor.RESET); msg=msg.replace("[REPAIRCHANCE]", ChatColor.BLUE+df.format(tier/3)+ChatColor.RESET); msg=msg.replace("[DODGEVAL]", ChatColor.BLUE+df.format(tier)+ChatColor.RESET); + msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format((11-tier)*5)+ChatColor.RESET); return msg; } public static String displayDescriptionUpgrade(ArtifactAbility ability, int tier, int fromlv, int tolv, double playerdmgval) { //Level to display information for. @@ -592,8 +599,9 @@ public enum ArtifactAbility { msg=msg.replace("[PENDMG]", DisplayChangedValue(df.format(calculateValue(ability,tier,fromlv)/100*playerdmgval),df.format(calculateValue(ability,tier,tolv)/100*playerdmgval))); //Based on multiplying [VAL] by the base damage value. msg=msg.replace("[HUNGERVAL]", DisplayBadChangedValue(df.format(10*fromlv),df.format(10*tolv))); msg=msg.replace("[FATALDMG]", DisplayChangedValue(df.format(120-fromlv),df.format(120-tolv))); - msg=msg.replace("[REPAIRCHANCE]", DisplayChangedValue(df.format(tier),df.format(tier/3))); - msg=msg.replace("[DODGEVAL]", DisplayChangedValue(df.format(tier),df.format(tier))); + msg=msg.replace("[REPAIRCHANCE]", df.format(tier/3)); + msg=msg.replace("[DODGEVAL]", df.format(tier)); + msg=msg.replace("[GREEDCHANCE]", ChatColor.BLUE+df.format((11-tier)*5)+ChatColor.RESET); return msg; } diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java index d1458ba..93baa54 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java @@ -2621,7 +2621,7 @@ public class GenericFunctions { MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId()); ms.SetTarget(damager); } else { - TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(damager)); + TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(m,damager)); } TwosideKeeper.habitat_data.addNewStartingLocation(target); } @@ -2645,11 +2645,43 @@ public class GenericFunctions { 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); } + public static void knockOffGreed(Player p) { + // Chance: (11-tier)*5 + //Check for artifacts on all equips. + boolean brokeone = false; + for (int i=0;i stringy, String searchfor) { for (int i=0;i=128) { diff --git a/src/sig/plugin/TwosideKeeper/MonsterStructure.java b/src/sig/plugin/TwosideKeeper/MonsterStructure.java index b9eec40..783d50b 100644 --- a/src/sig/plugin/TwosideKeeper/MonsterStructure.java +++ b/src/sig/plugin/TwosideKeeper/MonsterStructure.java @@ -1,18 +1,23 @@ package sig.plugin.TwosideKeeper; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Monster; public class MonsterStructure { public LivingEntity target; public String original_name; + public Monster m; + public boolean isLeader; - public MonsterStructure() { + public MonsterStructure(Monster m) { target=null; original_name=""; + this.m=m; } - public MonsterStructure(LivingEntity target) { + public MonsterStructure(Monster m, LivingEntity target) { this.target=target; original_name=""; + this.m=m; } public LivingEntity GetTarget() { @@ -26,6 +31,9 @@ public class MonsterStructure { public void SetTarget(LivingEntity target) { this.target=target; } + public void SetLeader(boolean leader) { + this.isLeader=leader; + } public boolean hasOriginalName() { return !this.original_name.equalsIgnoreCase(""); @@ -38,4 +46,8 @@ public class MonsterStructure { return ""; } } + + public boolean getLeader() { + return this.isLeader; + } } diff --git a/src/sig/plugin/TwosideKeeper/NewCombat.java b/src/sig/plugin/TwosideKeeper/NewCombat.java index 3eeafec..3efc8b1 100644 --- a/src/sig/plugin/TwosideKeeper/NewCombat.java +++ b/src/sig/plugin/TwosideKeeper/NewCombat.java @@ -1,5 +1,6 @@ package sig.plugin.TwosideKeeper; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -166,7 +167,7 @@ public class NewCombat { armorpendmg = calculateArmorPen(p, finaldmg); } - return CalculateDamageReduction(finaldmg,target,damager) + + return CalculateDamageReduction(finaldmg-armorpendmg,target,damager) + armorpendmg; } @@ -400,7 +401,7 @@ public class NewCombat { if (TwosideKeeper.monsterdata.containsKey(m.getUniqueId())) { MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(m.getUniqueId()); } else { - TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(p)); + TwosideKeeper.monsterdata.put(m.getUniqueId(),new MonsterStructure(m,p)); } } @@ -427,7 +428,7 @@ public class NewCombat { MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(mm.getUniqueId()); ms.SetTarget(p); } else { - TwosideKeeper.monsterdata.put(mm.getUniqueId(),new MonsterStructure(p)); + TwosideKeeper.monsterdata.put(mm.getUniqueId(),new MonsterStructure(m,p)); } } } @@ -486,7 +487,7 @@ public class NewCombat { public static double CalculateWeaponDamage(Entity damager, LivingEntity target, boolean useBow) { - double basedmg = 0.0; + double basedmg = 0.0; double basemult = 1.0; boolean headshot=false; boolean preemptive=false; @@ -607,7 +608,13 @@ public class NewCombat { if (shooter instanceof Player) { pd.target=getDamagerEntity(target); } - TwosideKeeper.updateTitle(pl,headshot,preemptive); + + if (pd.damagelogging) { + DecimalFormat df = new DecimalFormat("0.0"); + TwosideKeeper.updateTitle(pl,ChatColor.AQUA+df.format(pd.damagedata.getLastDamageDealt())); + } else { + TwosideKeeper.updateTitle(pl,headshot,preemptive); + } } } @@ -1121,9 +1128,9 @@ public class NewCombat { double reductionamt = GenericFunctions.getAbilityValue(ArtifactAbility.DAMAGE_REDUCTION, armor[i]); dmgreduction+=reductionamt; TwosideKeeper.log("Reducing damage by "+reductionamt+"%",5); - if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, armor[i])) { - dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, armor[i]),2); - } + /*if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, armor[i])) { + dmgreduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, armor[i])?2:1; + }*/ } } } @@ -1155,11 +1162,11 @@ public class NewCombat { TwosideKeeper.log("Base damage became "+(dmgreduce*100)+"% of original amount.",5); } if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i])) { - dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i]),2); + dmgreduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getArmorContents()[i])?2:1; } } if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) { - dmgreduction /= Math.pow(ArtifactAbility.getEnchantmentLevel(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand()),2); + dmgreduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1; } dmgreduction *= 1.0+(ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 4, 4)/100d); } diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index 2fcc33e..a7e412f 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -251,7 +251,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static final int DEATHMARK_COOLDOWN=240; public static final int EARTHWAVE_COOLDOWN=300; public static final int ERUPTION_COOLDOWN=100; - public static final int LINEDRIVE_COOLDOWN=160; + public static final int LINEDRIVE_COOLDOWN=240; public static final int REJUVENATE_COOLDOWN=2400; public static File filesave; @@ -264,6 +264,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { public static LootLogger Loot_Logger; //The logger for Loot. public static AutoUpdatePlugin pluginupdater; public static boolean restarting_server=false; + + long LastClearStructureTime = 0; public int TeamCounter = 0; public static int time_passed = 0; //The total amount of time lost due to modifications to FullTime(). @@ -338,6 +340,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { habitat_data = new Habitation(); habitat_data.loadLocationHashesFromConfig(); + LastClearStructureTime = getServerTickTime(); + TwosideRecyclingCenter = new RecyclingCenter(); TwosideRecyclingCenter.loadConfig(); TwosideRecyclingCenter.populateItemListFromAllNodes(); @@ -525,6 +529,23 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } } + if (getServerTickTime()-LastClearStructureTime>=100) { + //Perform a clear of Monster Structure. + for (int i=0;ip.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen); @@ -2835,7 +2856,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener { AreaEffectCloud lp = (AreaEffectCloud)ev1.getPlayer().getWorld().spawnEntity(newpos, EntityType.AREA_EFFECT_CLOUD); lp.setColor(Color.OLIVE); DecimalFormat df = new DecimalFormat("0.00"); - lp.setCustomName("LD "+df.format(NewCombat.CalculateWeaponDamage(ev1.getPlayer(),null)*7)+" "+ev1.getPlayer().getName()); + lp.setCustomName("LD "+df.format(NewCombat.CalculateWeaponDamage(ev1.getPlayer(),null))+" "+ev1.getPlayer().getName()); lp.setRadius(2f); lp.setDuration(1); lp.setReapplicationDelay(5); @@ -3505,6 +3526,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener { @EventHandler(priority=EventPriority.LOW,ignoreCancelled = true) public void MonsterSpawnEvent(CreatureSpawnEvent ev) { + + if (ev.getEntity() instanceof Monster) { + Monster m = (Monster)ev.getEntity(); + if (!habitat_data.addNewStartingLocation(ev.getEntity())) { + ev.getEntity().remove(); + ev.setCancelled(true); + } + if (!monsterdata.containsKey(m.getUniqueId())) { + monsterdata.put(m.getUniqueId(), new MonsterStructure(m)); + } + } + + if ((ev.getSpawnReason().equals(SpawnReason.DISPENSE_EGG) || ev.getSpawnReason().equals(SpawnReason.EGG)) && NewCombat.trimNonLivingEntities(ev.getEntity().getNearbyEntities(8, 8, 8)).size()>20) { @@ -3546,13 +3580,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener { log("Prevented a skeleton horse from spawning at Location "+ev.getLocation().toString()+".",3); } } - - if (ev.getEntity() instanceof Monster) { - if (!habitat_data.addNewStartingLocation(ev.getEntity())) { - ev.getEntity().remove(); - ev.setCancelled(true); - } - } } //A fix to make achievemnt announcements not show the healthbar! @@ -3860,17 +3887,31 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } if (ev.getEntityType()==EntityType.ENDERMAN) { //There is a small chance to drop a Mysterious Essence. - if (/*Math.random()<=0.0625*ARTIFACT_RARITY &&*/ ((Monster)ev.getEntity()).getTarget()==null) { //We won't drop it when they are targeting a player, only when they are doing their own thing. - if (MonsterController.getMonsterDifficulty(((Monster)ev.getEntity()))==MonsterDifficulty.HELLFIRE) { - EssenceLogger.AddHellfireEssence(); - ItemStack - i=new ItemStack(Material.PUMPKIN_SEEDS,1); - Item it = ev.getFrom().getWorld().dropItem(ev.getFrom().add(0,200,0), Artifact.convert(Artifact.setName(i,ArtifactItem.MYSTERIOUS_ESSENCE),ArtifactItem.MYSTERIOUS_ESSENCE,true)); - it.setVelocity(new Vector(0,0,0)); - } else { - //EssenceLogger.AddGeneralEssence(); - Item it = ev.getFrom().getWorld().dropItem(ev.getFrom().add(0,200,0), Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE)); - it.setVelocity(new Vector(0,0,0)); + if (/*Math.random()<=0.0625*ARTIFACT_RARITY &&*/ ((Monster)ev.getEntity()).getTarget()==null && + ((!monsterdata.containsKey(ev.getEntity().getUniqueId())) || + monsterdata.get(ev.getEntity().getUniqueId()).GetTarget()==null)) { //We won't drop it when they are targeting a player, only when they are doing their own thing. + Block block_teleported_on = ev.getFrom().add(0,0,0).getBlock(); + log("Teleported on "+block_teleported_on.getType()+".",2); + if (block_teleported_on.isLiquid()) { + if (MonsterController.getMonsterDifficulty(((Monster)ev.getEntity()))==MonsterDifficulty.HELLFIRE) { + ItemStack i=new ItemStack(Material.PUMPKIN_SEEDS,1); + Item it = ev.getFrom().getWorld().dropItem(ev.getFrom().add(0,200,0), Artifact.convert(Artifact.setName(i,ArtifactItem.MYSTERIOUS_ESSENCE),ArtifactItem.MYSTERIOUS_ESSENCE,true)); + it.setVelocity(new Vector(0,0,0)); + EssenceLogger.AddHellfireEssence(); + } else { + EssenceLogger.AddGeneralEssence(); + Item it = ev.getFrom().getWorld().dropItem(ev.getFrom().add(0,200,0), Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE)); + it.setVelocity(new Vector(0,0,0)); + } + } + } + Monster m = (Monster)ev.getEntity(); + if (m.getTarget() instanceof Player) { + Player p = (Player)m.getTarget(); + if (GenericFunctions.isRanger(p)) { + //Teleport it into oblivion. + log("Going into another dimension...",2); + m.teleport(new Location(Bukkit.getWorld("world_nether"),m.getLocation().getX(),m.getLocation().getY(),m.getLocation().getZ())); } } } @@ -3976,36 +4017,38 @@ public class TwosideKeeper extends JavaPlugin implements Listener { if (p.hasPotionEffect(PotionEffectType.GLOWING)) { ev.setCancelled(true); } - double dodgechance = NewCombat.CalculateDodgeChance(p); - if (ev.getCause()==DamageCause.THORNS && - GenericFunctions.isRanger(p)) { - dodgechance=1; - p.setHealth(p.getHealth()-0.25); - p.playSound(p.getLocation(), Sound.ENCHANT_THORNS_HIT, 0.8f, 3.0f); - } - - PlayerStructure pd = (PlayerStructure)playerdata.get(p.getUniqueId()); - - if (pd.fulldodge) { - pd.fulldodge=false; - } - - if (Math.random()<=dodgechance) { - //Cancel this event, we dodged the attack. - p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f); - log("Triggered Dodge.",3); - for (int i=0;i