mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 03:04:44 +02:00
CompatibilityLayer framework
This commit is contained in:
@ -68,7 +68,7 @@ public class AxesManager extends SkillManager {
|
||||
* Handle the effects of the Axe Mastery ability
|
||||
*/
|
||||
public double axeMastery() {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.ALWAYS_FIRES, SubSkillType.AXES_AXE_MASTERY, getPlayer())) {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.ALWAYS_FIRES, SubSkillType.AXES_AXE_MASTERY, getPlayer(), mcMMOPlayer.getAttackStrength())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class AxesManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*/
|
||||
public double criticalHit(LivingEntity target, double damage) {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.AXES_CRITICAL_STRIKES, getPlayer())) {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.AXES_CRITICAL_STRIKES, getPlayer(), mcMMOPlayer.getAttackStrength())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ public class AxesManager extends SkillManager {
|
||||
|
||||
for (ItemStack armor : target.getEquipment().getArmorContents()) {
|
||||
if (armor != null && ItemUtils.isArmor(armor)) {
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_ARMOR_IMPACT, getPlayer())) {
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_ARMOR_IMPACT, getPlayer(), mcMMOPlayer.getAttackStrength())) {
|
||||
SkillUtils.handleDurabilityChange(armor, durabilityDamage, 1);
|
||||
}
|
||||
}
|
||||
@ -136,7 +136,7 @@ public class AxesManager extends SkillManager {
|
||||
*/
|
||||
public double greaterImpact(LivingEntity target) {
|
||||
//static chance (3rd param)
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_GREATER_IMPACT, getPlayer())) {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_STATIC_CHANCE, SubSkillType.AXES_GREATER_IMPACT, getPlayer(), mcMMOPlayer.getAttackStrength())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class SwordsManager extends SkillManager {
|
||||
* @param target The defending entity
|
||||
*/
|
||||
public void ruptureCheck(LivingEntity target) {
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.SWORDS_RUPTURE, getPlayer())) {
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.SWORDS_RUPTURE, getPlayer(), this.mcMMOPlayer.getAttackStrength())) {
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
@ -89,8 +89,7 @@ public class SwordsManager extends SkillManager {
|
||||
|
||||
if(rank > 0)
|
||||
{
|
||||
double stabDamage = 1.0D + (rank * 1.5);
|
||||
return stabDamage;
|
||||
return (1.0D + (rank * 1.5));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -26,23 +26,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class UnarmedManager extends SkillManager {
|
||||
private long lastAttacked;
|
||||
private long attackInterval;
|
||||
|
||||
public UnarmedManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, PrimarySkillType.UNARMED);
|
||||
initUnarmedPerPlayerVars();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits variables used for each player for unarmed
|
||||
*/
|
||||
private void initUnarmedPerPlayerVars() {
|
||||
lastAttacked = 0;
|
||||
attackInterval = 750;
|
||||
}
|
||||
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
return mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && Permissions.berserk(getPlayer());
|
||||
}
|
||||
@ -113,7 +101,7 @@ public class UnarmedManager extends SkillManager {
|
||||
* @param defender The defending player
|
||||
*/
|
||||
public void disarmCheck(Player defender) {
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.UNARMED_DISARM, getPlayer()) && !hasIronGrip(defender)) {
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.UNARMED_DISARM, getPlayer(), mcMMOPlayer.getAttackStrength()) && !hasIronGrip(defender)) {
|
||||
if (EventUtils.callDisarmEvent(defender).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
@ -150,7 +138,7 @@ public class UnarmedManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
*/
|
||||
public double berserkDamage(double damage) {
|
||||
damage = (damage * Unarmed.berserkDamageModifier) - damage;
|
||||
damage = ((damage * Unarmed.berserkDamageModifier) * mcMMOPlayer.getAttackStrength()) - damage;
|
||||
|
||||
return damage;
|
||||
}
|
||||
@ -158,7 +146,7 @@ public class UnarmedManager extends SkillManager {
|
||||
/**
|
||||
* Handle the effects of the Iron Arm ability
|
||||
*/
|
||||
public double ironArm() {
|
||||
public double calculateIronArmDamage() {
|
||||
if (!RandomChanceUtil.isActivationSuccessful(SkillActivationType.ALWAYS_FIRES, SubSkillType.UNARMED_IRON_ARM_STYLE, getPlayer())) {
|
||||
return 0;
|
||||
}
|
||||
@ -166,10 +154,6 @@ public class UnarmedManager extends SkillManager {
|
||||
return getIronArmDamage();
|
||||
}
|
||||
|
||||
public boolean isPunchingCooldownOver() {
|
||||
return (lastAttacked + attackInterval) <= System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public double getIronArmDamage() {
|
||||
int rank = RankUtils.getRank(getPlayer(), SubSkillType.UNARMED_IRON_ARM_STYLE);
|
||||
|
||||
@ -199,20 +183,4 @@ public class UnarmedManager extends SkillManager {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public long getLastAttacked() {
|
||||
return lastAttacked;
|
||||
}
|
||||
|
||||
public void setLastAttacked(long lastAttacked) {
|
||||
this.lastAttacked = lastAttacked;
|
||||
}
|
||||
|
||||
public long getAttackInterval() {
|
||||
return attackInterval;
|
||||
}
|
||||
|
||||
public void setAttackInterval(long attackInterval) {
|
||||
this.attackInterval = attackInterval;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user