First test of new patch.
This commit is contained in:
parent
94e4645e85
commit
db04feaa3b
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: TwosideKeeper
|
name: TwosideKeeper
|
||||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||||
version: 3.7.3cr9
|
version: 3.8.0-alpha1
|
||||||
commands:
|
commands:
|
||||||
money:
|
money:
|
||||||
description: Tells the player the amount of money they are holding.
|
description: Tells the player the amount of money they are holding.
|
||||||
|
@ -41,6 +41,8 @@ import org.bukkit.material.Wool;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.util.Vector;
|
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.Function;
|
||||||
import com.google.common.base.Functions;
|
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) {
|
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);
|
LivingEntity shooter = NewCombat.getDamagerEntity(damager);
|
||||||
if (shooter!=null) {
|
if (enoughTicksHavePassed(target,shooter)) {
|
||||||
if (!(shooter instanceof Monster) || !(target instanceof Monster)) {
|
if (damager!=null && (target instanceof Monster)) {
|
||||||
TwosideKeeper.log(GenericFunctions.GetEntityDisplayName(shooter)+"->"+
|
Monster m = (Monster)target;
|
||||||
GenericFunctions.GetEntityDisplayName(target)+ChatColor.WHITE+": Damage dealt was "+dmg,2);
|
if (damager instanceof Player) {
|
||||||
}
|
NewCombat.addMonsterToTargetList(m, (Player)damager);
|
||||||
} 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.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);
|
||||||
|
}
|
||||||
|
|
||||||
TwosideKeeper.log(ChatColor.BLUE+" "+oldhp+"->"+((LivingEntity)target).getHealth()+" HP",3);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void knockOffGreed(Player p) {
|
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) {
|
public static void subtractHealth(LivingEntity entity, LivingEntity damager, double dmg, ItemStack artifact) {
|
||||||
if (damager instanceof Player) {
|
entity.setLastDamage(0);
|
||||||
Player p = (Player)damager;
|
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);
|
TwosideKeeper.log("Damage goes from "+dmg+"->"+(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER),5);
|
||||||
entity.damage(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER,damager);
|
entity.damage(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER,damager);
|
||||||
aPlugin.API.showDamage(entity, GetHeartAmount(dmg));
|
aPlugin.API.showDamage(entity, GetHeartAmount(dmg));
|
||||||
|
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
if (pd.damagelogging) {
|
if (pd.damagelogging) {
|
||||||
pd.target=entity;
|
pd.target=entity;
|
||||||
DecimalFormat df = new DecimalFormat("0.0");
|
DecimalFormat df = new DecimalFormat("0.0");
|
||||||
TwosideKeeper.updateTitle(p,ChatColor.AQUA+df.format(dmg));
|
TwosideKeeper.updateTitle(p,ChatColor.AQUA+df.format(dmg));
|
||||||
TwosideKeeper.log("In here",2);
|
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 {
|
} else {
|
||||||
pd.target=entity;
|
if (entity instanceof Player) {
|
||||||
TwosideKeeper.updateTitle(p);
|
double dodgechance = NewCombat.CalculateDodgeChance((Player)entity);
|
||||||
}
|
Player p = (Player)entity;
|
||||||
//Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(damager,entity,DamageCause.CUSTOM,dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER));
|
if (!p.hasPotionEffect(PotionEffectType.GLOWING)) {
|
||||||
} else {
|
if (Math.random()<=dodgechance) {
|
||||||
if (entity instanceof Player) {
|
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
|
||||||
double dodgechance = NewCombat.CalculateDodgeChance((Player)entity);
|
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
||||||
Player p = (Player)entity;
|
ItemStack equip = p.getEquipment().getArmorContents()[i];
|
||||||
if (!p.hasPotionEffect(PotionEffectType.GLOWING)) {
|
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GRACEFULDODGE, equip)) {
|
||||||
if (Math.random()<=dodgechance) {
|
p.addPotionEffect(
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
|
new PotionEffect(PotionEffectType.GLOWING,
|
||||||
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
|
(int)(GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equip)*20),
|
||||||
ItemStack equip = p.getEquipment().getArmorContents()[i];
|
0)
|
||||||
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GRACEFULDODGE, equip)) {
|
);
|
||||||
p.addPotionEffect(
|
}
|
||||||
new PotionEffect(PotionEffectType.GLOWING,
|
}
|
||||||
(int)(GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equip)*20),
|
p.setNoDamageTicks(10);
|
||||||
0)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p.setNoDamageTicks(10);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//Use old system if we cannot get a valid damager.
|
//Use old system if we cannot get a valid damager.
|
||||||
if (entity.getHealth()>dmg && entity instanceof Player) {
|
if (entity.getHealth()>dmg && entity instanceof Player) {
|
||||||
if (!AttemptRevive((Player)entity,dmg)) {
|
if (!AttemptRevive((Player)entity,dmg)) {
|
||||||
entity.setHealth(((Player)entity).getHealth()-dmg);
|
entity.setHealth(((Player)entity).getHealth()-dmg);
|
||||||
aPlugin.API.showDamage(entity, GetHeartAmount(dmg));
|
aPlugin.API.showDamage(entity, GetHeartAmount(dmg));
|
||||||
aPlugin.API.sendEntityHurtAnimation((Player)entity);
|
aPlugin.API.sendEntityHurtAnimation((Player)entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
//List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||||
|
//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 {
|
else {
|
||||||
//List<ItemStack> drops = new ArrayList<ItemStack>();
|
//List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||||
@ -2860,29 +2889,52 @@ public class GenericFunctions {
|
|||||||
//entity.setHealth(0);
|
//entity.setHealth(0);
|
||||||
if (entity instanceof Player && !AttemptRevive((Player)entity,Integer.MAX_VALUE)) {
|
if (entity instanceof Player && !AttemptRevive((Player)entity,Integer.MAX_VALUE)) {
|
||||||
entity.damage(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+10<TwosideKeeper.getServerTickTime()) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (entity.getHealth()>dmg && entity instanceof Player) {
|
return true;
|
||||||
if (!AttemptRevive((Player)entity,dmg)) {
|
|
||||||
entity.setHealth(((Player)entity).getHealth()-dmg);
|
|
||||||
aPlugin.API.sendEntityHurtAnimation((Player)entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
//List<ItemStack> drops = new ArrayList<ItemStack>();
|
|
||||||
//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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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<TwosideKeeper.getServerTickTime()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void updateNoDamageTickMap(LivingEntity entity, LivingEntity damager) {
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
Player p = (Player)entity;
|
||||||
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
pd.hitlist.put(damager.getUniqueId(), TwosideKeeper.getServerTickTime());
|
||||||
|
}
|
||||||
|
if (entity instanceof Monster) {
|
||||||
|
Monster m = (Monster)entity;
|
||||||
|
MonsterStructure md = MonsterStructure.getMonsterStructure(m);
|
||||||
|
md.hitlist.put(damager.getUniqueId(), TwosideKeeper.getServerTickTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int GetHeartAmount(double dmg) {
|
private static int GetHeartAmount(double dmg) {
|
||||||
@ -3113,4 +3165,34 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Returns 0.0-100.0.
|
||||||
|
public static double PercentBlocksAroundArea(Block b, Material matchType, int x, int y, int z) {
|
||||||
|
int totalblocks = 0;
|
||||||
|
int matchedblocks = 0;
|
||||||
|
for (int i=-x/2;i<x/2+1;i++) {
|
||||||
|
for (int j=-y/2;j<y/2+1;j++) {
|
||||||
|
for (int k=-z/2;k<z/2+1;k++) {
|
||||||
|
if (b.getRelative(i, j, k)!=null && b.getRelative(i, j, k).getType()==matchType) {
|
||||||
|
matchedblocks++;
|
||||||
|
}
|
||||||
|
totalblocks++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double pct = (((double)matchedblocks)/totalblocks)*100d;
|
||||||
|
TwosideKeeper.log("Checking a "+x/2+"x"+y/2+"x"+z/2+" area for block type "+matchType.name()+": "+pct+"%.", 4);
|
||||||
|
return pct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setGlowing(Monster m, Color color) {
|
||||||
|
Object[] players = Bukkit.getOnlinePlayers().toArray();
|
||||||
|
for (int i=0;i<players.length;i++) {
|
||||||
|
Player p = (Player)players[i];
|
||||||
|
GlowAPI.setGlowing(m, false, p);
|
||||||
|
if (!GlowAPI.isGlowing(m, p)) {
|
||||||
|
GlowAPI.setGlowing(m, color, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class Habitation {
|
|||||||
if (locationhashes.containsKey(hash)) {
|
if (locationhashes.containsKey(hash)) {
|
||||||
int spawnamt = locationhashes.get(hash);
|
int spawnamt = locationhashes.get(hash);
|
||||||
TwosideKeeper.log("[Habitat]Spawn Amount was "+spawnamt+". "+((0.5/(spawnamt+1))*100)+"% chance to fail.",4);
|
TwosideKeeper.log("[Habitat]Spawn Amount was "+spawnamt+". "+((0.5/(spawnamt+1))*100)+"% chance to fail.",4);
|
||||||
if (Math.random()<=(0.5/(spawnamt+1))) {
|
if (Math.random()>(20/(spawnamt+1))) {
|
||||||
TwosideKeeper.log("[Habitat]It failed.",4);
|
TwosideKeeper.log("[Habitat]It failed.",4);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -56,12 +56,12 @@ public class Habitation {
|
|||||||
}
|
}
|
||||||
if (locationhashes.containsKey(hash)) {
|
if (locationhashes.containsKey(hash)) {
|
||||||
int spawnamt = locationhashes.get(hash);
|
int spawnamt = locationhashes.get(hash);
|
||||||
spawnamt+=5;
|
spawnamt+=1;
|
||||||
locationhashes.put(hash,spawnamt);
|
locationhashes.put(hash,spawnamt);
|
||||||
for (int x=-2;x<3;x++) {
|
for (int x=-2;x<3;x++) {
|
||||||
for (int z=-2;z<3;z++) {
|
for (int z=-2;z<3;z++) {
|
||||||
if (x!=0^z!=0) {
|
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);
|
String hash = getLocationHash(l);
|
||||||
if (locationhashes.containsKey(hash)) {
|
if (locationhashes.containsKey(hash)) {
|
||||||
int spawnamt = locationhashes.get(hash);
|
int spawnamt = locationhashes.get(hash);
|
||||||
spawnamt+=2;
|
if (Math.random()<=0.5) {
|
||||||
|
spawnamt+=1;
|
||||||
|
}
|
||||||
locationhashes.put(hash,spawnamt);
|
locationhashes.put(hash,spawnamt);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -148,7 +148,7 @@ public enum ItemSet {
|
|||||||
if (temp!=null) {
|
if (temp!=null) {
|
||||||
int tier = ItemSet.GetTier(GenericFunctions.getEquipment(ent)[i]);
|
int tier = ItemSet.GetTier(GenericFunctions.getEquipment(ent)[i]);
|
||||||
int detectedsets = ItemSet.GetTierSetCount(set, tier, ent);
|
int detectedsets = ItemSet.GetTierSetCount(set, tier, ent);
|
||||||
TwosideKeeper.log("Sets: "+detectedsets, 2);
|
TwosideKeeper.log("Sets: "+detectedsets, 5);
|
||||||
if (detectedsets>=5) {
|
if (detectedsets>=5) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ public class LootStructure {
|
|||||||
boolean hardened_item;
|
boolean hardened_item;
|
||||||
int amt;
|
int amt;
|
||||||
ArtifactItem art;
|
ArtifactItem art;
|
||||||
|
boolean set;
|
||||||
|
int minSetLevel;
|
||||||
|
|
||||||
public LootStructure(Material mat, boolean ishardened) {
|
public LootStructure(Material mat, boolean ishardened) {
|
||||||
this.mat=mat;
|
this.mat=mat;
|
||||||
@ -33,6 +35,23 @@ public class LootStructure {
|
|||||||
this.art=art;
|
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() {
|
public Material GetMaterial() {
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,62 @@ public enum MonsterDifficulty {
|
|||||||
new LootStructure(Material.LEATHER_LEGGINGS,4),
|
new LootStructure(Material.LEATHER_LEGGINGS,4),
|
||||||
new LootStructure(Material.LEATHER_BOOTS,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_regular;
|
||||||
LootStructure[] loot_rare;
|
LootStructure[] loot_rare;
|
||||||
@ -192,6 +247,10 @@ public enum MonsterDifficulty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isRanger) {
|
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isRanger) {
|
||||||
|
return RandomizeDrops(dropmult,isBoss,false,isRanger);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemStack> RandomizeDrops(double dropmult, boolean isBoss, boolean isElite, boolean isRanger) {
|
||||||
TwosideKeeper.log(ChatColor.AQUA+"->Entering RandomizeDrops()", 5);
|
TwosideKeeper.log(ChatColor.AQUA+"->Entering RandomizeDrops()", 5);
|
||||||
List<ItemStack> droplist = new ArrayList<ItemStack>();
|
List<ItemStack> droplist = new ArrayList<ItemStack>();
|
||||||
dropmult += 1; //Base dropmult is 1.0.
|
dropmult += 1; //Base dropmult is 1.0.
|
||||||
@ -208,7 +267,7 @@ public enum MonsterDifficulty {
|
|||||||
//First do a common roll.
|
//First do a common roll.
|
||||||
if (Math.random()<TwosideKeeper.COMMON_DROP_RATE &&
|
if (Math.random()<TwosideKeeper.COMMON_DROP_RATE &&
|
||||||
this.loot_regular.length>0) {
|
this.loot_regular.length>0) {
|
||||||
TwosideKeeper.log(">Attempting Common roll.", 1);
|
TwosideKeeper.log(">Attempting Common roll.", 4);
|
||||||
//This is a common roll.
|
//This is a common roll.
|
||||||
ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger);
|
ItemStack gen_loot = DistributeRandomLoot(this.loot_regular, isRanger);
|
||||||
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
|
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
|
||||||
@ -218,15 +277,15 @@ public enum MonsterDifficulty {
|
|||||||
//Rare Loot roll.
|
//Rare Loot roll.
|
||||||
if (Math.random()<TwosideKeeper.RARE_DROP_RATE &&
|
if (Math.random()<TwosideKeeper.RARE_DROP_RATE &&
|
||||||
this.loot_rare.length>0) {
|
this.loot_rare.length>0) {
|
||||||
TwosideKeeper.log(">Attempting Rare roll.", 1);
|
TwosideKeeper.log(">Attempting Rare roll.", 3);
|
||||||
//This is a common roll.
|
//This is a common roll.
|
||||||
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger);
|
ItemStack gen_loot = DistributeRandomLoot(this.loot_rare, isRanger);
|
||||||
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
|
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
|
||||||
droplist.add(gen_loot);
|
droplist.add(gen_loot);
|
||||||
double randomness = Math.random();
|
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) {
|
if (randomness<=0.2) {
|
||||||
TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn an essence!", 1);
|
TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn an essence!", 4);
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case DANGEROUS:
|
case DANGEROUS:
|
||||||
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE));
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_ESSENCE));
|
||||||
@ -237,6 +296,9 @@ public enum MonsterDifficulty {
|
|||||||
case HELLFIRE:
|
case HELLFIRE:
|
||||||
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE));
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE));
|
||||||
break;
|
break;
|
||||||
|
case ELITE:
|
||||||
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_ESSENCE));
|
||||||
|
break;
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE));
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_ESSENCE));
|
||||||
break;
|
break;
|
||||||
@ -250,15 +312,15 @@ public enum MonsterDifficulty {
|
|||||||
//Legendary Loot roll.
|
//Legendary Loot roll.
|
||||||
if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE &&
|
if (Math.random()<TwosideKeeper.LEGENDARY_DROP_RATE &&
|
||||||
this.loot_legendary.length>0) {
|
this.loot_legendary.length>0) {
|
||||||
TwosideKeeper.log(">Attempting Legendary roll.", 1);
|
TwosideKeeper.log(">Attempting Legendary roll.", 3);
|
||||||
//This is a common roll.
|
//This is a common roll.
|
||||||
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger);
|
ItemStack gen_loot = DistributeRandomLoot(this.loot_legendary, isRanger);
|
||||||
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
|
TwosideKeeper.log("Adding "+gen_loot.toString()+" to loot table.", 4);
|
||||||
droplist.add(gen_loot);
|
droplist.add(gen_loot);
|
||||||
double randomness = Math.random();
|
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) {
|
if (randomness<=0.2) {
|
||||||
TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Core!", 1);
|
TwosideKeeper.log(ChatColor.DARK_GREEN+" Spawn a Core!", 4);
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case DANGEROUS:
|
case DANGEROUS:
|
||||||
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE));
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ANCIENT_CORE));
|
||||||
@ -269,6 +331,9 @@ public enum MonsterDifficulty {
|
|||||||
case HELLFIRE:
|
case HELLFIRE:
|
||||||
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE));
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE));
|
||||||
break;
|
break;
|
||||||
|
case ELITE:
|
||||||
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE));
|
||||||
|
break;
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE));
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.ARTIFACT_CORE));
|
||||||
break;
|
break;
|
||||||
@ -278,11 +343,11 @@ public enum MonsterDifficulty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
randomness = Math.random();
|
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) {
|
if (randomness<=0.6) {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case NORMAL:
|
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));
|
droplist.add(sig.plugin.TwosideKeeper.Artifact.createArtifactItem(ArtifactItem.MYSTERIOUS_ESSENCE));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,13 @@ public class MonsterController {
|
|||||||
ms.SetLeader(true);
|
ms.SetLeader(true);
|
||||||
//Set the HP of the leader to a more proper amount.
|
//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) {
|
if (ylv>=128) {
|
||||||
//This is a 95% chance this will despawn.
|
//This is a 95% chance this will despawn.
|
||||||
if (Math.random()<=0.95 && !ent.getWorld().hasStorm() &&
|
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<TwosideKeeper.getServerTickTime()) {
|
||||||
|
TwosideKeeper.log("Trying for an elite monster.", 4);
|
||||||
|
if (GenericFunctions.PercentBlocksAroundArea(ent.getLocation().getBlock(),Material.AIR,16,8,16)>=75) {
|
||||||
|
TwosideKeeper.LAST_ELITE_SPAWN=TwosideKeeper.getServerTickTime();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static void RandomizeEquipment(Monster m, int lv) {
|
private static void RandomizeEquipment(Monster m, int lv) {
|
||||||
/*
|
/*
|
||||||
* Lv1: Leather/Iron Armor.
|
* Lv1: Leather/Iron Armor.
|
||||||
@ -571,6 +589,9 @@ public class MonsterController {
|
|||||||
if (m.getCustomName().contains("Hellfire")) {
|
if (m.getCustomName().contains("Hellfire")) {
|
||||||
return MonsterDifficulty.HELLFIRE;
|
return MonsterDifficulty.HELLFIRE;
|
||||||
} else
|
} else
|
||||||
|
if (m.getCustomName().contains("Elite")) {
|
||||||
|
return MonsterDifficulty.ELITE;
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
return MonsterDifficulty.NORMAL;
|
return MonsterDifficulty.NORMAL;
|
||||||
}
|
}
|
||||||
@ -608,9 +629,11 @@ public class MonsterController {
|
|||||||
}
|
}
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,4));
|
||||||
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
||||||
m.setMaxHealth(20);
|
m.setMaxHealth(20);
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
|
MonsterStructure.getMonsterStructure(m).SetLeader(true);
|
||||||
}
|
}
|
||||||
if (!GenericFunctions.isArmoredMob(m)) {
|
if (!GenericFunctions.isArmoredMob(m)) {
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,1));
|
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));
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,1));
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,4));
|
||||||
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
||||||
m.setMaxHealth(50);
|
m.setMaxHealth(50);
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
|
MonsterStructure.getMonsterStructure(m).SetLeader(true);
|
||||||
}
|
}
|
||||||
if (!GenericFunctions.isArmoredMob(m)) {
|
if (!GenericFunctions.isArmoredMob(m)) {
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,3));
|
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 (Math.random()<=0.2) {m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,99999,1));}
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,99999,4));
|
||||||
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
|
||||||
m.setMaxHealth(200);
|
m.setMaxHealth(200);
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
|
MonsterStructure.getMonsterStructure(m).SetLeader(true);
|
||||||
}
|
}
|
||||||
if (!GenericFunctions.isArmoredMob(m)) {
|
if (!GenericFunctions.isArmoredMob(m)) {
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,5));
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,5));
|
||||||
}
|
}
|
||||||
}break;
|
}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: {
|
default: {
|
||||||
if (isAllowedToEquipItems(m)) {
|
if (isAllowedToEquipItems(m)) {
|
||||||
m.getEquipment().clear();
|
m.getEquipment().clear();
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
package sig.plugin.TwosideKeeper;
|
package sig.plugin.TwosideKeeper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
|
|
||||||
public class MonsterStructure {
|
public class MonsterStructure {
|
||||||
public LivingEntity target;
|
public LivingEntity target;
|
||||||
public String original_name;
|
public String original_name="";
|
||||||
public Monster m;
|
public Monster m;
|
||||||
public boolean isLeader;
|
public boolean isLeader=false;
|
||||||
|
public boolean isElite=false;
|
||||||
|
public HashMap<UUID,Long> hitlist = new HashMap<UUID,Long>();
|
||||||
|
|
||||||
public MonsterStructure(Monster m) {
|
public MonsterStructure(Monster m) {
|
||||||
target=null;
|
target=null;
|
||||||
@ -34,6 +39,9 @@ public class MonsterStructure {
|
|||||||
public void SetLeader(boolean leader) {
|
public void SetLeader(boolean leader) {
|
||||||
this.isLeader=leader;
|
this.isLeader=leader;
|
||||||
}
|
}
|
||||||
|
public void SetElite(boolean elite) {
|
||||||
|
this.isElite=elite;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasOriginalName() {
|
public boolean hasOriginalName() {
|
||||||
return !this.original_name.equalsIgnoreCase("");
|
return !this.original_name.equalsIgnoreCase("");
|
||||||
@ -50,4 +58,19 @@ public class MonsterStructure {
|
|||||||
public boolean getLeader() {
|
public boolean getLeader() {
|
||||||
return this.isLeader;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,12 +428,8 @@ public class NewCombat {
|
|||||||
if (Iterables.get(nearby, i) instanceof Monster) {
|
if (Iterables.get(nearby, i) instanceof Monster) {
|
||||||
Monster mm = (Monster)(Iterables.get(nearby, i));
|
Monster mm = (Monster)(Iterables.get(nearby, i));
|
||||||
mm.setTarget(p);
|
mm.setTarget(p);
|
||||||
if (TwosideKeeper.monsterdata.containsKey(mm.getUniqueId())) {
|
MonsterStructure ms = MonsterStructure.getMonsterStructure(mm);
|
||||||
MonsterStructure ms = (MonsterStructure)TwosideKeeper.monsterdata.get(mm.getUniqueId());
|
ms.SetTarget(p);
|
||||||
ms.SetTarget(p);
|
|
||||||
} else {
|
|
||||||
TwosideKeeper.monsterdata.put(mm.getUniqueId(),new MonsterStructure(m,p));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -87,6 +88,7 @@ public class PlayerStructure {
|
|||||||
public String deathloc_world = "";
|
public String deathloc_world = "";
|
||||||
public List<ItemStack> deathloot = new ArrayList<ItemStack>();
|
public List<ItemStack> deathloot = new ArrayList<ItemStack>();
|
||||||
public double vendetta_amt = 0.0;
|
public double vendetta_amt = 0.0;
|
||||||
|
public HashMap<UUID,Long> hitlist = new HashMap<UUID,Long>();
|
||||||
|
|
||||||
public double prev_weapondmg=0.0;
|
public double prev_weapondmg=0.0;
|
||||||
public double prev_buffdmg=0.0;
|
public double prev_buffdmg=0.0;
|
||||||
|
@ -167,7 +167,7 @@ public class RecyclingCenter {
|
|||||||
|
|
||||||
public void AddItemToRecyclingCenter(Item i) {
|
public void AddItemToRecyclingCenter(Item i) {
|
||||||
//There is a % chance of it going to a recycling center.
|
//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())) {
|
IsItemAllowed(i.getItemStack())) {
|
||||||
//Recycle allowed. Now figure out which node to go to.
|
//Recycle allowed. Now figure out which node to go to.
|
||||||
if (getNumberOfNodes()>0) {
|
if (getNumberOfNodes()>0) {
|
||||||
|
@ -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 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 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 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 ServerType SERVER_TYPE=ServerType.TEST; //The type of server this is running on.
|
||||||
public static int COMMONITEMPCT=3;
|
public static int COMMONITEMPCT=3;
|
||||||
|
public static long LAST_ELITE_SPAWN = 0;
|
||||||
public static List<ArtifactAbility> TEMPORARYABILITIES = new ArrayList<ArtifactAbility>();
|
public static List<ArtifactAbility> TEMPORARYABILITIES = new ArrayList<ArtifactAbility>();
|
||||||
|
|
||||||
public static final int DODGE_COOLDOWN=100;
|
public static final int DODGE_COOLDOWN=100;
|
||||||
@ -489,6 +492,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('*', MOTD));
|
getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('*', MOTD));
|
||||||
habitat_data.increaseHabitationLevels();
|
habitat_data.increaseHabitationLevels();
|
||||||
habitat_data.startinglocs.clear();
|
habitat_data.startinglocs.clear();
|
||||||
|
for (int i=0;i<Bukkit.getOnlinePlayers().size();i++) {
|
||||||
|
Player p = (Player)(Bukkit.getOnlinePlayers().toArray()[i]);
|
||||||
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
pd.hitlist.clear();
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
getServer().broadcastMessage("Thanks for playing on Sig's Minecraft!");
|
getServer().broadcastMessage("Thanks for playing on Sig's Minecraft!");
|
||||||
getServer().broadcastMessage(ChatColor.AQUA+"Check out http://z-gamers.net/mc for update info!");
|
getServer().broadcastMessage(ChatColor.AQUA+"Check out http://z-gamers.net/mc for update info!");
|
||||||
@ -550,7 +558,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
if (mon.isLeader) {
|
if (mon.isLeader) {
|
||||||
//Make it glow red.
|
//Make it glow red.
|
||||||
GlowAPI.setGlowing(m, GlowAPI.Color.DARK_RED, Bukkit.getOnlinePlayers());
|
GenericFunctions.setGlowing(m, GlowAPI.Color.DARK_RED);
|
||||||
|
}
|
||||||
|
if (mon.isElite) {
|
||||||
|
//Make it glow dark purple.
|
||||||
|
GenericFunctions.setGlowing(m, GlowAPI.Color.DARK_PURPLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3550,6 +3562,25 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
TwosideRecyclingCenter.AddItemToRecyclingCenter(i);
|
TwosideRecyclingCenter.AddItemToRecyclingCenter(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
|
public void onChunkLoadEvent(ChunkLoadEvent ev) {
|
||||||
|
//Grab all entities. Create monster structures for all monsters. Detect elites and leaders and set their status accordingly.
|
||||||
|
Entity[] entities = ev.getChunk().getEntities();
|
||||||
|
for (int i=0;i<entities.length;i++) {
|
||||||
|
if (entities[i]!=null && entities[i].isValid() && (entities[i] instanceof Monster)) {
|
||||||
|
Monster m = (Monster)entities[i];
|
||||||
|
MonsterStructure ms = MonsterStructure.getMonsterStructure(m);
|
||||||
|
MonsterDifficulty md = MonsterController.getMonsterDifficulty(m);
|
||||||
|
if (md == MonsterDifficulty.ELITE) {
|
||||||
|
ms.SetElite(true);
|
||||||
|
}
|
||||||
|
if (MonsterController.isZombieLeader(m)) {
|
||||||
|
ms.SetLeader(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
public void MonsterSpawnEvent(CreatureSpawnEvent ev) {
|
public void MonsterSpawnEvent(CreatureSpawnEvent ev) {
|
||||||
|
|
||||||
@ -3559,9 +3590,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ev.getEntity().remove();
|
ev.getEntity().remove();
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
}
|
}
|
||||||
if (!monsterdata.containsKey(m.getUniqueId())) {
|
MonsterStructure.getMonsterStructure(m);
|
||||||
monsterdata.put(m.getUniqueId(), new MonsterStructure(m));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3572,6 +3601,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
log("Denied chicken spawn.",4);
|
log("Denied chicken spawn.",4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ev.getSpawnReason().equals(SpawnReason.CHUNK_GEN)) {
|
||||||
|
log("Chunk gen",2);
|
||||||
|
}
|
||||||
|
|
||||||
if ((ev.getSpawnReason().equals(SpawnReason.NATURAL) ||
|
if ((ev.getSpawnReason().equals(SpawnReason.NATURAL) ||
|
||||||
ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) ||
|
ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) ||
|
||||||
ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) ||
|
ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) ||
|
||||||
@ -4054,6 +4087,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
log("New Damage: "+ev.getFinalDamage(),4);
|
log("New Damage: "+ev.getFinalDamage(),4);
|
||||||
} else {
|
} else {
|
||||||
double dmg = 0.0;
|
double dmg = 0.0;
|
||||||
|
boolean hitallowed=true;
|
||||||
|
if (ev.getEntity() instanceof LivingEntity) {
|
||||||
|
hitallowed =GenericFunctions.enoughTicksHavePassed((LivingEntity)ev.getEntity(),NewCombat.getDamagerEntity(ev.getDamager()));
|
||||||
|
}
|
||||||
|
ev.setCancelled(!hitallowed);
|
||||||
if (ev.getEntity() instanceof Player) {
|
if (ev.getEntity() instanceof Player) {
|
||||||
Player p = (Player)ev.getEntity();
|
Player p = (Player)ev.getEntity();
|
||||||
if (p.hasPotionEffect(PotionEffectType.GLOWING)) {
|
if (p.hasPotionEffect(PotionEffectType.GLOWING)) {
|
||||||
@ -4113,7 +4151,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ev.setDamage(0);
|
ev.setDamage(0);
|
||||||
//ev.setCancelled(true);
|
//ev.setCancelled(true);
|
||||||
if (ev.getEntity() instanceof LivingEntity) {
|
if (ev.getEntity() instanceof LivingEntity) {
|
||||||
((LivingEntity)ev.getEntity()).setNoDamageTicks(10);
|
((LivingEntity)ev.getEntity()).setLastDamage(0);
|
||||||
|
((LivingEntity)ev.getEntity()).setNoDamageTicks(0);
|
||||||
|
((LivingEntity)ev.getEntity()).setMaximumNoDamageTicks(0);
|
||||||
final double oldhp=((LivingEntity)ev.getEntity()).getHealth();
|
final double oldhp=((LivingEntity)ev.getEntity()).getHealth();
|
||||||
|
|
||||||
if (ev.getEntity() instanceof Player) {
|
if (ev.getEntity() instanceof Player) {
|
||||||
@ -5377,6 +5417,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
getConfig().set("LOGGING_LEVEL", LOGGING_LEVEL);
|
getConfig().set("LOGGING_LEVEL", LOGGING_LEVEL);
|
||||||
//getConfig().set("ARTIFACT_RARITY", ARTIFACT_RARITY);
|
//getConfig().set("ARTIFACT_RARITY", ARTIFACT_RARITY);
|
||||||
getConfig().set("SERVER_TYPE", SERVER_TYPE.GetValue());
|
getConfig().set("SERVER_TYPE", SERVER_TYPE.GetValue());
|
||||||
|
getConfig().set("LAST_ELITE_SPAWN", LAST_ELITE_SPAWN);
|
||||||
//getConfig().set("MOTD", MOTD); //It makes no sense to save the MOTD as it will never be modified in-game.
|
//getConfig().set("MOTD", MOTD); //It makes no sense to save the MOTD as it will never be modified in-game.
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
@ -5430,6 +5471,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
getConfig().addDefault("LOGGING_LEVEL", LOGGING_LEVEL);
|
getConfig().addDefault("LOGGING_LEVEL", LOGGING_LEVEL);
|
||||||
getConfig().addDefault("ARTIFACT_RARITY", ARTIFACT_RARITY);
|
getConfig().addDefault("ARTIFACT_RARITY", ARTIFACT_RARITY);
|
||||||
getConfig().addDefault("SERVER_TYPE", SERVER_TYPE.GetValue());
|
getConfig().addDefault("SERVER_TYPE", SERVER_TYPE.GetValue());
|
||||||
|
getConfig().addDefault("LAST_ELITE_SPAWN", LAST_ELITE_SPAWN);
|
||||||
getConfig().options().copyDefaults(true);
|
getConfig().options().copyDefaults(true);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
SERVERTICK = getConfig().getLong("SERVERTICK");
|
SERVERTICK = getConfig().getLong("SERVERTICK");
|
||||||
@ -5461,6 +5503,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
LOGGING_LEVEL = getConfig().getInt("LOGGING_LEVEL");
|
LOGGING_LEVEL = getConfig().getInt("LOGGING_LEVEL");
|
||||||
ARTIFACT_RARITY = getConfig().getDouble("ARTIFACT_RARITY");
|
ARTIFACT_RARITY = getConfig().getDouble("ARTIFACT_RARITY");
|
||||||
SERVER_TYPE = ServerType.GetTypeFromValue(getConfig().getInt("SERVER_TYPE"));
|
SERVER_TYPE = ServerType.GetTypeFromValue(getConfig().getInt("SERVER_TYPE"));
|
||||||
|
LAST_ELITE_SPAWN = getConfig().getLong("LAST_ELITE_SPAWN");
|
||||||
getMOTD();
|
getMOTD();
|
||||||
|
|
||||||
//Informational reports to the console.
|
//Informational reports to the console.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user