public class DamageCalculatorAttack
extends java.lang.Object
DamageCalculator
Modifier and Type | Field and Description |
---|---|
private int |
damage
The final calculated damage value.
|
private org.bukkit.entity.Entity |
entity
The entity who gets attacked.
|
private org.bukkit.event.entity.EntityDamageByEntityEvent |
event
The damage event.
|
private static int |
INCREASE_SKILL_CHANCE
The chance that a weapon skill increases on weapon usage.
|
private boolean |
isAttackDebugMode
In attack debug mode, the damage output is multiplied by 100.
|
private boolean |
isCritical
If the attack was a critical hit.
|
private boolean |
isFixedDamage
If the damage should have a fixed value.
|
private boolean |
isMagic
If the damage was dealt by a magic skill.
|
private double |
magicMultiplier
The multiplier for magic skills, still counting as "unmodified" damage.
|
private org.bukkit.entity.Player |
player
The player who is attacking.
|
private int |
unmodifiedDamage
The damage value before weapon or random multipliers are applied.
|
private org.bukkit.inventory.ItemStack |
weaponItemStack
The item stack, the player is attacking with.
|
Constructor and Description |
---|
DamageCalculatorAttack(org.bukkit.event.entity.EntityDamageByEntityEvent event)
Creates a new calculator attack.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
applyMagicMultiplier()
Applies attack bonuses to a damage value, based on the spell type.
|
private void |
applyRandomizedMultiplier()
Applies attack bonuses to a damage value, based on randomness and mob modifiers.
|
private void |
applyWeaponMultiplier()
Applies attack bonuses to a damage value, based on weapon and passive skills.
|
private boolean |
checkWeaponRequirements()
Checks if the player meets the requirements to attack with their weapon.
|
private void |
inflictDamage()
Inflicts the calculated damage, with a minimum value of 1, to the entity.
|
void |
run()
Determines the amount of damage a player dealt.
|
private static final int INCREASE_SKILL_CHANCE
private org.bukkit.event.entity.EntityDamageByEntityEvent event
private org.bukkit.entity.Player player
private org.bukkit.entity.Entity entity
private org.bukkit.inventory.ItemStack weaponItemStack
private boolean isFixedDamage
private boolean isMagic
private boolean isCritical
private boolean isAttackDebugMode
private double magicMultiplier
private int unmodifiedDamage
private int damage
public DamageCalculatorAttack(org.bukkit.event.entity.EntityDamageByEntityEvent event)
event
- The damage event.run()
public void run()
private boolean checkWeaponRequirements()
EquipmentUtils.getLevelRequirement(ItemStack)
,
DeprecatedUtils.removeDamageModifiers(EntityDamageEvent)
,
DurabilityCalculator.damageItem(Player, ItemStack, boolean)
,
RageCalculator.generateRage(Player)
,
ValueIndicator.spawnDamageIndicator(Entity, Integer)
private boolean applyMagicMultiplier()
MobMetadataUtils.getMagicDamageMultiplier(Entity)
,
EquipmentUtils.getEnhancementSkillDamageMultiplier(ItemStack)
,
EquipmentUtils.getBaseAtk(ItemStack)
,
ValueIndicator.spawnMissedIndicator(Entity)
private void applyWeaponMultiplier()
private void applyRandomizedMultiplier()
private void inflictDamage()