Creeper Explode damage reduction

This commit is contained in:
Sam 2017-05-01 11:10:19 +01:00
parent 0f925dd655
commit 1cc9888e58

View File

@ -34,6 +34,7 @@ public class PerkCreeperExplode extends SmashPerk
private int _radiusSmash;
private int _damageNormal;
private int _damageSmash;
private double _damageReduction;
private int _spawnRemovalRadius;
private float _knockbackMagnitude;
private int _blockDestroyRadius;
@ -56,6 +57,7 @@ public class PerkCreeperExplode extends SmashPerk
_radiusSmash = getPerkInt("Radius Smash");
_damageNormal = getPerkInt("Damage Normal");
_damageSmash = getPerkInt("Damage Smash");
_damageReduction = getPerkPercentage("Damage Reduction");
_spawnRemovalRadius = (int) Math.pow(getPerkInt("Spawn Removal Radius"), 2);
_knockbackMagnitude = getPerkFloat("Knockback Magnitude");
_blockDestroyRadius = getPerkInt("Block Destroy Radius");
@ -336,6 +338,22 @@ public class PerkCreeperExplode extends SmashPerk
DecreaseSize(player);
}
@EventHandler
public void damageReduction(CustomDamageEvent event)
{
Player player = event.GetDamageePlayer();
if (player == null)
{
return;
}
if (_active.containsKey(player.getUniqueId()))
{
event.AddMod("Damage Reduction", -event.GetDamage() * _damageReduction);
}
}
@EventHandler
public void addDestroyedSpawns(UpdateEvent event)
{