Merge branch 'master' of github.com:mcMMO-Dev/mcMMO

This commit is contained in:
nossr50 2012-02-27 03:53:46 -08:00
commit d7d1d0b58d
2 changed files with 77 additions and 71 deletions

View File

@ -381,38 +381,54 @@ public class Combat
else else
xpinc = damage; xpinc = damage;
if(entity instanceof Animals) if(entity instanceof Animals)
xp = (int) (xpinc * LoadProperties.animalXP); xp = (int) (xpinc * LoadProperties.animalXP);
else else
{ {
if(entity instanceof Enderman) EntityType type = entity.getType();
xp = (int) (xpinc * LoadProperties.endermanXP); switch(type){
else if(entity instanceof Creeper) case BLAZE:
xp = (int) (xpinc * LoadProperties.creeperXP); xp = (int) (xpinc * LoadProperties.blazeXP);
else if(entity instanceof Silverfish) break;
xp = (int) (xpinc * LoadProperties.silverfishXP); case CAVE_SPIDER:
else if(entity instanceof CaveSpider) xp = (int) (xpinc * LoadProperties.cavespiderXP);
xp = (int) (xpinc * LoadProperties.cavespiderXP); break;
else if(entity instanceof Spider) case CREEPER:
xp = (int) (xpinc * LoadProperties.spiderXP); xp = (int) (xpinc * LoadProperties.creeperXP);
else if(entity instanceof Skeleton) break;
xp = (int) (xpinc * LoadProperties.skeletonXP); case ENDER_DRAGON:
else if(entity instanceof Zombie) xp = (int) (xpinc * LoadProperties.enderdragonXP);
xp = (int) (xpinc * LoadProperties.zombieXP); break;
else if(entity instanceof PigZombie) case ENDERMAN:
xp = (int) (xpinc * LoadProperties.pigzombieXP); xp = (int) (xpinc * LoadProperties.endermanXP);
else if(entity instanceof Slime) break;
xp = (int) (xpinc * LoadProperties.slimeXP); case GHAST:
else if(entity instanceof Ghast) xp = (int) (xpinc * LoadProperties.ghastXP);
xp = (int) (xpinc * LoadProperties.ghastXP); break;
else if(entity instanceof Blaze) case MAGMA_CUBE:
xp = (int) (xpinc * LoadProperties.blazeXP); xp = (int) (xpinc * LoadProperties.magmacubeXP);
else if(entity instanceof EnderDragon) break;
xp = (int) (xpinc * LoadProperties.enderdragonXP); case PIG_ZOMBIE:
else if(entity instanceof MagmaCube) xp = (int) (xpinc * LoadProperties.pigzombieXP);
xp = (int) (xpinc * LoadProperties.magmacubeXP); break;
} case SILVERFISH:
} xp = (int) (xpinc * LoadProperties.silverfishXP);
return xp; break;
case SKELETON:
xp = (int) (xpinc * LoadProperties.skeletonXP);
break;
case SLIME:
xp = (int) (xpinc * LoadProperties.slimeXP);
break;
case SPIDER:
xp = (int) (xpinc * LoadProperties.spiderXP);
break;
case ZOMBIE:
xp = (int) (xpinc * LoadProperties.zombieXP);
break;
}
}
}
return xp;
} }
} }

View File

@ -16,7 +16,6 @@
*/ */
package com.gmail.nossr50.skills; package com.gmail.nossr50.skills;
import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -32,12 +31,11 @@ public class Unarmed {
public static void berserkActivationCheck(Player player) public static void berserkActivationCheck(Player player)
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(player.getItemInHand().getTypeId() == 0) AbilityType ability = AbilityType.BERSERK;
if(player.getItemInHand() == null)
{ {
if(PP.getFistsPreparationMode()) if(PP.getFistsPreparationMode())
{
PP.setFistsPreparationMode(false); PP.setFistsPreparationMode(false);
}
int ticks = 2; int ticks = 2;
int x = PP.getSkillLevel(SkillType.UNARMED); int x = PP.getSkillLevel(SkillType.UNARMED);
@ -48,16 +46,16 @@ public class Unarmed {
ticks++; ticks++;
} }
if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getSkillDATS(AbilityType.BERSERK), LoadProperties.berserkCooldown)) if(!PP.getBerserkMode() && Skills.cooldownOver(player, PP.getSkillDATS(ability), LoadProperties.berserkCooldown))
{ {
player.sendMessage(mcLocale.getString("Skills.BerserkOn")); player.sendMessage(mcLocale.getString("Skills.BerserkOn"));
for(Player y : player.getWorld().getPlayers()) for(Player y : player.getWorld().getPlayers())
{ {
if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10) if(y != null && y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()})); y.sendMessage(mcLocale.getString("Skills.BerserkPlayer", new Object[] {player.getName()}));
} }
PP.setSkillDATS(AbilityType.BERSERK, System.currentTimeMillis()+(ticks*1000)); PP.setSkillDATS(ability, System.currentTimeMillis()+(ticks*1000));
System.out.println("getSkillDATS(): "+PP.getSkillDATS(AbilityType.BERSERK));
PP.setBerserkMode(true); PP.setBerserkMode(true);
} }
} }
@ -65,56 +63,48 @@ public class Unarmed {
public static void unarmedBonus(Player attacker, EntityDamageByEntityEvent event) public static void unarmedBonus(Player attacker, EntityDamageByEntityEvent event)
{ {
PlayerProfile PPa = Users.getProfile(attacker);
int bonus = 3; int bonus = 3;
//Add 1 DMG for every 50 skill levels //Add 1 DMG for every 50 skill levels
bonus += PPa.getSkillLevel(SkillType.UNARMED)/50; bonus += Users.getProfile(attacker).getSkillLevel(SkillType.UNARMED)/50;
if(bonus > 8) if(bonus > 8)
bonus = 8; bonus = 8;
event.setDamage(event.getDamage()+bonus); event.setDamage(event.getDamage() + bonus);
} }
public static void disarmProcCheck(Player attacker, Player defender) public static void disarmProcCheck(Player attacker, Player defender)
{ {
PlayerProfile PP = Users.getProfile(attacker); int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.UNARMED);
if(attacker.getItemInHand().getTypeId() == 0) if(attacker.getItemInHand() == null)
{ {
if(PP.getSkillLevel(SkillType.UNARMED) >= 1000) if(skillLevel >= 1000)
{ {
if(Math.random() * 4000 <= 1000) if(Math.random() * 4000 <= 1000)
{ {
Location loc = defender.getLocation(); ItemStack item = defender.getItemInHand();
if(defender.getItemInHand() != null && defender.getItemInHand().getTypeId() != 0) if(item != null)
{ {
defender.sendMessage(mcLocale.getString("Skills.Disarmed")); defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
ItemStack item = defender.getItemInHand(); m.mcDropItem(defender.getLocation(), item);
if(item != null) defender.setItemInHand(null);
{
m.mcDropItem(loc, item);
ItemStack itemx = null;
defender.setItemInHand(itemx);
}
} }
} }
} else {
if(Math.random() * 4000 <= PP.getSkillLevel(SkillType.UNARMED)){
Location loc = defender.getLocation();
if(defender.getItemInHand() != null && defender.getItemInHand().getTypeId() != 0)
{
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
ItemStack item = defender.getItemInHand();
if(item != null)
{
m.mcDropItem(loc, item);
ItemStack itemx = null;
defender.setItemInHand(itemx);
}
}
}
} }
else
{
if(Math.random() * 4000 <= skillLevel)
{
ItemStack item = defender.getItemInHand();
if(item != null)
{
defender.sendMessage(mcLocale.getString("Skills.Disarmed"));
m.mcDropItem(defender.getLocation(), item);
defender.setItemInHand(null);
}
}
}
} }
} }
} }