Starting to convert existing subskills to be JSON friendly

So far only a few have been converted
This commit is contained in:
nossr50 2019-01-03 03:42:11 -08:00
parent f4ead570d4
commit 4669e3e54d
7 changed files with 90 additions and 31 deletions

View File

@ -9,7 +9,7 @@ Key:
Version 2.1.0 Version 2.1.0
+ Added JSON support to Woodcutting command + Added JSON support to Woodcutting command
+ Added config setting to enable or disable classic mcMMO mode + Added config setting to enable or disable classic mcMMO skill scaling
+ (Config) Added rank settings for the new Woodcutting skill + (Config) Added rank settings for the new Woodcutting skill
+ (Config) Added configurable parameters for the new Tree Feller + (Config) Added configurable parameters for the new Tree Feller
+ (Config) Added classic toggle for Tree Feller + (Config) Added classic toggle for Tree Feller
@ -17,8 +17,12 @@ 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
! Woodcutting's Double Drop subskill is now named Harvest Lumber - (Config) Removed Skills.Archery.SkillShot.IncreaseLevel & Skills.Archery.SkillShot.IncreasePercentage
! Replaced the old Double Drop permission node for woodcutting with a new Harvest Lumber permission node ! (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
! (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
! (API) SkillType is now PrimarySkill ! (API) SkillType is now PrimarySkill
@ -28,8 +32,8 @@ Version 2.1.0
! (API) SecondarySkill ENUM is being updated to have the parent skill as a prefix and a getter method for grabbing the parent skill ! (API) SecondarySkill ENUM is being updated to have the parent skill as a prefix and a getter method for grabbing the parent skill
! (API) GREEN_THUMB_PLANT & GREEN_THUMB_BLOCK are replaced by GREEN_THUMB ! (API) GREEN_THUMB_PLANT & GREEN_THUMB_BLOCK are replaced by GREEN_THUMB
! Skill Super Powers (Tree Feller, etc...) will now require level 10+ to use ! Skill Super Powers (Tree Feller, etc...) will now require level 10+ to use
! mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (I'll be explaining this in a write-up) ! (Skills) mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (for existing mcMMO installs this is opt-in and off by default)
! Refactored some unreadable code relating to SecondaryAbility activation in SkillUtils ! (Code) Refactored some unreadable code relating to SecondaryAbility activation in SkillUtils
Version 2.0.0 Version 2.0.0

View File

@ -118,16 +118,13 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
} }
/* ARCHERY */ /* ARCHERY */
if (getSkillShotIncreaseLevel() < 1) {
reason.add("Skills.Archery.SkillShot.IncreaseLevel should be at least 1!");
}
if (getSkillShotIncreasePercentage() <= 0) { if (getSkillShotIncreasePercentage() <= 0) {
reason.add("Skills.Archery.SkillShot.IncreasePercentage should be greater than 0!"); reason.add("Skills.Archery.SkillShot.IncreaseDamage should be greater than 0!");
} }
if (getSkillShotBonusMax() < 0) { if (getSkillShotBonusMax() < 0) {
reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!"); reason.add("Skills.Archery.SkillShot.IncreaseDamageMaxBonus should be at least 0!");
} }
if (getMaxChance(SubSkill.ARCHERY_DAZE) < 1) { if (getMaxChance(SubSkill.ARCHERY_DAZE) < 1) {
@ -739,8 +736,8 @@ 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.IncreasePercentage", 0.1D); } public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot.IncreaseDamage", 10.0D); }
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot.MaxBonus", 2.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); }

View File

@ -2,23 +2,27 @@ package com.gmail.nossr50.datatypes.skills;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
import static com.gmail.nossr50.datatypes.skills.SubSkillFlags.ACTIVE;
import static com.gmail.nossr50.datatypes.skills.SubSkillFlags.SUPERABILITY;
import static com.gmail.nossr50.datatypes.skills.SubSkillFlags.RNG;
public enum SubSkill { public enum SubSkill {
/* !! Warning -- Do not let subskills share a name with any existing PrimarySkill as it will clash with the static import !! */ /* !! Warning -- Do not let subskills share a name with any existing PrimarySkill as it will clash with the static import !! */
/* ACROBATICS */ /* ACROBATICS */
ACROBATICS_DODGE, ACROBATICS_DODGE(0, RNG),
ACROBATICS_GRACEFUL_ROLL, ACROBATICS_GRACEFUL_ROLL(0, ACTIVE | RNG),
ACROBATICS_ROLL, ACROBATICS_ROLL(0, RNG),
/* ALCHEMY */ /* ALCHEMY */
ALCHEMY_CATALYSIS, ALCHEMY_CATALYSIS,
ALCHEMY_CONCOCTIONS, ALCHEMY_CONCOCTIONS(8),
/* ARCHERY */ /* ARCHERY */
ARCHERY_DAZE, ARCHERY_DAZE,
ARCHERY_RETRIEVE, ARCHERY_RETRIEVE,
ARCHERY_SKILL_SHOT, ARCHERY_SKILL_SHOT(20),
/* Axes */ /* Axes */
AXES_ARMOR_IMPACT, AXES_ARMOR_IMPACT,
@ -85,33 +89,43 @@ public enum SubSkill {
UNARMED_IRON_GRIP, UNARMED_IRON_GRIP,
/* Woodcutting */ /* Woodcutting */
WOODCUTTING_TREE_FELLER(5), WOODCUTTING_TREE_FELLER(5, ACTIVE | SUPERABILITY),
WOODCUTTING_LEAF_BLOWER(3), WOODCUTTING_LEAF_BLOWER(3),
WOODCUTTING_BARK_SURGEON(3), WOODCUTTING_BARK_SURGEON(3, ACTIVE),
WOODCUTTING_NATURES_BOUNTY(3), WOODCUTTING_NATURES_BOUNTY(3),
WOODCUTTING_SPLINTER(3), WOODCUTTING_SPLINTER(3),
WOODCUTTING_HARVEST_LUMBER(3); WOODCUTTING_HARVEST_LUMBER(3, RNG);
private final int numRanks; private final int numRanks;
private final int flags;
/** /**
* If our SubSkill has more than 1 rank define it * If our SubSkill has more than 1 rank define it
* @param numRanks The number of ranks our SubSkill has * @param numRanks The number of ranks our SubSkill has
*/ */
SubSkill(int numRanks, int flags)
{
this.numRanks = numRanks;
this.flags = flags;
}
SubSkill(int numRanks) SubSkill(int numRanks)
{ {
this.numRanks = numRanks; this.numRanks = numRanks;
this.flags = 0x00;
} }
/**
* SubSkills will default to having 0 ranks if not defined
*/
SubSkill() SubSkill()
{ {
this.numRanks = 0; this.numRanks = 0;
this.flags = 0x00;
} }
/**
* Get the bit flags for this subskill
* @return The bit flags for this subskill
*/
public final int getFlags() { return flags; }
public int getNumRanks() public int getNumRanks()
{ {

View File

@ -0,0 +1,11 @@
package com.gmail.nossr50.datatypes.skills;
public class SubSkillFlags {
/*
* Bitwise Flags
* These are so I can establish properties of each subskill quite easily
*/
public static final byte ACTIVE = 0x01; //Active subskills are ones that aren't passive
public static final byte SUPERABILITY = 0x02; //If the subskill is a super ability
public static final byte RNG = 0x04; //If the subskill makes use of RNG
}

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.skills.archery; package com.gmail.nossr50.skills.archery;
import com.gmail.nossr50.datatypes.skills.SubSkill; import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SubSkillActivationType; import com.gmail.nossr50.util.skills.SubSkillActivationType;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -101,8 +102,14 @@ public class ArcheryManager extends SkillManager {
return damage; return damage;
} }
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage); /*
* 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 Math.min(damage * damageBonusPercent, Archery.skillShotMaxBonusDamage);
} }
} }

View File

@ -81,4 +81,6 @@ public class SkillTextComponentFactory {
subSkillHoverComponents.put(subSkill, newComponents); subSkillHoverComponents.put(subSkill, newComponents);
return subSkillHoverComponents.get(subSkill); return subSkillHoverComponents.get(subSkill);
} }
} }

View File

@ -76,12 +76,36 @@ Skills:
### ###
Archery: Archery:
SkillShot: SkillShot:
# IncreaseLevel: Every <IncreaseLevel> the skillshot bonus will go up by <IncreasePercentage> Rank_Levels:
# IncreasePercentage: This is a percentage value, 0.1 = 10% Rank_1: 5
Rank_2: 10
Rank_3: 15
Rank_4: 20
Rank_5: 25
Rank_6: 30
Rank_7: 35
Rank_8: 40
Rank_9: 45
Rank_10: 50
Rank_11: 55
Rank_12: 60
Rank_13: 65
Rank_14: 70
Rank_15: 75
Rank_16: 80
Rank_17: 85
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% # MaxBonus: When the <MaxBonus> has been reached, the bonus percentage will not go up anymore. 2.0 = 200%
IncreaseLevel: 5 # --OLD SYSTEM -- MaxBonus: 2.0
IncreasePercentage: 0.1
MaxBonus: 2.0
MaxDamage: 9.0 MaxDamage: 9.0
Daze: Daze: