mcMMO/src/main/java/com/gmail/nossr50/skills/Unarmed.java

54 lines
1.5 KiB
Java
Raw Normal View History

2012-01-09 20:00:13 +01:00
package com.gmail.nossr50.skills;
2012-03-01 17:34:56 +01:00
import org.bukkit.Material;
2012-01-09 20:00:13 +01:00
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Users;
import com.gmail.nossr50.m;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.mcLocale;
public class Unarmed {
2012-01-09 20:00:13 +01:00
public static void unarmedBonus(Player attacker, EntityDamageByEntityEvent event)
{
int bonus = 3;
2012-02-23 14:38:50 +01:00
//Add 1 DMG for every 50 skill levels
2012-02-26 20:38:55 +01:00
bonus += Users.getProfile(attacker).getSkillLevel(SkillType.UNARMED)/50;
2012-02-23 14:38:50 +01:00
if(bonus > 8)
bonus = 8;
2012-02-23 14:38:50 +01:00
2012-02-26 20:38:55 +01:00
event.setDamage(event.getDamage() + bonus);
2012-01-09 20:00:13 +01:00
}
2012-01-09 20:00:13 +01:00
public static void disarmProcCheck(Player attacker, Player defender)
{
2012-02-26 20:38:55 +01:00
int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.UNARMED);
2012-03-01 17:34:56 +01:00
if(defender.getItemInHand() != null && defender.getItemInHand().getType() != Material.AIR)
2012-01-09 20:00:13 +01:00
{
2012-02-26 20:38:55 +01:00
if(skillLevel >= 1000)
2012-01-09 20:00:13 +01:00
{
if(Math.random() * 3000 <= 1000)
2012-02-26 20:38:55 +01:00
{
ItemStack item = defender.getItemInHand();
2012-03-01 01:27:58 +01:00
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
m.mcDropItem(defender.getLocation(), item);
defender.setItemInHand(null);
2012-02-26 20:38:55 +01:00
}
}
else
{
if(Math.random() * 3000 <= skillLevel)
2012-02-26 20:38:55 +01:00
{
ItemStack item = defender.getItemInHand();
2012-03-01 01:27:58 +01:00
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
m.mcDropItem(defender.getLocation(), item);
defender.setItemInHand(null);
2012-02-26 20:38:55 +01:00
}
}
2012-01-09 20:00:13 +01:00
}
}
2012-03-01 17:34:56 +01:00
}