From 3a1ee58339e02b0f810126837a1efd27c5ca7e1e Mon Sep 17 00:00:00 2001 From: GJ Date: Sun, 26 Feb 2012 01:53:54 -0500 Subject: [PATCH] Added custom values for mob combat multipliers. --- Changelog.txt | 1 + src/main/java/com/gmail/nossr50/Combat.java | 45 ++++++++++--------- .../gmail/nossr50/config/LoadProperties.java | 18 +++++++- .../nossr50/listeners/mcEntityListener.java | 8 ---- src/main/resources/config.yml | 17 ++++++- 5 files changed, 57 insertions(+), 32 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index eff2e60a0..8c2836736 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -18,6 +18,7 @@ Version 1.3.00-dev + Added Fast Food Service subskill to Taming + Added size limit to Tree Feller in config as Tree Feller Threshold + Added /addlevels command + + Added config values for XP multipliers for different hostile mobs + Re-added mcMMO reporting damage events = Fixed bug where Swords command showed Bleed Length twice instead of Bleed Chance = Fixed bug where Tree Feller wasn't checking for Tree Feller permission diff --git a/src/main/java/com/gmail/nossr50/Combat.java b/src/main/java/com/gmail/nossr50/Combat.java index 19cd316d7..e80330151 100644 --- a/src/main/java/com/gmail/nossr50/Combat.java +++ b/src/main/java/com/gmail/nossr50/Combat.java @@ -395,11 +395,13 @@ public class Combat int xp = 0; if(entity instanceof LivingEntity) { - LivingEntity le = (LivingEntity)entity; + LivingEntity le = (LivingEntity) entity; //Prevent a ridiculous amount of XP being granted by capping it at the remaining health of the entity - int hpLeft = le.getHealth(), xpinc = 0; - - if(hpLeft < event.getDamage()) + int hpLeft = le.getHealth(); + int xpinc = 0; + int damage = event.getDamage(); + + if(hpLeft < damage) { if(hpLeft > 0) xpinc = hpLeft; @@ -407,39 +409,38 @@ public class Combat xpinc = 0; } else - xpinc = event.getDamage(); + xpinc = damage; if(entity instanceof Animals) - { - xp = (int) (xpinc * 1); - } else + xp = (int) (xpinc * LoadProperties.animalXP); + else { if(entity instanceof Enderman) - xp = (xpinc * 2); - else if(entity instanceof Creeper) - xp = (xpinc * 4); + xp = (int) (xpinc * LoadProperties.endermanXP); + else if(entity instanceof Creeper) + xp = (int) (xpinc * LoadProperties.creeperXP); else if(entity instanceof Silverfish) - xp = (xpinc * 3); + xp = (int) (xpinc * LoadProperties.silverfishXP); else if(entity instanceof CaveSpider) - xp = (xpinc * 3); + xp = (int) (xpinc * LoadProperties.cavespiderXP); else if(entity instanceof Spider) - xp = (xpinc * 3); + xp = (int) (xpinc * LoadProperties.spiderXP); else if(entity instanceof Skeleton) - xp = (xpinc * 2); + xp = (int) (xpinc * LoadProperties.skeletonXP); else if(entity instanceof Zombie) - xp = (xpinc * 2); + xp = (int) (xpinc * LoadProperties.zombieXP); else if(entity instanceof PigZombie) - xp = (xpinc * 3); + xp = (int) (xpinc * LoadProperties.pigzombieXP); else if(entity instanceof Slime) - xp = (xpinc * 2); + xp = (int) (xpinc * LoadProperties.slimeXP); else if(entity instanceof Ghast) - xp = (xpinc * 3); + xp = (int) (xpinc * LoadProperties.ghastXP); else if(entity instanceof Blaze) - xp = (xpinc * 3); + xp = (int) (xpinc * LoadProperties.blazeXP); else if(entity instanceof EnderDragon) - xp = (xpinc * 8); + xp = (int) (xpinc * LoadProperties.enderdragonXP); else if(entity instanceof MagmaCube) - xp = (xpinc * 2); + xp = (int) (xpinc * LoadProperties.magmacubeXP); } } return xp; diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index f728cd7f9..088bce2c3 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -88,7 +88,8 @@ public class LoadProperties { miningxpmodifier, repairxpmodifier, woodcuttingxpmodifier, fishingxpmodifier, unarmedxpmodifier, herbalismxpmodifier, excavationxpmodifier, archeryxpmodifier, swordsxpmodifier, - axesxpmodifier, acrobaticsxpmodifier; + axesxpmodifier, acrobaticsxpmodifier, animalXP, creeperXP, skeletonXP, spiderXP, ghastXP, slimeXP, + zombieXP, pigzombieXP, endermanXP, cavespiderXP, silverfishXP, blazeXP, magmacubeXP, enderdragonXP; public static List excavationFromDirt = new ArrayList(); public static List excavationFromGrass = new ArrayList(); @@ -421,6 +422,21 @@ public class LoadProperties { aDisplayNames = readBoolean("Commands.a.Display_Names", true); pDisplayNames = readBoolean("Commands.p.Display_Names", true); + animalXP = readDouble("Experience.Combat.Multiplier.Animals", 1.0); + creeperXP = readDouble("Experience.Combat.Multiplier.Creeper", 4.0); + skeletonXP = readDouble("Experience.Combat.Multiplier.Skeleton", 2.0); + spiderXP = readDouble("Experience.Combat.Multiplier.Spider", 3.0); + ghastXP = readDouble("Experience.Combat.Multiplier.Ghast", 3.0); + slimeXP = readDouble("Experience.Combat.Multiplier.Slime", 2.0); + zombieXP = readDouble("Experience.Combat.Multiplier.Zombie", 2.0); + pigzombieXP = readDouble("Experience.Combat.Multiplier.Pig_Zombie", 3.0); + endermanXP = readDouble("Experience.Combat.Multiplier.Enderman", 2.0); + cavespiderXP = readDouble("Experience.Combat.Multiplier.Cave_Spider", 3.0); + silverfishXP = readDouble("Experience.Combat.Multiplier.Silverfish", 3.0); + blazeXP = readDouble("Experience.Combat.Multiplier.Blaze", 3.0); + magmacubeXP = readDouble("Experience.Combat.Multiplier.Magma_Cube", 2.0); + enderdragonXP = readDouble("Experience.Combat.Multiplier.Ender_Dragon", 8.0); + // Load treasures Map treasures = new HashMap(); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java index 0919e7fd0..8acba226f 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java @@ -343,12 +343,4 @@ public class mcEntityListener implements Listener } } } - - public boolean isPlayer(Entity entity){ - if (entity instanceof Player) { - return true; - } else{ - return false; - } - } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 64a260c66..3b19e82dc 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -223,7 +223,22 @@ Experience: Animal_Taming: Wolf: 250 Milking: 50 - + Combat: + Multiplier: + Animals: 1.0 + Creeper: 4.0 + Skeleton: 2.0 + Spider: 3.0 + Zombie: 2.0 + Pig_Zombie: 3.0 + Enderman: 2.0 + Cave_Spider: 3.0 + Silverfish: 3.0 + Blaze: 3.0 + Magma_Cube: 2.0 + Ender_Dragon: 8.0 + Slime: 2.0 + Ghast: 3.0 # # Settings for Fishing ###