mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
Setup Fishing XP Methods
This commit is contained in:
parent
e156d6d5ef
commit
2170c6de24
@ -160,11 +160,6 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
/*
|
/*
|
||||||
* XP SETTINGS
|
* XP SETTINGS
|
||||||
*/
|
*/
|
||||||
/* Archery */
|
|
||||||
if (getArcheryDistanceMultiplier() < 0) {
|
|
||||||
reason.add(EXPERIENCE + "." + ARCHERY + "." + DISTANCE + MULTIPLIER + " should be at least 0!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Combat XP Multipliers */
|
/* Combat XP Multipliers */
|
||||||
if (getAnimalsXP() < 0) {
|
if (getAnimalsXP() < 0) {
|
||||||
reason.add(EXPERIENCE + "." + COMBAT + "." + MULTIPLIER + "." + ANIMALS + " should be at least 0!");
|
reason.add(EXPERIENCE + "." + COMBAT + "." + MULTIPLIER + "." + ANIMALS + " should be at least 0!");
|
||||||
@ -379,11 +374,6 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
return BarStyle.SOLID;
|
return BarStyle.SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Archery */
|
|
||||||
public double getArcheryDistanceMultiplier() {
|
|
||||||
return getDoubleValue(EXPERIENCE, ARCHERY, DISTANCE + MULTIPLIER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFishingShakeXP() {
|
public int getFishingShakeXP() {
|
||||||
return getIntValue(EXPERIENCE, FISHING, SHAKE);
|
return getIntValue(EXPERIENCE, FISHING, SHAKE);
|
||||||
}
|
}
|
||||||
|
@ -143,4 +143,16 @@ public class ConfigExperience {
|
|||||||
public boolean isPvpXPEnabled() {
|
public boolean isPvpXPEnabled() {
|
||||||
return experienceCombat.isPvpXPEnabled();
|
return experienceCombat.isPvpXPEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getDistanceMultiplier() {
|
||||||
|
return experienceArchery.getDistanceMultiplier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, Integer> getFishingXPMap() {
|
||||||
|
return experienceFishing.getFishingXPMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getShakeXP() {
|
||||||
|
return experienceFishing.getShakeXP();
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,10 +1,22 @@
|
|||||||
package com.gmail.nossr50.config.hocon.experience;
|
package com.gmail.nossr50.config.hocon.experience;
|
||||||
|
|
||||||
|
import ninja.leaping.configurate.objectmapping.Setting;
|
||||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public class ConfigExperienceArchery {
|
public class ConfigExperienceArchery {
|
||||||
|
|
||||||
|
public static final double DISTANCE_MULTIPLIER_DEFAULT = 0.025D;
|
||||||
|
|
||||||
|
@Setting(value = "Distance-Multiplier", comment = "The distance multiplier is multiplied against the distance an " +
|
||||||
|
"arrow travels before hitting its target to determine final XP values awarded." +
|
||||||
|
"\nThe maximum distance bonus is 50, so expect this multiplier to peak at being multiplied against 50." +
|
||||||
|
"\nDistance is in blocks traveled." +
|
||||||
|
"\nThis value is added on to normal XP gains from damage for Archery." +
|
||||||
|
"\nDefault value: "+DISTANCE_MULTIPLIER_DEFAULT)
|
||||||
|
private double distanceMultiplier = DISTANCE_MULTIPLIER_DEFAULT;
|
||||||
|
|
||||||
|
public double getDistanceMultiplier() {
|
||||||
|
return distanceMultiplier;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,8 +1,36 @@
|
|||||||
package com.gmail.nossr50.config.hocon.experience;
|
package com.gmail.nossr50.config.hocon.experience;
|
||||||
|
|
||||||
|
import ninja.leaping.configurate.objectmapping.Setting;
|
||||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public class ConfigExperienceFishing {
|
public class ConfigExperienceFishing {
|
||||||
|
private final static HashMap<String, Integer> FISHING_DEFAULT_XP_MAP;
|
||||||
|
public static final int SHAKE_XP_DEFAULT = 50;
|
||||||
|
|
||||||
|
static {
|
||||||
|
FISHING_DEFAULT_XP_MAP = new HashMap<>();
|
||||||
|
|
||||||
|
FISHING_DEFAULT_XP_MAP.put(Material.COD.getKey().toString(), 100);
|
||||||
|
FISHING_DEFAULT_XP_MAP.put(Material.SALMON.getKey().toString(), 600);
|
||||||
|
FISHING_DEFAULT_XP_MAP.put(Material.TROPICAL_FISH.getKey().toString(), 10000);
|
||||||
|
FISHING_DEFAULT_XP_MAP.put(Material.PUFFERFISH.getKey().toString(), 2400);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Setting(value = "Fishing-Experience-Values", comment = "Experience values for Fishing.")
|
||||||
|
HashMap<String, Integer> fishingXPMap = FISHING_DEFAULT_XP_MAP;
|
||||||
|
|
||||||
|
@Setting(value = "Shake", comment = "XP Granted when shaking a mob")
|
||||||
|
private int shakeXP = SHAKE_XP_DEFAULT;
|
||||||
|
|
||||||
|
public HashMap<String, Integer> getFishingXPMap() {
|
||||||
|
return fishingXPMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getShakeXP() {
|
||||||
|
return shakeXP;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.skills.archery;
|
package com.gmail.nossr50.skills.archery;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -17,21 +17,30 @@ import java.util.List;
|
|||||||
public class Archery {
|
public class Archery {
|
||||||
private static List<TrackedEntity> trackedEntities;
|
private static List<TrackedEntity> trackedEntities;
|
||||||
|
|
||||||
public static double skillShotMaxBonusDamage;
|
private static double skillShotDamageCap;
|
||||||
|
|
||||||
public static double dazeBonusDamage;
|
private static double dazeBonusDamage;
|
||||||
|
|
||||||
public static double DISTANCE_XP_MULTIPLIER;
|
private static double distanceXpMultiplier;
|
||||||
|
|
||||||
|
private static Archery archery;
|
||||||
|
|
||||||
|
public static Archery getInstance() {
|
||||||
|
if(archery == null)
|
||||||
|
archery = new Archery();
|
||||||
|
|
||||||
|
return archery;
|
||||||
|
}
|
||||||
|
|
||||||
public Archery()
|
public Archery()
|
||||||
{
|
{
|
||||||
List<TrackedEntity> trackedEntities = new ArrayList<>();
|
List<TrackedEntity> trackedEntities = new ArrayList<>();
|
||||||
|
|
||||||
skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
skillShotDamageCap = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
||||||
|
|
||||||
dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
|
dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
|
||||||
|
|
||||||
DISTANCE_XP_MULTIPLIER = ExperienceConfig.getInstance().getArcheryDistanceMultiplier();
|
distanceXpMultiplier = mcMMO.getConfigManager().getConfigExperience().getDistanceMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
protected static void incrementTrackerValue(LivingEntity livingEntity) {
|
||||||
@ -77,10 +86,26 @@ public class Archery {
|
|||||||
{
|
{
|
||||||
double damageBonusPercent = getDamageBonusPercent(player);
|
double damageBonusPercent = getDamageBonusPercent(player);
|
||||||
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
|
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
|
||||||
return Math.min(newDamage, Archery.skillShotMaxBonusDamage);
|
return Math.min(newDamage, Archery.skillShotDamageCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getDamageBonusPercent(Player player) {
|
public static double getDamageBonusPercent(Player player) {
|
||||||
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier()) / 100.0D;
|
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier()) / 100.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TrackedEntity> getTrackedEntities() {
|
||||||
|
return trackedEntities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSkillShotDamageCap() {
|
||||||
|
return skillShotDamageCap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDazeBonusDamage() {
|
||||||
|
return dazeBonusDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getDistanceXpMultiplier() {
|
||||||
|
return distanceXpMultiplier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1 + Math.min(firedLocation.distance(targetLocation), 50) * Archery.DISTANCE_XP_MULTIPLIER;
|
return 1 + Math.min(firedLocation.distance(targetLocation), 50) * Archery.getInstance().getDistanceXpMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +98,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.TargetDazed");
|
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Combat.TargetDazed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Archery.dazeBonusDamage;
|
return Archery.getInstance().getDazeBonusDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user