Added Extraction

First complete Metalbending ability. Allows metalbenders to extract ores
from stone. (The stone wont revert, preventing dupes). Has a small
chance of doubling or tripling the loot.
This commit is contained in:
MistPhizzle 2014-07-10 23:40:58 -04:00
parent edd42d9caa
commit 4f8cc009e5
8 changed files with 112 additions and 3 deletions

Binary file not shown.

View file

@ -103,6 +103,7 @@ public class AbilityModuleManager {
if (a == StockAbilities.EarthTunnel) shiftabilities.add(a.name());
if (a == StockAbilities.EarthArmor) shiftabilities.add(a.name());
if (a == StockAbilities.EarthGrab) shiftabilities.add(a.name());
if (a == StockAbilities.Extraction) metalbendingabilities.add(a.name());
}
}
else if (StockAbilities.isFirebending(a)) {

View file

@ -4,7 +4,7 @@ public enum StockAbilities {
AirBlast, AirBubble, AirShield, AirSuction, AirSwipe, Tornado, AirScooter, AirSpout, AirBurst,
Catapult, RaiseEarth, EarthGrab, EarthTunnel, EarthBlast, Collapse, Tremorsense, EarthArmor, Shockwave,
Catapult, RaiseEarth, EarthGrab, EarthTunnel, EarthBlast, Collapse, Tremorsense, EarthArmor, Shockwave, Extraction,
HeatControl, Blaze, FireJet, Illumination, WallOfFire, FireBlast, Lightning, FireBurst, FireShield,
@ -23,7 +23,7 @@ public enum StockAbilities {
}
private enum EarthbendingAbilities {
Catapult, RaiseEarth, EarthGrab, EarthTunnel, EarthBlast, Collapse, Tremorsense, EarthArmor, Shockwave;
Catapult, RaiseEarth, EarthGrab, EarthTunnel, EarthBlast, Collapse, Tremorsense, EarthArmor, Shockwave, Extraction;
}
private enum FirebendingAbilities {

View file

@ -321,6 +321,12 @@ public class ConfigManager {
config.addDefault("Abilities.Earth.EarthTunnel.Radius", 0.25);
config.addDefault("Abilities.Earth.EarthTunnel.Revert", true);
config.addDefault("Abilities.Earth.EarthTunnel.Interval", 30);
config.addDefault("Abilities.Earth.Extraction.Enabled", true);
config.addDefault("Abilities.Earth.Extraction.Description", "This ability allows metalbenders to extract the minerals from ore blocks. To use, simply tap sneak while looking at an ore block with metal in it (iron, gold, quartz) and the ore will be extracted and drop in front of you. This ability has a small chance of doubling or tripling the loot. This ability has a short cooldown.");
config.addDefault("Abilities.Earth.Extraction.Cooldown", 10000);
config.addDefault("Abilities.Earth.Extraction.TripleLootChance", 15);
config.addDefault("Abilities.Earth.Extraction.DoubleLootChance", 40);
config.addDefault("Abilities.Earth.RaiseEarth.Enabled", true);
config.addDefault("Abilities.Earth.RaiseEarth.Description", "To use, simply left-click on an earthbendable block. "

View file

@ -75,6 +75,7 @@ import com.projectkorra.ProjectKorra.earthbending.EarthGrab;
import com.projectkorra.ProjectKorra.earthbending.EarthPassive;
import com.projectkorra.ProjectKorra.earthbending.EarthTunnel;
import com.projectkorra.ProjectKorra.earthbending.EarthWall;
import com.projectkorra.ProjectKorra.earthbending.Extraction;
import com.projectkorra.ProjectKorra.earthbending.Shockwave;
import com.projectkorra.ProjectKorra.earthbending.Tremorsense;
import com.projectkorra.ProjectKorra.firebending.ArcOfFire;
@ -298,6 +299,10 @@ public class PKListener implements Listener {
if (abil.equalsIgnoreCase("Tremorsense")) {
Methods.getBendingPlayer(player.getName()).toggleTremorsense();
}
if (abil.equalsIgnoreCase("Extraction")) {
new Extraction(player);
}
}

View file

@ -0,0 +1,91 @@
package com.projectkorra.ProjectKorra.earthbending;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.projectkorra.ProjectKorra.Methods;
import com.projectkorra.ProjectKorra.ProjectKorra;
public class Extraction {
private static Map<String, Long> cooldowns = new HashMap<String, Long>();
private long cooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Earth.Extraction.Cooldown");
private static int doublechance = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.Extraction.DoubleLootChance");
private static int triplechance = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.Extraction.TripleLootChance");
public Extraction(Player player) {
if (cooldowns.containsKey(player.getName())) {
if (cooldowns.get(player.getName()) + cooldown >= System.currentTimeMillis()) {
return;
} else {
cooldowns.remove(player.getName());
}
}
Block block = player.getTargetBlock(null, 5);
if (block == null) {
return;
}
if (!Methods.isRegionProtectedFromBuild(player, "Extraction", block.getLocation())) {
if (Methods.canMetalbend(player) && Methods.canBend(player.getName(), "Extraction")) {
Random rand = new Random();
if (rand.nextInt(99) + 1 <= triplechance) {
if (block.getType() == Material.IRON_ORE) {
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.IRON_INGOT, 3));
}
if (block.getType() == Material.GOLD_ORE){
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.GOLD_INGOT, 3));
}
if (block.getType() == Material.QUARTZ_ORE) {
block.setType(Material.NETHERRACK);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.QUARTZ, 3));
}
cooldowns.put(player.getName(), System.currentTimeMillis());
return;
}
else if (rand.nextInt(99) + 1 <= doublechance) {
if (block.getType() == Material.IRON_ORE) {
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.IRON_INGOT, 2));
}
if (block.getType() == Material.GOLD_ORE){
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.GOLD_INGOT, 2));
}
if (block.getType() == Material.QUARTZ_ORE) {
block.setType(Material.NETHERRACK);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.QUARTZ, 2));
}
cooldowns.put(player.getName(), System.currentTimeMillis());
return;
} else {
if (block.getType() == Material.IRON_ORE) {
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.IRON_INGOT));
}
if (block.getType() == Material.GOLD_ORE){
block.setType(Material.STONE);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.GOLD_INGOT));
}
if (block.getType() == Material.QUARTZ_ORE) {
block.setType(Material.NETHERRACK);
player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.QUARTZ));
}
cooldowns.put(player.getName(), System.currentTimeMillis());
return;
}
}
}
}
}

View file

@ -232,6 +232,12 @@ Abilities:
Radius: 0.25
Revert: true
Interval: 30
Extraction:
Enabled: true
Description: "This ability allows metalbenders to extract the minerals from ore blocks. To use, simply tap sneak while looking at an ore block with metal in it (iron, gold, etc) and the ore will be extracted and drop in front of you. This ability has a small chance of doubling or tripling the loot. This ability has a short cooldown."
Cooldown: 10000
TripleLootChance: 15
DoubleLootChance: 40
RaiseEarth:
Enabled: true
Description: "To use, simply left-click on an earthbendable block. A column of earth will shoot upwards from that location. Anything in the way of the column will be brought up with it, leaving talented benders the ability to trap brainless entities up there. Additionally, simply sneak (default shift) looking at an earthbendable block. A wall of earth will shoot upwards from that location. Anything in the way of the wall will be brought up with it."

View file

@ -1,6 +1,6 @@
name: ProjectKorra
author: ProjectKorra
version: 1.2.0 BETA 4
version: 1.2.0 BETA 5
main: com.projectkorra.ProjectKorra.ProjectKorra
commands:
projectkorra: