mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 03:04:44 +02:00
converting more SubSkills to be JSON friendly
AxeMaster & SkillShot
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user