converting more SubSkills to be JSON friendly

AxeMaster & SkillShot
This commit is contained in:
nossr50 2019-01-03 04:32:46 -08:00
parent 4669e3e54d
commit 54cf356b71
10 changed files with 73 additions and 59 deletions

View File

@ -17,11 +17,13 @@ Version 2.1.0
+ (Commands) Added toggle command /mcchatspy
+ (Permissions) Added permission node mcmmo.commands.mcchatspy & mcmmo.commands.mcchatspy.others
+ (Permissions) Added permission nodes for Harvest Lumber, Splinter, Nature's Bounty, and Bark Surgeon
- (Config) Removed Skills.Archery.SkillShot.IncreaseLevel & Skills.Archery.SkillShot.IncreasePercentage
- (Config) Removed SkillShot's IncreaseLevel & IncreasePercentage (replaced by RankDamageMultiplier)
- (Config) Removed AxeMastery's MaxBonus & MaxBonusLevel (replaced by RankDamageMultiplier)
! (Skills) Woodcutting's Double Drop subskill is now named Harvest Lumber
! (Skills) Archery's Skill Shot now uses a rank system
! (Config) Archery's Skill Shot now uses IncreaseDamage for its damage bonus
! (Config) Archery's Skill shot now uses IncreaseDamageMaxBonus instead of MaxDamage
! (Skills) Axe's Axe Mastery now uses a rank system
! (Config) Archery's Skill Shot now uses RankDamageMultiplier for its damage bonus calculations
! (Config) Axe's Axe mastery now uses RankDamageMultiplier for its damage bonus calculations
! (Permissions) Replaced the old Double Drop permission node for woodcutting with a new Harvest Lumber permission node
! (Locale) Super Abilities no longer have (ABILITY) in their Skill.Effect strings
! (API) mcMMO is now built against Spigot-API instead of Bukkit

View File

@ -32,7 +32,7 @@ public class ArcheryCommand extends SkillCommand {
// SKILL SHOT
if (canSkillShot) {
double bonus = (skillValue / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage;
skillShotBonus = percent.format(Math.min(bonus, Archery.skillShotMaxBonusPercentage));
skillShotBonus = percent.format(Archery.getSkillShotBonusDamage(player, 0));
}
// ARCHERY_DAZE

View File

@ -3,8 +3,10 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList;
import java.util.List;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.skills.RankUtils;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@ -53,7 +55,7 @@ public class AxesCommand extends SkillCommand {
// AXE MASTERY
if (canAxeMastery) {
axeMasteryDamage = Math.min(skillValue / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
axeMasteryDamage = Axes.getAxeMasteryBonusDamage(player);
}
}

View File

@ -119,12 +119,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
/* ARCHERY */
if (getSkillShotIncreasePercentage() <= 0) {
reason.add("Skills.Archery.SkillShot.IncreaseDamage should be greater than 0!");
}
if (getSkillShotBonusMax() < 0) {
reason.add("Skills.Archery.SkillShot.IncreaseDamageMaxBonus should be at least 0!");
if (getSkillShotRankDamageMultiplier() <= 0) {
reason.add("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!");
}
if (getMaxChance(SubSkill.ARCHERY_DAZE) < 1) {
@ -152,12 +148,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
}
/* AXES */
if (getAxeMasteryBonusMax() < 1) {
reason.add("Skills.Axes.AxeMastery.MaxBonus should be at least 1!");
}
if (getAxeMasteryMaxBonusLevel() < 1) {
reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!");
if(getAxeMasteryRankDamageMultiplier() < 0)
{
reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
}
if (getMaxChance(SubSkill.AXES_CRITICAL_HIT) < 1) {
@ -736,8 +729,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
/* ARCHERY */
public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot.IncreaseLevel", 50); }
public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot.IncreaseDamage", 10.0D); }
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot.IncreaseDamageMaxBonus", 200.0D); }
public double getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.0D); }
public double getDazeBonusDamage() { return config.getDouble("Skills.Archery.Daze.BonusDamage", 4.0D); }
@ -745,8 +737,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
/* AXES */
public double getAxeMasteryBonusMax() { return config.getDouble("Skills.Axes.AxeMastery.MaxBonus", 4.0D); }
public int getAxeMasteryMaxBonusLevel() { return config.getInt("Skills.Axes.AxeMastery.MaxBonusLevel", 200); }
public double getAxeMasteryRankDamageMultiplier() { return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D); }
public double getCriticalHitPVPModifier() { return config.getDouble("Skills.Axes.CriticalHit.PVP_Modifier", 1.5D); }
public double getCriticalHitPVEModifier() { return config.getDouble("Skills.Axes.CriticalHit.PVE_Modifier", 2.0D); }

View File

@ -26,9 +26,10 @@ public enum SubSkill {
/* Axes */
AXES_ARMOR_IMPACT,
AXES_AXE_MASTERY,
AXES_AXE_MASTERY(4),
AXES_CRITICAL_HIT,
AXES_GREATER_IMPACT,
AXES_SKULL_SPLITTER(0, ACTIVE | SUPERABILITY),
/* Excavation */
EXCAVATION_TREASURE_HUNTER,
@ -97,6 +98,7 @@ public enum SubSkill {
WOODCUTTING_HARVEST_LUMBER(3, RNG);
private final int numRanks;
//TODO: SuperAbility should also contain flags for active by default? Not sure if it should work that way.
private final int flags;
/**

View File

@ -4,8 +4,11 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.skills.RankUtils;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.AdvancedConfig;
@ -16,8 +19,7 @@ public class Archery {
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel();
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage();
public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier();
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
public static double dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
@ -62,4 +64,19 @@ public class Archery {
}
}
}
/**
* Every rank we increase Skill Shot's bonus damage % by the IncreaseDamage percentage value from advanced.yml
* Divide end result by 100.0D to get proper scale
* Damage is capped in advanced.yml by Archery.SkillShot.MaxDamage
*
* @param player The target player
* @param oldDamage The raw damage of the arrow before we add bonus damage
* @return The damage that the arrow will deal after we've added bonus damage, damage is capped by Archery.SkillShot.MaxDamage
*/
public static double getSkillShotBonusDamage(Player player, double oldDamage)
{
double damageBonusPercent = ((RankUtils.getRank(player, SubSkill.ARCHERY_SKILL_SHOT)) * Archery.skillShotIncreasePercentage) / 100.0D;
return Math.min(oldDamage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
}
}

View File

@ -93,23 +93,15 @@ public class ArcheryManager extends SkillManager {
}
/**
* Handle the effects of the Skill Shot ability
* Calculates the damage to deal after Skill Shot has been applied
*
* @param damage The amount of damage initially dealt by the event
* @param oldDamage The raw damage value of this arrow before we modify it
*/
public double skillShot(double damage) {
public double skillShot(double oldDamage) {
if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.ALWAYS_FIRES, SubSkill.ARCHERY_SKILL_SHOT, getPlayer(), null, 0, 0)) {
return damage;
return oldDamage;
}
/*
* Archery
* Skill Shot
*
* Every rank we increase Skill Shot's bonus damage % by the IncreaseDamage percentage value from advanced.yml
* Divide end result by 100.0D to get proper scale
*/
double damageBonusPercent = (Math.min(((RankUtils.getRank(getPlayer(), SubSkill.ARCHERY_SKILL_SHOT)) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage) / 100.0D);
return Math.min(damage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
return Archery.getSkillShotBonusDamage(getPlayer(), oldDamage);
}
}

View File

@ -1,14 +1,17 @@
package com.gmail.nossr50.skills.axes;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.skills.RankUtils;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.util.ItemUtils;
public class Axes {
public static double axeMasteryMaxBonus = AdvancedConfig.getInstance().getAxeMasteryBonusMax();
public static int axeMasteryMaxBonusLevel = AdvancedConfig.getInstance().getAxeMasteryMaxBonusLevel();
public static double axeMasteryRankDamageMultiplier = AdvancedConfig.getInstance().getAxeMasteryRankDamageMultiplier();
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalHitPVPModifier();
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalHitPVEModifier();
@ -32,4 +35,14 @@ public class Axes {
return false;
}
/**
* For every rank in Axe Mastery we add RankDamageMultiplier to get the total bonus damage from Axe Mastery
* @param player The target player
* @return The axe mastery bonus damage which will be added to their attack
*/
public static double getAxeMasteryBonusDamage(Player player)
{
return RankUtils.getRank(player, SubSkill.AXES_AXE_MASTERY) * Axes.axeMasteryRankDamageMultiplier;
}
}

View File

@ -3,7 +3,7 @@ package com.gmail.nossr50.skills.axes;
import java.util.Map;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.skills.SubSkillActivationType;
import com.gmail.nossr50.util.skills.*;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
@ -18,9 +18,6 @@ import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
public class AxesManager extends SkillManager {
public AxesManager(McMMOPlayer mcMMOPlayer) {
@ -59,7 +56,7 @@ public class AxesManager extends SkillManager {
return 0;
}
return Math.min(getSkillLevel() / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
return Axes.getAxeMasteryBonusDamage(getPlayer());
}
/**

View File

@ -97,17 +97,12 @@ Skills:
Rank_18: 90
Rank_19: 95
Rank_20: 100
# IncreaseDamage: Every rank of the skill will add this much additional damage in percentage form, rank 1 = 10% bonus, rank 20 = 200% bonus (with default settings)
# IncreaseDamage is a percentage
IncreaseDamage: 10.0
# IncreaseDamageMax: When the <IncreaseDamageMax> has been reached, the bonus percentage will not go up anymore. 200.0 = 200%
IncreaseDamageMaxBonus: 200.0
# --OLD SYSTEM -- IncreaseLevel: 5
# --OLD SYSTEM -- IncreasePercentage: 0.1
# MaxBonus: When the <MaxBonus> has been reached, the bonus percentage will not go up anymore. 2.0 = 200%
# --OLD SYSTEM -- MaxBonus: 2.0
# RankDamageMultiplier: The current rank of this subskill is multiplied by this value to determine the bonus damage, rank 20 would result in 200% damage increase with a value of 10.0 for RankDamageMultiplier
# RankDamageMultiplier is a percentage
RankDamageMultiplier: 10.0
# MaxDamage: After adding bonus damage, the total damage dealt by the player will not exceed this number
# You should be careful to not set this too low
MaxDamage: 9.0
Daze:
# ChanceMax: Maximum chance of causing daze to opponents when on <MaxBonusLevel> or higher
# MaxBonusLevel: Maximum bonus level of Daze, when a player reaches this level his chance of causing a daze will be <ChanceMax>
@ -129,11 +124,14 @@ Skills:
###
Axes:
AxeMastery:
# MaxBonus: Maximum bonus damage when on <MaxBonusLevel> or higher
# MaxBonusLevel: Level where <MaxBonus> is reached
MaxBonus: 4.0
MaxBonusLevel: 20
# This number is multiplied by the current rank the player has in this subskill to find the amount of additional damage to apply
# With the default config value of 1.0, at rank 4 a player will deal 4.0 extra damage with Axes (1.0 * 4)
RankDamageMultiplier: 1.0
Rank_Levels:
Rank_1: 5
Rank_2: 10
Rank_3: 15
Rank_4: 20
CriticalHit:
# ChanceMax: Maximum chance of causing a critical hit when on <MaxBonusLevel> or higher
# MaxBonusLevel: Level where <ChanceMax> of causing critical hits is reached