mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 13:46:46 +01:00
Because NuclearW said I was wrong...
"Final is final unless it's not really final."
This commit is contained in:
parent
a8abfdae5e
commit
487e67d208
@ -3,17 +3,15 @@ package com.gmail.nossr50.skills.acrobatics;
|
|||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
|
|
||||||
public class Acrobatics {
|
public class Acrobatics {
|
||||||
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
public static int maxDodgeChance = AdvancedConfig.getInstance().getDodgeChanceMax();
|
||||||
|
public static int maxDodgeBonusLevel = AdvancedConfig.getInstance().getDodgeMaxBonusLevel();
|
||||||
|
public static int dodgeXpModifier = AdvancedConfig.getInstance().getDodgeXPModifier();
|
||||||
|
|
||||||
public static final int DODGE_MAX_CHANCE = advancedConfig.getDodgeChanceMax();
|
public static int maxRollChance = AdvancedConfig.getInstance().getRollChanceMax();
|
||||||
public static final int DODGE_MAX_BONUS_LEVEL = advancedConfig.getDodgeMaxBonusLevel();
|
public static int maxRollBonusLevel = AdvancedConfig.getInstance().getRollMaxBonusLevel();
|
||||||
public static final int DODGE_XP_MODIFIER = advancedConfig.getDodgeXPModifier();
|
public static int maxGracefulRollChance = AdvancedConfig.getInstance().getGracefulRollChanceMax();
|
||||||
|
public static int maxGracefulRollBonusLevel = AdvancedConfig.getInstance().getGracefulRollMaxBonusLevel();
|
||||||
|
|
||||||
public static final int ROLL_MAX_CHANCE = advancedConfig.getRollChanceMax();
|
public static int rollXpModifier = AdvancedConfig.getInstance().getRollXPModifier();
|
||||||
public static final int ROLL_MAX_BONUS_LEVEL = advancedConfig.getRollMaxBonusLevel();
|
public static int fallXpModifier = AdvancedConfig.getInstance().getFallXPModifier();
|
||||||
public static final int GRACEFUL_MAX_CHANCE = advancedConfig.getGracefulRollChanceMax();
|
|
||||||
public static final int GRACEFUL_MAX_BONUS_LEVEL = advancedConfig.getGracefulRollMaxBonusLevel();
|
|
||||||
|
|
||||||
public static final int ROLL_XP_MODIFIER = advancedConfig.getRollXPModifier();
|
|
||||||
public static final int FALL_XP_MODIFIER = advancedConfig.getFallXPModifier();
|
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,6 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
public class AcrobaticsManager extends SkillManager {
|
public class AcrobaticsManager extends SkillManager {
|
||||||
private static Config config = Config.getInstance();
|
|
||||||
|
|
||||||
public AcrobaticsManager (Player player) {
|
public AcrobaticsManager (Player player) {
|
||||||
super(player, SkillType.ACROBATICS);
|
super(player, SkillType.ACROBATICS);
|
||||||
}
|
}
|
||||||
@ -26,7 +24,7 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.getAcrobaticsAFKDisabled() && player.isInsideVehicle()) {
|
if (Config.getInstance().getAcrobaticsAFKDisabled() && player.isInsideVehicle()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,19 +38,19 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
float chance;
|
float chance;
|
||||||
|
|
||||||
if (eventHandler.isGraceful) {
|
if (eventHandler.isGraceful) {
|
||||||
chance = ((float) Acrobatics.GRACEFUL_MAX_CHANCE / Acrobatics.GRACEFUL_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
chance = ((float) Acrobatics.maxGracefulRollChance / Acrobatics.maxGracefulRollBonusLevel) * eventHandler.skillModifier;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chance = ((float) Acrobatics.ROLL_MAX_CHANCE / Acrobatics.ROLL_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
chance = ((float) Acrobatics.maxRollChance / Acrobatics.maxRollBonusLevel) * eventHandler.skillModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
|
if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
|
||||||
eventHandler.modifyEventDamage();
|
eventHandler.modifyEventDamage();
|
||||||
eventHandler.sendAbilityMessage();
|
eventHandler.sendAbilityMessage();
|
||||||
eventHandler.processXPGain(eventHandler.damage * Acrobatics.ROLL_XP_MODIFIER);
|
eventHandler.processXPGain(eventHandler.damage * Acrobatics.rollXpModifier);
|
||||||
}
|
}
|
||||||
else if (!eventHandler.isFatal(event.getDamage())) {
|
else if (!eventHandler.isFatal(event.getDamage())) {
|
||||||
eventHandler.processXPGain(eventHandler.damage * Acrobatics.FALL_XP_MODIFIER);
|
eventHandler.processXPGain(eventHandler.damage * Acrobatics.fallXpModifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,12 +71,12 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
randomChance = (int) (randomChance * 0.75);
|
randomChance = (int) (randomChance * 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
float chance = ((float) Acrobatics.DODGE_MAX_CHANCE / Acrobatics.DODGE_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
float chance = ((float) Acrobatics.maxDodgeChance / Acrobatics.maxDodgeBonusLevel) * eventHandler.skillModifier;
|
||||||
|
|
||||||
if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
|
if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
|
||||||
eventHandler.modifyEventDamage();
|
eventHandler.modifyEventDamage();
|
||||||
eventHandler.sendAbilityMessage();
|
eventHandler.sendAbilityMessage();
|
||||||
eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER);
|
eventHandler.processXPGain(eventHandler.damage * Acrobatics.dodgeXpModifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class DodgeEventHandler extends AcrobaticsEventHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void calculateSkillModifier() {
|
protected void calculateSkillModifier() {
|
||||||
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Acrobatics.DODGE_MAX_BONUS_LEVEL);
|
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Acrobatics.maxDodgeBonusLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,7 +29,7 @@ public class RollEventHandler extends AcrobaticsEventHandler {
|
|||||||
skillModifer = skillModifer * 2;
|
skillModifer = skillModifer * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
skillModifer = Misc.skillCheck(skillModifer, Acrobatics.ROLL_MAX_BONUS_LEVEL);
|
skillModifer = Misc.skillCheck(skillModifer, Acrobatics.maxRollBonusLevel);
|
||||||
this.skillModifier = skillModifer;
|
this.skillModifier = skillModifer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,19 +12,18 @@ import com.gmail.nossr50.config.AdvancedConfig;
|
|||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
|
||||||
public class Archery {
|
public class Archery {
|
||||||
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
|
||||||
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
||||||
|
|
||||||
public static final int ARROW_TRACKING_MAX_BONUS_LEVEL = advancedConfig.getRetrieveMaxBonusLevel();
|
public static int arrowTrackingMaxBonusLevel = AdvancedConfig.getInstance().getRetrieveMaxBonusLevel();
|
||||||
public static final int ARROW_TRACKING_MAX_BONUS = advancedConfig.getRetrieveBonusMax();
|
public static int arrowTrackingMaxBonus = AdvancedConfig.getInstance().getRetrieveBonusMax();
|
||||||
|
|
||||||
public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getSkillShotIncreaseLevel();
|
public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel();
|
||||||
public static final double BONUS_DAMAGE_INCREASE_PERCENT = advancedConfig.getSkillShotIncreasePercentage();
|
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage();
|
||||||
public static final double BONUS_DAMAGE_MAX_BONUS_PERCENTAGE = advancedConfig.getSkillShotBonusMax();
|
public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
|
||||||
|
|
||||||
public static final int DAZE_MAX_BONUS_LEVEL = advancedConfig.getDazeMaxBonusLevel();
|
public static int dazeMaxBonusLevel = AdvancedConfig.getInstance().getDazeMaxBonusLevel();
|
||||||
public static final int DAZE_MAX_BONUS = advancedConfig.getDazeBonusMax();
|
public static int dazeMaxBonus = AdvancedConfig.getInstance().getDazeBonusMax();
|
||||||
public static final int DAZE_MODIFIER = advancedConfig.getDazeModifier();
|
public static int dazeModifier = AdvancedConfig.getInstance().getDazeModifier();
|
||||||
|
|
||||||
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
||||||
for (TrackedEntity trackedEntity : trackedEntities) {
|
for (TrackedEntity trackedEntity : trackedEntities) {
|
||||||
|
@ -14,10 +14,10 @@ public class ArcheryBonusDamageEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void calculateDamageBonus() {
|
protected void calculateDamageBonus() {
|
||||||
this.damageBonusPercent = ((manager.getSkillLevel() / Archery.BONUS_DAMAGE_INCREASE_LEVEL) * Archery.BONUS_DAMAGE_INCREASE_PERCENT);
|
this.damageBonusPercent = ((manager.getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage);
|
||||||
|
|
||||||
if (damageBonusPercent > Archery.BONUS_DAMAGE_MAX_BONUS_PERCENTAGE) {
|
if (damageBonusPercent > Archery.skillShotMaxBonusPercentage) {
|
||||||
damageBonusPercent = Archery.BONUS_DAMAGE_MAX_BONUS_PERCENTAGE;
|
damageBonusPercent = Archery.skillShotMaxBonusPercentage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
randomChance = (int) (randomChance * 0.75);
|
randomChance = (int) (randomChance * 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
float chance = ((float) Archery.ARROW_TRACKING_MAX_BONUS / Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
float chance = ((float) Archery.arrowTrackingMaxBonus / Archery.arrowTrackingMaxBonusLevel) * eventHandler.skillModifier;
|
||||||
|
|
||||||
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
||||||
eventHandler.addToTracker();
|
eventHandler.addToTracker();
|
||||||
@ -56,7 +56,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
randomChance = (int) (randomChance * 0.75);
|
randomChance = (int) (randomChance * 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
float chance = ((float) Archery.DAZE_MAX_BONUS / Archery.DAZE_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
float chance = ((float) Archery.dazeMaxBonus / Archery.dazeMaxBonusLevel) * eventHandler.skillModifier;
|
||||||
|
|
||||||
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
||||||
eventHandler.handleDazeEffect();
|
eventHandler.handleDazeEffect();
|
||||||
@ -74,7 +74,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skillLevel >= Archery.BONUS_DAMAGE_INCREASE_LEVEL) {
|
if (skillLevel >= Archery.skillShotIncreaseLevel) {
|
||||||
ArcheryBonusDamageEventHandler eventHandler = new ArcheryBonusDamageEventHandler(this, event);
|
ArcheryBonusDamageEventHandler eventHandler = new ArcheryBonusDamageEventHandler(this, event);
|
||||||
|
|
||||||
eventHandler.calculateDamageBonus();
|
eventHandler.calculateDamageBonus();
|
||||||
|
@ -18,7 +18,7 @@ public class ArrowTrackingEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void calculateSkillModifier() {
|
protected void calculateSkillModifier() {
|
||||||
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.ARROW_TRACKING_MAX_BONUS_LEVEL);
|
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.arrowTrackingMaxBonusLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addToTracker() {
|
protected void addToTracker() {
|
||||||
|
@ -25,7 +25,7 @@ public class DazeEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void calculateSkillModifier() {
|
protected void calculateSkillModifier() {
|
||||||
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.DAZE_MAX_BONUS_LEVEL);
|
this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.dazeMaxBonusLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleDazeEffect() {
|
protected void handleDazeEffect() {
|
||||||
@ -39,7 +39,7 @@ public class DazeEventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defender.teleport(location);
|
defender.teleport(location);
|
||||||
event.setDamage(event.getDamage() + Archery.DAZE_MODIFIER);
|
event.setDamage(event.getDamage() + Archery.dazeModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendAbilityMessages() {
|
protected void sendAbilityMessages() {
|
||||||
|
@ -48,7 +48,7 @@ public class TrackedEntity implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (!isActive()) {
|
if (!isActive()) {
|
||||||
Archery.removeFromTracker(this);
|
Archery.removeFromTracker(this);
|
||||||
scheduler.cancelTask(taskId);
|
scheduler.cancelTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user