Toxin Set Implementation almost completed. Fixed a major bug with item

drops not working.
patch_branch
sigonasr2 8 years ago
parent f9f4935463
commit 30915bb6b6
  1. BIN
      TwosideKeeper.jar
  2. 23
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  3. 17
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/TemporaryBlock.java
  4. 8
      src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java
  5. 9
      src/sig/plugin/TwosideKeeper/HelperStructures/PlayerMode.java
  6. 5
      src/sig/plugin/TwosideKeeper/LivingEntityStructure.java
  7. 5
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  8. 9
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  9. 145
      src/sig/plugin/TwosideKeeper/runServerHeartbeat.java

Binary file not shown.

@ -779,8 +779,27 @@ public class CustomDamage {
}
private static void applyDoTs(Player p, LivingEntity target) {
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 2, 2)/100d;
if (Math.random()<=)
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 2)) {
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 2, 2)/100d;
int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN);
if (Math.random()<=(basechance + calculateDebuffChance(p))) {
Buff.addBuff(target, "BLEEDING", new Buff("Bleeding",20*15,tier,Color.MAROON,ChatColor.DARK_RED+"☠",false));
}
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 3)) {
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 3, 3)/100d;
int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN);
if (Math.random()<=(basechance + calculateDebuffChance(p))) {
Buff.addBuff(target, "INFECTION", new Buff("Infection",20*10,tier,Color.GRAY,ChatColor.GRAY+"❧",false));
}
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.TOXIN, 4)) {
double basechance = ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.TOXIN, 4, 4)/100d;
int tier = ItemSet.getHighestTierInSet(p, ItemSet.TOXIN);
if (Math.random()<=(basechance + calculateDebuffChance(p))) {
Buff.addBuff(target, "CRIPPLE", new Buff("Cripple",20*10,tier,Color.WHITE,ChatColor.WHITE+"☹",false));
}
}
}
private static void triggerDummyHitEvent(LivingEntity target, double damage) {

@ -1,6 +1,7 @@
package sig.plugin.TwosideKeeper.HelperStructures.Effects;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -220,4 +221,20 @@ public class TemporaryBlock {
return null;
}
}
public static void createTemporaryBlockCircle(Location center, int radius, Material convertedmat, byte converteddata, int duration, String specialKey) {
int width=0;
for (int i=-radius;i<=radius;i++) {
Location offset = center.clone().add(0,0,i);
for (int j=-width;j<=width;j++) {
Block b = offset.getBlock().getRelative(j, 0, 0);
new TemporaryBlock(b, convertedmat, converteddata, duration, specialKey);
}
if (i<0) {
width++;
} else {
width--;
}
}
}
}

@ -950,15 +950,15 @@ public enum ItemSet {
break;
case TOXIN:
lore.add(ChatColor.GOLD+""+ChatColor.ITALIC+"Set Bonus:");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Chance of projectiles applying Bleeding "+WorldShop.toRomanNumeral(tier)+" to target.");
lore.add(ChatColor.DARK_AQUA+" 2 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 2)+"% Chance of projectiles applying Bleeding "+WorldShop.toRomanNumeral(tier)+" to target (15 sec).");
lore.add(ChatColor.GRAY+" (Bleed deals faster damage over time compared to Poison.");
lore.add(ChatColor.GRAY+" it is not affected by Poison Resistance.)");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Chance of projectiles applying Infection "+WorldShop.toRomanNumeral(tier)+" to target.");
lore.add(ChatColor.DARK_AQUA+" 3 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 3)+"% Chance of projectiles applying Infection "+WorldShop.toRomanNumeral(tier)+" to target (10 sec).");
lore.add(ChatColor.GRAY+" (Infection deals damage over time and applies all debuffs");
lore.add(ChatColor.GRAY+" this target has to nearby targets.)");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Chance of projectiles applying Cripple "+WorldShop.toRomanNumeral(tier)+" to target.");
lore.add(ChatColor.DARK_AQUA+" 4 - "+ChatColor.WHITE+" +"+ItemSet.GetBaseAmount(set, tier, 4)+"% Chance of projectiles applying Cripple "+WorldShop.toRomanNumeral(tier)+" to target (10 sec).");
lore.add(ChatColor.GRAY+" (Cripple slows the target and decreases target's damage");
lore.add(ChatColor.GRAY+" by 10% per level.)");
lore.add(ChatColor.GRAY+" outpu t by 10% per level.)");
lore.add(ChatColor.DARK_AQUA+" 5 - "+ABILITY_LABEL+" Fire Cesspool"+ABILITY_LABEL_END);
lore.add(ChatColor.GRAY+" Shooting projectiles at the ground converts the land into");
lore.add(ChatColor.GRAY+" a temporary fire pool, applying stacking Burn to all");

@ -17,7 +17,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 x1-x5 damage, based on target's missing health. This costs 5% of your durability (Unbreaking decreases this amount.)\n"
+ ChatColor.WHITE+"->Press the drop key to 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",
@ -34,9 +34,8 @@ public enum PlayerMode {
+ ChatColor.GRAY+" Headshot collision area increases by x3. Headshots will deal an extra x0.25 damage for each headshot landed, up to a cap of 8 stacks. Each stack also increases your Slowness level by 1. You lose 10% dodge chance per Slowness stack, but gain one Resistance level and 10% critical chance per Slowness stack.\n"
+ ChatColor.WHITE+" Arrows are lightning-fast in Sniping Mode.\n"
+ ChatColor.GRAY+" Press the drop key in Sniping Mode to unleash 26 piercing arrows rapidly against your enemies.\n\n"
+ ChatColor.GRAY+"- "+ChatColor.BOLD+"Debilitation Mode:"+ChatColor.RESET+ChatColor.WHITE+" \n"
+ ChatColor.WHITE+" Adds a stack of Poison when hitting non-poisoned targets (20 second duration). Hitting mobs in this mode refreshes the duration of the poison stacks. Headshots made in this mode will increase the level of Poison on the mob, making the mob more and more vulnerable.\n"
+ ChatColor.GRAY+" Headshots also remove one level of a buff (does not affect debuffs) applied to the mob at random.\n"
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Debilitation Mode:"+ChatColor.RESET+ChatColor.WHITE+" \n"
+ ChatColor.GRAY+" Adds a stack of Poison when hitting non-poisoned targets (20 second duration). Hitting mobs in this mode refreshes the duration of the poison stacks. Headshots made in this mode will increase the level of Poison on the mob, making the mob more and more vulnerable.\n"
+ ChatColor.WHITE+" Press the drop key in Debilitation Mode when at least 1 poisoned target is nearby. Deals (Poison Level x 10) True Damage and Slows all targets the same level as the number of poison stacks applied to nearby targets for 15 seconds, and grants 4 Absorption health (2 hearts) to the Ranger per poison stack. Refreshes Poison duration on all nearby poisoned targets.\n"),
DEFENDER(ChatColor.GRAY,"D","Defender",
ChatColor.GRAY+""+ChatColor.BOLD+"Defender mode Perks: "+ChatColor.RESET+"\n"
@ -53,7 +52,7 @@ public enum PlayerMode {
+ ChatColor.WHITE+"->Hitting mobs as a Defender aggros them to you.\n"
+ ChatColor.GRAY+"->Knockback from attacks reduced by 75% while blocking.\n"
+ ChatColor.WHITE+"- "+ChatColor.BOLD+"Rejuvenation"+ChatColor.RESET+ChatColor.WHITE+"\n"
+ ChatColor.GRAY+"->Dropping your shield will give you Regeneration X for 10 seconds and 2 seconds of invulnerability. It also costs 400 shield durability!\n"),
+ ChatColor.GRAY+"->Dropping your shield will give you 10 seconds of massive health regeneration and 2 seconds of invulnerability. It also costs 400 shield durability!\n"),
BARBARIAN(ChatColor.GOLD,"B","Barbarian",
ChatColor.GOLD+""+ChatColor.BOLD+"Barbarian mode Perks: "+ChatColor.RESET+"\n"
+ ChatColor.WHITE+"->Players are identified as 'Barbarians' by wielding an axe in both the main hand and the offhand.\n"

@ -31,6 +31,11 @@ public class LivingEntityStructure {
public long lastpotionparticles=0;
public long lastPoisonTick=0;
public long lastShrapnelTick=0;
public long lastBleedingTick=0;
public long lastInfectionTick=0;
public long lastCrippleTick=0;
public long lastBurnTick=0;
public float MoveSpeedMultBeforeCripple=1f;
public LivingEntityStructure(LivingEntity m) {
target=null;

@ -202,6 +202,11 @@ public class PlayerStructure {
public Location restartLoc = null; //Set to a value when the player has to be re-teleported after being controlled by a camera.
public long lastPoisonTick=0;
public long lastShrapnelTick=0;
public long lastBleedingTick=0;
public long lastInfectionTick=0;
public long lastCrippleTick=0;
public long lastBurnTick=0;
public float MoveSpeedMultBeforeCripple=1f;
List<ItemStack> equipmentset = new ArrayList<ItemStack>();

@ -3152,6 +3152,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.DealExplosionDamageToEntities(ev.getEntity().getLocation(), 40f+shooter.getHealth()*0.1, 2, shooter, "Shrapnel Explosion");
aPlugin.API.sendSoundlessExplosion(ev.getEntity().getLocation(), 1);
SoundUtils.playGlobalSound(ev.getEntity().getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.6f, 0.5f);
} else
if (ItemSet.hasFullSet(p, ItemSet.TOXIN)) {
TemporaryBlock.createTemporaryBlockCircle(a.getLocation().add(0,-1,0), 2, Material.REDSTONE_BLOCK, (byte)0, 100, "FIRECESSPOOL");
}
}
a.setCustomName("HIT");
@ -6952,6 +6955,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
m.setCustomName(ms.getOriginalName());
}
}*/
if (livingentitydata.containsKey(m.getUniqueId())) {
ms = (LivingEntityStructure)livingentitydata.get(m.getUniqueId());
}
if (ms!=null && (ms.GetTarget() instanceof Player)) {
if ((m instanceof Slime) ||
@ -6971,7 +6977,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
habitat_data.addKillToLocation(m);
}
habitat_data.startinglocs.remove(m.getUniqueId());
log("Killed by a player.",5);
log("Killed by a player.",0);
killedByPlayer = true;
Player p = (Player)ms.GetTarget();
AwardDeathAchievements(p,ev.getEntity());
@ -7011,6 +7017,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
dropmult+=GenericFunctions.getAbilityValue(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())/100d;
}
} else {
TwosideKeeper.log("killedByPlayer flag set to false.", 0);
killedByPlayer=false;
}
}

@ -346,29 +346,148 @@ final class runServerHeartbeat implements Runnable {
if (ent instanceof Player) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)ent);
if (Buff.hasBuff(ent, "Poison") && pd.lastPoisonTick+getPoisonTickDelay(ent)<=TwosideKeeper.getServerTickTime()) {
CustomDamage.ApplyDamage(Buff.getBuff(ent, "Poison").getAmplifier(), null, ent, null, "POISON", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastPoisonTick=TwosideKeeper.getServerTickTime();
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage(Buff.getBuff(ent, "Poison").getAmplifier(), null, ent, null, "POISON", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastPoisonTick=TwosideKeeper.getServerTickTime();
}, (int)(Math.random()*10));
}
if (Buff.hasBuff(ent, "SHRAPNEL") && pd.lastShrapnelTick<=TwosideKeeper.getServerTickTime()) {
CustomDamage.ApplyDamage((Buff.getBuff(ent, "SHRAPNEL").getAmplifier()*2)*(1d-CustomDamage.getFireResistance(ent)), null, ent, null, "Shrapnel", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastShrapnelTick=TwosideKeeper.getServerTickTime();
SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
ent.getWorld().spawnParticle(Particle.LAVA, ent.getEyeLocation(), CustomDamage.GetHeartAmount(Buff.getBuff(ent, "SHRAPNEL").getAmplifier())*5);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage((Buff.getBuff(ent, "SHRAPNEL").getAmplifier()*2)*(1d-CustomDamage.getFireResistance(ent)), null, ent, null, "Shrapnel", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastShrapnelTick=TwosideKeeper.getServerTickTime();
SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
ent.getWorld().spawnParticle(Particle.LAVA, ent.getEyeLocation(), CustomDamage.GetHeartAmount(Buff.getBuff(ent, "SHRAPNEL").getAmplifier())*5);
}, (int)(Math.random()*10));
}
if (Buff.hasBuff(ent, "BLEEDING") && pd.lastBleedingTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastBleedingTick=TwosideKeeper.getServerTickTime();
//SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
//ent.getWorld().spawnParticle(Particle.LAVA, ent.getEyeLocation(), CustomDamage.GetHeartAmount(Buff.getBuff(ent, "SHRAPNEL").getAmplifier())*5);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
}, 10); //Bleeding DOT is twice as fast.
}, (int)(Math.random()*10));
}
if (Buff.hasBuff(ent, "INFECTION") && pd.lastInfectionTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage(Buff.getBuff(ent, "INFECTION").getAmplifier(), null, ent, null, "Infection", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastInfectionTick=TwosideKeeper.getServerTickTime();
infectNearbyPlayers(ent,pd.buffs);
}, (int)(Math.random()*10));
}
if (Buff.hasBuff(ent, "CRIPPLE") && aPlugin.API.getPlayerSpeedMultiplier((Player)ent)>(1-(Buff.getBuff(ent,"CRIPPLE").getAmplifier()*0.1))) {
float cripplespd = (float)((1-(Buff.getBuff(ent,"CRIPPLE").getAmplifier()*0.1)));
pd.MoveSpeedMultBeforeCripple = aPlugin.API.getPlayerSpeedMultiplier((Player)ent);
aPlugin.API.setPlayerSpeedMultiplier((Player)ent, cripplespd);
} else
if (pd.MoveSpeedMultBeforeCripple!=1f && !Buff.hasBuff(ent, "CRIPPLE")) {
aPlugin.API.setPlayerSpeedMultiplier((Player)ent, pd.MoveSpeedMultBeforeCripple);
pd.MoveSpeedMultBeforeCripple=1f;
}
if (Buff.hasBuff(ent, "BURN") && pd.lastBurnTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage(Buff.getBuff(ent, "BURN").getAmplifier(), null, ent, null, "Burn", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
pd.lastBurnTick=TwosideKeeper.getServerTickTime();
}, (int)(Math.random()*10));
}
} else {
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(ent);
if (Buff.hasBuff(ent, "Poison") && les.lastPoisonTick+getPoisonTickDelay(ent)<=TwosideKeeper.getServerTickTime()) {
CustomDamage.ApplyDamage(Buff.getBuff(ent, "Poison").getAmplifier(), null, ent, null, "POISON", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastPoisonTick=TwosideKeeper.getServerTickTime();
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage(Buff.getBuff(ent, "Poison").getAmplifier(), null, ent, null, "POISON", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastPoisonTick=TwosideKeeper.getServerTickTime();
}, (int)(Math.random()*10));
}
if (Buff.hasBuff(ent, "SHRAPNEL") && les.lastShrapnelTick<=TwosideKeeper.getServerTickTime()) {
CustomDamage.ApplyDamage((Buff.getBuff(ent, "SHRAPNEL").getAmplifier()*2)*(1d-CustomDamage.getFireResistance(ent)), null, ent, null, "Shrapnel", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastShrapnelTick=TwosideKeeper.getServerTickTime();
//SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
SoundUtils.playGlobalSound(ent.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
ent.getWorld().spawnParticle(Particle.LAVA, ent.getEyeLocation(), CustomDamage.GetHeartAmount(Buff.getBuff(ent, "SHRAPNEL").getAmplifier())*5);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage((Buff.getBuff(ent, "SHRAPNEL").getAmplifier()*2)*(1d-CustomDamage.getFireResistance(ent)), null, ent, null, "Shrapnel", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastShrapnelTick=TwosideKeeper.getServerTickTime();
//SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
SoundUtils.playGlobalSound(ent.getLocation(), Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
ent.getWorld().spawnParticle(Particle.LAVA, ent.getEyeLocation(), CustomDamage.GetHeartAmount(Buff.getBuff(ent, "SHRAPNEL").getAmplifier())*5);
}, (int)(Math.random()*10));
}
if (Buff.hasBuff(ent, "BLEEDING") && les.lastBleedingTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastBleedingTick=TwosideKeeper.getServerTickTime();
//SoundUtils.playLocalSound((Player)ent, Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1.0f, 1.0f);
//ent.getWorld().spawnParticle(Particle.LAVA, ent.getEyeLocation(), CustomDamage.GetHeartAmount(Buff.getBuff(ent, "SHRAPNEL").getAmplifier())*5);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage((Buff.getBuff(ent, "BLEEDING").getAmplifier()), null, ent, null, "Bleeding", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
}, 10); //Bleeding DOT is twice as fast.
}, (int)(Math.random()*10));
}
if (Buff.hasBuff(ent, "INFECTION") && les.lastInfectionTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage(Buff.getBuff(ent, "INFECTION").getAmplifier(), null, ent, null, "Infection", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastInfectionTick=TwosideKeeper.getServerTickTime();
infectNearbyEntities(ent,les.buffs);
}, (int)(Math.random()*10));
}
if (Buff.hasBuff(ent, "CRIPPLE") && ent.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue()>=les.original_movespd*(1-(Buff.getBuff(ent,"CRIPPLE").getAmplifier()*0.1))) {
float cripplespd = (float)((1-(Buff.getBuff(ent,"CRIPPLE").getAmplifier()*0.1)));
les.MoveSpeedMultBeforeCripple=2f; //Just set it to something not 1 to indicate it's been modified.
ent.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(les.original_movespd*cripplespd);
} else
if (les.MoveSpeedMultBeforeCripple!=1f && !Buff.hasBuff(ent, "CRIPPLE")) {
ent.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(les.original_movespd);
les.MoveSpeedMultBeforeCripple=1f;
}
if (Buff.hasBuff(ent, "BURN") && les.lastBurnTick<=TwosideKeeper.getServerTickTime()) {
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
CustomDamage.ApplyDamage(Buff.getBuff(ent, "BURN").getAmplifier(), null, ent, null, "Burn", CustomDamage.IGNOREDODGE|CustomDamage.TRUEDMG|CustomDamage.IGNORE_DAMAGE_TICK);
les.lastBurnTick=TwosideKeeper.getServerTickTime();
}, (int)(Math.random()*10));
}
}
}
private void infectNearbyPlayers(LivingEntity ent, HashMap<String,Buff> buffs) {
HashMap<String,Buff> debuffsToApply = getDebuffsOnly(buffs);
List<Entity> list = ent.getNearbyEntities(2, 1, 2);
for (Entity e : list) {
if (!ent.equals(e)) {
if (e instanceof Player) {
Player p = (Player)e;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
for (String str : debuffsToApply.keySet()) {
Buff db = debuffsToApply.get(str);
Buff.addBuff(p, str, db);
}
}
}
}
}
private void infectNearbyEntities(LivingEntity ent, HashMap<String,Buff> buffs) {
HashMap<String,Buff> debuffsToApply = getDebuffsOnly(buffs);
List<Entity> list = ent.getNearbyEntities(2, 1, 2);
for (Entity e : list) {
if (!ent.equals(e)) {
if ((e instanceof LivingEntity) && !(e instanceof Player)) {
LivingEntity l = (LivingEntity)e;
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
for (String str : debuffsToApply.keySet()) {
Buff db = debuffsToApply.get(str);
Buff.addBuff(l, str, db);
}
}
}
}
}
private HashMap<String,Buff> getDebuffsOnly(HashMap<String, Buff> buffs) {
HashMap<String,Buff> debufflist = new HashMap<String,Buff>();
for (String str : buffs.keySet()) {
Buff b = buffs.get(str);
if (b.isDebuff()) {
debufflist.put(str, b);
}
}
return debufflist;
}
private double getPoisonTickDelay(LivingEntity ent) {

Loading…
Cancel
Save