Added Iron Grip skill to Unarmed which gives players an chance to keep

from being disarmed.
This commit is contained in:
GJ 2012-04-18 23:34:46 -04:00
parent c265aad6d7
commit e3267f2e0c
5 changed files with 31 additions and 6 deletions

View File

@ -10,6 +10,8 @@ Key:
Version 1.3.06-dev Version 1.3.06-dev
+ Added permissions check to skill functions + Added permissions check to skill functions
+ Added API functions for obtaining offline profiles & profiles via player names + 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 Herbalism required double drops permission to give XP
= Fixed bug where {0} would be displayed in front of your power level in mcstats = Fixed bug where {0} would be displayed in front of your power level in mcstats
= Fixed mmoupdate not being useable from console = Fixed mmoupdate not being useable from console

View File

@ -100,7 +100,7 @@ public class Combat {
} }
if (targetType.equals(EntityType.PLAYER) && mcPermissions.getInstance().disarm(attacker)) { 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); startGainXp(attacker, PPa, target, SkillType.UNARMED, plugin);

View File

@ -23,7 +23,9 @@ public class ChatAPI {
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(sender, party, message); McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(sender, party, message);
Bukkit.getPluginManager().callEvent(chatEvent); Bukkit.getPluginManager().callEvent(chatEvent);
if(chatEvent.isCancelled()) return; if (chatEvent.isCancelled()) {
return;
}
String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.GREEN + ") "; String pPrefix = ChatColor.GREEN + "(" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.GREEN + ") ";
@ -50,7 +52,9 @@ public class ChatAPI {
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(sender, message); McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(sender, message);
Bukkit.getPluginManager().callEvent(chatEvent); Bukkit.getPluginManager().callEvent(chatEvent);
if(chatEvent.isCancelled()) return; if (chatEvent.isCancelled()) {
return;
}
String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.AQUA + "} "; String aPrefix = ChatColor.AQUA + "{" + ChatColor.WHITE + chatEvent.getSender() + ChatColor.AQUA + "} ";

View File

@ -30,7 +30,7 @@ public class MmoeditCommand implements CommandExecutor {
int newValue; int newValue;
SkillType skill; SkillType skill;
String skillName; 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")) { if (CommandHelper.noCommandPermissions(sender, "mcmmo.tools.mmoedit")) {
return true; return true;

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.skills;
import java.util.Random; import java.util.Random;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
@ -43,16 +44,17 @@ public class Unarmed {
* @param PPa Profile of the attacking player * @param PPa Profile of the attacking player
* @param defender The defending 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; final int MAX_BONUS_LEVEL = 1000;
PlayerProfile PPa = Users.getProfile(attacker);
int skillLevel = PPa.getSkillLevel(SkillType.UNARMED); int skillLevel = PPa.getSkillLevel(SkillType.UNARMED);
int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = m.skillCheck(skillLevel, MAX_BONUS_LEVEL);
ItemStack inHand = defender.getItemInHand(); ItemStack inHand = defender.getItemInHand();
if (!inHand.getType().equals(Material.AIR)) { 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")); defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
m.mcDropItem(defender.getLocation(), inHand); m.mcDropItem(defender.getLocation(), inHand);
@ -78,4 +80,21 @@ public class Unarmed {
defender.sendMessage(mcLocale.getString("Combat.ArrowDeflect")); 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;
}
}
} }