/** * Check for Bleed effect. * * @param defender The defending entity */ public void bleedCheck(LivingEntity defender) { if (!permissionsInstance.swordsBleed(player)) { return; } if (Combat.shouldBeAffected(player, defender)) { BleedEventHandler eventHandler = new BleedEventHandler(this, defender); int randomChance = 1000; if (player.hasPermission("mcmmo.perks.lucky.swords")) { randomChance = (int) (randomChance * 0.75); } if (Swords.getRandom().nextInt(randomChance) < eventHandler.skillModifier) { eventHandler.addBleedTicks(); eventHandler.sendAbilityMessages(); } } }
public void counterAttackChecks(LivingEntity attacker, int damage) { if (!permissionsInstance.counterAttack(player)) { return; } CounterAttackEventHandler eventHandler = new CounterAttackEventHandler(this, attacker, damage); if (eventHandler.isHoldingSword()) { eventHandler.calculateSkillModifier(); int randomChance = 2000; if (player.hasPermission("mcmmo.perks.lucky.swords")) { randomChance = (int) (randomChance * 0.75); } if (Swords.getRandom().nextInt(randomChance) < eventHandler.skillModifier) { eventHandler.dealDamage(); eventHandler.sendAbilityMessages(); } } }