mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Added Iron Grip skill to Unarmed which gives players an chance to keep
from being disarmed.
This commit is contained in:
parent
c265aad6d7
commit
e3267f2e0c
@ -10,6 +10,8 @@ Key:
|
||||
Version 1.3.06-dev
|
||||
+ Added permissions check to skill functions
|
||||
+ Added API functions for obtaining offline profiles & profiles via player names
|
||||
+ Added API functions for admin & party chat
|
||||
+ Added Iron Grip skill to Unarmed which gives players an chance to keep from being disarmed.
|
||||
= Fixed bug where Herbalism required double drops permission to give XP
|
||||
= Fixed bug where {0} would be displayed in front of your power level in mcstats
|
||||
= Fixed mmoupdate not being useable from console
|
||||
|
@ -100,7 +100,7 @@ public class Combat {
|
||||
}
|
||||
|
||||
if (targetType.equals(EntityType.PLAYER) && mcPermissions.getInstance().disarm(attacker)) {
|
||||
Unarmed.disarmProcCheck(PPa, (Player) target);
|
||||
Unarmed.disarmProcCheck(attacker, (Player) target);
|
||||
}
|
||||
|
||||
startGainXp(attacker, PPa, target, SkillType.UNARMED, plugin);
|
||||
|
@ -23,7 +23,9 @@ public class ChatAPI {
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(sender, party, message);
|
||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if(chatEvent.isCancelled()) return;
|
||||
if (chatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.GREEN + ") ";
|
||||
|
||||
@ -50,7 +52,9 @@ public class ChatAPI {
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(sender, message);
|
||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if(chatEvent.isCancelled()) return;
|
||||
if (chatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.AQUA + "} ";
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
int newValue;
|
||||
SkillType skill;
|
||||
String skillName;
|
||||
String usage = ChatColor.RED + "Proper usage is /mmoedit [player] <skill> <newvalue>"; //TODO: Needs more locale.
|
||||
String usage = ChatColor.RED + "Proper usage is /mmoedit [player] <skill> <level>"; //TODO: Needs more locale.
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
|
||||
return true;
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.skills;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -43,16 +44,17 @@ public class Unarmed {
|
||||
* @param PPa Profile of the attacking player
|
||||
* @param defender The defending player
|
||||
*/
|
||||
public static void disarmProcCheck(PlayerProfile PPa, Player defender) {
|
||||
public static void disarmProcCheck(Player attacker, Player defender) {
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
PlayerProfile PPa = Users.getProfile(attacker);
|
||||
int skillLevel = PPa.getSkillLevel(SkillType.UNARMED);
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
ItemStack inHand = defender.getItemInHand();
|
||||
|
||||
if (!inHand.getType().equals(Material.AIR)) {
|
||||
if (random.nextInt(3000) <= skillCheck) {
|
||||
if (random.nextInt(3000) <= skillCheck && ironGrip(defender, attacker)) {
|
||||
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
|
||||
|
||||
m.mcDropItem(defender.getLocation(), inHand);
|
||||
@ -78,4 +80,21 @@ public class Unarmed {
|
||||
defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect"));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean ironGrip(Player defender, Player attacker) {
|
||||
final int MAX_BONUS_LEVEL = 1000;
|
||||
|
||||
PlayerProfile PPd = Users.getProfile(defender);
|
||||
int skillLevel = PPd.getSkillLevel(SkillType.UNARMED);
|
||||
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
|
||||
|
||||
if (random.nextInt(3000) <= skillCheck) {
|
||||
defender.sendMessage(ChatColor.GREEN + "Your iron grip kept you from being disarmed!"); //TODO: Use locale
|
||||
attacker.sendMessage(ChatColor.RED + "Your opponent has an iron grip!"); //TODO: Use locale
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user