Patch Explosion damage.

This commit is contained in:
sigonasr2 2016-08-04 23:59:57 -05:00
parent e13dc4b29e
commit 4528d33446
4 changed files with 67 additions and 19 deletions

Binary file not shown.

View File

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

View File

@ -2802,20 +2802,62 @@ public class GenericFunctions {
entity.damage(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER,damager); entity.damage(dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER,damager);
//Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(damager,entity,DamageCause.CUSTOM,dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER)); //Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(damager,entity,DamageCause.CUSTOM,dmg+TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER));
} else { } else {
//Use old system if we cannot get a valid damager. if (entity instanceof Player) {
if (entity.getHealth()>dmg && entity instanceof Player) { double dodgechance = NewCombat.CalculateDodgeChance((Player)entity);
if (!AttemptRevive((Player)entity,dmg)) { Player p = (Player)entity;
entity.setHealth(((Player)entity).getHealth()-dmg); if (!p.hasPotionEffect(PotionEffectType.GLOWING)) {
aPlugin.API.sendEntityHurtAnimation((Player)entity); if (Math.random()<=dodgechance) {
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 3.0f, 1.0f);
for (int i=0;i<p.getEquipment().getArmorContents().length;i++) {
ItemStack equip = p.getEquipment().getArmorContents()[i];
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GRACEFULDODGE, equip)) {
p.addPotionEffect(
new PotionEffect(PotionEffectType.GLOWING,
(int)(GenericFunctions.getAbilityValue(ArtifactAbility.GRACEFULDODGE, equip)*20),
0)
);
}
}
p.setNoDamageTicks(10);
} else {
//Use old system if we cannot get a valid damager.
if (entity.getHealth()>dmg && entity instanceof Player) {
if (!AttemptRevive((Player)entity,dmg)) {
entity.setHealth(((Player)entity).getHealth()-dmg);
aPlugin.API.sendEntityHurtAnimation((Player)entity);
}
}
else {
//List<ItemStack> drops = new ArrayList<ItemStack>();
//EntityDeathEvent ev = new EntityDeathEvent(entity,drops);
//Bukkit.getPluginManager().callEvent(ev);
//entity.setHealth(0);
if (entity instanceof Player && !AttemptRevive((Player)entity,Integer.MAX_VALUE)) {
entity.damage(Integer.MAX_VALUE);
}
}
}
} }
} else { } else {
//List<ItemStack> drops = new ArrayList<ItemStack>(); if (entity.getHealth()>dmg && entity instanceof Player) {
//EntityDeathEvent ev = new EntityDeathEvent(entity,drops); if (!AttemptRevive((Player)entity,dmg)) {
//Bukkit.getPluginManager().callEvent(ev); entity.setHealth(((Player)entity).getHealth()-dmg);
//entity.setHealth(0); aPlugin.API.sendEntityHurtAnimation((Player)entity);
if (entity instanceof Player && !AttemptRevive((Player)entity,Integer.MAX_VALUE)) { }
entity.damage(Integer.MAX_VALUE); }
}
else {
//List<ItemStack> drops = new ArrayList<ItemStack>();
//EntityDeathEvent ev = new EntityDeathEvent(entity,drops);
//Bukkit.getPluginManager().callEvent(ev);
//entity.setHealth(0);
if (entity instanceof Player && !AttemptRevive((Player)entity,Integer.MAX_VALUE)) {
entity.damage(Integer.MAX_VALUE);
}
}
} }
} }
} }
@ -2973,8 +3015,9 @@ public class GenericFunctions {
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION,20,0)); p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION,20,0));
} }
@Deprecated
public static void DealExplosionDamageToEntities(Location l, double basedmg, double range) { public static void DealExplosionDamageToEntities(Location l, double basedmg, double range) {
List<Entity> nearbyentities = new ArrayList<Entity>(); /*List<Entity> nearbyentities = new ArrayList<Entity>();
nearbyentities.addAll(l.getWorld().getNearbyEntities(l, range, range, range)); nearbyentities.addAll(l.getWorld().getNearbyEntities(l, range, range, range));
for (int i=0;i<nearbyentities.size();i++) { for (int i=0;i<nearbyentities.size();i++) {
Entity ent = nearbyentities.get(i); Entity ent = nearbyentities.get(i);
@ -2989,8 +3032,13 @@ public class GenericFunctions {
damage_mult*=TwosideKeeper.EXPLOSION_DMG_MULT; damage_mult*=TwosideKeeper.EXPLOSION_DMG_MULT;
damage_mult*=CalculateBlastResistance((LivingEntity)nearbyentities.get(i)); damage_mult*=CalculateBlastResistance((LivingEntity)nearbyentities.get(i));
double dmg = basedmg * damage_mult; double dmg = basedmg * damage_mult;
double dodgechance = 0.0;
if (nearbyentities.get(i) instanceof Player) {
Player p = (Player)nearbyentities.get(i);
dodgechance = NewCombat.CalculateDodgeChance(p);
}
DealDamageToMob(dmg,(LivingEntity)nearbyentities.get(i),null,null,"Explosion"); DealDamageToMob(dmg,(LivingEntity)nearbyentities.get(i),null,null,"Explosion");
} }*/
} }
private static double CalculateBlastResistance(LivingEntity l) { private static double CalculateBlastResistance(LivingEntity l) {

View File

@ -234,7 +234,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static long HEALTH_REGENERATION_RATE=100; //The amount of ticks between each health regeneration event. public static long HEALTH_REGENERATION_RATE=100; //The amount of ticks between each health regeneration event.
public static long FOOD_HEAL_AMT=2; //1 Heart per food item consumed. public static long FOOD_HEAL_AMT=2; //1 Heart per food item consumed.
public static double ENEMY_DMG_MULT=1.0f; // public static double ENEMY_DMG_MULT=1.0f; //
public static double EXPLOSION_DMG_MULT=1.2f; // public static double EXPLOSION_DMG_MULT=0.6f; //
public static double HEADSHOT_ACC=1.0f; //How accurate headshots have to be. Lower values means more leniency on headshots. Higher values means more strict. public static double HEADSHOT_ACC=1.0f; //How accurate headshots have to be. Lower values means more leniency on headshots. Higher values means more strict.
public static double COMMON_DROP_RATE=0.1; // 1/10 chance public static double COMMON_DROP_RATE=0.1; // 1/10 chance
public static double RARE_DROP_RATE=0.0078125; // 1/128 chance public static double RARE_DROP_RATE=0.0078125; // 1/128 chance
@ -5407,9 +5407,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
SERVERTICK = getConfig().getLong("SERVERTICK"); SERVERTICK = getConfig().getLong("SERVERTICK");
DAYMULT = getConfig().getDouble("DAYMULT"); DAYMULT = getConfig().getDouble("DAYMULT");
SERVERCHECKERTICKS = getConfig().getInt("SERVERCHECKERTICKS"); SERVERCHECKERTICKS = getConfig().getInt("SERVERCHECKERTICKS");
TERMINALTIME = getConfig().getInt("TERMINALTIME"); TERMINALTIME = getConfig().getInt("TERMINALTIME");
DEATHPENALTY = getConfig().getDouble("DEATHPENALTY"); DEATHPENALTY = getConfig().getDouble("DEATHPENALTY");
RECYCLECHANCE = getConfig().getDouble("RECYCLECHANCE"); RECYCLECHANCE = getConfig().getDouble("RECYCLECHANCE");
RECYCLEDECAYAMT = getConfig().getDouble("RECYCLEDECAYAMT"); RECYCLEDECAYAMT = getConfig().getDouble("RECYCLEDECAYAMT");
ITEMCUBEID = getConfig().getInt("ITEMCUBEID"); ITEMCUBEID = getConfig().getInt("ITEMCUBEID");
ARMOR_LEATHER_HP = getConfig().getDouble("ARMOR/ARMOR_LEATHER_HP"); ARMOR_LEATHER_HP = getConfig().getDouble("ARMOR/ARMOR_LEATHER_HP");
@ -5422,7 +5422,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
HEALTH_REGENERATION_RATE = getConfig().getLong("HEALTH/HEALTH_REGENERATION_RATE"); HEALTH_REGENERATION_RATE = getConfig().getLong("HEALTH/HEALTH_REGENERATION_RATE");
FOOD_HEAL_AMT = getConfig().getInt("HEALTH/FOOD_HEAL_AMT"); FOOD_HEAL_AMT = getConfig().getInt("HEALTH/FOOD_HEAL_AMT");
ENEMY_DMG_MULT = getConfig().getDouble("ENEMY/ENEMY_DMG_MULT"); ENEMY_DMG_MULT = getConfig().getDouble("ENEMY/ENEMY_DMG_MULT");
EXPLOSION_DMG_MULT = getConfig().getDouble("ENEMY/EXPLOSION_DMG_MULT"); EXPLOSION_DMG_MULT = getConfig().getDouble("ENEMY/EXPLOSION_DMG_MULT")/2;
HEADSHOT_ACC = getConfig().getDouble("ENEMY/HEADSHOT_ACC"); HEADSHOT_ACC = getConfig().getDouble("ENEMY/HEADSHOT_ACC");
RARE_DROP_RATE = getConfig().getDouble("ITEM/RARE_DROP_RATE"); RARE_DROP_RATE = getConfig().getDouble("ITEM/RARE_DROP_RATE");
COMMON_DROP_RATE = getConfig().getDouble("ITEM/COMMON_DROP_RATE"); COMMON_DROP_RATE = getConfig().getDouble("ITEM/COMMON_DROP_RATE");