mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Cleanup
This commit is contained in:
parent
a9b2a4940e
commit
f9e5096ceb
@ -20,19 +20,18 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class Swords {
|
public class Swords {
|
||||||
|
|
||||||
private static Random random = new Random();
|
private static Random random = new Random();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for Bleed effect.
|
* Check for Bleed effect.
|
||||||
*
|
*
|
||||||
* @param attacker The attacking player
|
* @param attacker The attacking player
|
||||||
* @param entity The defending entity
|
* @param defender The defending entity
|
||||||
*/
|
*/
|
||||||
public static void bleedCheck(Player attacker, LivingEntity entity) {
|
public static void bleedCheck(Player attacker, LivingEntity defender) {
|
||||||
|
|
||||||
if (entity instanceof Tameable) {
|
if (defender instanceof Tameable) {
|
||||||
Tameable pet = (Tameable) entity;
|
Tameable pet = (Tameable) defender;
|
||||||
|
|
||||||
if (pet.isTamed()) {
|
if (pet.isTamed()) {
|
||||||
AnimalTamer tamer = pet.getOwner();
|
AnimalTamer tamer = pet.getOwner();
|
||||||
@ -53,7 +52,7 @@ public class Swords {
|
|||||||
int skillLevel = PPa.getSkillLevel(SkillType.SWORDS);
|
int skillLevel = PPa.getSkillLevel(SkillType.SWORDS);
|
||||||
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||||
|
|
||||||
if (random.nextInt(1000) <= skillCheck && !entity.isDead()) {
|
if (random.nextInt(1000) <= skillCheck && !defender.isDead()) {
|
||||||
int bleedTicks = 0;
|
int bleedTicks = 0;
|
||||||
|
|
||||||
if (skillLevel >= 750) {
|
if (skillLevel >= 750) {
|
||||||
@ -63,7 +62,7 @@ public class Swords {
|
|||||||
bleedTicks = 2;
|
bleedTicks = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
BleedTimer.add(entity, bleedTicks);
|
BleedTimer.add(defender, bleedTicks);
|
||||||
attacker.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
|
attacker.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,7 +70,9 @@ public class Swords {
|
|||||||
/**
|
/**
|
||||||
* Counter-attack entities.
|
* Counter-attack entities.
|
||||||
*
|
*
|
||||||
* @param event The event to modify
|
* @param attacker The attacking entity
|
||||||
|
* @param defender The defending player
|
||||||
|
* @param damage The amount of damage being countered
|
||||||
*/
|
*/
|
||||||
public static void counterAttackChecks(Entity attacker, Player defender, int damage) {
|
public static void counterAttackChecks(Entity attacker, Player defender, int damage) {
|
||||||
if (!(attacker instanceof LivingEntity)) {
|
if (!(attacker instanceof LivingEntity)) {
|
||||||
|
@ -29,7 +29,6 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class Taming {
|
public class Taming {
|
||||||
|
|
||||||
private static Random random = new Random();
|
private static Random random = new Random();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,15 +36,14 @@ public class Taming {
|
|||||||
*
|
*
|
||||||
* @param PPo The PlayerProfile of the wolf's owner
|
* @param PPo The PlayerProfile of the wolf's owner
|
||||||
* @param theWolf The wolf using the ability
|
* @param theWolf The wolf using the ability
|
||||||
* @param event The event to modify
|
* @param damage The damage being absorbed by the wolf
|
||||||
*/
|
*/
|
||||||
public static void fastFoodService (PlayerProfile PPo, Wolf theWolf, EntityDamageEvent event) {
|
public static void fastFoodService (PlayerProfile PPo, Wolf theWolf, int damage) {
|
||||||
final int SKILL_ACTIVATION_LEVEL = 50;
|
final int SKILL_ACTIVATION_LEVEL = 50;
|
||||||
final int ACTIVATION_CHANCE = 50;
|
final int ACTIVATION_CHANCE = 50;
|
||||||
|
|
||||||
int health = theWolf.getHealth();
|
int health = theWolf.getHealth();
|
||||||
int maxHealth = theWolf.getMaxHealth();
|
int maxHealth = theWolf.getMaxHealth();
|
||||||
int damage = event.getDamage();
|
|
||||||
|
|
||||||
if (PPo.getSkillLevel(SkillType.TAMING) >= SKILL_ACTIVATION_LEVEL) {
|
if (PPo.getSkillLevel(SkillType.TAMING) >= SKILL_ACTIVATION_LEVEL) {
|
||||||
if (health < maxHealth) {
|
if (health < maxHealth) {
|
||||||
@ -82,9 +80,8 @@ public class Taming {
|
|||||||
* @param PPo The PlayerProfile of the wolf's owner
|
* @param PPo The PlayerProfile of the wolf's owner
|
||||||
* @param event The event to modify
|
* @param event The event to modify
|
||||||
* @param master The wolf's master
|
* @param master The wolf's master
|
||||||
* @param plugin mcMMO plugin instance
|
|
||||||
*/
|
*/
|
||||||
public static void gore(PlayerProfile PPo, EntityDamageEvent event, Player master, mcMMO plugin) {
|
public static void gore(PlayerProfile PPo, EntityDamageEvent event, Player master) {
|
||||||
final int GORE_MULTIPLIER = 2;
|
final int GORE_MULTIPLIER = 2;
|
||||||
|
|
||||||
if (random.nextInt(1000) <= PPo.getSkillLevel(SkillType.TAMING)) {
|
if (random.nextInt(1000) <= PPo.getSkillLevel(SkillType.TAMING)) {
|
||||||
@ -111,8 +108,7 @@ public class Taming {
|
|||||||
AnimalTamer tamer = beast.getOwner();
|
AnimalTamer tamer = beast.getOwner();
|
||||||
|
|
||||||
if (tamer instanceof Player) {
|
if (tamer instanceof Player) {
|
||||||
Player owner = (Player) tamer;
|
return ((Player) tamer).getName();
|
||||||
return owner.getName();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "Offline Master";
|
return "Offline Master";
|
||||||
@ -261,7 +257,7 @@ public class Taming {
|
|||||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + Misc.prettyItemString(summonItem.getId()));
|
player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(summonItem.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class Unarmed {
|
public class Unarmed {
|
||||||
|
|
||||||
private static Random random = new Random();
|
private static Random random = new Random();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +80,14 @@ public class Unarmed {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean ironGrip(Player defender, Player attacker) {
|
/**
|
||||||
|
* Check Iron Grip ability success
|
||||||
|
*
|
||||||
|
* @param defender The defending player
|
||||||
|
* @param attacker The attacking player
|
||||||
|
* @return true if the defender was not disarmed, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean ironGrip(Player defender, Player attacker) {
|
||||||
final int MAX_BONUS_LEVEL = 1000;
|
final int MAX_BONUS_LEVEL = 1000;
|
||||||
|
|
||||||
PlayerProfile PPd = Users.getProfile(defender);
|
PlayerProfile PPd = Users.getProfile(defender);
|
||||||
|
@ -148,7 +148,8 @@ public class Combat {
|
|||||||
else if (itemInHand.getType().equals(Material.BONE) && permInstance.beastLore(attacker)) {
|
else if (itemInHand.getType().equals(Material.BONE) && permInstance.beastLore(attacker)) {
|
||||||
Taming.beastLore(event, target, attacker);
|
Taming.beastLore(event, target, attacker);
|
||||||
}
|
}
|
||||||
} else if (damager instanceof Wolf) {
|
}
|
||||||
|
else if (damager instanceof Wolf) {
|
||||||
Wolf wolf = (Wolf) damager;
|
Wolf wolf = (Wolf) damager;
|
||||||
|
|
||||||
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
if (wolf.isTamed() && wolf.getOwner() instanceof Player) {
|
||||||
@ -167,19 +168,19 @@ public class Combat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (permInstance.fastFoodService(master)) {
|
||||||
|
Taming.fastFoodService(PPo, wolf, event.getDamage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (permInstance.sharpenedClaws(master)) {
|
||||||
|
Taming.sharpenedClaws(PPo, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (permInstance.gore(master)) {
|
||||||
|
Taming.gore(PPo, event, master);
|
||||||
|
}
|
||||||
|
|
||||||
if (permInstance.taming(master)) {
|
if (permInstance.taming(master)) {
|
||||||
if (permInstance.fastFoodService(master)) {
|
|
||||||
Taming.fastFoodService(PPo, wolf, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (permInstance.sharpenedClaws(master)) {
|
|
||||||
Taming.sharpenedClaws(PPo, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (permInstance.gore(master)) {
|
|
||||||
Taming.gore(PPo, event, master, plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
startGainXp(master, PPo, target, SkillType.TAMING, plugin);
|
startGainXp(master, PPo, target, SkillType.TAMING, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user