2015-06-22 22:20:20 +02:00
|
|
|
package mineplex.game.clans.items.attributes;
|
2015-05-16 18:58:58 +02:00
|
|
|
|
|
|
|
import mineplex.game.clans.items.generation.ValueDistribution;
|
2015-06-01 18:25:20 +02:00
|
|
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
2015-05-05 21:33:42 +02:00
|
|
|
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
|
|
|
|
|
|
public abstract class DamageAttribute extends ItemAttribute
|
|
|
|
{
|
|
|
|
private double _bonusDamage;
|
2015-05-25 20:22:06 +02:00
|
|
|
public double getBonusDamage() { return _bonusDamage; }
|
2015-05-05 21:33:42 +02:00
|
|
|
|
|
|
|
public DamageAttribute(ValueDistribution damageGen)
|
|
|
|
{
|
|
|
|
_bonusDamage = damageGen.generateValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-06-01 18:25:20 +02:00
|
|
|
public void onAttack(CustomDamageEvent event)
|
2015-05-05 21:33:42 +02:00
|
|
|
{
|
2015-06-01 18:25:20 +02:00
|
|
|
if (grantBonusDamage(event.GetDamageeEntity()))
|
2015-05-05 21:33:42 +02:00
|
|
|
{
|
2015-06-01 18:25:20 +02:00
|
|
|
event.AddMod("Damage Attribute", _bonusDamage);
|
2015-05-05 21:33:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract boolean grantBonusDamage(Entity defender);
|
|
|
|
}
|