Give exp in item breakdown, reduce cooldown

This commit is contained in:
Spencer 2018-01-01 11:30:10 -05:00 committed by Alexander Meech
parent be72f7ea90
commit a2e0ca19ba

View File

@ -24,14 +24,17 @@ public class PerkItemBreakdown extends Perk
private static final Random random = new Random();
// 90 seconds
private static final long ABILITY_COOLDOWN = 90000;
private static final long ABILITY_COOLDOWN = 5000;
public PerkItemBreakdown()
{
super("Item Breakdown", new String[] {
C.cYellow + "Left Click " + C.mBody + "a crafting table",
"with weapons, armor, and some food",
"to scavenge it for parts!"
"to scavenge it for parts!",
"",
"You will also receive some XP",
"when you break items down."
});
}
@ -146,7 +149,9 @@ public class PerkItemBreakdown extends Perk
}
else if (UtilItem.isChainmailProduct(item))
{
returnMat = Material.IRON_INGOT;
// 50% chance to be 0 or 1
returnMat = random.nextInt(2) == 1 ? Material.IRON_INGOT : Material.GOLD_INGOT;
returnAmount = Math.floorDiv(returnAmount, 2);
}
else if (UtilItem.isGoldProduct(item))
@ -190,6 +195,9 @@ public class PerkItemBreakdown extends Perk
item.setAmount(item.getAmount() - 1);
}
// Give up to 9 XP
player.giveExp(random.nextInt(10));
player.getInventory().addItem(returningItem);
player.playSound(player.getLocation(), Sound.ANVIL_BREAK, 1F, 1F);