Added "lucky" donor perk - abilities have 25% better chance to activate

This commit is contained in:
GJ 2012-07-02 11:09:55 -04:00
parent 246961887e
commit 819b6fcacb
14 changed files with 226 additions and 28 deletions

View File

@ -12,6 +12,7 @@ Version 1.3.10-dev
+ Added ability for custom blocks to drop a range of items.
+ Added Ability API functions
+ Added 50% & 150% XP boost perks
+ Added "lucky" perk for donors
= Fixed "GenericLabel belonging to mcMMO..." message
= Fixed menu exit button not working
= Fixed Repair enchant downgrade not working

View File

@ -32,7 +32,13 @@ public class AcrobaticsManager {
RollEventHandler eventHandler = new RollEventHandler(this, event);
if (Acrobatics.getRandom().nextInt(1000) <= eventHandler.skillModifier && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
int randomChance = 1000;
if (player.hasPermission("mcmmo.perks.lucky.acrobatics")) {
randomChance = (int) (randomChance * 0.75);
}
if (Acrobatics.getRandom().nextInt(randomChance) <= eventHandler.skillModifier && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
eventHandler.modifyEventDamage();
eventHandler.sendAbilityMessage();
eventHandler.processXPGain(eventHandler.damage * Acrobatics.ROLL_XP_MODIFIER);
@ -54,7 +60,13 @@ public class AcrobaticsManager {
DodgeEventHandler eventHandler = new DodgeEventHandler(this, event);
if (Acrobatics.getRandom().nextInt(4000) <= eventHandler.skillModifier && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
int randomChance = 4000;
if (player.hasPermission("mcmmo.perks.lucky.acrobatics")) {
randomChance = (int) (randomChance * 0.75);
}
if (Acrobatics.getRandom().nextInt(randomChance) <= eventHandler.skillModifier && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
eventHandler.modifyEventDamage();
eventHandler.sendAbilityMessage();
eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER);

View File

@ -34,7 +34,13 @@ public class ArcheryManager {
ArrowTrackingEventHandler eventHandler = new ArrowTrackingEventHandler(this, livingEntity);
if (Archery.getRandom().nextInt(1000) < eventHandler.skillModifier) {
int randomChance = 1000;
if (player.hasPermission("mcmmo.perks.lucky.archery")) {
randomChance = (int) (randomChance * 0.75);
}
if (Archery.getRandom().nextInt(randomChance) < eventHandler.skillModifier) {
eventHandler.addToTracker();
}
}
@ -52,7 +58,13 @@ public class ArcheryManager {
DazeEventHandler eventHandler = new DazeEventHandler(this, event, defender);
if (Archery.getRandom().nextInt(2000) < eventHandler.skillModifier) {
int randomChance = 2000;
if (player.hasPermission("mcmmo.perks.lucky.archery")) {
randomChance = (int) (randomChance * 0.75);
}
if (Archery.getRandom().nextInt(randomChance) < eventHandler.skillModifier) {
eventHandler.handleDazeEffect();
eventHandler.sendAbilityMessages();
}

View File

@ -75,7 +75,13 @@ public class Axes {
int skillLevel = PPa.getSkillLevel(SkillType.AXES);
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(2000) <= skillCheck && !entity.isDead()){
int randomChance = 2000;
if (attacker.hasPermission("mcmmo.perks.lucky.axes")) {
randomChance = (int) (randomChance * 0.75);
}
if (random.nextInt(randomChance) <= skillCheck && !entity.isDead()){
int damage = event.getDamage();
if (entity instanceof Player){
@ -139,7 +145,13 @@ public class Axes {
return;
}
if (random.nextInt(100) <= GREATER_IMPACT_CHANCE) {
int randomChance = 100;
if (attacker.hasPermission("mcmmo.perks.lucky.axes")) {
randomChance = (int) (randomChance * 0.75);
}
if (random.nextInt(randomChance) <= GREATER_IMPACT_CHANCE) {
event.setDamage(event.getDamage() + 2);
target.setVelocity(attacker.getLocation().getDirection().normalize().multiply(GREATER_IMPACT_MULTIPLIER));
attacker.sendMessage(LocaleLoader.getString("Axes.Combat.GI.Proc"));

View File

@ -91,7 +91,13 @@ public class Excavation {
for (ExcavationTreasure treasure : treasures) {
if (skillLevel >= treasure.getDropLevel()) {
if (random.nextDouble() * 100 <= treasure.getDropChance()) {
int randomChance = 100;
if (player.hasPermission("mcmmo.perks.lucky.excavation")) {
randomChance = (int) (randomChance * 0.75);
}
if (random.nextDouble() * randomChance <= treasure.getDropChance()) {
xp += treasure.getXp();
is.add(treasure.getDrop());
}

View File

@ -102,7 +102,13 @@ public class Fishing {
if (Config.getInstance().getFishingDropsEnabled() && rewards.size() > 0 && Permissions.getInstance().fishingTreasures(player)) {
FishingTreasure treasure = rewards.get(random.nextInt(rewards.size()));
if (random.nextDouble() * 100 <= treasure.getDropChance()) {
int randomChance = 100;
if (player.hasPermission("mcmmo.perks.lucky.fishing")) {
randomChance = (int) (randomChance * 0.75);
}
if (random.nextDouble() * randomChance <= treasure.getDropChance()) {
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp());
theCatch.setItemStack(treasure.getDrop());
}
@ -138,8 +144,15 @@ public class Fishing {
ItemStack fishingResults = theCatch.getItemStack();
player.sendMessage(LocaleLoader.getString("Fishing.ItemFound"));
if (ItemChecks.isArmor(fishingResults) || ItemChecks.isTool(fishingResults)) {
if (random.nextInt(100) <= ENCHANTMENT_CHANCE && Permissions.getInstance().fishingMagic(player)) {
int randomChance = 100;
if (player.hasPermission("mcmmo.perks.lucky.fishing")) {
randomChance = (int) (randomChance * 0.75);
}
if (random.nextInt(randomChance) <= ENCHANTMENT_CHANCE && Permissions.getInstance().fishingMagic(player)) {
for (Enchantment newEnchant : Enchantment.values()) {
if (newEnchant.canEnchantItem(fishingResults)) {
Map<Enchantment, Integer> resultEnchantments = fishingResults.getEnchantments();
@ -178,7 +191,13 @@ public class Fishing {
* @param event The event to modify
*/
public static void shakeMob(PlayerFishEvent event) {
final int DROP_NUMBER = random.nextInt(100);
int randomChance = 100;
if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) {
randomChance = (int) (randomChance * 0.75);
}
final int DROP_NUMBER = random.nextInt(randomChance);
LivingEntity le = (LivingEntity) event.getCaught();
EntityType type = le.getType();

View File

@ -92,6 +92,12 @@ public class Herbalism {
boolean customPlant = false;
int randomChance = 1000;
if (player.hasPermission("mcmmo.perks.lucky.herbalism")) {
randomChance = (int) (randomChance * 0.75);
}
switch (type) {
case BROWN_MUSHROOM:
case RED_MUSHROOM:
@ -107,7 +113,7 @@ public class Herbalism {
if (b.getType().equals(Material.CACTUS)) {
mat = Material.CACTUS;
if (!mcMMO.placeStore.isTrue(b)) {
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) {
catciDrops++;
}
xp += Config.getInstance().getHerbalismXPCactus();
@ -163,7 +169,7 @@ public class Herbalism {
if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
mat = Material.SUGAR_CANE;
if (!mcMMO.placeStore.isTrue(b)) {
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) {
caneDrops++;
}
xp += Config.getInstance().getHerbalismXPSugarCane();
@ -208,7 +214,7 @@ public class Herbalism {
is = new ItemStack(mat);
}
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) {
Config configInstance = Config.getInstance();
switch (type) {
@ -321,7 +327,13 @@ public class Herbalism {
boolean hasSeeds = inventory.contains(Material.SEEDS);
Location loc = block.getLocation();
if (hasSeeds && PP.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= herbLevel)) {
int randomChance = 1500;
if (player.hasPermission("mcmmo.perks.lucky.herbalism")) {
randomChance = (int) (randomChance * 0.75);
}
if (hasSeeds && PP.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel)) {
event.setCancelled(true);
Misc.dropItem(loc, new ItemStack(Material.WHEAT));
@ -350,7 +362,13 @@ public class Herbalism {
player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1));
if (skillLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= skillLevel) {
int randomChance = 1500;
if (player.hasPermission("mcmmo.perks.lucky.herbalism")) {
randomChance = (int) (randomChance * 0.75);
}
if (skillLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= skillLevel) {
greenTerraConvert(player, block);
}
else {

View File

@ -307,7 +307,13 @@ public class Mining {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
if (random.nextInt(1000) <= skillCheck && Permissions.getInstance().miningDoubleDrops(player)) {
int randomChance = 1000;
if (player.hasPermission("mcmmo.perks.lucky.mining")) {
randomChance = (int) (randomChance * 0.75);
}
if (random.nextInt(randomChance) <= skillCheck && Permissions.getInstance().miningDoubleDrops(player)) {
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
silkTouchDrops(block);
}

View File

@ -303,7 +303,13 @@ public class WoodCutting {
Tree tree = (Tree) block.getState().getData();
TreeSpecies species = tree.getSpecies();
if ((skillLevel > MAX_SKILL_LEVEL || random.nextInt(1000) <= skillLevel) && Permissions.getInstance().woodcuttingDoubleDrops(player)) {
int randomChance = 1000;
if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) {
randomChance = (int) (randomChance * 0.75);
}
if ((skillLevel > MAX_SKILL_LEVEL || random.nextInt(randomChance) <= skillLevel) && Permissions.getInstance().woodcuttingDoubleDrops(player)) {
Config configInstance = Config.getInstance();
ItemStack item;
Location location;

View File

@ -104,11 +104,17 @@ public class Repair {
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
Enchantment enchantment = enchant.getKey();
if (random.nextInt(100) <= getEnchantChance(rank)) {
int randomChance = 100;
if (player.hasPermission("mcmmo.perks.lucky.repair")) {
randomChance = (int) (randomChance * 0.75);
}
if (random.nextInt(randomChance) <= getEnchantChance(rank)) {
int enchantLevel = enchant.getValue();
if (configInstance.getArcaneForgingDowngradeEnabled() && enchantLevel > 1) {
if (random.nextInt(100) <= getDowngradeChance(rank)) {
if (random.nextInt(randomChance) <= getDowngradeChance(rank)) {
is.addEnchantment(enchantment, --enchantLevel);
downgraded = true;
}
@ -223,7 +229,13 @@ public class Repair {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= skillLevel) && permInstance.repairBonus(player)) {
int randomChance = 1000;
if (player.hasPermission("mcmmo.perks.lucky.repair")) {
randomChance = (int) (randomChance * 0.75);
}
if ((skillLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= skillLevel) && permInstance.repairBonus(player)) {
player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
return true;
}

View File

@ -35,7 +35,13 @@ public class SwordsManager {
if (Combat.shouldBeAffected(player, defender)) {
BleedEventHandler eventHandler = new BleedEventHandler(this, defender);
if (Swords.getRandom().nextInt(1000) < eventHandler.skillModifier) {
int randomChance = 1000;
if (player.hasPermission("mcmmo.perks.lucky.swords")) {
randomChance = (int) (randomChance * 0.75);
}
if (Swords.getRandom().nextInt(randomChance) < eventHandler.skillModifier) {
eventHandler.addBleedTicks();
eventHandler.sendAbilityMessages();
}
@ -52,7 +58,13 @@ public class SwordsManager {
if (eventHandler.isHoldingSword()) {
eventHandler.calculateSkillModifier();
if (Swords.getRandom().nextInt(2000) < eventHandler.skillModifier) {
int randomChance = 2000;
if (player.hasPermission("mcmmo.perks.lucky.swords")) {
randomChance = (int) (randomChance * 0.75);
}
if (Swords.getRandom().nextInt(randomChance) < eventHandler.skillModifier) {
eventHandler.dealDamage();
eventHandler.sendAbilityMessages();
}
@ -66,7 +78,7 @@ public class SwordsManager {
SerratedStrikesEventHandler eventHandler = new SerratedStrikesEventHandler(this, target, damage);
eventHandler.applyAbilityEffects();
eventHandler.applyAbilityEffects();
}
protected int getSkillLevel() {

View File

@ -41,7 +41,13 @@ public class TamingManager {
}
if (skillLevel >= Taming.FAST_FOOD_SERVICE_ACTIVATION_LEVEL) {
if (Taming.getRandom().nextInt(100) < Taming.FAST_FOOD_SERVICE_ACTIVATION_CHANCE) {
int randomChance = 100;
if (player.hasPermission("mcmmo.perks.lucky.taming")) {
randomChance = (int) (randomChance * 0.75);
}
if (Taming.getRandom().nextInt(randomChance) < Taming.FAST_FOOD_SERVICE_ACTIVATION_CHANCE) {
FastFoodServiceEventHandler eventHandler = new FastFoodServiceEventHandler(wolf);
eventHandler.modifyHealth(damage);
@ -78,7 +84,13 @@ public class TamingManager {
GoreEventHandler eventHandler = new GoreEventHandler(this, event);
if (Taming.getRandom().nextInt(1000) < eventHandler.skillModifier) {
int randomChance = 1000;
if (player.hasPermission("mcmmo.perks.lucky.taming")) {
randomChance = (int) (randomChance * 0.75);
}
if (Taming.getRandom().nextInt(randomChance) < eventHandler.skillModifier) {
eventHandler.modifyEventDamage();
eventHandler.applyBleed();
eventHandler.sendAbilityMessage();

View File

@ -36,7 +36,13 @@ public class UnarmedManager {
if (eventHandler.isHoldingItem()) {
eventHandler.calculateSkillModifier();
if (Unarmed.getRandom().nextInt(3000) < eventHandler.skillModifier) {
int randomChance = 3000;
if (player.hasPermission("mcmmo.perks.lucky.unarmed")) {
randomChance = (int) (randomChance * 0.75);
}
if (Unarmed.getRandom().nextInt(randomChance) < eventHandler.skillModifier) {
if (!hasIronGrip(defender)) {
eventHandler.sendAbilityMessage();
eventHandler.handleDisarm();
@ -58,7 +64,13 @@ public class UnarmedManager {
DeflectEventHandler eventHandler = new DeflectEventHandler(this, event);
if (Unarmed.getRandom().nextInt(2000) < eventHandler.skillModifier) {
int randomChance = 2000;
if (player.hasPermission("mcmmo.perks.lucky.unarmed")) {
randomChance = (int) (randomChance * 0.75);
}
if (Unarmed.getRandom().nextInt(randomChance) < eventHandler.skillModifier) {
eventHandler.cancelEvent();
eventHandler.sendAbilityMessage();
}
@ -93,7 +105,13 @@ public class UnarmedManager {
IronGripEventHandler eventHandler = new IronGripEventHandler(this, defender);
if (Unarmed.getRandom().nextInt(1000) < eventHandler.skillModifier) {
int randomChance = 1000;
if (defender.hasPermission("mcmmo.perks.lucky.unarmed")) {
randomChance = (int) (randomChance * 0.75);
}
if (Unarmed.getRandom().nextInt(randomChance) < eventHandler.skillModifier) {
eventHandler.sendAbilityMessages();
return true;
}

View File

@ -194,6 +194,58 @@ permissions:
mcmmo.perks.xp.50percentboost:
default: false
description: Mulitplies incoming XP by 1.5
mcmmo.perks.lucky.*:
default: false
description: Gives all abilities & skills a 25% better chance to activate.
children:
mcmmo.perks.lucky.acrobatics: false
mcmmo.perks.lucky.archery: false
mcmmo.perks.lucky.axes: false
mcmmo.perks.lucky.excavation: false
mcmmo.perks.lucky.fishing: false
mcmmo.perks.lucky.herbalism: false
mcmmo.perks.lucky.mining: false
mcmmo.perks.lucky.repair: false
mcmmo.perks.lucky.swords: false
mcmmo.perks.lucky.taming: false
mcmmo.perks.lucky.unarmed: false
mcmmo.perks.lucky.woodcutting: false
mcmmo.perks.lucky.acrobatics:
default: false
description: Gives Acrobatics abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.archery:
default: false
description: Gives Archery abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.axes:
default: false
description: Gives Axes abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.excavation:
default: false
description: Gives Excavation abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.fishing:
default: false
description: Gives Fishing abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.herbalism:
default: false
description: Gives Herbalism abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.mining:
default: false
description: Gives Mining abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.repair:
default: false
description: Gives Repair abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.swords:
default: false
description: Gives Swords abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.taming:
default: false
description: Gives Taming abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.unarmed:
default: false
description: Gives Unarmed abilities & skills a 25% better chance to activate.
mcmmo.perks.lucky.woodcutting:
default: false
description: Gives Woodcutting abilities & skills a 25% better chance to activate.
mcmmo.bypass.*:
default: false
description: Implies all bypass permissions.