Absorption works again. During thunderstorms, mobs will spawn at 100%
the regular spawn rate.
This commit is contained in:
parent
b3c5722a80
commit
8f6c7ed236
Binary file not shown.
@ -21,6 +21,7 @@ import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -1851,7 +1852,7 @@ public class GenericFunctions {
|
||||
}
|
||||
}
|
||||
public static boolean isRanger(Player p) {
|
||||
if (p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW &&
|
||||
if (p!=null && !p.isDead() && p.getEquipment().getItemInMainHand()!=null && p.getEquipment().getItemInMainHand().getType()==Material.BOW &&
|
||||
(p.getInventory().getExtraContents()[0]==null || p.getInventory().getExtraContents()[0].getType().toString().contains("ARROW")) &&
|
||||
AllLeatherArmor(p)) {
|
||||
return true;
|
||||
@ -2523,6 +2524,15 @@ public class GenericFunctions {
|
||||
} else {
|
||||
finaldmg = TwosideKeeper.CalculateDamageReduction(dmg, target, damager);
|
||||
}
|
||||
|
||||
if (target.hasPotionEffect(PotionEffectType.ABSORPTION)) {
|
||||
//We attempt to absorb the amount of damage of absorption level we have.
|
||||
finaldmg-=(GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, target)+1)*4;
|
||||
if (finaldmg<0) {
|
||||
finaldmg=0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((target instanceof Monster) && damager!=null) {
|
||||
Monster m = (Monster)target;
|
||||
m.setTarget(damager);
|
||||
@ -2555,4 +2565,19 @@ public class GenericFunctions {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getPotionEffectLevel(PotionEffectType type, LivingEntity ent) {
|
||||
if (ent.hasPotionEffect(type)) {
|
||||
for (int j=0;j<ent.getActivePotionEffects().size();j++) {
|
||||
if (Iterables.get(ent.getActivePotionEffects(), j).getType().equals(type)) {
|
||||
//Get the level.
|
||||
return Iterables.get(ent.getActivePotionEffects(), j).getAmplifier();
|
||||
}
|
||||
}
|
||||
TwosideKeeper.log("Something went wrong while getting potion effect level of "+type+" for Entity "+ent.getName()+"!", 1);
|
||||
return -1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package sig.plugin.TwosideKeeper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
@ -52,7 +53,7 @@ public class MonsterController {
|
||||
}
|
||||
if (ylv>=128) {
|
||||
//This is a 95% chance this will despawn.
|
||||
if (Math.random()<=0.95) {
|
||||
if (Math.random()<=0.95 && !ent.getWorld().hasStorm()) {
|
||||
ent.remove();
|
||||
return false;
|
||||
} else {
|
||||
@ -65,7 +66,7 @@ public class MonsterController {
|
||||
} else
|
||||
if (ylv>=64) {
|
||||
//This is a 90% chance this will despawn.
|
||||
if (Math.random()<=0.90) {
|
||||
if (Math.random()<=0.90 && !ent.getWorld().hasStorm()) {
|
||||
ent.remove();
|
||||
return false;
|
||||
} else {
|
||||
@ -79,7 +80,7 @@ public class MonsterController {
|
||||
if (ylv>=48) {
|
||||
//"Normal" spawn rate. We're going to decrease it a bit for the time being.
|
||||
//This is a 50% chance this will despawn.
|
||||
if (Math.random()<=0.50) {
|
||||
if (Math.random()<=0.50 && !ent.getWorld().hasStorm()) {
|
||||
ent.remove();
|
||||
return false;
|
||||
} else {
|
||||
|
@ -3222,6 +3222,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
it.setCustomName((it.getItemStack().getItemMeta().hasDisplayName())?it.getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(it.getItemStack()));
|
||||
it.setCustomNameVisible(true);
|
||||
}
|
||||
if (GenericFunctions.isArtifactEquip(it.getItemStack())) {
|
||||
it.setInvulnerable(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3694,7 +3697,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.setDamage(DamageModifier.MAGIC,0);
|
||||
ev.setDamage(DamageModifier.RESISTANCE,0);
|
||||
ev.setDamage(DamageModifier.ARMOR,0);
|
||||
ev.setDamage(DamageModifier.ABSORPTION,0);
|
||||
|
||||
int dmgmult = 1;
|
||||
|
||||
@ -3723,6 +3725,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
double rawdmg = ev.getDamage()*dmgmult*ENEMY_DMG_MULT;
|
||||
ev.setDamage(CalculateDamageReduction(rawdmg,p,m));
|
||||
|
||||
log("New damage: "+ev.getDamage(),2);
|
||||
|
||||
if (GenericFunctions.isStriker(p)) {
|
||||
int currentSpeedLevel = -1;
|
||||
for (int j=0;j<p.getActivePotionEffects().size();j++) {
|
||||
@ -4023,7 +4027,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.setDamage(DamageModifier.MAGIC,0);
|
||||
ev.setDamage(DamageModifier.RESISTANCE,0);
|
||||
ev.setDamage(DamageModifier.ARMOR,0);
|
||||
ev.setDamage(DamageModifier.ABSORPTION,0);
|
||||
|
||||
|
||||
int dmgmult = 1;
|
||||
@ -5977,6 +5980,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,60,(p.isBlocking())?1:0));
|
||||
}
|
||||
|
||||
/*
|
||||
if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) {
|
||||
Collection<PotionEffect> player_effects = p.getActivePotionEffects();
|
||||
for (int i=0;i<player_effects.size();i++) {
|
||||
@ -5984,7 +5988,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
hp += (Iterables.get(player_effects, i).getAmplifier()+1)*4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (GenericFunctions.HasFullRangerSet(p)) {
|
||||
hp += 20;
|
||||
|
Loading…
x
Reference in New Issue
Block a user