mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Let's do this the right way.
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
package com.gmail.nossr50.skills.archery;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@ -15,6 +17,7 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
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.SkillUtils;
|
||||
|
||||
public class ArcheryManager extends SkillManager {
|
||||
@ -68,26 +71,26 @@ public class ArcheryManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
public double dazeCheck(Player defender, double damage) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel)) {
|
||||
Location dazedLocation = defender.getLocation();
|
||||
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
|
||||
|
||||
defender.teleport(dazedLocation);
|
||||
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||
}
|
||||
|
||||
return damage + Archery.dazeModifier;
|
||||
public void daze(Player defender, Arrow arrow) {
|
||||
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return damage;
|
||||
Location dazedLocation = defender.getLocation();
|
||||
dazedLocation.setPitch(90 - Misc.getRandom().nextInt(181));
|
||||
|
||||
defender.teleport(dazedLocation);
|
||||
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
|
||||
}
|
||||
|
||||
CombatUtils.dealDamage(defender, Archery.dazeModifier, DamageCause.PROJECTILE, arrow);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,10 +99,10 @@ public class ArcheryManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @return the modified event damage
|
||||
*/
|
||||
public double skillShotCheck(double damage) {
|
||||
public void skillShot(LivingEntity target, double damage, Arrow arrow) {
|
||||
double damageBonusPercent = Math.min(((getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage), Archery.skillShotMaxBonusPercentage);
|
||||
double archeryBonus = damage * damageBonusPercent;
|
||||
|
||||
return damage + archeryBonus;
|
||||
CombatUtils.dealDamage(target, archeryBonus, DamageCause.PROJECTILE, arrow);
|
||||
}
|
||||
}
|
||||
|
@ -55,10 +55,10 @@ public class AxesManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @return the modified event damage
|
||||
*/
|
||||
public double axeMasteryCheck(double damage) {
|
||||
public void axeMastery(LivingEntity target) {
|
||||
double axeBonus = Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
|
||||
|
||||
return damage + axeBonus;
|
||||
CombatUtils.dealDamage(target, axeBonus, getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,20 +68,25 @@ public class AxesManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
public double criticalHitCheck(LivingEntity target, double damage) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
||||
|
||||
if (target instanceof Player) {
|
||||
((Player) target).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||
|
||||
return damage * Axes.criticalHitPVPModifier;
|
||||
}
|
||||
|
||||
return damage * Axes.criticalHitPVEModifier;
|
||||
public void criticalHit(LivingEntity target, double damage) {
|
||||
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return damage;
|
||||
Player player = getPlayer();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.CriticalHit"));
|
||||
|
||||
if (target instanceof Player) {
|
||||
((Player) target).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||
|
||||
damage = (damage * Axes.criticalHitPVPModifier) - damage;
|
||||
}
|
||||
else {
|
||||
damage = (damage * Axes.criticalHitPVEModifier) - damage;
|
||||
}
|
||||
|
||||
CombatUtils.dealDamage(target, damage, player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,29 +116,29 @@ public class AxesManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||
*/
|
||||
public double greaterImpactCheck(LivingEntity target, double damage) {
|
||||
if (Axes.greaterImpactChance > Misc.getRandom().nextInt(getActivationChance())) {
|
||||
Player player = getPlayer();
|
||||
|
||||
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||
target.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
||||
}
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
defender.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
||||
}
|
||||
}
|
||||
|
||||
return damage + Axes.greaterImpactBonusDamage;
|
||||
public void greaterImpact(LivingEntity target) {
|
||||
if (!(Axes.greaterImpactChance > Misc.getRandom().nextInt(getActivationChance()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
return damage;
|
||||
Player player = getPlayer();
|
||||
|
||||
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||
target.setVelocity(player.getLocation().getDirection().normalize().multiply(Axes.greaterImpactKnockbackMultiplier));
|
||||
|
||||
if (mcMMOPlayer.useChatNotifications()) {
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));
|
||||
}
|
||||
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
defender.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Struck"));
|
||||
}
|
||||
}
|
||||
|
||||
CombatUtils.dealDamage(target, Axes.greaterImpactBonusDamage, player);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class TamingManager extends SkillManager {
|
||||
@ -103,19 +104,25 @@ public class TamingManager extends SkillManager {
|
||||
* @param target The LivingEntity to apply Gore on
|
||||
* @param damage The initial damage
|
||||
*/
|
||||
public double gore(LivingEntity target, double damage) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Taming.goreMaxChance, Taming.goreMaxBonusLevel)) {
|
||||
BleedTimerTask.add(target, Taming.goreBleedTicks);
|
||||
|
||||
if (target instanceof Player) {
|
||||
((Player) target).sendMessage(LocaleLoader.getString("Combat.StruckByGore"));
|
||||
}
|
||||
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
|
||||
return damage * Taming.goreModifier;
|
||||
public void gore(LivingEntity target, double damage, Wolf wolf) {
|
||||
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Taming.goreMaxChance, Taming.goreMaxBonusLevel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return damage;
|
||||
BleedTimerTask.add(target, Taming.goreBleedTicks);
|
||||
|
||||
if (target instanceof Player) {
|
||||
((Player) target).sendMessage(LocaleLoader.getString("Combat.StruckByGore"));
|
||||
}
|
||||
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));
|
||||
|
||||
damage = (damage * Taming.goreModifier) - damage;
|
||||
CombatUtils.dealDamage(target, damage, wolf);
|
||||
}
|
||||
|
||||
public void sharpenedClaws(LivingEntity target, Wolf wolf) {
|
||||
CombatUtils.dealDamage(target, Taming.sharpenedClawsBonusDamage, wolf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class UnarmedManager extends SkillManager {
|
||||
@ -95,8 +96,10 @@ public class UnarmedManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public double berserkDamage(double damage) {
|
||||
return damage * Unarmed.berserkDamageModifier;
|
||||
public void berserkDamage(LivingEntity target, double damage) {
|
||||
damage = (damage * Unarmed.berserkDamageModifier) - damage;
|
||||
|
||||
CombatUtils.dealDamage(target, damage, getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,10 +108,10 @@ public class UnarmedManager extends SkillManager {
|
||||
* @param damage The amount of damage initially dealt by the event
|
||||
* @return the modified event damage
|
||||
*/
|
||||
public double ironArmCheck(double damage) {
|
||||
public void ironArm(LivingEntity target) {
|
||||
int unarmedBonus = Math.min(Unarmed.ironArmMinBonusDamage + (getSkillLevel() / Unarmed.ironArmIncreaseLevel), Unarmed.ironArmMaxBonusDamage);
|
||||
|
||||
return damage + unarmedBonus;
|
||||
CombatUtils.dealDamage(target, unarmedBonus, getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user