->Fixed a bug allowing players to use Rejuvenation when not in Defender

mode.
->Fixed a bug allowing players to use Line Drive when not in Striker
mode.
->Fire Resistance mechanics modified. If you are on fire with Fire
Resistance, fire resistance duration goes down by 10 seconds every
second. Higher levels of fire resistance resist fire better.
->Switching modes while toggling items in your hotbar now reflects your
health % properly. This means if you have 50% health in Striker mode and
switch to Ranger mode, you'll have 50% health in that mode as well.
->Suppression status effect implemented. Entities that are suppressed
cannot move, attack, teleport, or explode.
->Cooldown Reduction stat implemented. This stat decreases the amount of
time it takes for all cooldown-sensitive abilities to be available
again.
->Fixed a bug where players could activate Vendetta just by having 5
Songsteel pieces regardless of what Tier they were.
->Fixed Pre-emptive Strike (x4->x3), Hand-made Arrow(x3->x2), and
Diamond-Tipped Arrow(x5->x4) multipliers not being correct in the damage
engine.

->Slayer mode has been released!
	-Slayer Mode is defined by wearing no armor, and wearing a Bauble in
your hotbar.
	-Slayers can make use of up to 9 Baubles by placing them on their
hotbar (Ideally you would want to use one slot for a weapon). Each
Bauble adds a certain amount of stats to the Slayer, making them more
efficient.
	-Slayers take a maximum of 2 HP (1 Heart) in damage from all attacks,
making this mode essentially 5 lives.
	-Slayers are not affected by any Health Recovery and Health
Regeneration effects. This mode only heals from kills, using the
Amulet's set effect, or sleeping. However, Absorption will still work
for a Slayer. Absorption hearts just get removed with normal damage
calculation rules.
	-Whenever a Slayer kills a target, they recover 1 Heart (2 HP). This
can be modified by a special weapon.
	-Slayers can enter Stealth mode by pressing Sneak. Once in Stealth
mode, Slayers will not leave stealth until they hit a monster or Sneak
again. Stealth mode drains 1 Durability every second from tools on your
hotbar.
	-While in Stealth mode, nothing will be able to detect you. Note this
does not get rid of aggression from targets that have already aggro'd
you.
	-Slayers can Backstab targets by getting behind them and hitting them.
A backstab does triple the normal damage of an attack.
	-Whenever a Slayer critically strikes, it suppresses a target for 0.75
seconds. Suppression prevents movement, attacking, teleporting, and
exploding. Suppressed targets glow Black.
	-Slayers thrive in 1vs1 situations. If a target is completely alone,
they will glow white to the Slayer. Isolated targets take 50% more
damage from the Slayer. Slayer's Dodge Chance increases by 40% against
isolated targets.
	-Slayers can use the Assassination ability. Press the Drop key while
looking at an enemy to perform an assassination: You jump directly
behind the enemy, gaining 0.5 seconds of invulnerability. If the next
hit after Assassination is performed kills the target, you gain a speed
and strength buff. These buffs cap at Speed V and Strength X
respectively and last 10 seconds. Assassination cooldown is reset
whenever a target is instantly killed in this manner, and you get
immediately put back into stealth, preventing further detection from
other monsters.
	
->New set pieces have been released.
dev
sigonasr2 9 years ago
parent 81ad5cd243
commit 9acf1190e1
  1. BIN
      TwosideKeeper.jar
  2. 2
      src/plugin.yml
  3. 214
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  4. 21
      src/sig/plugin/TwosideKeeper/DropDeathItems.java
  5. 6
      src/sig/plugin/TwosideKeeper/EliteMonster.java
  6. 301
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  7. 73
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  8. 22
      src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java
  9. 18
      src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java
  10. 106
      src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java
  11. 3
      src/sig/plugin/TwosideKeeper/ItemCubeWindow.java
  12. 2
      src/sig/plugin/TwosideKeeper/MonsterController.java
  13. 11
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  14. 449
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  15. 6
      src/sig/plugin/TwosideKeeper/TwosideKeeperAPI.java

Binary file not shown.

@ -1,6 +1,6 @@
name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.8.5e1
version: 3.8.6
commands:
money:
description: Tells the player the amount of money they are holding.

@ -185,12 +185,16 @@ public class CustomDamage {
}
dmg += addToPlayerLogger(damager,target,"Execute",(((GenericFunctions.getAbilityValue(ArtifactAbility.EXECUTION, weapon)*5.0)*(1-(target.getHealth()/target.getMaxHealth())))));
if (shooter instanceof Player) {
dmg += addToPlayerLogger(damager,target,"Execute Set Bonus",(((ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 4, 4)*5.0)*(1-(target.getHealth()/target.getMaxHealth())))));
dmg += addToPlayerLogger(damager,target,"Execute Set Bonus",(((ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 4, 4)*5.0)*(1-(target.getHealth()/target.getMaxHealth())))));
}
dmg += addMultiplierToPlayerLogger(damager,target,"Striker Mult",dmg * calculateStrikerMultiplier(shooter,target));
double preemptivedmg = addMultiplierToPlayerLogger(damager,target,"Preemptive Strike Mult",dmg * calculatePreemptiveStrikeMultiplier(target,shooter));
if (preemptivedmg!=0.0) {preemptive=true;}
dmg += preemptivedmg;
double backstabdmg = addMultiplierToPlayerLogger(damager,target,"Backstab Mult",dmg * calculateBackstabMultiplier(target,shooter));
if (backstabdmg!=0.0) {preemptive=true;}
dmg += backstabdmg;
dmg += addMultiplierToPlayerLogger(damager,target,"Isolation Damage Mult",dmg * calculateIsolationMultiplier(shooter,target));
dmg += addMultiplierToPlayerLogger(damager,target,"STRENGTH Mult",dmg * calculateStrengthEffectMultiplier(shooter,target));
dmg += addMultiplierToPlayerLogger(damager,target,"WEAKNESS Mult",dmg * calculateWeaknessEffectMultiplier(shooter,target));
dmg += addMultiplierToPlayerLogger(damager,target,"POISON Mult",dmg * calculatePoisonEffectMultiplier(target));
@ -208,20 +212,6 @@ public class CustomDamage {
return dmg;
}
private static double calculateCustomArrowMultiplier(ItemStack weapon, Entity damager, LivingEntity target) {
double mult = 0.0;
if (damager instanceof TippedArrow) {
TippedArrow a = (TippedArrow)damager;
if (a.hasMetadata("QUADRUPLE_DAMAGE_ARR")) {
mult += 4.0;
}
if (a.hasMetadata("DOUBLE_DAMAGE_ARR")) {
mult+=2.0;
}
}
return mult;
}
private static void addToPlayerRawDamage(double damage, LivingEntity target) {
if (target instanceof Player) {
Player p = (Player)target;
@ -265,6 +255,7 @@ public class CustomDamage {
dmg += addToPlayerLogger(damager,target,"Strike",GenericFunctions.getAbilityValue(ArtifactAbility.DAMAGE, weapon));
dmg += addToPlayerLogger(damager,target,"Highwinder",calculateHighwinderDamage(weapon,damager));
dmg += addToPlayerLogger(damager,target,"Set Bonus",calculateSetBonusDamage(damager));
dmg += addMultiplierToPlayerLogger(damager,target,"Set Bonus Mult",dmg * calculateSetBonusMultiplier(weapon,damager));
dmg += addMultiplierToPlayerLogger(damager,target,"Belligerent Mult",dmg * calculateBeliggerentMultiplier(weapon,damager));
}
return dmg;
@ -326,10 +317,10 @@ public class CustomDamage {
String reason, int flags) {
if (target instanceof Player) {
Player p = (Player)target;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (PlayerMode.isDefender(p)) {
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4);
if (p.isBlocking() && ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.3;
aPlugin.API.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
}
@ -352,9 +343,6 @@ public class CustomDamage {
increaseStrikerSpeed(p);
healDefenderSaturation(p);
reduceDefenderKnockback(p);
if (GenericFunctions.AttemptRevive(p, damage, reason)) {
damage=0;
}
reduceSwiftAegisBuff(p);
if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);}
aPlugin.API.showDamage(target, GetHeartAmount(damage));
@ -364,10 +352,26 @@ public class CustomDamage {
GenericFunctions.RemoveNewDebuffs(p);
}
},1);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
//PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (damage>2) {
damage=2;
}
GenericFunctions.SubtractSlayerModeHealth(p, damage);
//p.setHealth(pd.slayermodehp);
//damage=0;
GenericFunctions.removeStealth(p);
}
pd.slayermegahit=false;
if (GenericFunctions.AttemptRevive(p, damage, reason)) {
damage=0;
}
}
LivingEntity shooter = getDamagerEntity(damager);
if ((shooter instanceof Player) && target!=null) {
Player p = (Player)shooter;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (damager instanceof TippedArrow) {
TippedArrow a = (TippedArrow)damager;
if (a.hasMetadata("EXPLODE_ARR")) {
@ -405,7 +409,6 @@ public class CustomDamage {
}
},1);
} else {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.storedbowxp+=(int)((ratio*20)+5)*((isFlagSet(flags,IS_HEADSHOT))?2:1);
pd.lasthittarget=TwosideKeeper.getServerTickTime();
}
@ -454,6 +457,22 @@ public class CustomDamage {
triggerEliteHitEvent(p,target,damage);
subtractWeaponDurability(p,weapon);
aPlugin.API.showDamage(target, GetHeartAmount(damage));
pd.slayermegahit=false;
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
if (isFlagSet(pd.lasthitproperties,IS_CRIT)) {
GenericFunctions.addSuppressionTime(target, 15);
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 2)) {
int poisonlv = (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 2, 2);
if (target.hasPotionEffect(PotionEffectType.BLINDNESS) && GenericFunctions.getPotionEffectLevel(PotionEffectType.BLINDNESS, target)<=poisonlv) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*15, (int)poisonlv, target);
} else {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*15, (int)poisonlv, target, true);
}
}
}
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new Runnable() {
@Override
public void run() {
@ -610,7 +629,7 @@ public class CustomDamage {
p.playSound(p.getLocation(), Sound.ENTITY_FIREWORK_LARGE_BLAST, 1.0f, 1.0f);
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
pd.last_shovelspell=TwosideKeeper.getServerTickTime()+TwosideKeeper.ERUPTION_COOLDOWN;
pd.last_shovelspell=TwosideKeeper.getServerTickTime()+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ERUPTION_COOLDOWN,p);
}
}
}
@ -788,7 +807,7 @@ public class CustomDamage {
* @return Returns true if the target cannot be hit. False otherwise.
*/
static public boolean InvulnerableCheck(Entity damager, LivingEntity target, int flags) {
if (isFlagSet(flags,IGNORE_DAMAGE_TICK) || (GenericFunctions.enoughTicksHavePassed(target, damager) && canHitMobDueToWeakness(damager))) {
if (isFlagSet(flags,IGNORE_DAMAGE_TICK) || (GenericFunctions.enoughTicksHavePassed(target, damager) && canHitMobDueToWeakness(damager) && !GenericFunctions.isSuppressed(getDamagerEntity(damager)))) {
TwosideKeeper.log("Enough ticks have passed.", 5);
if (isFlagSet(flags,IGNOREDODGE) || !PassesIframeCheck(target,damager)) {
TwosideKeeper.log("Not in an iframe.", 5);
@ -819,7 +838,7 @@ public class CustomDamage {
if (p.hasPotionEffect(PotionEffectType.WEAKNESS)) {
int weaknesslv = GenericFunctions.getPotionEffectLevel(PotionEffectType.WEAKNESS, p);
if (weaknesslv>=9) {
p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 1.0f, 3.6f);
p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.3f, 3.6f);
return false;
}
}
@ -836,7 +855,7 @@ public class CustomDamage {
duration += GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equip[i]);
}
}
duration+=ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target,ItemSet.JAMDAK,4,4)/20d;
duration+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), (Player)target,ItemSet.JAMDAK,4,4)/20d;
//Convert from seconds to ticks.
int tick_duration = (int)(duration*20);
//Apply iframes.
@ -857,7 +876,7 @@ public class CustomDamage {
if ((target instanceof Player) && Math.random()<CalculateDodgeChance((Player)target)) {
Player p = (Player)target;
double rawdmg = CalculateDamage(0,damager,target,null,null,TRUEDMG)*(1d/CalculateDamageReduction(1,target,damager));
if (p.isBlocking() && ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) {
if (p.isBlocking() && ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*rawdmg);
aPlugin.API.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
@ -867,6 +886,10 @@ public class CustomDamage {
return false;
}
public static double CalculateDodgeChance(Player p) {
return CalculateDodgeChance(p,null);
}
/**
* 0 = 0% dodge chance
* 1 = 100% dodge chance
@ -874,7 +897,7 @@ public class CustomDamage {
* @return
*/
@SuppressWarnings("deprecation")
public static double CalculateDodgeChance(Player p) {
public static double CalculateDodgeChance(Player p, Entity damager) {
double dodgechance = 0.0d;
dodgechance+=(ArtifactAbility.calculateValue(ArtifactAbility.DODGE, p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK), ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DODGE, p.getEquipment().getItemInMainHand()))/100d);
@ -901,10 +924,10 @@ public class CustomDamage {
}
}*/
}
dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.ALIKAHN)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.DARNYS)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.JAMDAK)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.LORASAADI)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.DARNYS)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.JAMDAK)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.LORASAADI)/100d;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
@ -913,12 +936,31 @@ public class CustomDamage {
dodgechance+=0.01*p.getEquipment().getItemInMainHand().getEnchantmentLevel(Enchantment.LUCK);
}
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,3,3)/100d;
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.PANROS,3,3)/100d;
if (p.isBlocking()) {
dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)/100d;
}
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.JAMDAK,2,2)/100d;
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.JAMDAK,3,3)/100d;
LivingEntity shooter = getDamagerEntity(damager);
if (shooter!=null && shooter instanceof Monster) {
Monster m = (Monster)shooter;
if (GenericFunctions.isIsolatedTarget(m, p)) {
dodgechance+=0.4;
}
}
if (PlayerMode.isSlayer(p)) {
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 3, 3)/100d;
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7)) {
dodgechance+=(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7, 4))); //For every 1m, give 5%.
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7) &&
GenericFunctions.hasStealth(p)) {
dodgechance+=0.4;
}
}
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d;
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,3,3)/100d;
if (PlayerMode.isStriker(p) &&
93.182445*pd.velocity>4.317) {
@ -932,7 +974,7 @@ public class CustomDamage {
dodgechance=0.95;
}
if (pd.fulldodge) {
if (pd.fulldodge || pd.slayermegahit) {
dodgechance = 1.0;
}
return dodgechance;
@ -953,8 +995,8 @@ public class CustomDamage {
if (target instanceof LivingEntity) {
ItemStack[] armor = GenericFunctions.getEquipment(target);
if (target instanceof Player) {
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 3, 3)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), (Player)target, ItemSet.DARNYS, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(target), (Player)target, ItemSet.DARNYS, 3, 3)/100d;
/*rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.ALIKAHN, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.JAMDAK, 2, 2)/100d;
rangerdmgdiv += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)target, ItemSet.DARNYS, 2, 2)/100d;
@ -1076,7 +1118,7 @@ public class CustomDamage {
/*if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
dmgreduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
}*/
setbonus = ((100-ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 4, 4))/100d);
setbonus = ((100-ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL, 4, 4))/100d);
}
@ -1369,11 +1411,12 @@ public class CustomDamage {
LivingEntity shooter = getDamagerEntity(damager);
if (shooter instanceof Player) {
dmg += ItemSet.GetTotalBaseAmount(shooter,ItemSet.PANROS);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.PANROS, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DAWNTRACKER, 4, 4);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.LORASAADI, 3, 3);
dmg += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(shooter),shooter,ItemSet.PANROS);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.PANROS, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.DAWNTRACKER, 4, 4);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 2, 2);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(shooter),(Player)shooter, ItemSet.LORASAADI, 3, 3);
dmg += ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(shooter), (Player)shooter, ItemSet.LORASYS);
/*dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.JAMDAK, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.DARNYS, 3, 3);
dmg += ItemSet.TotalBaseAmountBasedOnSetBonusCount((Player)shooter, ItemSet.ALIKAHN, 3, 3);
@ -1496,7 +1539,7 @@ public class CustomDamage {
return mult;
}
public static double calculateDefenderAbsorbtion(LivingEntity entity, double dmg) {
public static double calculateDefenderAbsorption(LivingEntity entity, double dmg) {
//See if we're in a party with a defender.
if (entity instanceof Player) {
Player p = (Player)entity;
@ -1548,9 +1591,12 @@ public class CustomDamage {
if (shooter!=null) {
if (shooter instanceof Player) {
Player p = (Player)shooter;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
critchance += (PlayerMode.isStriker(p)?0.2:0.0);
critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,4,4)/100d;
critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p,ItemSet.PANROS,4,4)/100d;
critchance += (PlayerMode.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0);
critchance += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 5, 4)/100;
critchance += (pd.slayermegahit)?1.0:0.0;
}
}
return critchance;
@ -1565,7 +1611,7 @@ public class CustomDamage {
return (Math.random()<=chance || isCriticalStrike);
}
static double calculateCriticalStrikeMultiplier(Entity damager, ItemStack weapon) {
public static double calculateCriticalStrikeMultiplier(Entity damager, ItemStack weapon) {
double critdmg=1.0;
if (ArtifactAbility.containsEnchantment(ArtifactAbility.CRIT_DMG, weapon)) {
critdmg+=(GenericFunctions.getAbilityValue(ArtifactAbility.CRIT_DMG,weapon))/100d;
@ -1577,6 +1623,7 @@ public class CustomDamage {
GenericFunctions.getBowMode(weapon)==BowMode.SNIPE) {
critdmg+=1.0;
}
critdmg+=ItemSet.GetTotalBaseAmount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW)/100d;
}
TwosideKeeper.log("Crit Damage is "+critdmg, 5);
return critdmg;
@ -1626,7 +1673,7 @@ public class CustomDamage {
//Deal triple damage.
TwosideKeeper.log("Triple damage!",5);
pl.playSound(pl.getLocation(), Sound.ENTITY_SHULKER_TELEPORT, 1f, 3.65f);
mult+=3.0;
mult+=2.0;
}
}
return mult;
@ -1878,7 +1925,7 @@ public class CustomDamage {
/*0.0-1.0*/
public static double calculateLifeStealAmount(Player p, ItemStack weapon) {
double lifestealpct = GenericFunctions.getAbilityValue(ArtifactAbility.LIFESTEAL, weapon)/100;
lifestealpct += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 3, 3)/100d;
lifestealpct += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DAWNTRACKER, 3, 3)/100d;
return lifestealpct;
}
@ -2007,10 +2054,12 @@ public class CustomDamage {
}
/*Returns the amount of cooldown reduction the player has.
* 0% meaning cooldowns are not reduced at all. 100% meaning cooldowns should be non-existent.
* 0.0 meaning cooldowns are not reduced at all. 1.0 meaning cooldowns should be non-existent.
*/
public static double calculateCooldownReduction(Player p) {
return 0.0;
double cooldown = 0.0;
cooldown+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 2, 2)/100d;
return cooldown;
}
//REturns 0-100.
@ -2025,7 +2074,68 @@ public class CustomDamage {
removechance+=resistamt;
}
}
removechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 2, 2);
removechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DAWNTRACKER, 2, 2);
return removechance;
}
private static double calculateBackstabMultiplier(LivingEntity target, LivingEntity shooter) {
double mult = 0.0;
if (target!=null && shooter!=null && isBackstab(target,shooter) &&
(shooter instanceof Player) && PlayerMode.getPlayerMode((Player)shooter)==PlayerMode.SLAYER) {
mult+=2.0;
}
return mult;
}
private static boolean isBackstab(LivingEntity target, LivingEntity shooter) {
if (target.getLocation().getDirection()!=null &&
shooter.getLocation().getDirection()!=null &&
Math.signum(target.getLocation().getDirection().getX())==Math.signum(shooter.getLocation().getDirection().getX()) &&
Math.signum(target.getLocation().getDirection().getZ())==Math.signum(shooter.getLocation().getDirection().getZ()))
{
if (shooter instanceof Player) {
Player p = (Player)shooter;
p.playSound(p.getLocation(), Sound.ENTITY_SHULKER_TELEPORT, 1f, 3.65f);
}
return true;
} else {
return false;
}
}
private static double calculateCustomArrowMultiplier(ItemStack weapon, Entity damager, LivingEntity target) {
double mult = 0.0;
if (damager instanceof TippedArrow) {
TippedArrow a = (TippedArrow)damager;
if (a.hasMetadata("QUADRUPLE_DAMAGE_ARR")) {
mult += 3.0;
}
if (a.hasMetadata("DOUBLE_DAMAGE_ARR")) {
mult += 1.0;
}
}
return mult;
}
private static double calculateIsolationMultiplier(LivingEntity shooter, LivingEntity target) {
double mult = 0.0;
if (shooter instanceof Player && target instanceof Monster) {
Player p = (Player)shooter;
Monster m = (Monster)target;
if (GenericFunctions.isIsolatedTarget(m, p)) {
mult += 0.5;
}
}
return mult;
}
private static double calculateSetBonusMultiplier(ItemStack weapon, Entity damager) {
double mult = 0.0;
LivingEntity shooter = getDamagerEntity(damager);
if (shooter instanceof Player) {
mult += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(shooter), (Player)shooter, ItemSet.MOONSHADOW, 3, 3)/100;
}
return mult;
}
}

@ -1,19 +1,20 @@
package sig.plugin.TwosideKeeper;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class DropDeathItems implements Runnable{
Player p = null;
Location deathloc = null;
Inventory contents;
List<ItemStack> contents;
DropDeathItems(Player p, Inventory contents, Location deathloc) {
DropDeathItems(Player p, List<ItemStack> contents, Location deathloc) {
this.p=p;
this.deathloc=deathloc;
this.contents=contents;
@ -30,12 +31,14 @@ public class DropDeathItems implements Runnable{
deathloc.getWorld().loadChunk(deathloc.getChunk());
if (deathloc.getChunk().isLoaded()) {
TwosideKeeper.log("Respawn and Dropping...", 2);
for (int i=0;i<contents.getSize();i++) {
if (contents.getItem(i)!=null &&
contents.getItem(i).getType()!=Material.AIR) {
Item it = deathloc.getWorld().dropItemNaturally(deathloc, contents.getItem(i));
while (contents.size()>0) {
if (deathloc.getChunk().isLoaded()) {
Item it = deathloc.getWorld().dropItemNaturally(deathloc, contents.get(0));
it.setInvulnerable(true);
TwosideKeeper.log("Dropping "+contents.getItem(i).toString()+" at Death location "+deathloc,2);
TwosideKeeper.log("Dropping "+contents.get(0).toString()+" at Death location "+deathloc,2);
contents.remove(0);
} else {
deathloc.getWorld().loadChunk(deathloc.getChunk());
}
}
DeathManager.removeDeathStructure(p);

@ -450,6 +450,12 @@ public class EliteMonster {
}
}
public void runPlayerLeaveEvent(Player p) {
targetlist.remove(p);
bar.removePlayer(p);
willpower_bar.removePlayer(p);
}
//Triggers when this mob is hit.
public void runHitEvent(LivingEntity damager, double dmg) {
bar.setColor(BarColor.RED);

@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -32,11 +33,14 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import org.inventivetalent.glow.GlowAPI;
import org.inventivetalent.glow.GlowAPI.Color;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@ -2450,10 +2454,10 @@ public class GenericFunctions {
}
public static boolean HasFullRangerSet(Player p) {
return ItemSet.hasFullSet(p, ItemSet.ALIKAHN) ||
ItemSet.hasFullSet(p, ItemSet.DARNYS) ||
ItemSet.hasFullSet(p, ItemSet.JAMDAK) ||
ItemSet.hasFullSet(p, ItemSet.LORASAADI);
return ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN) ||
ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.DARNYS) ||
ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.JAMDAK) ||
ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.LORASAADI);
/*int rangerarmort1 = 0; //Count the number of each tier of sets. //LEGACY CODE.
int rangerarmort2 = 0;
int rangerarmort3 = 0;
@ -2703,7 +2707,7 @@ public class GenericFunctions {
if (p.isOnGround() && PlayerMode.isRanger(p) &&
(GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())==BowMode.CLOSE)) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.last_dodge+TwosideKeeper.DODGE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
if (pd.last_dodge+GetModifiedCooldown(TwosideKeeper.DODGE_COOLDOWN,p)<=TwosideKeeper.getServerTickTime()) {
pd.last_dodge=TwosideKeeper.getServerTickTime();
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), 100);
p.playSound(p.getLocation(), Sound.ENTITY_DONKEY_CHEST, 1.0f, 1.0f);
@ -2728,11 +2732,16 @@ public class GenericFunctions {
}
}
public static void logAndApplyPotionEffectToPlayer(PotionEffectType type, int ticks, int amplifier, Player p) {
public static int GetModifiedCooldown(int cooldown, Player p) {
double cdr = CustomDamage.calculateCooldownReduction(p); //0.0-1.0
return (int)(cooldown*(1-cdr));
}
public static void logAndApplyPotionEffectToPlayer(PotionEffectType type, int ticks, int amplifier, LivingEntity p) {
logAndApplyPotionEffectToPlayer(type,ticks,amplifier,p,false);
}
public static void logAndApplyPotionEffectToPlayer(PotionEffectType type, int ticks, int amplifier, Player p, boolean force) {
public static void logAndApplyPotionEffectToPlayer(PotionEffectType type, int ticks, int amplifier, LivingEntity p, boolean force) {
TwosideKeeper.log(ChatColor.WHITE+"Adding Potion Effect "+type.getName()+" "+WorldShop.toRomanNumeral((amplifier+1))+"("+amplifier+") to "+p.getName()+" with "+ticks+" tick duration. "+((force)?ChatColor.RED+"FORCED":""), TwosideKeeper.POTION_DEBUG_LEVEL);
if (p.hasPotionEffect(type)) {
TwosideKeeper.log(ChatColor.YELLOW+" Already had effect on Player "+p.getName()+". "+type.getName()+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+"), Duration: "+getPotionEffectDuration(type,p)+" ticks", TwosideKeeper.POTION_DEBUG_LEVEL);
@ -2758,7 +2767,7 @@ public class GenericFunctions {
}
}
public static void logAndRemovePotionEffectFromPlayer(PotionEffectType type, Player p) {
public static void logAndRemovePotionEffectFromPlayer(PotionEffectType type, LivingEntity p) {
TwosideKeeper.log(ChatColor.WHITE+"Removing Potion Effect "+type+" "+WorldShop.toRomanNumeral((getPotionEffectLevel(type,p)+1))+"("+getPotionEffectLevel(type,p)+") on Player "+p.getName()+" Duration: "+getPotionEffectDuration(type,p)+" ticks by adding a 0 duration version of this effect.", TwosideKeeper.POTION_DEBUG_LEVEL);
//p.removePotionEffect(type);
logAndApplyPotionEffectToPlayer(type,1,0,p,true);
@ -2958,11 +2967,11 @@ public class GenericFunctions {
public static void PerformRejuvenate(Player player) {
PlayerStructure pd = (PlayerStructure)TwosideKeeper.playerdata.get(player.getUniqueId());
if (pd.last_rejuvenate+TwosideKeeper.REJUVENATE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
if (pd.last_rejuvenate+GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,player)<=TwosideKeeper.getServerTickTime()) {
player.playSound(player.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0f, 1.0f);
addIFrame(player,40);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.REGENERATION,200,9,player,true);
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), TwosideKeeper.REJUVENATE_COOLDOWN);
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,player));
}
}
@ -3243,10 +3252,36 @@ public class GenericFunctions {
Bukkit.broadcastMessage(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
}
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER &&
ItemSet.HasSetBonusBasedOnSetBonusCount(hotbar, p, ItemSet.GLADOMAIN, 5) &&
pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)<=TwosideKeeper.getServerTickTime()) {
pd.lastlifesavertime=TwosideKeeper.getServerTickTime();
RevivePlayer(p,p.getMaxHealth());
pd.slayermodehp = p.getMaxHealth();
GenericFunctions.applyStealth(p,false);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.SPEED, 20*10, 3, p, true);
deAggroNearbyTargets(p);
revived=true;
Bukkit.broadcastMessage(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p));
}
}
return revived;
}
public static void deAggroNearbyTargets(Player p) {
List<Monster> monsters = getNearbyMobs(p.getLocation(),8);
for (Monster m : monsters) {
if (m.getTarget()!=null &&
m.getTarget().equals(p) &&
m.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING,5,0))) {
m.setTarget(null);
}
}
}
private static void RevivePlayer(Player p, double healdmg) {
p.setHealth(healdmg);
p.playSound(p.getLocation(), Sound.BLOCK_REDSTONE_TORCH_BURNOUT, 1.0f, 1.5f);
@ -3411,7 +3446,7 @@ public class GenericFunctions {
Player p = (Player)damager;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.last_strikerspell = pd.last_strikerspell-40;
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), (int)(TwosideKeeper.LINEDRIVE_COOLDOWN-(TwosideKeeper.getServerTickTime()-pd.last_strikerspell)));
aPlugin.API.sendCooldownPacket(p, p.getEquipment().getItemInMainHand(), (int)(GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p)-(TwosideKeeper.getServerTickTime()-pd.last_strikerspell)));
}
updateNoDamageTickMap(m,(Player)damager);
}
@ -3672,7 +3707,7 @@ public class GenericFunctions {
public static void ApplySwiftAegis(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
int swiftaegislv=(int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4);
int swiftaegislv=(int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.DARNYS, 4, 4);
if (swiftaegislv>0) {
TwosideKeeper.log("Applying "+swiftaegislv+" levels of Swift Aegis.",5);
int resistancelv = 0;
@ -3759,7 +3794,7 @@ public class GenericFunctions {
break;
}
}
return hasArmor;
return !hasArmor;
}
public static void RemoveNewDebuffs(Player p) {
@ -3812,7 +3847,7 @@ public class GenericFunctions {
public static void logToFile(String message) {
try {
if (!TwosideKeeper..exists()) {
if (!TwosideKeeper.getT.exists()) {
savePath.mkdir();
}
@ -3832,4 +3867,242 @@ public class GenericFunctions {
e.printStackTrace();
}
}
public static boolean isSkullItem(ItemStack item) {
if (item!=null &&
item.getType()!=Material.AIR && (item.getType()==Material.SKULL_ITEM)) {
return true;
}
return false;
}
public static void applyStealth(Player p, boolean blindness_effect) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 111, p, true);
if (blindness_effect) {GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*2, 111, p);}
p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.5f);
}
public static void removeStealth(Player p) {
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p);
GenericFunctions.addIFrame(p, 10);
}
public static boolean hasStealth(Player p) {
return (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER &&
p.hasPotionEffect(PotionEffectType.INVISIBILITY));
}
public static void SubtractSlayerModeHealth(Player p,double damage) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.slayermodehp-=damage;
TwosideKeeper.log("Slayer Mode HP: "+pd.slayermodehp, 5);
//p.setHealth(pd.slayermodehp);
}
public static void PerformLineDrive(Player p, ItemStack weaponused, boolean second_charge) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
boolean ex_version = ItemSet.hasFullSet(GenericFunctions.getEquipment(p), p, ItemSet.PANROS);
Vector facing = p.getLocation().getDirection();
if (!second_charge) {
facing = p.getLocation().getDirection().setY(0);
logAndApplyPotionEffectToPlayer(PotionEffectType.SLOW,(ex_version)?7:15,20,p);
}
if (!ex_version || second_charge) {
aPlugin.API.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p));
pd.last_strikerspell=TwosideKeeper.getServerTickTime();
}
p.playSound(p.getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 1.0f);
aPlugin.API.damageItem(p, weaponused, (weaponused.getType().getMaxDurability()/10)+7);
final Player p1 = p;
int mult=2;
final double xspd=p.getLocation().getDirection().getX()*mult;
double tempyspd=0;
final double yspd=tempyspd;
final double zspd=p.getLocation().getDirection().getZ()*mult;
final double xpos=p.getLocation().getX();
final double ypos=p.getLocation().getY();
final double zpos=p.getLocation().getZ();
final Vector facing1 = facing;
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() {
p.setVelocity(facing1.multiply(8));
addIFrame(p, 10);
p.playSound(p.getLocation(), Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f);
final Location newpos=new Location(p.getWorld(),xpos,ypos,zpos);
double dmgdealt=CustomDamage.getBaseWeaponDamage(weaponused, p, null);
List<Monster> monsters = getNearbyMobs(newpos, 2);
for (int i=0;i<monsters.size();i++) {
removeNoDamageTick(monsters.get(i), p);
}
for (int i=0;i<50;i++) {
newpos.getWorld().playEffect(newpos, Effect.FLAME, 60);
}
DealDamageToNearbyMobs(newpos, dmgdealt, 2, true, 0.8d, p, weaponused, true);
//DecimalFormat df = new DecimalFormat("0.00");
p.playSound(p.getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.5f);
int range=8;
for (int i=0;i<range;i++) {
final double xpos2=p.getLocation().getX();
final double ypos2=p.getLocation().getY();
final double zpos2=p.getLocation().getZ();
final Location newpos2=new Location(p.getWorld(),xpos2,ypos2,zpos2).add(i*xspd,i*yspd,i*zspd);
for (int j=0;j<50;j++) {
newpos.getWorld().playEffect(newpos, Effect.FLAME, 60);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
public void run() {
DealDamageToNearbyMobs(newpos2, dmgdealt, 2, true, 0.4d, p, weaponused, true);
p1.playSound(newpos2, Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.3f);
}
},1);
}
}
},(ex_version)?7:15);
if (ex_version) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
public void run() {
aPlugin.API.sendCooldownPacket(p, weaponused, GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,p));;
pd.last_strikerspell=TwosideKeeper.getServerTickTime();
}
},17);
}
}
public static void PerformAssassinate(Player player, Material name) {
//Try to find a target to look at.
LivingEntity target = aPlugin.API.getTargetEntity(player, 100);
if (target!=null) {
//We found a target, try to jump behind them now.
Location teleloc = target.getLocation().add(target.getLocation().getDirection().multiply(-1.0));
int i=0;
while (teleloc.getBlock().getType().isSolid()) {
if (i==0) {
teleloc=target.getLocation();
} else
if (i%5==1){
teleloc=teleloc.add(1,0,0);
} else
if (i%5==2){
teleloc=teleloc.add(0,0,1);
} else
if (i%5==3){
teleloc=teleloc.add(-1,0,0);
} else
if (i%5==4){
teleloc=teleloc.add(0,0,-1);
} else {
teleloc=teleloc.add(0,1,0);
}
i++;
}
player.playSound(teleloc, Sound.BLOCK_NOTE_SNARE, 1.0f, 1.0f);
player.teleport(teleloc);
Location newfacingdir = target.getLocation().setDirection(target.getLocation().getDirection());
target.teleport(newfacingdir);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(player);
if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)<TwosideKeeper.getServerTickTime()) { //Don't overwrite life saver cooldowns.
aPlugin.API.sendCooldownPacket(player, name, GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player));
}
pd.lastassassinatetime=TwosideKeeper.getServerTickTime();
GenericFunctions.addIFrame(player, 10);
}
}
public static void DamageRandomTool(Player p) {
if (ItemSet.GetSetCount(GenericFunctions.getHotbarItems(p), ItemSet.LORASYS, p)==0) {
ItemStack[] inv = p.getInventory().getContents();
for (int i=0;i<9;i++) {
if (inv[i]!=null &&
isTool(inv[i]) && inv[i].getType()!=Material.BOW) {
aPlugin.API.damageItem(p, inv[i], 1);
}
}
}
}
public static int GetNearbyMonsterCount(LivingEntity ent, double range) {
List<Entity> ents = ent.getNearbyEntities(range, range, range);
int count=0;
for (Entity e : ents) {
if (e instanceof Monster && !e.equals(ent)) {
count++;
}
}
return count;
}
public static boolean isIsolatedTarget(Monster m, Player p) {
return GlowAPI.isGlowing(m, p) &&
GlowAPI.getGlowColor(m, p).equals(Color.WHITE);
}
public static boolean isSpecialGlowMonster(Monster m) {
return MonsterStructure.getMonsterStructure(m).isLeader ||
MonsterStructure.getMonsterStructure(m).isElite;
}
public static boolean isSuppressed(Entity ent) {
if (ent!=null && ent.hasMetadata("SuppressionTime")) {
return getSuppressionTime(ent)>0;
} else {
return false;
}
}
public static void setSuppressionTime(Entity ent, int ticks) {
if (ent!=null) {
ent.setMetadata("SuppressionTime", new FixedMetadataValue(TwosideKeeper.plugin,TwosideKeeper.getServerTickTime()+ticks));
SetupSuppression(ent,ticks);
}
}
public static void addSuppressionTime(Entity ent, int ticks) {
if (ent!=null) {
ent.setMetadata("SuppressionTime", new FixedMetadataValue(TwosideKeeper.plugin,TwosideKeeper.getServerTickTime()+getSuppressionTime(ent)+ticks));
SetupSuppression(ent,ticks);
}
}
public static double getSuppressionTime(Entity ent) {
double suppressiontime=0;
List<MetadataValue> vals = ent.getMetadata("SuppressionTime");
for (MetadataValue val : vals) {
if (val.getOwningPlugin().equals(TwosideKeeper.plugin)) {
long time = val.asLong();
TwosideKeeper.log("Value: "+val.asLong(), 5);
if (time>TwosideKeeper.getServerTickTime()) {
suppressiontime = time-TwosideKeeper.getServerTickTime();
}
}
}
return suppressiontime;
}
private static void SetupSuppression(Entity ent, int ticks) {
if (!TwosideKeeper.suppressed_entities.contains(ent)) {
TwosideKeeper.suppressed_entities.add(ent);
}
GlowAPI.setGlowing(ent, GlowAPI.Color.BLACK, Bukkit.getOnlinePlayers());
if (ent instanceof LivingEntity) {
LivingEntity l = (LivingEntity)ent;
l.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,ticks,99));
}
}
public static ItemStack[] getHotbarItems(LivingEntity p) {
Player pl = (Player)p;
return new ItemStack[]{
pl.getInventory().getContents()[0],
pl.getInventory().getContents()[1],
pl.getInventory().getContents()[2],
pl.getInventory().getContents()[3],
pl.getInventory().getContents()[4],
pl.getInventory().getContents()[5],
pl.getInventory().getContents()[6],
pl.getInventory().getContents()[7],
pl.getInventory().getContents()[8],
};
}
}

@ -22,8 +22,8 @@ public enum ItemSet {
DARNYS(1,1, 10,5, 20,5, 1,1),
ALIKAHN(1,1, 15,6, 30,10, 12,6),
LORASAADI(1,1, 1,1, 3,2, 2,1),
MOONSHADOW(4,1, 12,17, 8,8, 10,15),
GLADOMAIN(4,1, 12,17, 8,8, 10,15);
MOONSHADOW(4,2, 1,1, 8,8, 10,5),
GLADOMAIN(1,1, 12,10, 8,8, 1,1);
int baseval;
int increase_val;
@ -53,7 +53,7 @@ public enum ItemSet {
}
public static ItemSet GetSet(ItemStack item) {
if (GenericFunctions.isEquip(item) &&
if ((GenericFunctions.isEquip(item) || GenericFunctions.isSkullItem(item)) &&
item.getItemMeta().hasLore()) {
List<String> lore = item.getItemMeta().getLore();
for (int i=0;i<lore.size();i++) {
@ -131,10 +131,10 @@ public enum ItemSet {
return baseval+((GetTier(item)-1)*increase_val);
}
public static int GetSetCount(ItemSet set, LivingEntity ent) {
public static int GetSetCount(ItemStack[] equips, ItemSet set, LivingEntity ent) {
int count = 0;
for (int i=0;i<GenericFunctions.getEquipment(ent).length;i++) {
ItemSet temp = ItemSet.GetSet(GenericFunctions.getEquipment(ent)[i]);
for (ItemStack item : equips) {
ItemSet temp = ItemSet.GetSet(item);
if (temp!=null) {
if (temp.equals(set)) {
count++;
@ -145,12 +145,12 @@ public enum ItemSet {
return count;
}
public static int GetTierSetCount(ItemSet set, int tier, LivingEntity ent) {
public static int GetTierSetCount(ItemStack[] equips, ItemSet set, int tier, LivingEntity ent) {
int count = 0;
for (int i=0;i<GenericFunctions.getEquipment(ent).length;i++) {
ItemSet temp = ItemSet.GetSet(GenericFunctions.getEquipment(ent)[i]);
for (ItemStack item : equips) {
ItemSet temp = ItemSet.GetSet(item);
if (temp!=null) {
if (temp.equals(set) && GetTier(GenericFunctions.getEquipment(ent)[i])==tier) {
if (temp.equals(set) && GetTier(item)==tier) {
count++;
}
}
@ -159,13 +159,13 @@ public enum ItemSet {
return count;
}
public static int GetTotalBaseAmount(LivingEntity ent, ItemSet set) {
public static int GetTotalBaseAmount(ItemStack[] equips, LivingEntity ent, ItemSet set) {
int count = 0;
for (int i=0;i<GenericFunctions.getEquipment(ent).length;i++) {
ItemSet temp = ItemSet.GetSet(GenericFunctions.getEquipment(ent)[i]);
for (ItemStack item : equips) {
ItemSet temp = ItemSet.GetSet(item);
if (temp!=null) {
if (temp.equals(set)) {
count += set.GetBaseAmount(GenericFunctions.getEquipment(ent)[i]);
count += set.GetBaseAmount(item);
}
}
}
@ -173,13 +173,13 @@ public enum ItemSet {
return count;
}
public static boolean hasFullSet(LivingEntity ent, ItemSet set) {
public static boolean hasFullSet(ItemStack[] equips, LivingEntity ent, ItemSet set) {
//Return a mapping of all tier values that meet the count requirement for that set.
for (int i=0;i<GenericFunctions.getEquipment(ent).length;i++) {
ItemSet temp = ItemSet.GetSet(GenericFunctions.getEquipment(ent)[i]);
for (ItemStack item : equips) {
ItemSet temp = ItemSet.GetSet(item);
if (temp!=null) {
int tier = ItemSet.GetTier(GenericFunctions.getEquipment(ent)[i]);
int detectedsets = ItemSet.GetTierSetCount(set, tier, ent);
int tier = ItemSet.GetTier(item);
int detectedsets = ItemSet.GetTierSetCount(equips, set, tier, ent);
TwosideKeeper.log("Sets: "+detectedsets, 5);
if (detectedsets>=5) {
return true;
@ -189,14 +189,14 @@ public enum ItemSet {
return false;
}
public static List<Integer> GetSetBonusCount(LivingEntity ent, ItemSet set, int count) {
public static List<Integer> GetSetBonusCount(ItemStack[] equips, LivingEntity ent, ItemSet set, int count) {
//Return a mapping of all tier values that meet the count requirement for that set.
List<Integer> mapping = new ArrayList<Integer>();
for (int i=0;i<GenericFunctions.getEquipment(ent).length;i++) {
ItemSet temp = ItemSet.GetSet(GenericFunctions.getEquipment(ent)[i]);
for (ItemStack item : equips) {
ItemSet temp = ItemSet.GetSet(item);
if (temp!=null) {
int tier = ItemSet.GetTier(GenericFunctions.getEquipment(ent)[i]);
if (ItemSet.GetTierSetCount(set, tier, ent)>=count) {
int tier = ItemSet.GetTier(item);
if (ItemSet.GetTierSetCount(equips, set, tier, ent)>=count) {
if (!mapping.contains(tier)) {
mapping.add(tier);
}
@ -206,10 +206,15 @@ public enum ItemSet {
return mapping;
}
public static double TotalBaseAmountBasedOnSetBonusCount(Player p, ItemSet set, int count, int set_bonus) {
public static boolean HasSetBonusBasedOnSetBonusCount(ItemStack[] equips, Player p, ItemSet set, int count) {
//Similar to HasFullSet, but lets you decide how many pieces to check for from that particular set and matching tiers.
return ItemSet.GetSetBonusCount(equips, p, set, count).size()>0;
}
public static double TotalBaseAmountBasedOnSetBonusCount(ItemStack[] equips, Player p, ItemSet set, int count, int set_bonus) {
double amt = 0.0;
for (int i=0;i<ItemSet.GetSetBonusCount(p, set, count).size();i++) {
int tier = ItemSet.GetSetBonusCount(p, set, count).get(i);
List<Integer> mapping = ItemSet.GetSetBonusCount(equips, p, set, count);
for (Integer tier : mapping) {
amt+=ItemSet.GetBaseAmount(set, tier, set_bonus);
}
return amt;
@ -259,14 +264,14 @@ public enum ItemSet {
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Dodge Chance");
}break;
case GLADOMAIN:{
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Bangle");
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Amulet");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Gladomain Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+" HP");
}break;
case MOONSHADOW:{
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Amulet");
lore.add(ChatColor.LIGHT_PURPLE+"Slayer Trinket");
lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Moonshadow Set");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Debuff Resistance");
lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1)+"% Crit Damage");
}break;
}
@ -377,7 +382,7 @@ public enum ItemSet {
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Dodge Chance");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" Life Saver "+WorldShop.toRomanNumeral(ItemSet.GetBaseAmount(set, tier, 4))+"");
lore.add(ChatColor.GRAY+" When about to be killed, puts you into");
lore.add(ChatColor.GRAY+" stealth for "+(ItemSet.GetBaseAmount(set, tier, 4)*2)+" seconds, gain Speed IV,");
lore.add(ChatColor.GRAY+" stealth, applies Speed IV for 10 seconds, adds");
lore.add(ChatColor.GRAY+" invulnerability, and de-aggros all current");
lore.add(ChatColor.GRAY+" targets.");
lore.add(ChatColor.WHITE+" 3 Minute Cooldown");
@ -385,16 +390,16 @@ public enum ItemSet {
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"A successful Assassination grants 100%");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Critical Strike Chance and 100% Dodge");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"chance for the next hit. Dodge Chance");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"increases by +5% per 1m/sec of movement");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"increases by +"+(5+ItemSet.GetBaseAmount(set, tier, 4))+"% per 1m/sec of movement");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"speed.");
}break;
case MOONSHADOW:{
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" Applies Poison "+WorldShop.toRomanNumeral(ItemSet.GetBaseAmount(set, tier, 2))+ChatColor.GRAY+" (0:15)");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Damage");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Critical Chance");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Critical Chance");
lore.add(ChatColor.DARK_AQUA+" 7 - "+ChatColor.WHITE+" Provides the Following Bonuses:");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Strength Cap Increases to 40.");
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+"in an AoE Range.");
lore.add(ChatColor.GRAY+" "+ChatColor.WHITE+"Slayers can drop aggro by sneaking");

@ -9,6 +9,7 @@ import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Monster;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
@ -414,10 +415,20 @@ public class Loot {
return raresword;
}
/**
* @deprecated This generates a random piece based on an item. This is very old and is not recommended to be used anymore.
* <b>Use the other GenerateSetPiece() combinations instead!</b>
*/
@Deprecated
public static ItemStack GenerateSetPiece(ItemStack item, boolean hardened) {
return GenerateSetPiece(item,hardened,0);
}
/**
* @deprecated This generates a random piece based on an item. This is very old and is not recommended to be used anymore.
* <b>Use the other GenerateSetPiece() combinations instead!</b>
*/
@Deprecated
public static ItemStack GenerateSetPiece(ItemStack item, boolean hardened, int tierbonus) {
int type = (int)(Math.random()*3);
if (item.getType().name().contains("LEATHER") || item.getType()==Material.BOW) {
@ -492,6 +503,9 @@ public class Loot {
set_name = prefix+"Dawntracker Barbarian "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break;
case LORASYS:{
if (!item.getType().toString().contains("SWORD")) {
item.setType(Material.IRON_SWORD);
}
tierbonus = (custom)?tierbonus:modifyTierBonus(item,tierbonus);
set_name = prefix+"Lorasys Slayer "+GenericFunctions.UserFriendlyMaterialName(item.getType());
}break;
@ -538,11 +552,17 @@ public class Loot {
case GLADOMAIN:{
item.setType(Material.SKULL_ITEM);
item.setDurability((short)2);
set_name = prefix+"Gladomain Slayer Trinket";
ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m);
set_name = prefix+"Gladomain Slayer Amulet";
}break;
case MOONSHADOW:{
item.setType(Material.SKULL_ITEM);
item.setDurability((short)0);
ItemMeta m = item.getItemMeta();
m.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(m);
set_name = prefix+"Moonshadow Slayer Trinket";
}break;
}

@ -375,10 +375,10 @@ public enum MonsterDifficulty {
final int NUMBER_OF_MODES=3;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
if (selectweight<10) {
set = ItemSet.LORASYS;
} else
if (selectweight<100) {
if (selectweight<80) {
set = ItemSet.MOONSHADOW;
} else
{
@ -393,7 +393,7 @@ public enum MonsterDifficulty {
}
private ItemSet PickRandomSet() {
final int NUMBER_OF_MODES=4;
final int NUMBER_OF_MODES=5;
int totalweight=50*NUMBER_OF_MODES; //50 for each mode.
int selectweight=(int)(Math.random()*totalweight);
if (selectweight<50) {
@ -419,7 +419,17 @@ public enum MonsterDifficulty {
if (selectweight<200) {
return ItemSet.LORASAADI;
}
}
} else
if (selectweight<250) {
if (selectweight<205) {
return ItemSet.LORASYS;
} else
if (selectweight<223) {
return ItemSet.GLADOMAIN;
} else {
return ItemSet.MOONSHADOW;
}
}
return ItemSet.PANROS;
}
}

@ -16,7 +16,7 @@ public enum PlayerMode {
+ ChatColor.WHITE+"->20% chance to critically strike.\n"
+ ChatColor.WHITE+"->Getting hit increases Speed by 1 Level. Stacks up to Speed V (Lasts five seconds.)\n"
+ ChatColor.GRAY+"->Swinging your weapon stops nearby flying arrows. Each arrow deflected will give you a Strength buff. Stacks up to Strength V (Lasts five seconds.)\n"
+ ChatColor.WHITE+"->Dropping your weapon will perform a line drive. Enemies you charge through take x7 your base damage. This costs 5% of your durability (Unbreaking decreases this amount.)\n"
+ ChatColor.WHITE+"->Dropping your weapon will perform a line drive. Enemies you charge through take x1-x5 damage, based on target's missing health. This costs 5% of your durability (Unbreaking decreases this amount.)\n"
+ ChatColor.GRAY+"->Strikers have a 20% chance to dodge incoming attacks from any damage source while moving.\n"
+ ChatColor.WHITE+"->Hitting a target when they have not noticed you yet does x3 normal damage.\n"),
RANGER(ChatColor.DARK_GREEN,"R","Ranger",
@ -55,15 +55,17 @@ public enum PlayerMode {
ChatColor.GOLD+""+ChatColor.BOLD+"Barbarian mode Perks: "+ChatColor.RESET+"\n"),
SLAYER(ChatColor.DARK_BLUE,"SL","Slayer",
ChatColor.DARK_BLUE+""+ChatColor.BOLD+"Slayer mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Slayers' by wearing no armor, and wearing a Bauble in your hotbar.\n"
+ ChatColor.WHITE+"->Players are identified as 'Slayers' by wearing no armor, and wearing a Bauble in their hotbar.\n"
+ ChatColor.GRAY+"->Slayers can make use of up to 9 Baubles by placing them on their hotbar (Ideally you would want to use one slot for a weapon). Each Bauble adds a certain amount of stats to the Slayer, making them more efficient.\n"
+ ChatColor.WHITE+"->Slayers lose 2 HP from every hit regardless of damage taken, making this mode essentially have 5 lives.\n"
+ ChatColor.GRAY+"->Slayers are not affected by any Health Recovery and Health Regeneration effects. This mode only heals from kills or by using the Amulet's set effect. However, Absorption will still work for a Slayer. Absorption hearts just get removed with normal damage calculation rules.\n"
+ ChatColor.WHITE+"->Slayers can enter Stealth mode by pressing Sneak. Once in Stealth mode, Slayers will not leave stealth until they hit a monster or Sneak again. Stealth mode drains either 1% Durability or 1 Durability, whichever is larger, from a tool on your hotbar.\n"
+ ChatColor.WHITE+"->Slayers take a maximum of 1 Heart (2 HP) in damage from all attacks, making this mode essentially 5 lives.\n"
+ ChatColor.GRAY+"->Slayers are not affected by any Health Recovery and Health Regeneration effects. This mode only heals from kills, using the Amulet's set effect, or sleeping. However, Absorption will still work for a Slayer. Absorption hearts just get removed with normal damage calculation rules.\n"
+ ChatColor.WHITE+"->Whenever a Slayer kills a target, they recover 1 Heart (2 HP). This can be modified by a special weapon.\n"
+ ChatColor.GRAY+"->Slayers can enter Stealth mode by pressing Sneak. Once in Stealth mode, Slayers will not leave stealth until they hit a monster or Sneak again. Stealth mode drains 1 Durability every second from tools on your hotbar.\n"
+ ChatColor.WHITE+"->While in Stealth mode, nothing will be able to detect you. Note this does not get rid of aggression from targets that have already aggro'd you.\n"
+ ChatColor.GRAY+"->Slayers can Backstab targets by getting behind them and hitting them. A backstab does triple the normal damage of an attack.\n"
+ ChatColor.WHITE+"->Whenever a Slayer critically strikes, it suppresses a target for 0.25 seconds. Suppression prevents movement, attacking, teleporting, and exploding. Suppressed targets glow Black.\n"
+ ChatColor.WHITE+"->Whenever a Slayer critically strikes, it suppresses a target for 0.75 seconds. Suppression prevents movement, attacking, teleporting, and exploding. Suppressed targets glow Black.\n"
+ ChatColor.GRAY+"->Slayers thrive in 1vs1 situations. If a target is completely alone, they will glow white to the Slayer. Isolated targets take 50% more damage from the Slayer. Slayer's Dodge Chance increases by 40% against isolated targets.\n"
+ ChatColor.WHITE+"->Slayers can use the Assassination ability. Press the Drop key while looking at an enemy to perform an assassination: You jump directly behind the enemy, gaining 0.5 seconds of invulnerability. If the next hit after Assassination is performed kills the target, you gain 1 Heart (2 Health) back along with a speed and strength buff. These buffs cap at Speed V and Strength X respectively. Assassination cooldown is reset whenever a target is instantly killed in this manner, and you get immediately put back into stealth, preventing further detection from other monsters.\n"),
+ ChatColor.WHITE+"->Slayers can use the Assassination ability. Press the Drop key while looking at an enemy to perform an assassination: You jump directly behind the enemy, gaining 0.5 seconds of invulnerability. If the next hit after Assassination is performed kills the target, you gain a speed and strength buff. These buffs cap at Speed V and Strength X respectively and last 10 seconds. Assassination cooldown is reset whenever a target is instantly killed in this manner, and you get immediately put back into stealth, preventing further detection from other monsters.\n"),
SUMMONER(ChatColor.DARK_PURPLE,"SM","Summoner",
ChatColor.DARK_PURPLE+""+ChatColor.BOLD+"Summoner mode Perks: "+ChatColor.RESET+"\n"),
NORMAL(ChatColor.WHITE,"","Normal",
@ -90,24 +92,27 @@ public enum PlayerMode {
public static PlayerMode getPlayerMode(Player p) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
if (isSlayer(p)) {
if (Check_isSlayer(p)) {
if (pd.lastmode!=PlayerMode.SLAYER) {pd.slayermodehp=p.getHealth();}
pd.lastmode=PlayerMode.SLAYER;
} else
if (isStriker(p)) {
pd.lastmode=PlayerMode.STRIKER;
} else
if (isDefender(p)) {
pd.lastmode=PlayerMode.DEFENDER;
} else
if (isRanger(p)) {
pd.lastmode=PlayerMode.RANGER;
} else {
pd.lastmode=PlayerMode.NORMAL;
if (pd.lastmode==PlayerMode.SLAYER) {
GenericFunctions.removeStealth(p);
}
if (Check_isStriker(p)) {
pd.lastmode=PlayerMode.STRIKER;
} else
if (Check_isDefender(p)) {
pd.lastmode=PlayerMode.DEFENDER;
} else
if (Check_isRanger(p)) {
pd.lastmode=PlayerMode.RANGER;
} else {
pd.lastmode=PlayerMode.NORMAL;
}
}
return pd.lastmode;
} else {
return pd.lastmode;
}
return pd.lastmode;
}
public static boolean needsUpdating(PlayerStructure pd) {
@ -115,6 +120,59 @@ public enum PlayerMode {
}
public static boolean isRanger(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
return getPlayerMode(p)==PlayerMode.RANGER;
} else {
return pd.lastmode==PlayerMode.RANGER;
}
} else {
return false;
}
}
public static boolean isDefender(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
return getPlayerMode(p)==PlayerMode.DEFENDER;
} else {
return pd.lastmode==PlayerMode.DEFENDER;
}
} else {
return false;
}
}
public static boolean isStriker(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
return getPlayerMode(p)==PlayerMode.STRIKER;
} else {
return pd.lastmode==PlayerMode.STRIKER;
}
} else {
return false;
}
}
public static boolean isSlayer(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
return getPlayerMode(p)==PlayerMode.SLAYER;
} else {
return pd.lastmode==PlayerMode.SLAYER;
}
} else {
return false;
}
}
public static boolean Check_isRanger(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
@ -135,7 +193,7 @@ public enum PlayerMode {
}
}
public static boolean isDefender(Player p) {
public static boolean Check_isDefender(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
@ -152,7 +210,7 @@ public enum PlayerMode {
}
}
public static boolean isStriker(Player p) {
public static boolean Check_isStriker(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {
@ -170,7 +228,7 @@ public enum PlayerMode {
}
}
public static boolean isSlayer(Player p) {
public static boolean Check_isSlayer(Player p) {
if (p!=null && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) {

@ -36,7 +36,8 @@ public class ItemCubeWindow {
Inventory temp = Bukkit.getServer().createInventory(p, inv_size, "Item Cube #"+itemcubeid);
pd.opened_another_cube=true;
TwosideKeeper.openItemCubeInventory(temp);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {@Override public void run() {InventoryView newinv = p.openInventory(temp);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {@Override public void run() {@SuppressWarnings("unused")
InventoryView newinv = p.openInventory(temp);
pd.opened_another_cube=false;
pd.isViewingItemCube=true;}},1);
p.playSound(p.getLocation(),Sound.BLOCK_CHEST_OPEN,1.0f,1.0f);

@ -159,7 +159,7 @@ public class MonsterController {
dist = (temp<dist)?temp:dist;
}
}
return (dist<4096 && ent.getNearbyEntities(16, 16, 16).size()<nearbyplayers*3);
return (dist<4096 && GenericFunctions.getNearbyMobs(ent.getLocation(), 16).size()<(nearbyplayers*3)+1);
}
private static boolean meetsConditionsToBeElite(LivingEntity ent) {

@ -104,6 +104,11 @@ public class PlayerStructure {
public boolean stealthmode=false;
public long lastcompassnotification=0;
public long endnotification=0;
public long turnedonsneak=0;
public double slayermodehp=0;
public long lastassassinatetime=0;
public long lastlifesavertime=0;
public boolean slayermegahit=false;
public long iframetime = 0;
@ -121,6 +126,7 @@ public class PlayerStructure {
public int storedbowxp=0;
public long lasthittarget=0;
public long lastbowmodeswitch=0;
public long lastsneak=0;
public boolean isPlayingSpleef=false;
@ -134,7 +140,7 @@ public class PlayerStructure {
this.velocity = 0d;
this.name = p.getName();
this.joined = serverTickTime;
this.firstjoined=serverTickTime;
this.firstjoined = serverTickTime;
this.money=100;
this.bank_money=0;
this.opened_inventory=false;
@ -173,6 +179,8 @@ public class PlayerStructure {
this.destroyedminecart=false;
this.last_laugh_time=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.last_rejuvenate=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.lastassassinatetime=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.lastlifesavertime=(TwosideKeeper.getServerType()==ServerType.MAIN)?TwosideKeeper.getServerTickTime():0;
this.damagedata = new DamageLogger(p);
this.damagelogging=false;
this.isPlayingSpleef=false;
@ -218,6 +226,7 @@ public class PlayerStructure {
applyCooldownToAllTypes(p,"SPADE",TwosideKeeper.EARTHWAVE_COOLDOWN);
applyCooldownToAllTypes(p,"SWORD",TwosideKeeper.LINEDRIVE_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.SHIELD, TwosideKeeper.REJUVENATE_COOLDOWN);
aPlugin.API.sendCooldownPacket(p, Material.SKULL_ITEM, TwosideKeeper.LIFESAVER_COOLDOWN);
}
private void applyCooldownToAllTypes(Player p, String item, int cooldown) {

@ -16,7 +16,6 @@ import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -326,6 +325,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
int sleeping=0;
for (Player p : players) {
if (p.isSleeping()) {
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.slayermodehp=p.getMaxHealth();
}
p.setHealth(p.getMaxHealth());
sleeping++;
}
@ -446,6 +449,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideKeeper.log("Added "+pd.storedbowxp+" Artifact XP", 2);
pd.storedbowxp=0;
}
if (p.getFireTicks()>0 && p.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
int duration = GenericFunctions.getPotionEffectDuration(PotionEffectType.FIRE_RESISTANCE, p);
int lv = GenericFunctions.getPotionEffectLevel(PotionEffectType.FIRE_RESISTANCE, p);
if (lv>10) {lv=10;}
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.FIRE_RESISTANCE, duration-(20*(10-lv)), lv, p, true);
}
if (GenericFunctions.hasStealth(p)) {GenericFunctions.DamageRandomTool(p);}
p.getAttribute(Attribute.GENERIC_ARMOR).setBaseValue(20*(1.0d-CustomDamage.CalculateDamageReduction(1,p,null))+subtractVanillaArmorBar(p.getEquipment().getArmorContents()));
@ -461,7 +473,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
double totalregen = 1+(p.getMaxHealth()*0.05);
double bonusregen = 0.0;
bonusregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4);
bonusregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 4, 4);
totalregen += bonusregen;
for (ItemStack equip : equips) {
if (GenericFunctions.isArtifactEquip(equip)) {
@ -481,10 +493,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
if (pd.endnotification+72000<getServerTickTime() &&
p.getWorld().getName().equalsIgnoreCase("world_the_end")) {
pd.endnotification=getServerTickTime();
playEndWarningNotification(p);
if (p.getWorld().getName().equalsIgnoreCase("world_the_end")) {
if (pd.endnotification+72000<getServerTickTime()) {
pd.endnotification=getServerTickTime();
playEndWarningNotification(p);
}
randomlyAggroNearbyEndermen(p);
}
//See if this player is sleeping.
@ -512,6 +526,31 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (ArtifactAbility.containsEnchantment(ArtifactAbility.COMBO, p.getEquipment().getItemInMainHand()) &&
pd.last_swordhit+40<getServerTickTime()) {
pd.swordcombo=0; //Reset the sword combo meter since the time limit expired.
}
if (PlayerMode.isSlayer(p)) {
if (pd.lastsneak+50<=getServerTickTime() &&
p.isSneaking() &&
ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7)) {
GenericFunctions.deAggroNearbyTargets(p);
GenericFunctions.applyStealth(p, true);
}
List<Monster> mobs = GenericFunctions.getNearbyMobs(p.getLocation(), 16);
for (Monster m : mobs) {
if (!GenericFunctions.isIsolatedTarget(m,p) &&
!GenericFunctions.isSpecialGlowMonster(m)) {GlowAPI.setGlowing(m, GlowAPI.Color.WHITE, p);}
if (GenericFunctions.isIsolatedTarget(m,p) &&
!GenericFunctions.isSpecialGlowMonster(m) &&
GenericFunctions.GetNearbyMonsterCount(m, 8)>0) {
GlowAPI.setGlowing(m, false, p);
}
}
} else {
List<Monster> mobs = GenericFunctions.getNearbyMobs(p.getLocation(), 16);
for (Monster m : mobs) {
if (GenericFunctions.isIsolatedTarget(m,p) &&
!GenericFunctions.isSpecialGlowMonster(m)) {GlowAPI.setGlowing(m, false, p);}
}
}
GenericFunctions.AutoRepairItems(p);
@ -523,6 +562,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideSpleefGames.TickEvent();
}
private void randomlyAggroNearbyEndermen(Player p) {
List<Monster> ents = GenericFunctions.getNearbyMobs(p.getLocation(), 16);
for (Monster m : ents) {
if (Math.random()<=0.05 && !m.hasPotionEffect(PotionEffectType.GLOWING)) {
m.setTarget(p);
}
}
}
private void playEndWarningNotification(Player p) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
@ -661,7 +709,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
private final class ReapplyAbsorptionHeartsFromSet implements Runnable {
public void run(){
for (Player p : Bukkit.getOnlinePlayers()) {
double absorption_amt = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 3, 3)-4;
double absorption_amt = ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL, 3, 3)-4;
if (absorption_amt>0) {
if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) {
int oldlv = GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, p);
@ -742,6 +790,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
em.runTick();
}
}
for (Entity e : suppressed_entities) {
if (e==null || !e.isValid() ||
GenericFunctions.getSuppressionTime(e)<=0) {
if (GlowAPI.isGlowing(e, Bukkit.getOnlinePlayers(),false)) {
GlowAPI.setGlowing(e, null, Bukkit.getOnlinePlayers());
}
ScheduleRemoval(suppressed_entities,e);
}
}
}
}
@ -808,6 +865,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static boolean LOOT_TABLE_NEEDS_POPULATING=true;
public static List<ArtifactAbility> TEMPORARYABILITIES = new ArrayList<ArtifactAbility>();
public static Set<Inventory> notWorldShop = new HashSet<Inventory>();
public static List<Entity> suppressed_entities = new ArrayList<Entity>();
public static CustomItem HUNTERS_COMPASS;
public static CustomItem UPGRADE_SHARD;
@ -909,6 +967,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static final int ERUPTION_COOLDOWN=100;
public static final int LINEDRIVE_COOLDOWN=240;
public static final int REJUVENATE_COOLDOWN=2400;
public static final int ASSASSINATE_COOLDOWN=200;
public static final int LIFESAVER_COOLDOWN=3600;
public static File filesave;
public static HashMap<UUID,PlayerStructure> playerdata;
@ -1320,9 +1380,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
*/
/*TwosideKeeper.log("Suppressed: "+GenericFunctions.isSuppressed(p),1);
TwosideKeeper.log("Suppression Time: "+GenericFunctions.getSuppressionTime(p), 1);
GenericFunctions.setSuppressionTime(p, 20);
TwosideKeeper.log("Suppression Time: "+GenericFunctions.getSuppressionTime(p), 1);
GenericFunctions.addSuppressionTime(p, 30);
TwosideKeeper.log("Suppression Time: "+GenericFunctions.getSuppressionTime(p), 1);
TwosideKeeper.log("Suppressed: "+GenericFunctions.isSuppressed(p),1);*/
/*ItemStack item = p.getEquipment().getItemInMainHand();
AwakenedArtifact.addPotentialEXP(item, 50000, p);*/
p.getEquipment().getItemInMainHand().setType(Material.SULPHUR);
//p.getEquipment().getItemInMainHand().setType(Material.SULPHUR);
//if (GenericFunctions.isSuppressed(p)
//TwosideKeeperAPI.removeAllArtifactAbilityPoints(p.getEquipment().getItemInMainHand());
//p.sendMessage(tpstracker.getTPS()+"");
//GenericFunctions.addObscureHardenedItemBreaks(p.getEquipment().getItemInMainHand(), 4);
@ -1644,9 +1712,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onPlayerLeave(PlayerQuitEvent ev) {
TwosideSpleefGames.PassEvent(ev);
for (EliteMonster em : elitemonsters) {
em.runPlayerLeaveEvent(ev.getPlayer());
}
for (int i=0;i<Bukkit.getOnlinePlayers().toArray().length;i++) {
Player p = (Player)Bukkit.getOnlinePlayers().toArray()[i];
for (Player p :Bukkit.getOnlinePlayers()) {
if (p!=null) {
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_PLING, 8, 0.7f);
}
@ -2130,19 +2200,22 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
@SuppressWarnings("deprecation")
@EventHandler(priority=EventPriority.LOW,ignoreCancelled=true)
public void onPlayerSneak(PlayerToggleSneakEvent ev) {
Player p = ev.getPlayer();
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (ev.isSneaking()) {
pd.stealthmode=!pd.stealthmode;
if (pd.stealthmode) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 111, p, true);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*4, 111, p);
p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 0.5f);
pd.turnedonsneak=getServerTickTime();
pd.lastsneak=getServerTickTime();
//TwosideKeeper.log("Turned on sneak SET "+getServerTickTime(), 1);
}
if (!ev.isSneaking() && p.isOnGround() && pd.turnedonsneak+10>getServerTickTime()) {
if (!GenericFunctions.hasStealth(p)) {
GenericFunctions.applyStealth(p,true);
} else {
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.INVISIBILITY, p);
GenericFunctions.removeStealth(p);
}
}
}
@ -2944,7 +3017,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public boolean performDeathMark(final Player player, boolean bursted) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(player); //Make sure it's off cooldown.
if (pd.last_deathmark+DEATHMARK_COOLDOWN<getServerTickTime()) {
if (pd.last_deathmark+GenericFunctions.GetModifiedCooldown(TwosideKeeper.DEATHMARK_COOLDOWN,player)<getServerTickTime()) {
if (ArtifactAbility.getEnchantmentLevel(ArtifactAbility.DEATHMARK, player.getEquipment().getItemInMainHand())>0) {
double dmg = GenericFunctions.getAbilityValue(ArtifactAbility.DEATHMARK, player.getEquipment().getItemInMainHand());
//Look for nearby mobs up to 10 blocks away.
@ -2976,7 +3049,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
if (reset) {
pd.last_deathmark = getServerTickTime()-DEATHMARK_COOLDOWN+20;
pd.last_deathmark = getServerTickTime()-GenericFunctions.GetModifiedCooldown(TwosideKeeper.DEATHMARK_COOLDOWN,player)+20;
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), 20);
}
}
@ -3026,6 +3099,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (Artifact.isArtifact(ev.getItemInHand()) && !GenericFunctions.isArtifactEquip(ev.getItemInHand())) {
ev.setCancelled(true);
}
if (ItemSet.isSetItem(ev.getItemInHand())) {
ev.setCancelled(true);
}
}
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled = true)
@ -3309,18 +3386,30 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
if (PlayerMode.isSlayer(ev.getPlayer()) && !GenericFunctions.isViewingInventory(ev.getPlayer())) {
ev.setCancelled(true);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(ev.getPlayer());
if (pd.lastassassinatetime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,ev.getPlayer())<=TwosideKeeper.getServerTickTime()) {
//ev.getPlayer().getEquipment().setItemInMainHand(ev.getItemDrop().getItemStack());
GenericFunctions.PerformAssassinate(ev.getPlayer(),ev.getItemDrop().getItemStack().getType());
//ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
}
return;
}
if (ev.getItemDrop().getItemStack().getType()==Material.SHIELD && !GenericFunctions.isViewingInventory(ev.getPlayer())) {
ev.setCancelled(true);
if (ev.getPlayer().getEquipment().getItemInMainHand()==null || ev.getPlayer().getEquipment().getItemInMainHand().getType()==Material.AIR) {
ev.getPlayer().getEquipment().setItemInMainHand(ev.getItemDrop().getItemStack());
PlayerStructure pd = PlayerStructure.GetPlayerStructure(ev.getPlayer());
if (pd.last_rejuvenate+TwosideKeeper.REJUVENATE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
if (pd.last_rejuvenate+GenericFunctions.GetModifiedCooldown(TwosideKeeper.REJUVENATE_COOLDOWN,ev.getPlayer())<=TwosideKeeper.getServerTickTime() && PlayerMode.isDefender(ev.getPlayer())) {
GenericFunctions.PerformRejuvenate(ev.getPlayer());
pd.last_rejuvenate = TwosideKeeper.getServerTickTime();
aPlugin.API.damageItem(ev.getPlayer(), ev.getItemDrop().getItemStack(), 400);
}
ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
}
return;
}
if (ev.getItemDrop().getItemStack().getType()==Material.BOW && !GenericFunctions.isViewingInventory(ev.getPlayer())) {
@ -3330,6 +3419,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.PerformDodge(ev.getPlayer());
ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
}
return;
}
if (GenericFunctions.holdingNoShield(ev.getPlayer()) &&
@ -3338,85 +3428,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true);
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
boolean second_charge = (CustomDamage.isInIframe(ev.getPlayer()) || (ev.getPlayer().hasPotionEffect(PotionEffectType.SLOW) && GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, ev.getPlayer())==20));
//ev.getPlayer().getEquipment().setItemInMainHand(ev.getItemDrop().getItemStack());
if ((ev.getPlayer().isOnGround() || second_charge) &&
pd.last_strikerspell+LINEDRIVE_COOLDOWN<getServerTickTime()) {
pd.last_strikerspell+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LINEDRIVE_COOLDOWN,ev.getPlayer())<getServerTickTime()) {
if (pd.target!=null &&
!pd.target.isDead()) {
pd.target.setNoDamageTicks(0);
}
ev.getPlayer().getEquipment().setItemInMainHand(ev.getItemDrop().getItemStack());
boolean ex_version = ItemSet.hasFullSet(ev.getPlayer(), ItemSet.PANROS);
ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
ev.getItemDrop().setPickupDelay(0);
Vector facing = ev.getPlayer().getLocation().getDirection();
if (!second_charge) {
facing = ev.getPlayer().getLocation().getDirection().setY(0);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.SLOW,(ex_version)?7:15,20,ev.getPlayer());
}
if (!ex_version || second_charge) {
aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), LINEDRIVE_COOLDOWN);
aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), LINEDRIVE_COOLDOWN);
pd.last_strikerspell=getServerTickTime();
}
ev.getPlayer().playSound(ev.getPlayer().getLocation(), Sound.UI_BUTTON_CLICK, 1.0f, 1.0f);
aPlugin.API.damageItem(ev.getPlayer(), ev.getItemDrop().getItemStack(), (ev.getItemDrop().getItemStack().getType().getMaxDurability()/10)+7);
final PlayerDropItemEvent ev1 = ev;
final Player p1 = ev1.getPlayer();
int mult=2;
final double xspd=ev1.getPlayer().getLocation().getDirection().getX()*mult;
double tempyspd=0;
final double yspd=tempyspd;
final double zspd=ev1.getPlayer().getLocation().getDirection().getZ()*mult;
final double xpos=ev1.getPlayer().getLocation().getX();
final double ypos=ev1.getPlayer().getLocation().getY();
final double zpos=ev1.getPlayer().getLocation().getZ();
final Vector facing1 = facing;
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
ev1.getPlayer().setVelocity(facing1.multiply(8));
GenericFunctions.addIFrame(ev1.getPlayer(), 10);
ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ITEM_CHORUS_FRUIT_TELEPORT, 1.0f, 1.0f);
final Location newpos=new Location(ev1.getPlayer().getWorld(),xpos,ypos,zpos);
double dmgdealt=CustomDamage.getBaseWeaponDamage(ev.getItemDrop().getItemStack(), ev1.getPlayer(), null);
List<Monster> monsters = GenericFunctions.getNearbyMobs(newpos, 2);
for (int i=0;i<monsters.size();i++) {
GenericFunctions.removeNoDamageTick(monsters.get(i), ev1.getPlayer());
}
for (int i=0;i<50;i++) {
newpos.getWorld().playEffect(newpos, Effect.FLAME, 60);
}
GenericFunctions.DealDamageToNearbyMobs(newpos, dmgdealt, 2, true, 0.8d, ev1.getPlayer(), ev.getItemDrop().getItemStack(), true);
//DecimalFormat df = new DecimalFormat("0.00");
ev1.getPlayer().playSound(ev1.getPlayer().getLocation(), Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.5f);
int range=8;
for (int i=0;i<range;i++) {
final double xpos2=ev1.getPlayer().getLocation().getX();
final double ypos2=ev1.getPlayer().getLocation().getY();
final double zpos2=ev1.getPlayer().getLocation().getZ();
final Location newpos2=new Location(ev1.getPlayer().getWorld(),xpos2,ypos2,zpos2).add(i*xspd,i*yspd,i*zspd);
for (int j=0;j<50;j++) {
newpos.getWorld().playEffect(newpos, Effect.FLAME, 60);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("TwosideKeeper"), new Runnable() {
public void run() {
GenericFunctions.DealDamageToNearbyMobs(newpos2, dmgdealt, 2, true, 0.4d, ev1.getPlayer(), ev.getItemDrop().getItemStack(), true);
p1.playSound(newpos2, Sound.ENTITY_ARMORSTAND_HIT, 1.0f, 0.3f);
}
},1);
}
}
},(ex_version)?7:15);
if (ex_version) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), LINEDRIVE_COOLDOWN);
aPlugin.API.sendCooldownPacket(ev.getPlayer(), ev.getItemDrop().getItemStack(), LINEDRIVE_COOLDOWN);
pd.last_strikerspell=getServerTickTime();
}
},17);
}
if (PlayerMode.isStriker(ev.getPlayer())) {
ev.getItemDrop().setPickupDelay(0);
GenericFunctions.PerformLineDrive(ev.getPlayer(), ev.getItemDrop().getItemStack(), second_charge);
}
ev.getPlayer().getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
}
} else {
if (ev.getItemDrop().getItemStack().getType().toString().contains("SWORD") &&
@ -3424,9 +3450,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true);
}
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
return;
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onInventoryOpen(InventoryOpenEvent ev) {
PlayerStructure pd = (PlayerStructure)playerdata.get(ev.getPlayer().getUniqueId());
pd.isViewingInventory=true;
@ -3468,7 +3495,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
log("-------",2);
Bukkit.getScheduler().scheduleSyncDelayedTask(this,new DropDeathItems(p,contents,deathloc),1);
List<ItemStack> list=new ArrayList<ItemStack>();
for (int i=0;i<contents.getSize();i++) {
if (contents.getItem(i)!=null &&
contents.getItem(i).getType()!=Material.AIR) {
list.add(contents.getItem(i));
}
}
Bukkit.getScheduler().scheduleSyncDelayedTask(this,new DropDeathItems(p,list,deathloc),1);
}
@ -3549,7 +3583,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
setPlayerMaxHealth(player);
setPlayerMaxHealth(player,player.getHealth()/player.getMaxHealth());
}
},1);
}
@ -3567,6 +3601,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("Saturation increased to "+pd.saturation+". Old saturation: "+((Player)ev.getEntity()).getSaturation(),4);
}
}
if (ev.getEntity() instanceof Player) {
Player p = (Player)ev.getEntity();
if (p!=null) {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
}
}
}
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
@ -4321,6 +4362,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (PlayerMode.isRanger((Player)ev.getEntity())) {
dmgdealt=0.25;
}
if (PlayerMode.isSlayer((Player)ev.getEntity()) &&
ItemSet.GetSetCount(GenericFunctions.getHotbarItems((Player)ev.getEntity()), ItemSet.LORASYS, (Player)ev.getEntity())>0) {
dmgdealt=0.0;
}
}
ev.getEntity().getWorld().playSound(ev.getEntity().getLocation(), Sound.ENCHANT_THORNS_HIT, 1.0f, 1.0f);
CustomDamage.setupTrueDamage(ev);
@ -4352,8 +4397,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (CustomDamage.getDamagerEntity(ev.getDamager()) instanceof Player) {
Player p = (Player)CustomDamage.getDamagerEntity(ev.getDamager());
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (PlayerMode.isDefender(p) && ItemSet.GetSetCount(ItemSet.SONGSTEEL, p)>=5 && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead.
if (PlayerMode.isDefender(p) && ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL,5) && pd.vendetta_amt>0.0) { //Deal Vendetta damage instead.
p.playSound(p.getLocation(), Sound.BLOCK_GLASS_BREAK, 1.0f, 0.5f);
GenericFunctions.removeNoDamageTick((LivingEntity)ev.getEntity(), ev.getDamager());
CustomDamage.ApplyDamage(pd.vendetta_amt, ev.getDamager(), (LivingEntity)ev.getEntity(), null, "Vendetta");
pd.vendetta_amt=0.0;
aPlugin.API.sendActionBarMessage(p, ChatColor.YELLOW+"Vendetta: "+ChatColor.GREEN+Math.round(pd.vendetta_amt)+" dmg stored");
@ -4380,8 +4426,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
CustomDamage.setupTrueDamage(ev);
ev.setDamage(DamageModifier.BASE, dmgdealt);
if (dmgdealt < 1) {
ev.setDamage(DamageModifier.BASE,dmgdealt);
if (dmgdealt < 1) {
ev.setDamage(DamageModifier.BASE,dmgdealt);
} else {
ev.setDamage(DamageModifier.BASE,1d);
((LivingEntity)ev.getEntity()).setHealth(Math.max(((LivingEntity)ev.getEntity()).getHealth() - (dmgdealt - 1d), 0.5));
@ -4412,14 +4458,25 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void onEndermanTeleport(EntityTeleportEvent ev) {
if (GenericFunctions.isSuppressed(ev.getEntity())) {
ev.setTo(ev.getFrom());
ev.setCancelled(true);
return;
}
if (ev.getEntity() instanceof Monster && MonsterController.getMonsterDifficulty((Monster)ev.getEntity()).equals(MonsterDifficulty.ELITE)) {
ev.setTo(ev.getFrom());
ev.setCancelled(true);
return;
}
if (ev.getEntity().isDead()) {
ev.setTo(ev.getFrom());
ev.setCancelled(true);
return;
}
if (ev.getEntityType()==EntityType.ENDERMAN) {
//There is a small chance to drop a Mysterious Essence.
if (/*Math.random()<=0.0625*ARTIFACT_RARITY &&*/ ((Monster)ev.getEntity()).getTarget()==null &&
@ -4455,6 +4512,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void creeperExplodeEvent(ExplosionPrimeEvent ev) {
log("Explosion Entity Type: "+ev.getEntityType().toString(),5);
if (GenericFunctions.isSuppressed(ev.getEntity())) {
ev.setCancelled(true);
return;
}
if (ev.getEntity() instanceof Creeper) {
log("This is a creeper.",5);
final Creeper c = (Creeper)ev.getEntity();
@ -4582,8 +4645,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getEntity() instanceof Monster) {
Player p = (Player)ev.getTarget();
Monster m = (Monster)ev.getEntity();
if (p.hasPotionEffect(PotionEffectType.INVISIBILITY) &&
PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
if (GenericFunctions.hasStealth(p) &&
m.getTarget()==null) {
ev.setCancelled(true);
}
}
@ -4703,6 +4766,45 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Player p = (Player)ms.GetTarget();
boolean isRanger=PlayerMode.isRanger(p);
boolean isSlayer=PlayerMode.isSlayer(p);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER && pd.lastassassinatetime+20>getServerTickTime()) {
pd.lastassassinatetime=getServerTickTime()-GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,p);
ItemStack[] inv = p.getInventory().getContents();
for (int i=0;i<8;i++) {
if (inv[i]!=null && (inv[i].getType()!=Material.SKULL_ITEM || pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,p)<TwosideKeeper.getServerTickTime())) {
aPlugin.API.sendCooldownPacket(p, inv[i], 0);
}
}
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.SPEED, 10*20, 4);
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7)) {
//Apply damage to everything around the player.
List<Monster> mobs = GenericFunctions.getNearbyMobs(m.getLocation(), 8);
for (Monster m1 : mobs) {
if (!m1.equals(m)) {
CustomDamage.ApplyDamage(0,p,m1,p.getEquipment().getItemInMainHand(),"AoE Damage",CustomDamage.NOAOE);
}
}
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9, 2);
} else {
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9);
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7)) {
pd.slayermegahit=true;
}
GenericFunctions.applyStealth(p, false);
}
if (isSlayer) {
int restore_amt = (ItemSet.GetSetCount(GenericFunctions.getHotbarItems(p), ItemSet.LORASYS, p)>0)?4:2;
if (pd.slayermodehp+restore_amt<p.getMaxHealth()) {
pd.slayermodehp+=restore_amt;
} else {
pd.slayermodehp = p.getMaxHealth();
}
p.setHealth(pd.slayermodehp);
}
if (isRanger) {
switch (GenericFunctions.getBowMode(p.getEquipment().getItemInMainHand())) {
@ -4813,17 +4915,19 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
final int expdrop = totalexp;
droplist.clear(); //Clear the drop list. We are going to delay the drops.
droplist.addAll(originaldroplist);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer.getLocation().getBlockY()<48) {
mer.getWorld().createExplosion(mer.getLocation().getBlockX(), mer.getLocation().getBlockY(), mer.getLocation().getBlockZ(), 3.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 8, 3);
} else {
mer.getWorld().createExplosion(mer.getLocation().getBlockX(), mer.getLocation().getBlockY(), mer.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 8, 6);
}
}}
,30);
if (!GenericFunctions.isSuppressed(m)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer.getLocation().getBlockY()<48) {
mer.getWorld().createExplosion(mer.getLocation().getBlockX(), mer.getLocation().getBlockY(), mer.getLocation().getBlockZ(), 3.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 8, 3);
} else {
mer.getWorld().createExplosion(mer.getLocation().getBlockX(), mer.getLocation().getBlockY(), mer.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer.getLocation(), 8, 6);
}
}}
,30);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
for (int i=0;i<drop.size();i++) {
@ -4842,19 +4946,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
final int expdrop1 = totalexp;
droplist.clear(); //Clear the drop list. We are going to delay the drops.
droplist.addAll(originaldroplist);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer1.getLocation().getBlockY()<48) {
mer1.getWorld().createExplosion(mer1.getLocation().getBlockX(), mer1.getLocation().getBlockY(), mer1.getLocation().getBlockZ(), 5.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 12, 5);
GenericFunctions.RandomlyCreateFire(mer1.getLocation(),2);
} else {
mer1.getWorld().createExplosion(mer1.getLocation().getBlockX(), mer1.getLocation().getBlockY(), mer1.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 12, 6);
GenericFunctions.RandomlyCreateFire(mer1.getLocation(),3);
}
}}
,30);
if (!GenericFunctions.isSuppressed(m)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer1.getLocation().getBlockY()<48) {
mer1.getWorld().createExplosion(mer1.getLocation().getBlockX(), mer1.getLocation().getBlockY(), mer1.getLocation().getBlockZ(), 5.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 12, 5);
GenericFunctions.RandomlyCreateFire(mer1.getLocation(),2);
} else {
mer1.getWorld().createExplosion(mer1.getLocation().getBlockX(), mer1.getLocation().getBlockY(), mer1.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer1.getLocation(), 12, 6);
GenericFunctions.RandomlyCreateFire(mer1.getLocation(),3);
}
}}
,30);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
for (int i=0;i<drop.size();i++) {
@ -4873,19 +4979,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
final int expdrop4 = totalexp;
droplist.clear(); //Clear the drop list. We are going to delay the drops.
droplist.addAll(originaldroplist);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer4.getLocation().getBlockY()<48) {
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 5.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 12, 5);
GenericFunctions.RandomlyCreateFire(mer4.getLocation(),2);
} else {
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 12, 6);
GenericFunctions.RandomlyCreateFire(mer4.getLocation(),3);
}
}}
,30);
if (!GenericFunctions.isSuppressed(m)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer4.getLocation().getBlockY()<48) {
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 5.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 150, 5);
GenericFunctions.RandomlyCreateFire(mer4.getLocation(),2);
} else {
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 150, 6);
GenericFunctions.RandomlyCreateFire(mer4.getLocation(),3);
}
}}
,30);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
for (int i=0;i<drop.size();i++) {
@ -4951,6 +5059,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.lastdeath=getServerTickTime();
pd.hasDied=false;
pd.slayermodehp=10;
//log("Block started on is "+ev.getRespawnLocation().getBlock(),2);
//p.teleport(GenericFunctions.FindRandomFreeLocation(p.getLocation().add(0,1,0)));
Location newloc = ev.getRespawnLocation();
@ -5284,7 +5393,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
//See if this armor type is not being worn by the player.
if (armor.getType().toString().contains("BOOTS") &&
p.getEquipment().getBoots()==null &&
(!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
(!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER"))) &&
!PlayerMode.isSlayer(p)) {
p.getEquipment().setBoots(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -5293,7 +5403,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else
if (armor.getType().toString().contains("LEGGINGS") &&
p.getEquipment().getLeggings()==null &&
(!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
(!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER"))) &&
!PlayerMode.isSlayer(p)) {
p.getEquipment().setLeggings(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -5302,7 +5413,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else
if (armor.getType().toString().contains("CHESTPLATE") &&
p.getEquipment().getChestplate()==null &&
(!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
(!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER"))) &&
!PlayerMode.isSlayer(p)) {
p.getEquipment().setChestplate(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -5311,7 +5423,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} else
if (armor.getType().toString().contains("HELMET") &&
p.getEquipment().getHelmet()==null &&
(!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER")))) {
(!PlayerMode.isRanger(p) || (armor.getType().toString().contains("LEATHER"))) &&
!PlayerMode.isSlayer(p)) {
p.getEquipment().setHelmet(armor);
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(item.getItemMeta().hasDisplayName()?item.getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(item)));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);
@ -6295,10 +6408,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
String bar = " ";
if (pcthp==100) {bar += ((isHungry)?ChatColor.BLUE:ChatColor.AQUA)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);} else
if (pcthp>66) {bar += ((isHungry)?ChatColor.DARK_GREEN:ChatColor.GREEN)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);}
else if (pcthp>33) {bar += ((isHungry)?ChatColor.GOLD:ChatColor.YELLOW)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);}
else {bar += ((isHungry)?ChatColor.DARK_RED:ChatColor.RED)+""+Math.round(p.getHealth())+""+Character.toString((char)0x2665);}
boolean isslayer = PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
double hpval = (isslayer)?pd.slayermodehp:p.getHealth();
if (isslayer) {p.setHealth(pd.slayermodehp);}
if (pcthp==100) {bar += ((isHungry)?ChatColor.BLUE:ChatColor.AQUA)+""+Math.round(hpval)+""+Character.toString((char)0x2665);} else
if (pcthp>66) {bar += ((isHungry)?ChatColor.DARK_GREEN:ChatColor.GREEN)+""+Math.round(hpval)+""+Character.toString((char)0x2665);}
else if (pcthp>33) {bar += ((isHungry)?ChatColor.GOLD:ChatColor.YELLOW)+""+Math.round(hpval)+""+Character.toString((char)0x2665);}
else {bar += ((isHungry)?ChatColor.DARK_RED:ChatColor.RED)+""+Math.round(hpval)+""+Character.toString((char)0x2665);}
/*
if (absorptionlv>0) {
@ -6516,6 +6635,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
public static void setPlayerMaxHealth(Player p) {
setPlayerMaxHealth(p,null);
}
public static void setPlayerMaxHealth(Player p, Double ratio) {
//Determine player max HP based on armor being worn.
double hp=10; //Get the base max health.
//Get all equips.
@ -6572,6 +6695,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
//Check the hotbar for set equips.
hp+=ItemSet.GetTotalBaseAmount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN);
}
log("Health is now "+hp,5);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
maxdeduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
@ -6592,7 +6719,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SONGSTEEL, 2, 2);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL, 2, 2);
/*
if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) {
@ -6603,7 +6730,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}*/
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 2, 2)+ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 3, 3);
hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 2, 2)+ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 3, 3);
/*hp+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.ALIKAHN, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DARNYS, 4, 4)+
ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LORASAADI, 4, 4)+
@ -6612,12 +6739,24 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
hp*=maxdeduction;
p.resetMaxHealth();
if (p.getHealth()>=hp) {
p.setHealth(hp);
}
if (p.getHealth()>=hp) {
p.setHealth(hp);
}
p.setMaxHealth(hp);
if (!p.isDead()) {
p.setHealth(p.getHealth());
if (ratio==null) {
p.setHealth(p.getHealth());
} else {
//TwosideKeeper.log("Hp is "+hp+". Ratio is "+ratio+". Setting to "+, loglv);
p.setHealth(ratio*p.getMaxHealth());
}
}
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
double slayermodehp = PlayerStructure.GetPlayerStructure(p).slayermodehp;
if (slayermodehp>p.getMaxHealth()) {
slayermodehp = PlayerStructure.GetPlayerStructure(p).slayermodehp = p.getMaxHealth();
}
p.setHealth(slayermodehp);
}
p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(hp);
}
@ -6922,10 +7061,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (all || lifestealamt>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Life Steal: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(lifestealamt)+"%");}
double critchance = (CustomDamage.calculateCriticalStrikeChance(p.getEquipment().getItemInMainHand(), p))*100;
if (all || critchance>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Critical Strike Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(critchance)+"%");}
double critdamage = CustomDamage.calculateCriticalStrikeMultiplier(p, p.getEquipment().getItemInMainHand())*100+100;
if (all || (critdamage>200 && critchance>0)) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Crit Damage: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(critdamage)+"%");}
if (PlayerMode.isDefender(p)) {
double dodgechance=0.0;
if (!p.isBlocking()) {
dodgechance+=ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d;
dodgechance+=ItemSet.GetTotalBaseAmount(GenericFunctions.getEquipment(p), p, ItemSet.SONGSTEEL)/100d;
}
if (all || dodgechance>0) {
receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Block Chance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format((CustomDamage.CalculateDodgeChance(p)+dodgechance)*100)+"%");
@ -6936,6 +7077,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
double debuffresistchance = CustomDamage.CalculateDebuffResistance(p);
if (all || debuffresistchance>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Debuff Resistance: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(debuffresistchance)+"%");}
double cooldownreduction = CustomDamage.calculateCooldownReduction(p);
if (all || cooldownreduction>0) {receiver.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Cooldown Reduction: "+ChatColor.RESET+""+ChatColor.DARK_AQUA+df.format(cooldownreduction*100)+"%");}
TextComponent f = new TextComponent(ChatColor.GRAY+""+ChatColor.ITALIC+"Current Mode: ");
f.addExtra(GenericFunctions.PlayerModeName(p));
if (receiver instanceof Player) {

@ -387,6 +387,10 @@ public final class TwosideKeeperAPI {
public static String getLocalizedItemName(Material i) {
return GenericFunctions.UserFriendlyMaterialName(i);
}
/**
* @deprecated Use the version that requires a short. Using a byte makes no sense
* as durability can be larger than 256.
*/
@Deprecated
public static String getLocalizedItemName(Material i, byte data) {
return GenericFunctions.UserFriendlyMaterialName(i,data);
@ -403,7 +407,7 @@ public final class TwosideKeeperAPI {
return PlayerMode.getPlayerMode(p);
}
/**Returns the amount of cooldown reduction the player has.
0% meaning cooldowns are not reduced at all. 100% meaning cooldowns should be non-existent.
0.0 meaning cooldowns are not reduced at all. 1.0 meaning cooldowns should be non-existent.
* @param p
* @return
*/

Loading…
Cancel
Save