mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Simplified combat ability checks
This commit is contained in:
parent
d51fa92b46
commit
e61342177d
@ -23,7 +23,6 @@ import com.gmail.nossr50.config.Config;
|
|||||||
import com.gmail.nossr50.datatypes.AbilityType;
|
import com.gmail.nossr50.datatypes.AbilityType;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.SkillType;
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
import com.gmail.nossr50.datatypes.ToolType;
|
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -64,8 +63,6 @@ public class Combat {
|
|||||||
ItemStack itemInHand = attacker.getItemInHand();
|
ItemStack itemInHand = attacker.getItemInHand();
|
||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
PlayerProfile PPa = Users.getProfile(attacker);
|
||||||
|
|
||||||
combatAbilityChecks(attacker);
|
|
||||||
|
|
||||||
if (ItemChecks.isSword(itemInHand)) {
|
if (ItemChecks.isSword(itemInHand)) {
|
||||||
if (targetIsPlayer || targetIsTamedPet) {
|
if (targetIsPlayer || targetIsTamedPet) {
|
||||||
if (!configInstance.getSwordsPVP()) {
|
if (!configInstance.getSwordsPVP()) {
|
||||||
@ -76,6 +73,8 @@ public class Combat {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Skills.abilityCheck(attacker, SkillType.SWORDS);
|
||||||
|
|
||||||
SwordsManager swordsManager = new SwordsManager(attacker);
|
SwordsManager swordsManager = new SwordsManager(attacker);
|
||||||
|
|
||||||
swordsManager.bleedCheck(target);
|
swordsManager.bleedCheck(target);
|
||||||
@ -96,6 +95,8 @@ public class Combat {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Skills.abilityCheck(attacker, SkillType.AXES);
|
||||||
|
|
||||||
if (permInstance.axeBonus(attacker)) {
|
if (permInstance.axeBonus(attacker)) {
|
||||||
Axes.axesBonus(attacker, event);
|
Axes.axesBonus(attacker, event);
|
||||||
}
|
}
|
||||||
@ -124,6 +125,8 @@ public class Combat {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Skills.abilityCheck(attacker, SkillType.UNARMED);
|
||||||
|
|
||||||
UnarmedManager unarmedManager = new UnarmedManager(attacker);
|
UnarmedManager unarmedManager = new UnarmedManager(attacker);
|
||||||
|
|
||||||
unarmedManager.bonusDamage(event);
|
unarmedManager.bonusDamage(event);
|
||||||
@ -218,25 +221,6 @@ public class Combat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Process combat abilities based on weapon preparation modes.
|
|
||||||
*
|
|
||||||
* @param attacker The player attacking
|
|
||||||
*/
|
|
||||||
public static void combatAbilityChecks(Player attacker) {
|
|
||||||
PlayerProfile PPa = Users.getProfile(attacker);
|
|
||||||
|
|
||||||
if (PPa.getToolPreparationMode(ToolType.AXE)) {
|
|
||||||
Skills.abilityCheck(attacker, SkillType.AXES);
|
|
||||||
}
|
|
||||||
else if (PPa.getToolPreparationMode(ToolType.SWORD)) {
|
|
||||||
Skills.abilityCheck(attacker, SkillType.SWORDS);
|
|
||||||
}
|
|
||||||
else if (PPa.getToolPreparationMode(ToolType.FISTS)) {
|
|
||||||
Skills.abilityCheck(attacker, SkillType.UNARMED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process archery abilities.
|
* Process archery abilities.
|
||||||
*
|
*
|
||||||
|
@ -384,14 +384,16 @@ public class Skills {
|
|||||||
*/
|
*/
|
||||||
public static void abilityCheck(Player player, SkillType type) {
|
public static void abilityCheck(Player player, SkillType type) {
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
AbilityType ability = type.getAbility();
|
|
||||||
ToolType tool = type.getTool();
|
ToolType tool = type.getTool();
|
||||||
|
|
||||||
if (type.getTool().inHand(player.getItemInHand())) {
|
if (!PP.getToolPreparationMode(tool)) {
|
||||||
if (PP.getToolPreparationMode(tool)) {
|
return;
|
||||||
PP.setToolPreparationMode(tool, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PP.setToolPreparationMode(tool, false);
|
||||||
|
|
||||||
|
AbilityType ability = type.getAbility();
|
||||||
|
|
||||||
/* Axes and Woodcutting are odd because they share the same tool.
|
/* Axes and Woodcutting are odd because they share the same tool.
|
||||||
* We show them the too tired message when they take action.
|
* We show them the too tired message when they take action.
|
||||||
*/
|
*/
|
||||||
@ -433,7 +435,6 @@ public class Skills {
|
|||||||
PP.setAbilityMode(ability, true);
|
PP.setAbilityMode(ability, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if ability should be triggered.
|
* Check to see if ability should be triggered.
|
||||||
|
Loading…
Reference in New Issue
Block a user