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 + (Commands) Added toggle command /mcchatspy
+ (Permissions) Added permission node mcmmo.commands.mcchatspy & mcmmo.commands.mcchatspy.others + (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 + (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) Woodcutting's Double Drop subskill is now named Harvest Lumber
! (Skills) Archery's Skill Shot now uses a rank system ! (Skills) Archery's Skill Shot now uses a rank system
! (Config) Archery's Skill Shot now uses IncreaseDamage for its damage bonus ! (Skills) Axe's Axe Mastery now uses a rank system
! (Config) Archery's Skill shot now uses IncreaseDamageMaxBonus instead of MaxDamage ! (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 ! (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 ! (Locale) Super Abilities no longer have (ABILITY) in their Skill.Effect strings
! (API) mcMMO is now built against Spigot-API instead of Bukkit ! (API) mcMMO is now built against Spigot-API instead of Bukkit

View File

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

View File

@ -3,8 +3,10 @@ package com.gmail.nossr50.commands.skills;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkill; import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.datatypes.skills.SubSkill; import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.skills.RankUtils;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -53,7 +55,7 @@ public class AxesCommand extends SkillCommand {
// AXE MASTERY // AXE MASTERY
if (canAxeMastery) { 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 */ /* ARCHERY */
if (getSkillShotIncreasePercentage() <= 0) { if (getSkillShotRankDamageMultiplier() <= 0) {
reason.add("Skills.Archery.SkillShot.IncreaseDamage should be greater than 0!"); reason.add("Skills.Archery.SkillShot.RankDamageMultiplier should be greater than 0!");
}
if (getSkillShotBonusMax() < 0) {
reason.add("Skills.Archery.SkillShot.IncreaseDamageMaxBonus should be at least 0!");
} }
if (getMaxChance(SubSkill.ARCHERY_DAZE) < 1) { if (getMaxChance(SubSkill.ARCHERY_DAZE) < 1) {
@ -152,12 +148,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
} }
/* AXES */ /* AXES */
if (getAxeMasteryBonusMax() < 1) { if(getAxeMasteryRankDamageMultiplier() < 0)
reason.add("Skills.Axes.AxeMastery.MaxBonus should be at least 1!"); {
} reason.add("Skills.Axes.AxeMastery.RankDamageMultiplier should be at least 0!");
if (getAxeMasteryMaxBonusLevel() < 1) {
reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SubSkill.AXES_CRITICAL_HIT) < 1) { if (getMaxChance(SubSkill.AXES_CRITICAL_HIT) < 1) {
@ -736,8 +729,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
/* ARCHERY */ /* ARCHERY */
public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot.IncreaseLevel", 50); } 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 getSkillShotRankDamageMultiplier() { return config.getDouble("Skills.Archery.SkillShot.RankDamageMultiplier", 10.0D); }
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot.IncreaseDamageMaxBonus", 200.0D); }
public double getSkillShotDamageMax() { return config.getDouble("Skills.Archery.SkillShot.MaxDamage", 9.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); } 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); } public double getForceMultiplier() { return config.getDouble("Skills.Archery.ForceMultiplier", 2.0D); }
/* AXES */ /* AXES */
public double getAxeMasteryBonusMax() { return config.getDouble("Skills.Axes.AxeMastery.MaxBonus", 4.0D); } public double getAxeMasteryRankDamageMultiplier() { return config.getDouble("Skills.Axes.AxeMastery.RankDamageMultiplier", 1.0D); }
public int getAxeMasteryMaxBonusLevel() { return config.getInt("Skills.Axes.AxeMastery.MaxBonusLevel", 200); }
public double getCriticalHitPVPModifier() { return config.getDouble("Skills.Axes.CriticalHit.PVP_Modifier", 1.5D); } 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); } public double getCriticalHitPVEModifier() { return config.getDouble("Skills.Axes.CriticalHit.PVE_Modifier", 2.0D); }

View File

@ -26,9 +26,10 @@ public enum SubSkill {
/* Axes */ /* Axes */
AXES_ARMOR_IMPACT, AXES_ARMOR_IMPACT,
AXES_AXE_MASTERY, AXES_AXE_MASTERY(4),
AXES_CRITICAL_HIT, AXES_CRITICAL_HIT,
AXES_GREATER_IMPACT, AXES_GREATER_IMPACT,
AXES_SKULL_SPLITTER(0, ACTIVE | SUPERABILITY),
/* Excavation */ /* Excavation */
EXCAVATION_TREASURE_HUNTER, EXCAVATION_TREASURE_HUNTER,
@ -97,6 +98,7 @@ public enum SubSkill {
WOODCUTTING_HARVEST_LUMBER(3, RNG); WOODCUTTING_HARVEST_LUMBER(3, RNG);
private final int numRanks; 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; private final int flags;
/** /**

View File

@ -4,8 +4,11 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; 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.Material;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
@ -16,8 +19,7 @@ public class Archery {
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>(); private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel(); public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel();
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage(); public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier();
public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax(); public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
public static double dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage(); 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)) { if (!SkillUtils.isActivationSuccessful(SubSkillActivationType.ALWAYS_FIRES, SubSkill.ARCHERY_SKILL_SHOT, getPlayer(), null, 0, 0)) {
return damage; return oldDamage;
} }
/* return Archery.getSkillShotBonusDamage(getPlayer(), 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);
} }
} }

View File

@ -1,14 +1,17 @@
package com.gmail.nossr50.skills.axes; 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.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
public class Axes { public class Axes {
public static double axeMasteryMaxBonus = AdvancedConfig.getInstance().getAxeMasteryBonusMax(); public static double axeMasteryRankDamageMultiplier = AdvancedConfig.getInstance().getAxeMasteryRankDamageMultiplier();
public static int axeMasteryMaxBonusLevel = AdvancedConfig.getInstance().getAxeMasteryMaxBonusLevel();
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalHitPVPModifier(); public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalHitPVPModifier();
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalHitPVEModifier(); public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalHitPVEModifier();
@ -32,4 +35,14 @@ public class Axes {
return false; 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 java.util.Map;
import com.gmail.nossr50.datatypes.skills.SubSkill; 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.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier; 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.ItemUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; 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 class AxesManager extends SkillManager {
public AxesManager(McMMOPlayer mcMMOPlayer) { public AxesManager(McMMOPlayer mcMMOPlayer) {
@ -59,7 +56,7 @@ public class AxesManager extends SkillManager {
return 0; 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_18: 90
Rank_19: 95 Rank_19: 95
Rank_20: 100 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) # 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
# IncreaseDamage is a percentage # RankDamageMultiplier is a percentage
IncreaseDamage: 10.0 RankDamageMultiplier: 10.0
# IncreaseDamageMax: When the <IncreaseDamageMax> has been reached, the bonus percentage will not go up anymore. 200.0 = 200% # MaxDamage: After adding bonus damage, the total damage dealt by the player will not exceed this number
IncreaseDamageMaxBonus: 200.0 # You should be careful to not set this too low
# --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
MaxDamage: 9.0 MaxDamage: 9.0
Daze: Daze:
# ChanceMax: Maximum chance of causing daze to opponents when on <MaxBonusLevel> or higher # 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> # 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: Axes:
AxeMastery: AxeMastery:
# MaxBonus: Maximum bonus damage when on <MaxBonusLevel> or higher # This number is multiplied by the current rank the player has in this subskill to find the amount of additional damage to apply
# MaxBonusLevel: Level where <MaxBonus> is reached # With the default config value of 1.0, at rank 4 a player will deal 4.0 extra damage with Axes (1.0 * 4)
MaxBonus: 4.0 RankDamageMultiplier: 1.0
MaxBonusLevel: 20 Rank_Levels:
Rank_1: 5
Rank_2: 10
Rank_3: 15
Rank_4: 20
CriticalHit: CriticalHit:
# ChanceMax: Maximum chance of causing a critical hit when on <MaxBonusLevel> or higher # ChanceMax: Maximum chance of causing a critical hit when on <MaxBonusLevel> or higher
# MaxBonusLevel: Level where <ChanceMax> of causing critical hits is reached # MaxBonusLevel: Level where <ChanceMax> of causing critical hits is reached