Rewrite Loot Tables to follow the original goals. Loot has been

rebalanced to account for gear progression over time. Farm gear at one
tier -> Get strong enough for next tier. Modified Mysterious Essence
Behavior. They are now harder to find, but still as random as ever.
Nerfed Malleable Base chance a tiny bit. Zombie Leaders / Bosses have a
very high chance to now give a special piece, so they are worth
fighting! Hellfire Zombies have gained a new ability: Wall Breakdown.
Similar to old Charge Zombies, they will attempt to break down blocks
around them to get to you. (Does NOT activate when they are idle!) Fixed
bugs relating to damage calculations for explosions and fixed Blast
Protection damage calculations.
dev
sigonasr2 9 years ago
parent 1a56bb7951
commit d8a3d0f781
  1. BIN
      TwosideKeeper.jar
  2. 12
      src/plugin.yml
  3. 3
      src/sig/plugin/TwosideKeeper/Artifact.java
  4. 187
      src/sig/plugin/TwosideKeeper/ChargeZombie.java
  5. 50
      src/sig/plugin/TwosideKeeper/HelperStructures/BlockToughness.java
  6. 45
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  7. 144
      src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java
  8. 48
      src/sig/plugin/TwosideKeeper/HelperStructures/LootStructure.java
  9. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/MalleableBaseQuest.java
  10. 227
      src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java
  11. 15
      src/sig/plugin/TwosideKeeper/HelperStructures/WorldShop.java
  12. 33
      src/sig/plugin/TwosideKeeper/Logging/MysteriousEssenceLogger.java
  13. 17
      src/sig/plugin/TwosideKeeper/MonsterController.java
  14. 1060
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.4.3e2
version: 3.4.4
commands:
money:
description: Tells the player the amount of money they are holding.
@ -52,6 +52,16 @@ commands:
usage: /servertype <MAIN|TEST|QUIET>
permission: TwosideKeeper.servertype
permission-message: No permissions!
ess:
description: Generates a Mysterious Essence report.
usage: /ess
permission: TwosideKeeper.report
permission-message: No permissions!
mega:
description: Generates a Mega Piece.
usage: /mega <MATERIAL> <false|true>
permission: TwosideKeeper.mega
permission-message: No permissions!
fix:
description: Does many things depending on what item is being held. Typically if it's broken, typing this will help.
usage: /fix

@ -6,12 +6,14 @@ import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Monster;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.MaterialData;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItemType;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class Artifact {
@ -62,6 +64,7 @@ public class Artifact {
break;
case MYSTERIOUS_ESSENCE:
i=new ItemStack(Material.PUMPKIN_SEEDS,amt);
TwosideKeeper.EssenceLogger.AddGeneralEssence();
break;
case ARTIFACT_RECIPE:
i=new ItemStack(Material.STAINED_GLASS_PANE,amt);

@ -0,0 +1,187 @@
package sig.plugin.TwosideKeeper;
import org.bukkit.block.Block;
import org.bukkit.entity.Monster;
import aPlugin.BlockUtils;
import sig.plugin.TwosideKeeper.HelperStructures.BlockToughness;
public class ChargeZombie {
Monster m;
public ChargeZombie(Monster m) {
this.m=m;
}
public Monster GetZombie() {
return m;
}
public boolean isAlive() {
return !m.isDead();
}
public boolean hasTarget() {
return (m.getTarget()!=null)?true:false;
}
public void BreakBlocksAroundArea(int radius) {
for (int x=-radius;x<radius+1;x++) {
for (int y=0;y<radius+1;y++) {
for (int z=-radius;z<radius+1;z++) {
if (!BlockUtils.isExplosionProof(m.getLocation().add(x,y,z).getBlock().getType())) {
//Break it.
if (ChanceToBreak(m.getLocation().add(x,y,z).getBlock())) {
m.getLocation().add(x,y,z).getBlock().breakNaturally();
}
}
}
}
}
}
public boolean ChanceToBreak(Block b) {
int blocktoughness = 0;
switch (b.getType()) {
case OBSIDIAN:{
blocktoughness=20;
}break;
case ENDER_CHEST:{
blocktoughness=20;
}break;
case ANVIL:{
blocktoughness=10;
}break;
case COAL_BLOCK:{
blocktoughness=10;
}break;
case DIAMOND_BLOCK:{
blocktoughness=10;
}break;
case EMERALD_BLOCK:{
blocktoughness=10;
}break;
case IRON_BLOCK:{
blocktoughness=10;
}break;
case REDSTONE_BLOCK:{
blocktoughness=10;
}break;
case ENCHANTMENT_TABLE:{
blocktoughness=10;
}break;
case IRON_FENCE:{
blocktoughness=10;
}break;
case IRON_DOOR:{
blocktoughness=10;
}break;
case IRON_TRAPDOOR:{
blocktoughness=10;
}break;
case MOB_SPAWNER:{
blocktoughness=10;
}break;
case WEB:{
blocktoughness=10;
}break;
case DISPENSER:{
blocktoughness=10;
}break;
case DROPPER:{
blocktoughness=10;
}break;
case FURNACE:{
blocktoughness=10;
}break;
case BEACON:{
blocktoughness=6;
}break;
case GOLD_BLOCK:{
blocktoughness=6;
}break;
case COAL_ORE:{
blocktoughness=6;
}break;
case DIAMOND_ORE:{
blocktoughness=6;
}break;
case EMERALD_ORE:{
blocktoughness=6;
}break;
case ENDER_STONE:{
blocktoughness=6;
}break;
case GOLD_ORE:{
blocktoughness=6;
}break;
case HOPPER:{
blocktoughness=6;
}break;
case IRON_ORE:{
blocktoughness=6;
}break;
case LAPIS_BLOCK:{
blocktoughness=6;
}break;
case LAPIS_ORE:{
blocktoughness=6;
}break;
case QUARTZ_ORE:{
blocktoughness=6;
}break;
case REDSTONE_ORE:{
blocktoughness=6;
}break;
case GLOWING_REDSTONE_ORE:{
blocktoughness=6;
}break;
case TRAP_DOOR:{
blocktoughness=6;
}break;
case WOODEN_DOOR:{
blocktoughness=6;
}break;
}
/*
* OBSIDIAN(50),
ENDER_CHEST(23),
ANVIL(10),
COAL_BLOCK(10),
DIAMOND_BLOCK(10),
EMERALD_BLOCK(10),
IRON_BLOCK(10),
REDSTONE_BLOCK(10),
ENCHANTMENT_TABLE(10),
IRON_FENCE(10),
IRON_DOOR(10),
IRON_TRAPDOOR(10),
MONSTER_SPAWNER(10),
WEB(10),
DISPENSER(10),
DROPPER(10),
FURNACE(10),
BEACON(6),
BLOCK_OF_GOLD(6),
COAL_ORE(6),
DIAMOND_ORE(6),
EMERALD_ORE(6),
END_STONE(6),
GOLD_ORE(6),
HOPPER(6),
IRON_ORE(6),
LAPIS_BLOCK(6),
LAPIS_ORE(6),
NETHER_QUARTZ_ORE(6),
REDSTONE_ORE(6),
GLOWING_REDSTONE_ORE(6),
TRAP_DOOR(6),
WOODEN_DOOR(6);
*/
if (Math.random()*((double)blocktoughness/5)<1) {
return true;
} else {
return false;
}
}
}

@ -0,0 +1,50 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Material;
public enum BlockToughness {
OBSIDIAN(20),
ENDER_CHEST(20),
ANVIL(10),
COAL_BLOCK(10),
DIAMOND_BLOCK(10),
EMERALD_BLOCK(10),
IRON_BLOCK(10),
REDSTONE_BLOCK(10),
ENCHANTMENT_TABLE(10),
IRON_FENCE(10),
IRON_DOOR(10),
IRON_TRAPDOOR(10),
MONSTER_SPAWNER(10),
WEB(10),
DISPENSER(10),
DROPPER(10),
FURNACE(10),
BEACON(6),
BLOCK_OF_GOLD(6),
COAL_ORE(6),
DIAMOND_ORE(6),
EMERALD_ORE(6),
END_STONE(6),
GOLD_ORE(6),
HOPPER(6),
IRON_ORE(6),
LAPIS_BLOCK(6),
LAPIS_ORE(6),
NETHER_QUARTZ_ORE(6),
REDSTONE_ORE(6),
GLOWING_REDSTONE_ORE(6),
TRAP_DOOR(6),
WOODEN_DOOR(6);
int toughness=3;
BlockToughness(int toughness) {
this.toughness=toughness;
}
public int GetToughness() {
return this.toughness;
}
}

@ -9,8 +9,13 @@ import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
@ -18,6 +23,7 @@ import org.bukkit.material.MaterialData;
import org.bukkit.material.Wool;
import sig.plugin.TwosideKeeper.Artifact;
import sig.plugin.TwosideKeeper.MonsterController;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
@ -1224,6 +1230,7 @@ public class GenericFunctions {
item.getType().toString().contains("AXE") ||
item.getType().toString().contains("SWORD") ||
item.getType().toString().contains("BOW") ||
item.getType().toString().contains("ROD") ||
item.getType().toString().contains("HOE") ||
item.getType().toString().contains("BOOTS") ||
item.getType().toString().contains("CHESTPLATE") ||
@ -1246,6 +1253,16 @@ public class GenericFunctions {
return false;
}
}
public static boolean isHarvestingTool(ItemStack item) {
if (item.getType().toString().contains("SPADE") ||
item.getType().toString().contains("AXE") ||
item.getType().toString().contains("HOE")) {
return true;
} else {
return false;
}
}
public static boolean isWeapon(ItemStack item) {
if (item.getType().toString().contains("BOW") ||
@ -1288,6 +1305,34 @@ public class GenericFunctions {
}
}
public static boolean isBossMonster(Monster m) {
if (m.getType()==EntityType.ZOMBIE &&
MonsterController.isZombieLeader(m) ||
(m.getType()==EntityType.GUARDIAN &&
((Guardian)m).isElder()) ||
m.getType()==EntityType.ENDER_DRAGON ||
m.getType()==EntityType.WITHER) {
return true;
} else {
return false;
}
}
public static boolean isCoreMonster(Monster m) {
if (m.getType()==EntityType.GUARDIAN ||
m.getType()==EntityType.SKELETON) {
if (m.getType()==EntityType.SKELETON) {
Skeleton s = (Skeleton)m;
if (s.getSkeletonType()==SkeletonType.WITHER) {
return true;
}
} else {
return true;
}
}
return false;
}
public static boolean isEdible(ItemStack it) {
if (it.getType()==Material.GOLDEN_CARROT ||
it.getType()==Material.GOLDEN_APPLE ||

@ -0,0 +1,144 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public class Loot {
static double HARDENED_ENCHANT_MULT = 1.4;
static int MAX_ENCHANT_LEVEL = 10;
public static ItemStack GenerateMegaPiece(Material mat_type, boolean hardened) {
ItemStack raresword = new ItemStack(mat_type);
ItemMeta sword_meta = raresword.getItemMeta();
sword_meta.setDisplayName(ChatColor.AQUA+""+ChatColor.BOLD+"Mega "+GenericFunctions.UserFriendlyMaterialName(mat_type));
raresword.setItemMeta(sword_meta);
raresword = addEnchantments(raresword,false);
if (hardened) {
sword_meta.setDisplayName(ChatColor.LIGHT_PURPLE+""+ChatColor.BOLD+"Hardened Mega "+GenericFunctions.UserFriendlyMaterialName(mat_type));
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+GetHardenedBreaks(mat_type));
sword_meta.setLore(lore);
raresword.setItemMeta(sword_meta);
raresword = addEnchantments(raresword,true);
}
return raresword;
}
private static int GetHardenedBreaks(Material type) {
if (type.toString().contains("STONE")) {
return (int)((Math.random()*3)+2);
} else
if (type.toString().contains("IRON")) {
return (int)((Math.random()*4)+3);
} else
if (type.toString().contains("DIAMOND")) {
return (int)((Math.random()*7)+5);
} else
if (type.toString().contains("GOLD")) {
return (int)((Math.random()*12)+10);
} else
{
return 5;
}
}
private static int GetEnchantmentLevels(Material type) {
return GetEnchantmentLevels(type, false);
}
private static int GetEnchantmentLevels(Material type, boolean hardened) {
int enchantment_level = 0;
if (type.toString().contains("STONE")) {
enchantment_level = (int)(((Math.random()*3)+2)*((hardened)?HARDENED_ENCHANT_MULT:1));
} else
if (type.toString().contains("IRON")) {
enchantment_level = (int)(((Math.random()*4)+3)*((hardened)?HARDENED_ENCHANT_MULT:1));
} else
if (type.toString().contains("DIAMOND")) {
enchantment_level = (int)(((Math.random()*4)+5)*((hardened)?HARDENED_ENCHANT_MULT:1));
} else
if (type.toString().contains("GOLD")) {
enchantment_level = (int)(((Math.random()*5)+6)*((hardened)?HARDENED_ENCHANT_MULT:1));
} else
if (type.toString().contains("BOW")) {
enchantment_level = (int)(((Math.random()*5)+6)*((hardened)?HARDENED_ENCHANT_MULT:1));
} else
{
enchantment_level = (int)(((Math.random()*9))*((hardened)?HARDENED_ENCHANT_MULT:1));
}
if (enchantment_level>MAX_ENCHANT_LEVEL) {
enchantment_level = 10;
}
return enchantment_level;
}
private static ItemStack addEnchantments(ItemStack item, boolean hardened) {
if (GenericFunctions.isHarvestingTool(item)) {
item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.DIG_SPEED, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 2);
if (item.getType().toString().contains("HOE")) {item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10);}
if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.SILK_TOUCH, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));}
} else
if (item.getType()==Material.BOW) {
item.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.ARROW_FIRE, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 2);
if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));}
} else
if (GenericFunctions.isWeapon(item)) {
item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));}
} else
if (GenericFunctions.isArmor(item)) {
item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, GetEnchantmentLevels(item.getType(),hardened));
if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.DEPTH_STRIDER, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.WATER_WORKER, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.5*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.OXYGEN, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.FROST_WALKER, GetEnchantmentLevels(item.getType(),hardened));}
if (Math.random()<0.08*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.THORNS, GetEnchantmentLevels(item.getType(),hardened));}
item.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
if (Math.random()<0.2*HARDENED_ENCHANT_MULT) {item.addUnsafeEnchantment(Enchantment.MENDING, GetEnchantmentLevels(item.getType(),hardened));}
} else
if (item.getType()==Material.FISHING_ROD) {
item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.DURABILITY, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.LUCK, GetEnchantmentLevels(item.getType(),hardened));
item.addUnsafeEnchantment(Enchantment.LURE, GetEnchantmentLevels(item.getType(),hardened));
} else {
//Generic Random Enchantments.
for (int i=0;i<Enchantment.values().length;i++) {
if (Math.random()<1.0/Enchantment.values().length*HARDENED_ENCHANT_MULT) {
item.addUnsafeEnchantment(Enchantment.values()[i], GetEnchantmentLevels(item.getType(),hardened));
}
}
}
return item;
}
}

@ -0,0 +1,48 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Material;
public class LootStructure {
Material mat;
boolean hardened_item;
int amt;
ArtifactItem art;
public LootStructure(Material mat, boolean ishardened) {
this.mat=mat;
this.hardened_item=ishardened;
this.amt=1;
this.art=null;
}
public LootStructure(Material mat, int amt) {
this.mat=mat;
this.amt=amt;
this.hardened_item=false;
this.art=null;
}
public LootStructure(Material mat) {
this.mat=mat;
this.amt=1;
this.hardened_item=false;
this.art=null;
}
public LootStructure(ArtifactItem art, int amt) {
this.mat=null;
this.amt=1;
this.hardened_item=false;
this.art=art;
}
public Material GetMaterial() {
return mat;
}
public boolean GetHardened() {
return hardened_item;
}
public int GetAmount() {
return amt;
}
public ArtifactItem GetArtifact() {
return art;
}
}

@ -44,8 +44,8 @@ public class MalleableBaseQuest {
//The time started is always on the third line.
ItemMeta m = base.getItemMeta();
List<String> lore = m.getLore();
lore.remove(2);
lore.add(2,ChatColor.BLUE+""+TwosideKeeper.getServerTickTime());
lore.remove(3);
lore.add(3,ChatColor.BLUE+""+TwosideKeeper.getServerTickTime());
m.setLore(lore);
base.setItemMeta(m);
return base;

@ -1,8 +1,227 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
public enum MonsterDifficulty {
NORMAL,
DANGEROUS,
DEADLY,
HELLFIRE
NORMAL( //Contains info about loot for everything.
new LootStructure[]{ //Regular Loot
},
new LootStructure[]{ //Rare Loot
new LootStructure(Material.STONE_SWORD, false),
new LootStructure(ArtifactItem.ARTIFACT_ESSENCE,1),
},
new LootStructure[]{ //Legendary Loot
new LootStructure(ArtifactItem.ARTIFACT_CORE,1),
new LootStructure(Material.STONE_SWORD, true),
}
),
DANGEROUS(
new LootStructure[]{ //Regular Loot
new LootStructure(Material.IRON_INGOT,false),
},
new LootStructure[]{ //Rare Loot
new LootStructure(ArtifactItem.ANCIENT_ESSENCE,1),
new LootStructure(Material.IRON_BLOCK,false),
new LootStructure(Material.IRON_SWORD, false),
new LootStructure(Material.IRON_CHESTPLATE, false),
new LootStructure(Material.IRON_LEGGINGS, false),
new LootStructure(Material.IRON_BOOTS, false),
new LootStructure(Material.IRON_HELMET, false),
new LootStructure(Material.STONE_AXE, false),
new LootStructure(Material.STONE_PICKAXE, false),
new LootStructure(Material.STONE_HOE, false),
new LootStructure(Material.STONE_SPADE, false),
new LootStructure(Material.FISHING_ROD, false),
},
new LootStructure[]{ //Legendary Loot
new LootStructure(ArtifactItem.ANCIENT_CORE,1),
new LootStructure(Material.IRON_SWORD, true),
new LootStructure(Material.IRON_CHESTPLATE, true),
new LootStructure(Material.IRON_LEGGINGS, true),
new LootStructure(Material.IRON_BOOTS, true),
new LootStructure(Material.IRON_HELMET, true),
new LootStructure(Material.STONE_AXE, true),
new LootStructure(Material.STONE_PICKAXE, true),
new LootStructure(Material.STONE_HOE, true),
new LootStructure(Material.STONE_SPADE, true),
new LootStructure(Material.FISHING_ROD, true),
}
),
DEADLY(
new LootStructure[]{ //Regular Loot
new LootStructure(Material.IRON_INGOT,(int)((Math.random()*2)+1)),
new LootStructure(Material.DIAMOND),
new LootStructure(Material.GOLD_NUGGET,(int)((Math.random()*3)+1)),
},
new LootStructure[]{ //Rare Loot
new LootStructure(ArtifactItem.LOST_ESSENCE,1),
new LootStructure(Material.IRON_BLOCK,(int)((Math.random()*2)+1)),
new LootStructure(Material.DIAMOND_BLOCK),
new LootStructure(Material.GOLD_INGOT,(int)((Math.random()*3)+1)),
new LootStructure(Material.DIAMOND_SWORD, false),
new LootStructure(Material.IRON_AXE, false),
new LootStructure(Material.IRON_PICKAXE, false),
new LootStructure(Material.IRON_HOE, false),
new LootStructure(Material.IRON_SPADE, false),
new LootStructure(Material.DIAMOND_CHESTPLATE, false),
new LootStructure(Material.DIAMOND_LEGGINGS, false),
new LootStructure(Material.DIAMOND_BOOTS, false),
new LootStructure(Material.DIAMOND_HELMET, false),
new LootStructure(Material.FISHING_ROD, false),
new LootStructure(Material.BOW, false),
},
new LootStructure[]{ //Legendary Loot
new LootStructure(ArtifactItem.LOST_CORE,1),
new LootStructure(Material.DIAMOND_SWORD, true),
new LootStructure(Material.IRON_AXE, true),
new LootStructure(Material.IRON_PICKAXE, true),
new LootStructure(Material.IRON_HOE, true),
new LootStructure(Material.IRON_SPADE, true),
new LootStructure(Material.FISHING_ROD, 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.FISHING_ROD, true),
}
),
HELLFIRE(
new LootStructure[]{ //Regular Loot
new LootStructure(Material.EMERALD,(int)((Math.random()*3)+1)),
new LootStructure(Material.DIAMOND,(int)((Math.random()*3)+1)),
new LootStructure(Material.GOLD_INGOT,(int)((Math.random()*3)+1)),
},
new LootStructure[]{ //Rare Loot
new LootStructure(ArtifactItem.DIVINE_ESSENCE,1),
new LootStructure(Material.EMERALD_BLOCK),
new LootStructure(Material.DIAMOND_BLOCK,(int)((Math.random()*2)+1)),
new LootStructure(Material.GOLD_BLOCK),
new LootStructure(Material.DIAMOND_SWORD, false),
new LootStructure(Material.GOLD_SWORD, false),
new LootStructure(Material.DIAMOND_AXE, false),
new LootStructure(Material.DIAMOND_PICKAXE, false),
new LootStructure(Material.DIAMOND_HOE, false),
new LootStructure(Material.DIAMOND_SPADE, false),
new LootStructure(Material.DIAMOND_CHESTPLATE, false),
new LootStructure(Material.DIAMOND_LEGGINGS, false),
new LootStructure(Material.DIAMOND_BOOTS, false),
new LootStructure(Material.DIAMOND_HELMET, false),
new LootStructure(Material.GOLD_CHESTPLATE, false),
new LootStructure(Material.GOLD_LEGGINGS, false),
new LootStructure(Material.GOLD_BOOTS, false),
new LootStructure(Material.GOLD_HELMET, false),
new LootStructure(Material.BOW, false),
new LootStructure(Material.FISHING_ROD, false),
},
new LootStructure[]{ //Legendary Loot
new LootStructure(ArtifactItem.DIVINE_CORE,1),
new LootStructure(Material.GOLD_SWORD, 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.GOLD_CHESTPLATE, true),
new LootStructure(Material.GOLD_LEGGINGS, true),
new LootStructure(Material.GOLD_BOOTS, true),
new LootStructure(Material.GOLD_HELMET, true),
new LootStructure(Material.BOW, true),
new LootStructure(Material.FISHING_ROD, true),
}
);
LootStructure[] loot_regular;
LootStructure[] loot_rare;
LootStructure[] loot_legendary;
private MonsterDifficulty(LootStructure[] loot_regular, LootStructure[] loot_rare, LootStructure[] loot_legendary) {
this.loot_regular=loot_regular;
this.loot_rare=loot_rare;
this.loot_legendary=loot_legendary;
}
private ItemStack Artifact() {
sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE,3);
return null;
}
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss) {
List<ItemStack> droplist = new ArrayList<ItemStack>();
dropmult += 1; //Base dropmult is 1.0.
//Basically for each additional dropmult integer value, the
//amount of rolls increases. (A dropmult of 1.0 is required for
//an additional roll.)
for (int i=0;i<dropmult;i++) {
//First do a common roll.
if (Math.random()<TwosideKeeper.COMMON_DROP_RATE*dropmult &&
this.loot_regular.length>0) {
//This is a common roll.
ItemStack gen_loot = DistributeRandomLoot(this.loot_regular);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2);
droplist.add(gen_loot);
}
//Rare Loot roll.
if (Math.random()<TwosideKeeper.RARE_DROP_RATE*dropmult &&
this.loot_rare.length>0) {
//This is a common roll.
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2);
droplist.add(gen_loot);
}
//Legendary Loot roll.
if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE*dropmult &&
this.loot_legendary.length>0) {
//This is a common roll.
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2);
droplist.add(gen_loot);
}
if (isBoss) { //50% of the time, we drop something great.
if (Math.random()<=0.5 && this.loot_legendary.length>0) {
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2);
droplist.add(gen_loot);
}
else
if (this.loot_rare.length>0) { //Consolation Prize.
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare);
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 2);
droplist.add(gen_loot);
}
}
}
return droplist;
}
private ItemStack DistributeRandomLoot(LootStructure[] lootlist) {
//Choose an item randomly from the loot list.
if (lootlist.length>0) {
//Choose an element.
LootStructure ls = lootlist[(int)((Math.random())*lootlist.length)];
if (GenericFunctions.isEquip(new ItemStack(ls.GetMaterial()))) {
//Turn it into a Mega Piece.
return Loot.GenerateMegaPiece(ls.GetMaterial(), ls.GetHardened());
} else {
//Turn it into a normal item.
return new ItemStack(ls.GetMaterial(),ls.GetAmount());
}
} else { //Something bad happened if we got here...
return new ItemStack(Material.AIR);
}
}
}

@ -105,7 +105,7 @@ public class WorldShop {
String message = "";
for (int i=0;i<Enchantment.values().length;i++) {
if (item.containsEnchantment(Enchantment.values()[i])) {
message+=((message.equals(""))?"":"\n")+ChatColor.GRAY+getRealName(Enchantment.values()[i])+" "+toRomanNumeral(item.getEnchantmentLevel(Enchantment.getByName(Enchantment.values()[i].getName()))); //This is an enchantment we have.
message+="\n"+ChatColor.GRAY+getRealName(Enchantment.values()[i])+" "+toRomanNumeral(item.getEnchantmentLevel(Enchantment.getByName(Enchantment.values()[i].getName()))); //This is an enchantment we have.
}
}
if (item.getType()==Material.ENCHANTED_BOOK) {
@ -401,11 +401,20 @@ public class WorldShop {
if (item.getType().getMaxDurability()>0) {
message+="\n\n"+ChatColor.GRAY+"Durability: "+(item.getType().getMaxDurability()-item.getDurability()-1)+"/"+(item.getType().getMaxDurability()-1);
}
if (item.getItemMeta() instanceof Repairable) {
if (item.getItemMeta() instanceof Repairable &&
GenericFunctions.isEquip(item)) {
Repairable rep = (Repairable)item.getItemMeta();
int repairs = 0;
if (rep.hasRepairCost()) {
message+="\n\n"+ChatColor.GRAY+"Repair Cost: "+(item.getType().getMaxDurability()-item.getDurability()-1)+"/"+(item.getType().getMaxDurability()-1);
int cost = rep.getRepairCost();
while (cost>0) {
cost/=2;
repairs++;
}
} else {
repairs=0;
}
message+="\n"+ChatColor.GRAY+"Repairs Left: "+(6-repairs);
}
return message;
}

@ -0,0 +1,33 @@
package sig.plugin.TwosideKeeper.Logging;
import java.text.DecimalFormat;
import org.bukkit.ChatColor;
public class MysteriousEssenceLogger {
int essence_hellfire = 0;
int essence_other = 0;
int essence_despawned = 0;
public MysteriousEssenceLogger() {
}
public void AddHellfireEssence() {
essence_hellfire++;
}
public void AddGeneralEssence() {
essence_other++;
}
public void AddEssenceDespawn() {
essence_despawned++;
}
public String GenerateReport() {
DecimalFormat df = new DecimalFormat("0.0");
if (essence_hellfire+essence_other>0) {
return "Total Essences Spawned: "+ChatColor.YELLOW+(essence_hellfire+essence_other)+ChatColor.WHITE+"\n"+
"Total Essences from Hellfires: "+ChatColor.YELLOW+essence_hellfire+ChatColor.RED+" ("+df.format(((double)essence_hellfire/(essence_other+essence_hellfire))*100)+"%)\n"+ChatColor.WHITE
+ "Total Essences Despawned: "+ChatColor.YELLOW+essence_despawned+ChatColor.BLUE+" ("+df.format(((double)essence_despawned/(essence_other+essence_hellfire))*100)+"%)";
} else {
return "Not enough data yet!";
}
}
}

@ -4,8 +4,12 @@ import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Banner;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@ -14,7 +18,10 @@ import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.MaterialData;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@ -290,7 +297,8 @@ public class MonsterController {
m.getEquipment().setItemInMainHand(weapon);
}
if (Math.random()<0.2) {
m.getEquipment().setItemInOffHand(new ItemStack(Material.SHIELD));
ItemStack shield = new ItemStack(Material.SHIELD,1,(short)((Math.random()*DyeColor.values().length)));
m.getEquipment().setItemInOffHand(shield);
}
} else {
ItemStack weapon = new ItemStack(Material.BOW);
@ -397,7 +405,8 @@ public class MonsterController {
m.getEquipment().setItemInMainHand(weapon);
}
if (Math.random()<0.5) {
m.getEquipment().setItemInOffHand(new ItemStack(Material.SHIELD));
ItemStack shield = new ItemStack(Material.SHIELD,1,(short)((Math.random()*DyeColor.values().length)));
m.getEquipment().setItemInOffHand(shield);
}
} else {
ItemStack weapon = new ItemStack(Material.BOW);
@ -628,7 +637,9 @@ public class MonsterController {
//m.setCustomNameVisible(true);
m.setMaxHealth(m.getMaxHealth()*4.0);
m.setHealth(m.getMaxHealth());
m.setFireTicks(999999);
if (m.getType()!=EntityType.ENDERMAN) {
m.setFireTicks(999999);
}
if (isAllowedToEquipItems(m)) {
m.getEquipment().clear();
RandomizeEquipment(m,3);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save