mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Move standard activation checks into activation function, Archery refactoring, Unarmed cleanup, start work on Axe events.
This commit is contained in:
parent
965035fa72
commit
d6fbf1be34
@ -51,6 +51,7 @@ Version 1.4.07
|
||||
+ Added new /mccooldowns command to show all ability cooldowns
|
||||
+ Commands may now both print text and display a scoreboard
|
||||
+ Killing a custom entity will automatically add it to the custom entity config file with default values.
|
||||
= Fixed McMMOPlayerDisarmEvent reporting the skill level of the defending player, not the attacking player.
|
||||
= Fixed bug where arrow retrieval was not properly detecting entities that already existed in the tracker
|
||||
= Fixed bug which allowed players to bypass fishing's exploit prevention
|
||||
= Fixed bug where FakeEntityDamageByEntityEvent wasn't being fired
|
||||
|
@ -757,6 +757,10 @@ public class McMMOPlayer {
|
||||
ToolType tool = skill.getTool();
|
||||
AbilityType ability = skill.getAbility();
|
||||
|
||||
if (!getToolPreparationMode(tool) || !ability.getPermissions(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setToolPreparationMode(tool, false);
|
||||
|
||||
if (getAbilityMode(ability)) {
|
||||
|
@ -0,0 +1,14 @@
|
||||
package com.gmail.nossr50.events.skills.axes;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerCombatEvent;
|
||||
|
||||
public class McMMOPlayerAxeCombatEvent extends McMMOPlayerCombatEvent {
|
||||
public McMMOPlayerAxeCombatEvent(Player player, Entity damager, Entity damagee, DamageCause cause, double damage) {
|
||||
super(player, damager, damagee, cause, damage, SkillType.AXES);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.gmail.nossr50.events.skills.axes;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public abstract class McMMOPlayerAxeEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
|
||||
protected McMMOPlayerAxeEvent(Player player) {
|
||||
super(player, SkillType.AXES);
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.gmail.nossr50.events.skills.unarmed;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class McMMOPlayerDeflectEvent extends McMMOPlayerUnarmedEvent {
|
||||
public McMMOPlayerDeflectEvent(Player player) {
|
||||
super(player);
|
||||
}
|
||||
}
|
@ -1,32 +1,27 @@
|
||||
package com.gmail.nossr50.events.skills.unarmed;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public class McMMOPlayerDisarmEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
public class McMMOPlayerDisarmEvent extends McMMOPlayerUnarmedEvent {
|
||||
private Player defender;
|
||||
private ItemStack droppedItem;
|
||||
|
||||
public McMMOPlayerDisarmEvent(Player defender) {
|
||||
super(defender, SkillType.UNARMED);
|
||||
public McMMOPlayerDisarmEvent(Player attacker, Player defender) {
|
||||
super(attacker);
|
||||
this.defender = defender;
|
||||
this.setDroppedItem(defender.getItemInHand());
|
||||
}
|
||||
|
||||
public Player getDefender() {
|
||||
return defender;
|
||||
}
|
||||
|
||||
/** Following are required for Cancellable **/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
public ItemStack getDroppedItem() {
|
||||
return droppedItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
public void setDroppedItem(ItemStack droppedItem) {
|
||||
this.droppedItem = droppedItem;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.gmail.nossr50.events.skills.unarmed;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||
|
||||
public abstract class McMMOPlayerUnarmedEvent extends McMMOPlayerSkillEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
|
||||
protected McMMOPlayerUnarmedEvent(Player player) {
|
||||
super(player, SkillType.UNARMED);
|
||||
cancelled = false;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
@ -26,7 +26,6 @@ import com.gmail.nossr50.config.HiddenConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||
import com.gmail.nossr50.runnables.StickyPistonTrackerTask;
|
||||
@ -148,9 +147,7 @@ public class BlockListener implements Listener {
|
||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||
|
||||
/* Green Terra */
|
||||
if (herbalismManager.canActivateAbility()) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't check the block store here because herbalism has too many unusual edge cases.
|
||||
@ -279,19 +276,19 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
if (ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState))) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.HERBALISM);
|
||||
}
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
else if (ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState)) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.WOODCUTTING);
|
||||
}
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
else if (ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState)) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.MINING);
|
||||
}
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
else if (ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState)) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.EXCAVATION);
|
||||
}
|
||||
else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||
else if (heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState))) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
|
@ -25,25 +25,13 @@ public class ArcheryManager extends SkillManager {
|
||||
super(mcMMOPlayer, SkillType.ARCHERY);
|
||||
}
|
||||
|
||||
public boolean canDaze(LivingEntity target) {
|
||||
return target instanceof Player && Permissions.daze(getPlayer()) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel);
|
||||
}
|
||||
|
||||
public boolean canUseSkillShot() {
|
||||
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.bonusDamage(getPlayer(), skill);
|
||||
}
|
||||
|
||||
public boolean canTrack(Arrow arrow) {
|
||||
return Permissions.arrowRetrieval(getPlayer()) && !arrow.hasMetadata(mcMMO.infiniteArrowKey) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.retrieveMaxChance, Archery.retrieveMaxBonusLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate bonus XP awarded for Archery when hitting a far-away target.
|
||||
*
|
||||
* @param target The {@link LivingEntity} damaged by the arrow
|
||||
* @param damager The {@link Entity} who shot the arrow
|
||||
*/
|
||||
public void distanceXpBonus(LivingEntity target, Entity damager) {
|
||||
public void awardDistanceXpBonus(LivingEntity target, Entity damager) {
|
||||
Location firedLocation = (Location) damager.getMetadata(mcMMO.arrowDistanceKey).get(0).value();
|
||||
Location targetLocation = target.getLocation();
|
||||
|
||||
@ -134,4 +122,16 @@ public class ArcheryManager extends SkillManager {
|
||||
|
||||
return archeryBonus;
|
||||
}
|
||||
|
||||
private boolean canDaze(LivingEntity target) {
|
||||
return target instanceof Player && Permissions.daze(getPlayer()) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel);
|
||||
}
|
||||
|
||||
private boolean canUseSkillShot() {
|
||||
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.bonusDamage(getPlayer(), skill);
|
||||
}
|
||||
|
||||
private boolean canTrack(Arrow arrow) {
|
||||
return Permissions.arrowRetrieval(getPlayer()) && !arrow.hasMetadata(mcMMO.infiniteArrowKey) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.retrieveMaxChance, Archery.retrieveMaxBonusLevel);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
@ -43,10 +42,6 @@ public class AxesManager extends SkillManager {
|
||||
return target.isValid() && mcMMOPlayer.getAbilityMode(AbilityType.SKULL_SPLITTER) && Permissions.skullSplitter(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
return mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && Permissions.skullSplitter(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the effects of the Axe Mastery ability
|
||||
*
|
||||
|
@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
@ -21,10 +20,6 @@ public class SwordsManager extends SkillManager {
|
||||
super(mcMMOPlayer, SkillType.SWORDS);
|
||||
}
|
||||
|
||||
public boolean canActivateAbility() {
|
||||
return mcMMOPlayer.getToolPreparationMode(ToolType.SWORD) && Permissions.serratedStrikes(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canUseBleed() {
|
||||
return Permissions.bleed(getPlayer());
|
||||
}
|
||||
|
@ -8,13 +8,15 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.SmoothBrick;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.events.skills.unarmed.McMMOPlayerDeflectEvent;
|
||||
import com.gmail.nossr50.events.skills.unarmed.McMMOPlayerDisarmEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
@ -37,14 +39,20 @@ public class UnarmedManager extends SkillManager {
|
||||
return mcMMOPlayer.getAbilityMode(AbilityType.BERSERK) && Permissions.berserk(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canDisarm(LivingEntity target) {
|
||||
return target instanceof Player && ((Player) target).getItemInHand().getType() != Material.AIR && Permissions.disarm(getPlayer());
|
||||
private boolean canDisarm(LivingEntity target) {
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
return defender.getItemInHand().getType() != Material.AIR && Permissions.disarm(getPlayer()) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Unarmed.disarmMaxChance, Unarmed.disarmMaxBonusLevel) && !hasIronGrip(defender);
|
||||
}
|
||||
|
||||
public boolean canDeflect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canDeflect() {
|
||||
Player player = getPlayer();
|
||||
|
||||
return player.getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect(player);
|
||||
return skill.getPVPEnabled() && player.getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect(player) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Unarmed.deflectMaxChance, Unarmed.deflectMaxBonusLevel);
|
||||
}
|
||||
|
||||
public boolean canUseBlockCracker() {
|
||||
@ -78,33 +86,49 @@ public class UnarmedManager extends SkillManager {
|
||||
/**
|
||||
* Check for disarm.
|
||||
*
|
||||
* @param defender The defending player
|
||||
* @param target The defending {@link LivingEntity}
|
||||
*/
|
||||
public void disarmCheck(Player defender) {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Unarmed.disarmMaxChance, Unarmed.disarmMaxBonusLevel) && !hasIronGrip(defender)) {
|
||||
if (EventUtils.callDisarmEvent(defender).isCancelled()) {
|
||||
public void disarm(LivingEntity target) {
|
||||
if (!canDisarm(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Misc.dropItem(defender.getLocation(), defender.getItemInHand());
|
||||
Player defender = (Player) target;
|
||||
|
||||
McMMOPlayerDisarmEvent event = new McMMOPlayerDisarmEvent(getPlayer(), defender);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Misc.dropItem(defender.getLocation(), event.getDroppedItem());
|
||||
|
||||
defender.setItemInHand(new ItemStack(Material.AIR));
|
||||
defender.sendMessage(LocaleLoader.getString("Skills.Disarmed"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for arrow deflection.
|
||||
*/
|
||||
public boolean deflectCheck() {
|
||||
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Unarmed.deflectMaxChance, Unarmed.deflectMaxBonusLevel)) {
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Combat.ArrowDeflect"));
|
||||
return true;
|
||||
public boolean deflect() {
|
||||
if (!canDeflect()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = getPlayer();
|
||||
|
||||
McMMOPlayerDeflectEvent event = new McMMOPlayerDeflectEvent(player);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Combat.ArrowDeflect"));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the effects of the Berserk ability
|
||||
*
|
||||
|
@ -32,7 +32,6 @@ import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerMagicHunterEvent;
|
||||
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
||||
import com.gmail.nossr50.events.skills.unarmed.McMMOPlayerDisarmEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
@ -182,11 +181,4 @@ public class EventUtils {
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
public static McMMOPlayerDisarmEvent callDisarmEvent(Player defender) {
|
||||
McMMOPlayerDisarmEvent event = new McMMOPlayerDisarmEvent(defender);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +48,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
||||
|
||||
if (swordsManager.canActivateAbility()) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.SWORDS);
|
||||
}
|
||||
|
||||
if (swordsManager.canUseBleed()) {
|
||||
swordsManager.bleedCheck(target);
|
||||
@ -65,35 +63,33 @@ public final class CombatUtils {
|
||||
|
||||
private static void processAxeCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
|
||||
double initialDamage = event.getDamage();
|
||||
double finalDamage = initialDamage;
|
||||
double bonusDamage = 0;
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
AxesManager axesManager = mcMMOPlayer.getAxesManager();
|
||||
|
||||
if (axesManager.canActivateAbility()) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.AXES);
|
||||
}
|
||||
|
||||
if (axesManager.canUseAxeMastery()) {
|
||||
finalDamage += axesManager.axeMastery(target);
|
||||
bonusDamage += axesManager.axeMastery(target);
|
||||
}
|
||||
|
||||
if (axesManager.canCriticalHit(target)) {
|
||||
finalDamage += axesManager.criticalHit(target, initialDamage);
|
||||
bonusDamage += axesManager.criticalHit(target, initialDamage);
|
||||
}
|
||||
|
||||
if (axesManager.canImpact(target)) {
|
||||
axesManager.impactCheck(target);
|
||||
}
|
||||
else if (axesManager.canGreaterImpact(target)) {
|
||||
finalDamage += axesManager.greaterImpact(target);
|
||||
bonusDamage += axesManager.greaterImpact(target);
|
||||
}
|
||||
|
||||
if (axesManager.canUseSkullSplitter(target)) {
|
||||
axesManager.skullSplitterCheck(target, initialDamage);
|
||||
}
|
||||
|
||||
event.setDamage(finalDamage);
|
||||
event.setDamage(initialDamage + bonusDamage);
|
||||
startGainXp(mcMMOPlayer, target, SkillType.AXES);
|
||||
}
|
||||
|
||||
@ -104,9 +100,7 @@ public final class CombatUtils {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
|
||||
|
||||
if (unarmedManager.canActivateAbility()) {
|
||||
mcMMOPlayer.checkAbilityActivation(SkillType.UNARMED);
|
||||
}
|
||||
|
||||
if (unarmedManager.canUseIronArm()) {
|
||||
finalDamage += unarmedManager.ironArm(target);
|
||||
@ -116,9 +110,7 @@ public final class CombatUtils {
|
||||
finalDamage += unarmedManager.berserkDamage(target, initialDamage);
|
||||
}
|
||||
|
||||
if (unarmedManager.canDisarm(target)) {
|
||||
unarmedManager.disarmCheck((Player) target);
|
||||
}
|
||||
unarmedManager.disarm(target);
|
||||
|
||||
event.setDamage(finalDamage);
|
||||
startGainXp(mcMMOPlayer, target, SkillType.UNARMED);
|
||||
@ -148,31 +140,28 @@ public final class CombatUtils {
|
||||
}
|
||||
|
||||
private static void processArcheryCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Arrow arrow) {
|
||||
double initialDamage = event.getDamage();
|
||||
double finalDamage = initialDamage;
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
|
||||
|
||||
if (target instanceof Player && SkillType.UNARMED.getPVPEnabled()) {
|
||||
if (target instanceof Player) {
|
||||
UnarmedManager unarmedManager = UserManager.getPlayer((Player) target).getUnarmedManager();
|
||||
|
||||
if (unarmedManager.canDeflect()) {
|
||||
event.setCancelled(unarmedManager.deflectCheck());
|
||||
event.setCancelled(unarmedManager.deflect());
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
finalDamage += archeryManager.skillShot(target, initialDamage, arrow);
|
||||
finalDamage += archeryManager.daze(target, arrow);
|
||||
double initialDamage = event.getDamage();
|
||||
double bonusDamage = 0;
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
|
||||
|
||||
bonusDamage += archeryManager.skillShot(target, initialDamage, arrow);
|
||||
bonusDamage += archeryManager.daze(target, arrow);
|
||||
|
||||
archeryManager.trackArrow(target, arrow);
|
||||
archeryManager.distanceXpBonus(target, arrow);
|
||||
archeryManager.awardDistanceXpBonus(target, arrow);
|
||||
|
||||
event.setDamage(finalDamage);
|
||||
event.setDamage(initialDamage + bonusDamage);
|
||||
startGainXp(mcMMOPlayer, target, SkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user