Implement aggro mechanics for monsters.
This commit is contained in:
parent
7a87c6ce4f
commit
3d9479b9f2
@ -6,7 +6,7 @@
|
|||||||
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/AutoPluginUpdate.jar"/>
|
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/AutoPluginUpdate.jar"/>
|
||||||
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/GlowAPI_v1.4.4.jar"/>
|
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/GlowAPI_v1.4.4.jar"/>
|
||||||
<classpathentry kind="lib" path="D:/Documents/Test Server/spigot-1.9.2-R0.1-SNAPSHOT.jar"/>
|
<classpathentry kind="lib" path="D:/Documents/Test Server/spigot-1.9.2-R0.1-SNAPSHOT.jar"/>
|
||||||
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/aPlugin (99).jar"/>
|
<classpathentry kind="lib" path="D:/Documents/Test Server/plugins/aPlugin (102).jar"/>
|
||||||
<classpathentry kind="src" path="/AutoPluginUpdate"/>
|
<classpathentry kind="src" path="/AutoPluginUpdate"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: TwosideKeeper
|
name: TwosideKeeper
|
||||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||||
version: 3.12.1a
|
version: 3.12.1b
|
||||||
loadbefore: [aPlugin]
|
loadbefore: [aPlugin]
|
||||||
commands:
|
commands:
|
||||||
money:
|
money:
|
||||||
|
@ -23,8 +23,9 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MaterialData;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds data about an arena.
|
* Holds data about an arena.
|
||||||
|
* @param <E>
|
||||||
*/
|
*/
|
||||||
public class Arena {
|
public class Arena<E> {
|
||||||
HashMap<Block,MaterialData> oldblocklist = new HashMap<Block,MaterialData>();
|
HashMap<Block,MaterialData> oldblocklist = new HashMap<Block,MaterialData>();
|
||||||
List<Material> wallmats = new ArrayList<Material>();
|
List<Material> wallmats = new ArrayList<Material>();
|
||||||
List<Material> floormats = new ArrayList<Material>();
|
List<Material> floormats = new ArrayList<Material>();
|
||||||
@ -34,6 +35,7 @@ public class Arena {
|
|||||||
List<Player> arenaplayers = new ArrayList<Player>();
|
List<Player> arenaplayers = new ArrayList<Player>();
|
||||||
Box box;
|
Box box;
|
||||||
World world;
|
World world;
|
||||||
|
E test;
|
||||||
|
|
||||||
public Arena(World world, int x, int y, int z, int w, int h, int d,Material arena_mat) {
|
public Arena(World world, int x, int y, int z, int w, int h, int d,Material arena_mat) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
@ -1054,9 +1054,31 @@ public class CustomDamage {
|
|||||||
GenericFunctions.removeNoDamageTick(target, damager);
|
GenericFunctions.removeNoDamageTick(target, damager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateAggroValues(getDamagerEntity(damager),target,damage,reason);
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void updateAggroValues(LivingEntity damager, LivingEntity target, double damage, String reason) {
|
||||||
|
if (getDamagerEntity(damager)!=null && EntityUtils.isValidEntity(getDamagerEntity(damager))) {
|
||||||
|
if (target!=null && EntityUtils.isValidEntity(target) && !(target instanceof Player)) {
|
||||||
|
LivingEntity damaging_ent = getDamagerEntity(damager);
|
||||||
|
double mult = 1.0;
|
||||||
|
if (damaging_ent instanceof Player) {
|
||||||
|
if (PlayerMode.getPlayerMode((Player)damaging_ent)==PlayerMode.BARBARIAN) {
|
||||||
|
mult += 4-((damaging_ent.getHealth()/damaging_ent.getMaxHealth())*4d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||||
|
les.increaseAggro(getDamagerEntity(damager), (int)(damage*mult));
|
||||||
|
//TwosideKeeper.log(les.displayAggroTable(),0);
|
||||||
|
if (les.GetTarget()!=null &&
|
||||||
|
les.GetTarget() == getDamagerEntity(damager)) {
|
||||||
|
les.lastHit = TwosideKeeper.getServerTickTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void createBloodPool(Arrow proj, LivingEntity target) {
|
private static void createBloodPool(Arrow proj, LivingEntity target) {
|
||||||
TemporaryBlock.createTemporaryBlockCircle(target.getLocation(), 1, Material.WOOL, (byte)14, 20*30, "BLOODPOOL");
|
TemporaryBlock.createTemporaryBlockCircle(target.getLocation(), 1, Material.WOOL, (byte)14, 20*30, "BLOODPOOL");
|
||||||
new EffectPool(target.getLocation(),1,20*30,Color.fromRGB(255, 0, 0));
|
new EffectPool(target.getLocation(),1,20*30,Color.fromRGB(255, 0, 0));
|
||||||
@ -1415,10 +1437,12 @@ public class CustomDamage {
|
|||||||
for (Player pl : partymembers) {
|
for (Player pl : partymembers) {
|
||||||
if (!pl.equals(p) && ItemSet.HasSetBonusBasedOnSetBonusCount(pl, ItemSet.DONNER, 4)) {
|
if (!pl.equals(p) && ItemSet.HasSetBonusBasedOnSetBonusCount(pl, ItemSet.DONNER, 4)) {
|
||||||
//Aggro to them instead.
|
//Aggro to them instead.
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
if (!m.hasPotionEffect(PotionEffectType.GLOWING)) {
|
if (!m.hasPotionEffect(PotionEffectType.GLOWING)) {
|
||||||
setMonsterTarget(m,pl);
|
setMonsterTarget(m,pl);
|
||||||
setAggroGlowTickTime(m,100);
|
setAggroGlowTickTime(m,100);
|
||||||
}
|
}
|
||||||
|
les.increaseAggro(pl, 500*ItemSet.getHighestTierInSet(pl, ItemSet.DONNER));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1879,6 +1903,9 @@ public class CustomDamage {
|
|||||||
} else {
|
} else {
|
||||||
pd.regenpool += lifestealamt;
|
pd.regenpool += lifestealamt;
|
||||||
}
|
}
|
||||||
|
if (p.getMaxHealth()==p.getHealth()) {
|
||||||
|
pd.damagepool -= Math.max(pd.damagepool-lifestealamt, 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pd.regenpool += lifestealamt;
|
pd.regenpool += lifestealamt;
|
||||||
}
|
}
|
||||||
@ -1999,7 +2026,9 @@ public class CustomDamage {
|
|||||||
//This is allowed, get the level on the weapon.
|
//This is allowed, get the level on the weapon.
|
||||||
setMonsterTarget(m,p);
|
setMonsterTarget(m,p);
|
||||||
//TwosideKeeper.log("Aggro tick time: "+(int)(GenericFunctions.getAbilityValue(ArtifactAbility.PROVOKE, weapon)*20), 0);
|
//TwosideKeeper.log("Aggro tick time: "+(int)(GenericFunctions.getAbilityValue(ArtifactAbility.PROVOKE, weapon)*20), 0);
|
||||||
setAggroGlowTickTime(m,(int)(GenericFunctions.getAbilityValue(ArtifactAbility.PROVOKE, weapon, p)*20));
|
//setAggroGlowTickTime(m,(int)(GenericFunctions.getAbilityValue(ArtifactAbility.PROVOKE, weapon, p)*20));
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
les.increaseAggro(p, (int)GenericFunctions.getAbilityValue(ArtifactAbility.PROVOKE, weapon, p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2016,8 +2045,10 @@ public class CustomDamage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void applyDonnerSetAggro(Monster m, Player p) {
|
private static void applyDonnerSetAggro(Monster m, Player p) {
|
||||||
double aggrotime = ItemSet.GetTotalBaseAmount(p, ItemSet.DONNER)*20;
|
int aggroamt = ItemSet.GetTotalBaseAmount(p, ItemSet.DONNER);
|
||||||
setAggroGlowTickTime(m,(int)aggrotime);
|
//setAggroGlowTickTime(m,(int)aggrotime);
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
les.increaseAggro(p, aggroamt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void leaderRallyNearbyMonsters(Monster m, Player p) {
|
static void leaderRallyNearbyMonsters(Monster m, Player p) {
|
||||||
@ -2225,14 +2256,14 @@ public class CustomDamage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addMonsterToTargetList(LivingEntity m,Player p) {
|
public static void addMonsterToTargetList(LivingEntity m,Player p) {
|
||||||
if (m instanceof Monster && !m.hasPotionEffect(PotionEffectType.GLOWING)) {((Monster)m).setTarget(p);}
|
//if (m instanceof Monster && !m.hasPotionEffect(PotionEffectType.GLOWING)) {((Monster)m).setTarget(p);}
|
||||||
if (TwosideKeeper.livingentitydata.containsKey(m.getUniqueId())) {
|
if (TwosideKeeper.livingentitydata.containsKey(m.getUniqueId())) {
|
||||||
LivingEntityStructure ms = (LivingEntityStructure)TwosideKeeper.livingentitydata.get(m.getUniqueId());
|
LivingEntityStructure ms = (LivingEntityStructure)TwosideKeeper.livingentitydata.get(m.getUniqueId());
|
||||||
ms.SetTarget(p);
|
//ms.SetTarget(p);
|
||||||
} else {
|
} else {
|
||||||
LivingEntityStructure ms = new LivingEntityStructure(m,p);
|
LivingEntityStructure ms = new LivingEntityStructure(m,p);
|
||||||
TwosideKeeper.livingentitydata.put(m.getUniqueId(),ms);
|
TwosideKeeper.livingentitydata.put(m.getUniqueId(),ms);
|
||||||
ms.SetTarget(p);
|
//ms.SetTarget(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2344,7 +2375,7 @@ public class CustomDamage {
|
|||||||
PVP session = PVP.getMatch(defender);
|
PVP session = PVP.getMatch(defender);
|
||||||
session.joinMatch(attacker);
|
session.joinMatch(attacker);
|
||||||
} else
|
} else
|
||||||
if (!PVP.isPvPing(defender) && (weapon==null || (weapon.getType()==Material.AIR && weapon.isSimilar(attacker.getEquipment().getItemInMainHand())))) {
|
if (TwosideKeeper.PVPISENABLED && !PVP.isPvPing(defender) && (weapon==null || (weapon.getType()==Material.AIR && weapon.isSimilar(attacker.getEquipment().getItemInMainHand())))) {
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(attacker);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(attacker);
|
||||||
PlayerStructure pd2 = PlayerStructure.GetPlayerStructure(defender);
|
PlayerStructure pd2 = PlayerStructure.GetPlayerStructure(defender);
|
||||||
if (pd.lastStartedPlayerClicks+200<=TwosideKeeper.getServerTickTime() &&
|
if (pd.lastStartedPlayerClicks+200<=TwosideKeeper.getServerTickTime() &&
|
||||||
@ -2617,7 +2648,7 @@ public class CustomDamage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,3,3)/100d);
|
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,3,3)/100d);
|
||||||
if (p.isBlocking()) {
|
if (p.isBlocking() || pd.lastblock+20*5<=TwosideKeeper.getServerTickTime()) {
|
||||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.SONGSTEEL));
|
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.SONGSTEEL));
|
||||||
}
|
}
|
||||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d);
|
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d);
|
||||||
|
@ -323,6 +323,8 @@ public class EliteMonster {
|
|||||||
Player p = targetlist.get((int)(Math.random() * targetlist.size()));
|
Player p = targetlist.get((int)(Math.random() * targetlist.size()));
|
||||||
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS,20*1,7,p);
|
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.BLINDNESS,20*1,7,p);
|
||||||
m.setTarget(p);
|
m.setTarget(p);
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
les.increaseAggroWhileMultiplyingAllOthers(p, 0, 0.25);
|
||||||
TwosideKeeper.log("Set new target to "+p.getName(), 2);
|
TwosideKeeper.log("Set new target to "+p.getName(), 2);
|
||||||
return p;
|
return p;
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,7 +76,7 @@ public enum ArtifactAbility {
|
|||||||
new PVPValue(0,0.05),100,40,UpgradePath.ARMOR,10),
|
new PVPValue(0,0.05),100,40,UpgradePath.ARMOR,10),
|
||||||
|
|
||||||
//Sword abilities
|
//Sword abilities
|
||||||
PROVOKE("Provoke","Your attacks provoke enemies for [VAL] seconds.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
|
PROVOKE("Provoke","Your attacks increase Aggression by [VAL].",new double[]{5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5},
|
||||||
new PVPValue(0,1.0),10000,10,UpgradePath.PROVOKE,1),
|
new PVPValue(0,1.0),10000,10,UpgradePath.PROVOKE,1),
|
||||||
COMBO("Belligerent","[VAL]% more damage for each successive strike on a mob. Resets after 2 seconds of no combat.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
|
COMBO("Belligerent","[VAL]% more damage for each successive strike on a mob. Resets after 2 seconds of no combat.",new double[]{0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1},
|
||||||
new PVPValue(50,0.1),10000,40,UpgradePath.SWORD,1),
|
new PVPValue(50,0.1),10000,40,UpgradePath.SWORD,1),
|
||||||
|
@ -3711,7 +3711,7 @@ public class GenericFunctions {
|
|||||||
boolean revived=false;
|
boolean revived=false;
|
||||||
boolean fromRoom=false;
|
boolean fromRoom=false;
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
DebugUtils.showStackTrace();
|
//DebugUtils.showStackTrace();
|
||||||
if (p.getHealth()<=dmg || (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER && pd.slayermodehp<=dmg)) {
|
if (p.getHealth()<=dmg || (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER && pd.slayermodehp<=dmg)) {
|
||||||
//This means we would die from this attack. Attempt to revive the player.
|
//This means we would die from this attack. Attempt to revive the player.
|
||||||
//Check all artifact armor for a perk.
|
//Check all artifact armor for a perk.
|
||||||
@ -3892,9 +3892,13 @@ public class GenericFunctions {
|
|||||||
//List<Monster> monsters = getNearbyMobs(p.getLocation(),8);
|
//List<Monster> monsters = getNearbyMobs(p.getLocation(),8);
|
||||||
List<Monster> monsters = CustomDamage.trimNonMonsterEntities(p.getNearbyEntities(24, 24, 24));
|
List<Monster> monsters = CustomDamage.trimNonMonsterEntities(p.getNearbyEntities(24, 24, 24));
|
||||||
for (Monster m : monsters) {
|
for (Monster m : monsters) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
les.setAggro(m, 0);
|
||||||
|
if (les.GetTarget()==p) {
|
||||||
|
les.SetTarget(null);
|
||||||
|
}
|
||||||
if (m.getTarget()!=null &&
|
if (m.getTarget()!=null &&
|
||||||
m.getTarget().equals(p) &&
|
m.getTarget().equals(p)) {
|
||||||
!m.hasPotionEffect(PotionEffectType.GLOWING)) {
|
|
||||||
m.setTarget(null);
|
m.setTarget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5473,6 +5477,8 @@ public class GenericFunctions {
|
|||||||
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW, 20*15, poisonlv, ent);
|
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.SLOW, 20*15, poisonlv, ent);
|
||||||
}*/
|
}*/
|
||||||
CustomDamage.ApplyDamage(totalpoisonlv*10, p, ent, null, "Siphon", CustomDamage.TRUEDMG|CustomDamage.IGNOREDODGE|CustomDamage.IGNORE_DAMAGE_TICK);
|
CustomDamage.ApplyDamage(totalpoisonlv*10, p, ent, null, "Siphon", CustomDamage.TRUEDMG|CustomDamage.IGNOREDODGE|CustomDamage.IGNORE_DAMAGE_TICK);
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent);
|
||||||
|
les.setAggro(p, 0);
|
||||||
}
|
}
|
||||||
CustomDamage.setAbsorptionHearts(p, CustomDamage.getAbsorptionHearts(p)+totalpoisonstacks*4);
|
CustomDamage.setAbsorptionHearts(p, CustomDamage.getAbsorptionHearts(p)+totalpoisonstacks*4);
|
||||||
TwosideKeeper.sendSuccessfulCastMessage(p);
|
TwosideKeeper.sendSuccessfulCastMessage(p);
|
||||||
@ -5642,6 +5648,7 @@ public class GenericFunctions {
|
|||||||
if (e instanceof LivingEntity && !(e instanceof Player)) {
|
if (e instanceof LivingEntity && !(e instanceof Player)) {
|
||||||
LivingEntity l = (LivingEntity)e;
|
LivingEntity l = (LivingEntity)e;
|
||||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||||
|
les.setAggro(p, 0);
|
||||||
if (les.GetTarget()!=null &&
|
if (les.GetTarget()!=null &&
|
||||||
les.GetTarget().equals(p)) {
|
les.GetTarget().equals(p)) {
|
||||||
l.setAI(false);
|
l.setAI(false);
|
||||||
|
@ -43,7 +43,7 @@ public enum ItemSet {
|
|||||||
VIXEN(5,4, 3,3, 5,5, 0,0, 5, 3, 5, 0),
|
VIXEN(5,4, 3,3, 5,5, 0,0, 5, 3, 5, 0),
|
||||||
COMET(10,10, 10,10, 2,1, 0,0, 10, 10, 2, 0),
|
COMET(10,10, 10,10, 2,1, 0,0, 10, 10, 2, 0),
|
||||||
CUPID(10,5, 10,10, 2,1, 0,0, 10, 10, 2, 0),
|
CUPID(10,5, 10,10, 2,1, 0,0, 10, 10, 2, 0),
|
||||||
DONNER(5,5, 10,10, 2,1, 0,0, 5, 10, 2, 0),
|
DONNER(100,100, 10,10, 2,1, 0,0, 5, 10, 2, 0),
|
||||||
BLITZEN(10,10, 3,3, 5,5, 0,0, 10, 3, 5, 0),
|
BLITZEN(10,10, 3,3, 5,5, 0,0, 10, 3, 5, 0),
|
||||||
RUDOLPH(5,5, 10,10, 2,1, 0,0, 5, 10, 2, 0),
|
RUDOLPH(5,5, 10,10, 2,1, 0,0, 5, 10, 2, 0),
|
||||||
OLIVE(3,2, 10,10, 2,1, 0,0, 3, 10, 2, 0),
|
OLIVE(3,2, 10,10, 2,1, 0,0, 3, 10, 2, 0),
|
||||||
@ -520,7 +520,7 @@ public enum ItemSet {
|
|||||||
case DONNER:
|
case DONNER:
|
||||||
lore.add(ChatColor.BLUE+"Holiday Gear");
|
lore.add(ChatColor.BLUE+"Holiday Gear");
|
||||||
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
|
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" "+GenericFunctions.CapitalizeFirstLetters(set.name())+" Set");
|
||||||
lore.add(ChatColor.YELLOW+"Attacking aggros enemies for "+ItemSet.GetBaseAmount(set, tier, 1, p)+" seconds");
|
lore.add(ChatColor.YELLOW+"Attacking increases aggression by "+ItemSet.GetBaseAmount(set, tier, 1, p));
|
||||||
break;
|
break;
|
||||||
case OLIVE:
|
case OLIVE:
|
||||||
lore.add(ChatColor.BLUE+"Holiday Gear");
|
lore.add(ChatColor.BLUE+"Holiday Gear");
|
||||||
@ -637,7 +637,8 @@ public enum ItemSet {
|
|||||||
lore.add(ChatColor.GRAY+" Mock cooldown decreases from");
|
lore.add(ChatColor.GRAY+" Mock cooldown decreases from");
|
||||||
lore.add(ChatColor.GRAY+" 20 -> 10 seconds, making it stackable.");
|
lore.add(ChatColor.GRAY+" 20 -> 10 seconds, making it stackable.");
|
||||||
lore.add(ChatColor.GRAY+" All Lifesteal Stacks and Weapon Charges");
|
lore.add(ChatColor.GRAY+" All Lifesteal Stacks and Weapon Charges");
|
||||||
lore.add(ChatColor.GRAY+" gained are doubled.");
|
lore.add(ChatColor.GRAY+" gained are doubled. Increases Aggression");
|
||||||
|
lore.add(ChatColor.GRAY+" by an additional "+(tier*1000)+".");
|
||||||
lore.add(ChatColor.DARK_AQUA+" 6 - "+ChatColor.WHITE+"");
|
lore.add(ChatColor.DARK_AQUA+" 6 - "+ChatColor.WHITE+"");
|
||||||
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Lifesteal");
|
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Lifesteal");
|
||||||
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Health Regeneration");
|
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Health Regeneration");
|
||||||
@ -749,8 +750,6 @@ public enum ItemSet {
|
|||||||
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Strength Cap Increases to 40. 2 Stacks per kill.");
|
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Strength Cap Increases to 40. 2 Stacks per kill.");
|
||||||
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Successful Assassinations apply damage");
|
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Successful Assassinations apply damage");
|
||||||
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"in an AoE Range.");
|
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"in an AoE Range.");
|
||||||
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Slayers can drop aggro by sneaking");
|
|
||||||
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"for Three seconds.");
|
|
||||||
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"While in Stealth Mode you gain 40%");
|
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"While in Stealth Mode you gain 40%");
|
||||||
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Dodge Chance");
|
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Dodge Chance");
|
||||||
}break;
|
}break;
|
||||||
@ -828,7 +827,8 @@ public enum ItemSet {
|
|||||||
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Damage");
|
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3, p)+" Damage");
|
||||||
lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Come At Me"+ABILITY_LABEL_END);
|
lore.add(ChatColor.DARK_AQUA+" 4 - "+ABILITY_LABEL+" Come At Me"+ABILITY_LABEL_END);
|
||||||
lore.add(ChatColor.GRAY+" Monsters attacking your party members");
|
lore.add(ChatColor.GRAY+" Monsters attacking your party members");
|
||||||
lore.add(ChatColor.GRAY+" will automatically be provoked to you.");
|
lore.add(ChatColor.GRAY+" will increase aggression towards you by");
|
||||||
|
lore.add(ChatColor.GRAY+" "+(tier*500)+".");
|
||||||
break;
|
break;
|
||||||
case OLIVE:
|
case OLIVE:
|
||||||
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
|
||||||
@ -925,6 +925,8 @@ public enum ItemSet {
|
|||||||
lore.add(ChatColor.GRAY+" ");
|
lore.add(ChatColor.GRAY+" ");
|
||||||
lore.add(ChatColor.WHITE+" +50% Armor Penetration");
|
lore.add(ChatColor.WHITE+" +50% Armor Penetration");
|
||||||
lore.add(ChatColor.WHITE+" +20 Damage");
|
lore.add(ChatColor.WHITE+" +20 Damage");
|
||||||
|
lore.add(ChatColor.WHITE+" When at Full Health, all overflow");
|
||||||
|
lore.add(ChatColor.WHITE+" Lifesteal reduces your Damage Pool.");
|
||||||
lore.add(ChatColor.DARK_AQUA+" 6 - "+ChatColor.WHITE+"");
|
lore.add(ChatColor.DARK_AQUA+" 6 - "+ChatColor.WHITE+"");
|
||||||
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Lifesteal");
|
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Lifesteal");
|
||||||
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Health Regeneration");
|
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Health Regeneration");
|
||||||
@ -962,6 +964,7 @@ public enum ItemSet {
|
|||||||
lore.add(ChatColor.GRAY+" ");
|
lore.add(ChatColor.GRAY+" ");
|
||||||
lore.add(ChatColor.WHITE+" +50% Armor Penetration");
|
lore.add(ChatColor.WHITE+" +50% Armor Penetration");
|
||||||
lore.add(ChatColor.WHITE+" +20 Damage");
|
lore.add(ChatColor.WHITE+" +20 Damage");
|
||||||
|
lore.add(ChatColor.WHITE+" +"+(tier*100)+"% Threat Generation");
|
||||||
lore.add(ChatColor.DARK_AQUA+" 6 - "+ChatColor.WHITE+"");
|
lore.add(ChatColor.DARK_AQUA+" 6 - "+ChatColor.WHITE+"");
|
||||||
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Lifesteal");
|
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Lifesteal");
|
||||||
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Health Regeneration");
|
lore.add(ChatColor.WHITE+" +"+(tier*10)+"% Health Regeneration");
|
||||||
|
@ -84,4 +84,17 @@ public class BlockUtils {
|
|||||||
b.getType()==Material.WALL_SIGN ||
|
b.getType()==Material.WALL_SIGN ||
|
||||||
b.getType()==Material.SIGN_POST;
|
b.getType()==Material.SIGN_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isInteractable(Block b) {
|
||||||
|
return b.getType().name().contains("DOOR") ||
|
||||||
|
b.getType().name().contains("CHEST") ||
|
||||||
|
b.getType().name().contains("FURNACE") ||
|
||||||
|
b.getType().name().contains("MINECART") ||
|
||||||
|
b.getType()==Material.BREWING_STAND ||
|
||||||
|
b.getType()==Material.WORKBENCH ||
|
||||||
|
b.getType()==Material.ENCHANTMENT_TABLE ||
|
||||||
|
b.getType()==Material.LEVER ||
|
||||||
|
b.getType().name().contains("BUTTON") ||
|
||||||
|
b.getType().name().contains("BOAT");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,4 +210,8 @@ public class EntityUtils {
|
|||||||
//-X: -180/180 degrees (West)
|
//-X: -180/180 degrees (West)
|
||||||
return faces[(int)((dir+22.5)/45)%faces.length];
|
return faces[(int)((dir+22.5)/45)%faces.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isValidEntity(Entity e) {
|
||||||
|
return e!=null && e.isValid() && !e.isDead();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
|
|
||||||
public class TextUtils {
|
public class TextUtils {
|
||||||
|
|
||||||
public static ChatColor RandomColor() {
|
public static ChatColor RandomColor() {
|
||||||
@ -116,4 +118,38 @@ public class TextUtils {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Underline formatting to create a bar beneath a given set of text with X% of the width filled.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static String createUnderlineBar(String finaltext, double pct) {
|
||||||
|
//TODO Does not work.
|
||||||
|
int barlength = finaltext.length();
|
||||||
|
int filledbar = (int)(pct * barlength);
|
||||||
|
finaltext = ChatColor.UNDERLINE+finaltext;
|
||||||
|
TwosideKeeper.log("Text: "+finaltext, 0);
|
||||||
|
finaltext = finaltext.substring(0, filledbar-1) + ChatColor.RESET + finaltext.substring(filledbar-1, finaltext.length()-1);
|
||||||
|
return finaltext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use boxes to create an aggro bar.
|
||||||
|
*/
|
||||||
|
public static String createAggroBar(double pct) {
|
||||||
|
StringBuilder sb = new StringBuilder(ChatColor.DARK_RED+""+ChatColor.ITALIC+""+ChatColor.UNDERLINE+"");
|
||||||
|
for (int i=0;i<5;i++) {
|
||||||
|
if (pct>=(0.1*(i+1))+0.5) {
|
||||||
|
sb.append("█");
|
||||||
|
} else
|
||||||
|
if(pct>=0.1*(i+1)) {
|
||||||
|
sb.append("▄");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
sb.append(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString()+ChatColor.RESET;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
package sig.plugin.TwosideKeeper;
|
package sig.plugin.TwosideKeeper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||||
import org.inventivetalent.glow.GlowAPI;
|
import org.inventivetalent.glow.GlowAPI;
|
||||||
|
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
|
import sig.plugin.TwosideKeeper.HelperStructures.Channel;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
|
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.EntityUtils;
|
||||||
import sig.plugin.TwosideKeeper.Monster.Knight;
|
import sig.plugin.TwosideKeeper.Monster.Knight;
|
||||||
|
|
||||||
public class LivingEntityStructure {
|
public class LivingEntityStructure {
|
||||||
@ -42,9 +48,11 @@ public class LivingEntityStructure {
|
|||||||
public long lastInfectionTick=0;
|
public long lastInfectionTick=0;
|
||||||
public long lastCrippleTick=0;
|
public long lastCrippleTick=0;
|
||||||
public long lastBurnTick=0;
|
public long lastBurnTick=0;
|
||||||
|
public long lastHit=0;
|
||||||
public float MoveSpeedMultBeforeCripple=1f;
|
public float MoveSpeedMultBeforeCripple=1f;
|
||||||
public Channel currentChannel=null;
|
public Channel currentChannel=null;
|
||||||
public boolean isImportantGlowEnemy=true;
|
public boolean isImportantGlowEnemy=true;
|
||||||
|
public HashMap<UUID,Integer> aggro_table = new HashMap<UUID,Integer>();
|
||||||
|
|
||||||
final static String MODIFIED_NAME_CODE = ChatColor.RESET+""+ChatColor.RESET+""+ChatColor.RESET;
|
final static String MODIFIED_NAME_CODE = ChatColor.RESET+""+ChatColor.RESET+""+ChatColor.RESET;
|
||||||
final static String MODIFIED_NAME_DELIMITER = ChatColor.RESET+";"+ChatColor.RESET;
|
final static String MODIFIED_NAME_DELIMITER = ChatColor.RESET+";"+ChatColor.RESET;
|
||||||
@ -344,4 +352,148 @@ public class LivingEntityStructure {
|
|||||||
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||||
return les.prefix;
|
return les.prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getAggroRating(LivingEntity l, Entity targetEntity) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||||
|
if (les.aggro_table.containsKey(targetEntity.getUniqueId())) {
|
||||||
|
return les.aggro_table.get(targetEntity.getUniqueId());
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAggroRating(Entity targetEntity) {
|
||||||
|
return getAggroRating(m, targetEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* May return null if there is no currently aggro'd target.
|
||||||
|
*/
|
||||||
|
public static LivingEntity getAggroTarget(LivingEntity l) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
|
||||||
|
int highest_aggroRating = 0;
|
||||||
|
UUID bestAggroTarget = null;
|
||||||
|
for (UUID ent : les.aggro_table.keySet()) {
|
||||||
|
if (les.aggro_table.get(ent)>highest_aggroRating) {
|
||||||
|
highest_aggroRating = les.aggro_table.get(ent);
|
||||||
|
bestAggroTarget = ent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Entity e : l.getWorld().getEntities()) {
|
||||||
|
if (e instanceof LivingEntity) {
|
||||||
|
if (e.getUniqueId().equals(bestAggroTarget) && EntityUtils.isValidEntity(e)) {
|
||||||
|
return (LivingEntity)e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
les.aggro_table.remove(bestAggroTarget);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* May return null if there is no currently aggro'd target.
|
||||||
|
*/
|
||||||
|
public LivingEntity getAggroTarget() {
|
||||||
|
return getAggroTarget(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAggro(LivingEntity target, int aggroValue) {
|
||||||
|
if (isValidTarget(target)) {
|
||||||
|
UUID key = target.getUniqueId();
|
||||||
|
aggro_table.put(key, Math.max(aggroValue, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void increaseAggro(LivingEntity target, int amt) {
|
||||||
|
setAggro(target,getAggroRating(target)+amt);
|
||||||
|
}
|
||||||
|
public void decreaseAggro(LivingEntity target, int amt) {
|
||||||
|
increaseAggro(target,-amt);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Increases aggro of selected Target, multiplies all other aggro by multiplier.
|
||||||
|
*/
|
||||||
|
public void increaseAggroWhileMultiplyingAllOthers(LivingEntity target, int amt, double multiplier) {
|
||||||
|
if (isValidTarget(target)) {
|
||||||
|
for (UUID id : aggro_table.keySet()) {
|
||||||
|
if (id!=target.getUniqueId()) {
|
||||||
|
//setAggro(target,-(int)(getAggroRating(target)*multiplier));
|
||||||
|
if (aggro_table.containsKey(id)) {
|
||||||
|
aggro_table.put(id, (int)(aggro_table.get(id)*multiplier));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
increaseAggro(target,amt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void increaseAggroWhileMultiplyingAllOthers(List<LivingEntity> targets, int amt, double multiplier) {
|
||||||
|
List<UUID> uuid_list = new ArrayList<UUID>();
|
||||||
|
for (LivingEntity ent : targets) {
|
||||||
|
uuid_list.add(ent.getUniqueId());
|
||||||
|
}
|
||||||
|
if (isValidTarget(target)) {
|
||||||
|
for (UUID id : aggro_table.keySet()) {
|
||||||
|
if (!uuid_list.contains(id)) {
|
||||||
|
//setAggro(target,-(int)(getAggroRating(target)*multiplier));
|
||||||
|
if (aggro_table.containsKey(id)) {
|
||||||
|
aggro_table.put(id, (int)(aggro_table.get(id)*multiplier));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
increaseAggro(target,amt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidTarget(LivingEntity target) {
|
||||||
|
return target!=null && EntityUtils.isValidEntity(target) && target!=m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getAggroPercentage(LivingEntity target) {
|
||||||
|
int highestAggro = 0;
|
||||||
|
if (!aggro_table.containsKey(target.getUniqueId())) {
|
||||||
|
return 0.0;
|
||||||
|
} else {
|
||||||
|
for (UUID id : aggro_table.keySet()) {
|
||||||
|
if (aggro_table.get(id)>highestAggro) {
|
||||||
|
highestAggro = aggro_table.get(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//TwosideKeeper.log("Aggro is "+aggro_table.get(target.getUniqueId())+" / "+highestAggro, 0);
|
||||||
|
return ((double)aggro_table.get(target.getUniqueId()))/highestAggro;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String displayAggroTable() {
|
||||||
|
StringBuilder sb = new StringBuilder("Aggro Table for Entity "+GenericFunctions.GetEntityDisplayName(m)+": \n");
|
||||||
|
for (UUID id : aggro_table.keySet()) {
|
||||||
|
int aggroRating = aggro_table.get(id);
|
||||||
|
sb.append(" "+id+" : "+aggroRating+"\n");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
public void UpdateAggroTarget() {
|
||||||
|
LivingEntity target = getAggroTarget();
|
||||||
|
if (target!=null) {
|
||||||
|
if (m instanceof Monster) {
|
||||||
|
Monster mm = (Monster)m;
|
||||||
|
mm.setTarget(target);
|
||||||
|
EntityTargetEvent ev = new EntityTargetEvent(m,target,TargetReason.CUSTOM);
|
||||||
|
Bukkit.getPluginManager().callEvent(ev);
|
||||||
|
}
|
||||||
|
SetTarget(target);
|
||||||
|
if (lastHit+40<=TwosideKeeper.getServerTickTime()) {
|
||||||
|
decreaseAggro(target,getAggroRating(target)/2);
|
||||||
|
//TwosideKeeper.log("Decreased aggro due to no attacking to "+getAggroRating(target), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target!=null && !EntityUtils.isValidEntity(target)) {
|
||||||
|
aggro_table.remove(target.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -767,9 +767,13 @@ public class Knight extends GenericBoss{
|
|||||||
for (Player p : participantlist) {
|
for (Player p : participantlist) {
|
||||||
if (Math.random()<=1d/participantlist.size() &&
|
if (Math.random()<=1d/participantlist.size() &&
|
||||||
!p.isDead() && p.isValid()) {
|
!p.isDead() && p.isValid()) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
les.increaseAggroWhileMultiplyingAllOthers(p, 0, 0.25);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
les.increaseAggroWhileMultiplyingAllOthers(participantlist.get(0), 0, 0.25);
|
||||||
return participantlist.get(0);
|
return participantlist.get(0);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -624,9 +624,13 @@ public class SniperSkeleton extends GenericBoss{
|
|||||||
for (Player p : participantlist) {
|
for (Player p : participantlist) {
|
||||||
if (Math.random()<=1d/participantlist.size() &&
|
if (Math.random()<=1d/participantlist.size() &&
|
||||||
!p.isDead() && p.isValid()) {
|
!p.isDead() && p.isValid()) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
les.increaseAggroWhileMultiplyingAllOthers(p, 0, 0.25);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
les.increaseAggroWhileMultiplyingAllOthers(participantlist.get(0), 0, 0.25);
|
||||||
return participantlist.get(0);
|
return participantlist.get(0);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -354,6 +354,7 @@ public class PlayerStructure {
|
|||||||
this.equiparmor=true;
|
this.equiparmor=true;
|
||||||
this.customtitle = new AdvancedTitle(p);
|
this.customtitle = new AdvancedTitle(p);
|
||||||
this.lastLocationChange = TwosideKeeper.getServerTickTime();
|
this.lastLocationChange = TwosideKeeper.getServerTickTime();
|
||||||
|
this.lastblock = TwosideKeeper.getServerTickTime();
|
||||||
//Set defaults first, in case this is a new user.
|
//Set defaults first, in case this is a new user.
|
||||||
loadConfig();
|
loadConfig();
|
||||||
//p.getInventory().addItem(new ItemStack(Material.PORTAL));
|
//p.getInventory().addItem(new ItemStack(Material.PORTAL));
|
||||||
|
@ -258,6 +258,9 @@ public class DPSChallengeRoom extends Room{
|
|||||||
|
|
||||||
private void StartChallenge() {
|
private void StartChallenge() {
|
||||||
startTime = TwosideKeeper.getServerTickTime();
|
startTime = TwosideKeeper.getServerTickTime();
|
||||||
|
if (p!=null && p.isValid()) {
|
||||||
|
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,6 +231,9 @@ public class ParkourChallengeRoom extends Room{
|
|||||||
private void StartChallenge() {
|
private void StartChallenge() {
|
||||||
startTime = TwosideKeeper.getServerTickTime();
|
startTime = TwosideKeeper.getServerTickTime();
|
||||||
lastLavaTime = TwosideKeeper.getServerTickTime()+200;
|
lastLavaTime = TwosideKeeper.getServerTickTime()+200;
|
||||||
|
if (p!=null && p.isValid()) {
|
||||||
|
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION, p);
|
||||||
|
}
|
||||||
Block chest = instance.getBlockAt(ROOM_WIDTH/2, 1, ROOM_LENGTH/2);
|
Block chest = instance.getBlockAt(ROOM_WIDTH/2, 1, ROOM_LENGTH/2);
|
||||||
chest.setType(Material.CHEST);
|
chest.setType(Material.CHEST);
|
||||||
Chest c = (Chest)(chest.getState());
|
Chest c = (Chest)(chest.getState());
|
||||||
|
@ -242,6 +242,9 @@ public class TankChallengeRoom extends Room {
|
|||||||
|
|
||||||
private void StartChallenge() {
|
private void StartChallenge() {
|
||||||
startTime = TwosideKeeper.getServerTickTime();
|
startTime = TwosideKeeper.getServerTickTime();
|
||||||
|
if (p!=null && p.isValid()) {
|
||||||
|
GenericFunctions.logAndRemovePotionEffectFromEntity(PotionEffectType.LEVITATION, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,6 +113,7 @@ import org.bukkit.event.entity.EntityPortalEvent;
|
|||||||
import org.bukkit.event.entity.EntityPortalExitEvent;
|
import org.bukkit.event.entity.EntityPortalExitEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityTeleportEvent;
|
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||||
@ -278,6 +279,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.MessageUtils;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MovementUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MovementUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TimeUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TimeUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.InstanceFilter;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.InstanceFilter;
|
||||||
@ -301,7 +303,7 @@ import sig.plugin.TwosideKeeper.Rooms.ParkourChallengeRoom;
|
|||||||
import sig.plugin.TwosideKeeper.Rooms.TankChallengeRoom;
|
import sig.plugin.TwosideKeeper.Rooms.TankChallengeRoom;
|
||||||
|
|
||||||
|
|
||||||
public class TwosideKeeper extends JavaPlugin implements Listener {
|
public class TwosideKeeper<E> extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
public final static int CUSTOM_DAMAGE_IDENTIFIER = 500000;
|
public final static int CUSTOM_DAMAGE_IDENTIFIER = 500000;
|
||||||
|
|
||||||
@ -603,6 +605,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
public final static boolean ELITEGUARDIANS_ACTIVATED=false;
|
public final static boolean ELITEGUARDIANS_ACTIVATED=false;
|
||||||
public final static boolean MINIBOSSES_ACTIVATED=true;
|
public final static boolean MINIBOSSES_ACTIVATED=true;
|
||||||
public final static boolean NEWARTIFACTABILITIES_ACTIVATED=false;
|
public final static boolean NEWARTIFACTABILITIES_ACTIVATED=false;
|
||||||
|
public final static boolean PVPISENABLED=false;
|
||||||
|
|
||||||
public static final Set<EntityType> LIVING_ENTITY_TYPES = ImmutableSet.of(
|
public static final Set<EntityType> LIVING_ENTITY_TYPES = ImmutableSet.of(
|
||||||
EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.CHICKEN,
|
EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.CHICKEN,
|
||||||
@ -3150,6 +3153,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
private void setTier(ItemStack piece, int tier) {
|
private void setTier(ItemStack piece, int tier) {
|
||||||
TwosideKeeperAPI.setItemTier(piece, tier);
|
TwosideKeeperAPI.setItemTier(piece, tier);
|
||||||
|
piece.addUnsafeEnchantment(Enchantment.DURABILITY, 99);
|
||||||
}
|
}
|
||||||
private void CreateDarkReveriePool(Player p, int tier) {
|
private void CreateDarkReveriePool(Player p, int tier) {
|
||||||
AreaEffectCloud aec = (AreaEffectCloud)p.getWorld().spawnEntity(p.getLocation(), EntityType.AREA_EFFECT_CLOUD);
|
AreaEffectCloud aec = (AreaEffectCloud)p.getWorld().spawnEntity(p.getLocation(), EntityType.AREA_EFFECT_CLOUD);
|
||||||
@ -3976,6 +3980,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ItemStack[] tempitems = null;
|
ItemStack[] tempitems = null;
|
||||||
Player p = ev.getPlayer();
|
Player p = ev.getPlayer();
|
||||||
int marker = 0;
|
int marker = 0;
|
||||||
|
boolean firstItem=true;
|
||||||
byte[] messagebytes = ev.getMessage().getBytes();
|
byte[] messagebytes = ev.getMessage().getBytes();
|
||||||
TextComponent finalmsg = new TextComponent("<"+p.getName()+"> ");
|
TextComponent finalmsg = new TextComponent("<"+p.getName()+"> ");
|
||||||
TextComponent finalmsgDiscord = new TextComponent("");
|
TextComponent finalmsgDiscord = new TextComponent("");
|
||||||
@ -4034,7 +4039,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (tempitems!=null) {
|
if (tempitems!=null) {
|
||||||
for (int j=0;j<tempitems.length;j++) {
|
for (int j=0;j<tempitems.length;j++) {
|
||||||
String item_text_output = GenericFunctions.GetItemName(tempitems[j])+WorldShop.GetItemInfo(tempitems[j]);
|
String item_text_output = GenericFunctions.GetItemName(tempitems[j])+WorldShop.GetItemInfo(tempitems[j]);
|
||||||
TextComponent tc = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(tempitems[j])+ChatColor.RESET+ChatColor.GREEN+"]");
|
TextComponent tc = new TextComponent(ChatColor.GREEN+"["+GenericFunctions.GetItemName(tempitems[j])+ChatColor.RESET+((tempitems[j].getAmount()>1)?ChatColor.YELLOW+" x"+tempitems[j].getAmount():"")+ChatColor.RESET+ChatColor.GREEN+"]");
|
||||||
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(item_text_output).create()));
|
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new ComponentBuilder(item_text_output).create()));
|
||||||
if (j>0) {
|
if (j>0) {
|
||||||
finalmsg.addExtra("\n");
|
finalmsg.addExtra("\n");
|
||||||
@ -4043,7 +4048,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
finalmsg.addExtra(tc);
|
finalmsg.addExtra(tc);
|
||||||
finalmsgDiscord.addExtra("**");
|
finalmsgDiscord.addExtra("**");
|
||||||
finalmsgDiscord.addExtra(tc);
|
finalmsgDiscord.addExtra(tc);
|
||||||
finalmsgDiscord.addExtra("**");
|
finalmsgDiscord.addExtra("** ");
|
||||||
if (tempitems[j]!=null && tempitems[j].getType()!=Material.AIR) {
|
if (tempitems[j]!=null && tempitems[j].getType()!=Material.AIR) {
|
||||||
targetitem.add(tempitems[j]);
|
targetitem.add(tempitems[j]);
|
||||||
}
|
}
|
||||||
@ -4394,6 +4399,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
LinkPlayerToOtherPlayer(p,pl);
|
LinkPlayerToOtherPlayer(p,pl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
aggroMonsters(p,pd,1000,16);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LinkPlayerToOtherPlayer(Player p, Player pl) {
|
private void LinkPlayerToOtherPlayer(Player p, Player pl) {
|
||||||
@ -4761,37 +4767,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Shield related stuff in here.
|
//Shield related stuff in here.
|
||||||
if (ev.getAction()==Action.RIGHT_CLICK_AIR ||
|
//TwosideKeeper.log(ev.useInteractedBlock().toString(), 0);
|
||||||
ev.getAction()==Action.RIGHT_CLICK_BLOCK) {
|
if ((ev.getAction()==Action.RIGHT_CLICK_AIR ||
|
||||||
|
ev.getAction()==Action.RIGHT_CLICK_BLOCK) && (ev.getClickedBlock()==null || !BlockUtils.isInteractable(ev.getClickedBlock()))) {
|
||||||
|
aggroMonsters(p, pd, 1000, 16);
|
||||||
//See if this player is blocking. If so, give them absorption.
|
//See if this player is blocking. If so, give them absorption.
|
||||||
//Player p = ev.getPlayer();
|
//Player p = ev.getPlayer();
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
/*Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (p.isBlocking()) {
|
if (p.isBlocking()) {
|
||||||
//Give absorption hearts.
|
//Give absorption hearts.
|
||||||
if (PlayerMode.isDefender(p)) {
|
|
||||||
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.ABSORPTION,200,1,p);
|
|
||||||
List<Entity> entities = p.getNearbyEntities(16, 16, 16);
|
|
||||||
for (int i=0;i<entities.size();i++) {
|
|
||||||
if (entities.get(i) instanceof Monster) {
|
|
||||||
Monster m = (Monster)(entities.get(i));
|
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,100,5,true,true,Color.NAVY));
|
|
||||||
m.setTarget(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.ABSORPTION,200,0,p);
|
|
||||||
}
|
|
||||||
DecimalFormat df = new DecimalFormat("0.0");
|
|
||||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
|
||||||
if (pd.lastblock+20*5<=getServerTickTime()) {
|
|
||||||
p.sendMessage(ChatColor.GRAY+"Damage Reduction: "+ChatColor.DARK_AQUA+df.format(((1-CustomDamage.CalculateDamageReduction(1,p,null))*100))+"% "+ChatColor.GRAY+"Block Chance: "+ChatColor.DARK_AQUA+df.format(((CustomDamage.CalculateDodgeChance(p))*100))+"% ");
|
|
||||||
pd.lastblock=getServerTickTime();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},8);
|
},8);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if we're allowed to open a shop chest.
|
//Check if we're allowed to open a shop chest.
|
||||||
@ -5243,7 +5232,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (s.getLine(0).equalsIgnoreCase("-- CHALLENGE --")) {
|
if (s.getLine(0).equalsIgnoreCase("-- CHALLENGE --")) {
|
||||||
//PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
//PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_RED+"DPS CHALLENGE")) {
|
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_RED+"DPS CHALLENGE")) {
|
||||||
if (((isHoldingDailyToken(p) || pd.lastuseddailysign+100>TwosideKeeper.getServerTickTime()) && pd.nameoflastdailysign.equalsIgnoreCase(s.getLine(1)))) {
|
if (((isHoldingDailyToken(p) || pd.lastdpsDailyChallenge+1152000<=TwosideKeeper.getServerTickTime()) && pd.lastuseddailysign+100>TwosideKeeper.getServerTickTime() && pd.nameoflastdailysign.equalsIgnoreCase(s.getLine(1)))) {
|
||||||
new DPSChallengeRoom(p,new DPSRoom(32,32));
|
new DPSChallengeRoom(p,new DPSRoom(32,32));
|
||||||
if (isHoldingDailyToken(p)) {
|
if (isHoldingDailyToken(p)) {
|
||||||
consumeToken(p);
|
consumeToken(p);
|
||||||
@ -5264,7 +5253,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_GREEN+"TANK CHALLENGE")) {
|
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_GREEN+"TANK CHALLENGE")) {
|
||||||
if (((isHoldingDailyToken(p) || pd.lastuseddailysign+100>TwosideKeeper.getServerTickTime()) && pd.nameoflastdailysign.equalsIgnoreCase(s.getLine(1)))) {
|
if (((isHoldingDailyToken(p) || pd.lasttankDailyChallenge+1152000<=TwosideKeeper.getServerTickTime()) && pd.lastuseddailysign+100>TwosideKeeper.getServerTickTime() && pd.nameoflastdailysign.equalsIgnoreCase(s.getLine(1)))) {
|
||||||
new TankChallengeRoom(p,new DPSRoom(32,32));
|
new TankChallengeRoom(p,new DPSRoom(32,32));
|
||||||
if (isHoldingDailyToken(p)) {
|
if (isHoldingDailyToken(p)) {
|
||||||
consumeToken(p);
|
consumeToken(p);
|
||||||
@ -5285,7 +5274,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_PURPLE+"PARKOUR CHALLENGE")) {
|
if (s.getLine(1).equalsIgnoreCase(ChatColor.DARK_PURPLE+"PARKOUR CHALLENGE")) {
|
||||||
if (((isHoldingDailyToken(p) || pd.lastuseddailysign+100>TwosideKeeper.getServerTickTime()) && pd.nameoflastdailysign.equalsIgnoreCase(s.getLine(1)))) {
|
if (((isHoldingDailyToken(p) || pd.lastparkourDailyChallenge+1152000<=TwosideKeeper.getServerTickTime()) && pd.lastuseddailysign+100>TwosideKeeper.getServerTickTime() && pd.nameoflastdailysign.equalsIgnoreCase(s.getLine(1)))) {
|
||||||
if (isHoldingDailyToken(p)) {
|
if (isHoldingDailyToken(p)) {
|
||||||
consumeToken(p);
|
consumeToken(p);
|
||||||
} else {
|
} else {
|
||||||
@ -5471,6 +5460,33 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void aggroMonsters(final Player p, PlayerStructure pd, int tauntAmt, int range) {
|
||||||
|
if (PlayerMode.isDefender(p)) {
|
||||||
|
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.ABSORPTION,200,1,p);
|
||||||
|
List<Entity> entities = p.getNearbyEntities(range, range, range);
|
||||||
|
for (int i=0;i<entities.size();i++) {
|
||||||
|
if (entities.get(i) instanceof Monster) {
|
||||||
|
if (pd.lastblock+20*5>=getServerTickTime()) {
|
||||||
|
Monster m = (Monster)(entities.get(i));
|
||||||
|
m.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,100,5,true,true,Color.NAVY));
|
||||||
|
m.setTarget(p);
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
//les.increaseAggro(p, 1000);
|
||||||
|
les.increaseAggroWhileMultiplyingAllOthers(p, tauntAmt, 0.5);
|
||||||
|
les.lastHit = TwosideKeeper.getServerTickTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.ABSORPTION,200,0,p);
|
||||||
|
}
|
||||||
|
DecimalFormat df = new DecimalFormat("0.0");
|
||||||
|
if (pd.lastblock+20*5<=getServerTickTime()) {
|
||||||
|
p.sendMessage(ChatColor.GRAY+"Damage Reduction: "+ChatColor.DARK_AQUA+df.format(((1-CustomDamage.CalculateDamageReduction(1,p,null))*100))+"% "+ChatColor.GRAY+"Block Chance: "+ChatColor.DARK_AQUA+df.format(((CustomDamage.CalculateDodgeChance(p))*100))+"% ");
|
||||||
|
pd.lastblock=getServerTickTime();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
private void consumeToken(Player p) {
|
private void consumeToken(Player p) {
|
||||||
if (isHoldingDailyToken(p)) {
|
if (isHoldingDailyToken(p)) {
|
||||||
ItemStack tokens = p.getEquipment().getItemInMainHand().clone();
|
ItemStack tokens = p.getEquipment().getItemInMainHand().clone();
|
||||||
@ -6384,6 +6400,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
aggroMonsters(p,pd,2000+((hasFullSet)?(ItemSet.getHighestTierInSet(p, ItemSet.DAWNTRACKER)*1000):0),12);
|
||||||
SoundUtils.playLocalSound(p, Sound.ENTITY_VILLAGER_AMBIENT, 1.0f, 0.3f);
|
SoundUtils.playLocalSound(p, Sound.ENTITY_VILLAGER_AMBIENT, 1.0f, 0.3f);
|
||||||
aPlugin.API.displayEndRodParticle(p.getLocation(), 0, 0f, 0f, 5, 20);
|
aPlugin.API.displayEndRodParticle(p.getLocation(), 0, 0f, 0f, 5, 20);
|
||||||
if (hasFullSet) {
|
if (hasFullSet) {
|
||||||
@ -7752,6 +7769,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
public void dodgeEvent(PlayerDodgeEvent ev) {
|
public void dodgeEvent(PlayerDodgeEvent ev) {
|
||||||
Player p = ev.getPlayer();
|
Player p = ev.getPlayer();
|
||||||
PlayerMode pm = PlayerMode.getPlayerMode(p);
|
PlayerMode pm = PlayerMode.getPlayerMode(p);
|
||||||
|
LivingEntity damager = CustomDamage.getDamagerEntity(ev.getDamager());
|
||||||
|
if (damager != null &&
|
||||||
|
ev.getPlayer() != null) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(damager);
|
||||||
|
les.increaseAggro(ev.getPlayer(), (int)(5*ev.getRawDamage()));
|
||||||
|
les.increaseAggro(ev.getPlayer(), les.getAggroRating(ev.getPlayer())*2);
|
||||||
|
les.lastHit = TwosideKeeper.getServerTickTime();
|
||||||
|
}
|
||||||
if (!pm.isRanger(p)) {
|
if (!pm.isRanger(p)) {
|
||||||
if (p.isBlocking() || pm.isDefender(p)) {
|
if (p.isBlocking() || pm.isDefender(p)) {
|
||||||
//Only reduce durability of the shield.
|
//Only reduce durability of the shield.
|
||||||
@ -8190,14 +8215,37 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ChatColor finalcolor = GetHeartColor(color1);
|
ChatColor finalcolor = GetHeartColor(color1);
|
||||||
ChatColor finalcolor2 = GetHeartColor(color2);
|
ChatColor finalcolor2 = GetHeartColor(color2);
|
||||||
String finalheartdisplay=finalcolor2+((finalcolor2==ChatColor.MAGIC)?remainingheartdisplay.replace((char)0x2665, 'A'):remainingheartdisplay)+finalcolor+((finalcolor==ChatColor.MAGIC)?heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()).replace((char)0x2665, 'A'):heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()));
|
String finalheartdisplay=finalcolor2+((finalcolor2==ChatColor.MAGIC)?remainingheartdisplay.replace((char)0x2665, 'A'):remainingheartdisplay)+finalcolor+((finalcolor==ChatColor.MAGIC)?heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()).replace((char)0x2665, 'A'):heartdisplay.substring(0, heartdisplay.length()-remainingheartdisplay.length()));
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||||
if (target.getHealth()>2000) {
|
if (target.getHealth()>2000) {
|
||||||
finalheartdisplay=GetHeartColor(GetFactorialAmt(target.getHealth()))+FinalHealthDisplay(target.getHealth())+" / "+FinalHealthDisplay(target.getMaxHealth());
|
finalheartdisplay=GetHeartColor(GetFactorialAmt(target.getHealth()))+FinalHealthDisplay(target.getHealth())+" / "+FinalHealthDisplay(target.getMaxHealth());
|
||||||
//p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET);
|
//p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET);
|
||||||
pd.customtitle.modifySmallCenterTitle(finalMonsterName+ChatColor.RESET+" "+finalheartdisplay+" "+ChatColor.RESET, 100);
|
//String finaltext = " ";
|
||||||
|
String finaltext = finalMonsterName+ChatColor.RESET+" "+finalheartdisplay+" "+ChatColor.RESET;
|
||||||
|
if (!(target instanceof Player)) {
|
||||||
|
if (les.aggro_table.size()>1) {
|
||||||
|
finaltext = TextUtils.createAggroBar(les.getAggroPercentage(p)) +" "+ finaltext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pd.customtitle.modifySmallCenterTitle(finaltext, 100);
|
||||||
} else {
|
} else {
|
||||||
pd.customtitle.modifySmallCenterTitle(finalMonsterName+ChatColor.RESET+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(target.getHealth()/20+1), 100);
|
//String finaltext = " ";
|
||||||
|
//String finaltext = TextUtils.createUnderlineBar(,1);
|
||||||
|
String finaltext = finalMonsterName+ChatColor.RESET+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(target.getHealth()/20+1);
|
||||||
|
if (!(target instanceof Player)) {
|
||||||
|
if (les.aggro_table.size()>1) {
|
||||||
|
finaltext = TextUtils.createAggroBar(les.getAggroPercentage(p)) + " "+ finaltext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pd.customtitle.modifySmallCenterTitle(finaltext, 100);
|
||||||
//p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(target.getHealth()/20+1));
|
//p.sendTitle(message1, finalMonsterName+" "+finalheartdisplay+" "+ChatColor.RESET+ChatColor.DARK_GRAY+"x"+(int)(target.getHealth()/20+1));
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
//Only display the aggro bar, because they have the healthbar display disabled.
|
||||||
|
if (Bukkit.getPlayer(pd.name)!=null && target!=null) {
|
||||||
|
if (!(target instanceof Player)) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target);
|
||||||
|
pd.customtitle.modifySmallCenterTitle(TextUtils.createAggroBar(les.getAggroPercentage(p)), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//pd.customtitle.updateTitle(p, true);
|
//pd.customtitle.updateTitle(p, true);
|
||||||
}
|
}
|
||||||
@ -8438,13 +8486,52 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
log("A new artifact base was generated.",1);
|
log("A new artifact base was generated.",1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
|
public void entityTargetEvent(EntityTargetEvent ev) {
|
||||||
|
if (ev.getReason()==TargetReason.CUSTOM && ev.getEntity() instanceof LivingEntity && ev.getTarget() instanceof LivingEntity) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure((LivingEntity)ev.getEntity());
|
||||||
|
les.SetTarget((LivingEntity)ev.getTarget());
|
||||||
|
//TwosideKeeper.log("Aggro target set to "+GenericFunctions.GetEntityDisplayName(ev.getTarget()), 0);
|
||||||
|
ev.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((ev.getEntity() instanceof LivingEntity)) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure((LivingEntity)ev.getEntity());
|
||||||
|
if (ev.getReason()==TargetReason.FORGOT_TARGET && les.GetTarget()!=null && les.GetTarget().getUniqueId().equals(ev.getTarget())) {
|
||||||
|
TwosideKeeper.log("Trying to forget current target...Cancelled.", 0);
|
||||||
|
ev.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev.getEntity() instanceof LivingEntity &&
|
||||||
|
ev.getReason()==TargetReason.TARGET_ATTACKED_NEARBY_ENTITY) {
|
||||||
|
if (pigmanAggroCount<MAX_PIGMEN_AGGRO_AT_ONCE && lastPigmanAggroTime+200<=TwosideKeeper.getServerTickTime()) {
|
||||||
|
pigmanAggroCount++;
|
||||||
|
lastPigmanAggroTime=TwosideKeeper.getServerTickTime();
|
||||||
|
//TwosideKeeper.log("Pigman count increased "+pigmanAggroCount,0);
|
||||||
|
} else {
|
||||||
|
ev.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
public void entityTargetEvent(EntityTargetLivingEntityEvent ev) {
|
public void entityTargetEvent(EntityTargetLivingEntityEvent ev) {
|
||||||
|
if (ev.getReason()==TargetReason.CUSTOM && ev.getEntity() instanceof LivingEntity && ev.getTarget() instanceof LivingEntity) {
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure((LivingEntity)ev.getEntity());
|
||||||
|
les.SetTarget((LivingEntity)ev.getTarget());
|
||||||
|
ev.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((ev.getEntity() instanceof Monster)) {
|
if ((ev.getEntity() instanceof Monster)) {
|
||||||
log("In here 1",5);
|
log("In here 1",5);
|
||||||
Monster m = (Monster)ev.getEntity();
|
Monster m = (Monster)ev.getEntity();
|
||||||
|
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(m);
|
||||||
|
if (les.getAggroTarget()!=null) {
|
||||||
|
ev.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ev.getTarget() instanceof Monster &&
|
if (ev.getTarget() instanceof Monster &&
|
||||||
m.getTarget() instanceof Player) {
|
m.getTarget() instanceof Player) {
|
||||||
ev.setCancelled(true); //Monsters will not target other Monsters if they are already targeting a player.
|
ev.setCancelled(true); //Monsters will not target other Monsters if they are already targeting a player.
|
||||||
@ -8517,6 +8604,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (pigmanAggroCount<MAX_PIGMEN_AGGRO_AT_ONCE && lastPigmanAggroTime+200<=TwosideKeeper.getServerTickTime()) {
|
if (pigmanAggroCount<MAX_PIGMEN_AGGRO_AT_ONCE && lastPigmanAggroTime+200<=TwosideKeeper.getServerTickTime()) {
|
||||||
pigmanAggroCount++;
|
pigmanAggroCount++;
|
||||||
lastPigmanAggroTime=TwosideKeeper.getServerTickTime();
|
lastPigmanAggroTime=TwosideKeeper.getServerTickTime();
|
||||||
|
//TwosideKeeper.log("Pigman count increased "+pigmanAggroCount,0);
|
||||||
} else {
|
} else {
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -1408,6 +1408,7 @@ final public class runServerHeartbeat implements Runnable {
|
|||||||
ms.m.setVelocity(ms.m.getVelocity().add(new Vector(xdir,0,zdir)));
|
ms.m.setVelocity(ms.m.getVelocity().add(new Vector(xdir,0,zdir)));
|
||||||
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Randomly Move this Monster", (int)(System.nanoTime()-time));time=System.nanoTime();
|
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Randomly Move this Monster", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||||
}
|
}
|
||||||
|
ms.UpdateAggroTarget();
|
||||||
ms.UpdateGlow();
|
ms.UpdateGlow();
|
||||||
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Update Glow", (int)(System.nanoTime()-time));time=System.nanoTime();
|
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Update Glow", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||||
createPotionParticles(ms.m);
|
createPotionParticles(ms.m);
|
||||||
@ -1417,7 +1418,6 @@ final public class runServerHeartbeat implements Runnable {
|
|||||||
PerformPoisonTick(ms.m);
|
PerformPoisonTick(ms.m);
|
||||||
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Perform Poison Tick", (int)(System.nanoTime()-time));time=System.nanoTime();
|
TwosideKeeper.HeartbeatLogger.AddEntry("Monster Management - Perform Poison Tick", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user