Various fixes for Blast Mining.

This commit is contained in:
GJ 2012-02-07 15:28:41 -05:00
parent b4b0bbd081
commit 86e373b493
4 changed files with 98 additions and 23 deletions

View File

@ -19,7 +19,6 @@ package com.gmail.nossr50.config;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -37,7 +36,7 @@ public class Misc
public ArrayList<Block> treeFeller = new ArrayList<Block>(); public ArrayList<Block> treeFeller = new ArrayList<Block>();
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>(); public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>(); public ArrayList<LivingEntity> bleedTracker = new ArrayList<LivingEntity>();
public HashMap<Location, Integer> tntTracker = new HashMap<Location, Integer>(); public HashMap<Block, Integer> tntTracker = new HashMap<Block, Integer>();
mcMMO plugin = null; mcMMO plugin = null;
//BLEED QUE STUFF //BLEED QUE STUFF

View File

@ -83,7 +83,7 @@ public class mcBlockListener implements Listener
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
int skill = PP.getSkillLevel(SkillType.MINING); int skill = PP.getSkillLevel(SkillType.MINING);
plugin.misc.tntTracker.put(block.getLocation(), skill); plugin.misc.tntTracker.put(block, skill);
} }
//Check if the blocks placed should be monitored so they do not give out XP in the future //Check if the blocks placed should be monitored so they do not give out XP in the future

View File

@ -16,6 +16,7 @@
*/ */
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -217,8 +218,13 @@ public class mcEntityListener implements Listener
{ {
if(event.getEntity() instanceof TNTPrimed) if(event.getEntity() instanceof TNTPrimed)
{ {
int skillLevel = plugin.misc.tntTracker.get(event.getEntity().getLocation()); Block block = event.getEntity().getLocation().getBlock();
BlastMining.biggerBombs(skillLevel, event);
if(plugin.misc.tntTracker.get(block) != null)
{
int skillLevel = plugin.misc.tntTracker.get(block);
BlastMining.biggerBombs(skillLevel, event);
}
} }
} }
@ -228,8 +234,13 @@ public class mcEntityListener implements Listener
{ {
if(event.getEntity() instanceof TNTPrimed) if(event.getEntity() instanceof TNTPrimed)
{ {
int skillLevel = plugin.misc.tntTracker.get(event.getEntity().getLocation()); Block block = event.getLocation().getBlock();;
BlastMining.dropProcessing(skillLevel, event, plugin);
if(plugin.misc.tntTracker.get(block) != null)
{
int skillLevel = plugin.misc.tntTracker.get(block);
BlastMining.dropProcessing(skillLevel, event, plugin);
}
} }
} }

View File

@ -151,7 +151,7 @@ public class BlastMining{
if(skillLevel < 125) if(skillLevel < 125)
return; return;
//Drop 10% more ores //+5% ores
if(skillLevel >= 125 && skillLevel < 250) if(skillLevel >= 125 && skillLevel < 250)
{ {
event.setYield(0); event.setYield(0);
@ -160,7 +160,7 @@ public class BlastMining{
while(iterator2.hasNext()) while(iterator2.hasNext())
{ {
Block temp = iterator2.next(); Block temp = iterator2.next();
if(Math.random() * 100 < (yield + 10)) if(Math.random() < (yield + .05))
{ {
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp)); if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation()); explosionBlockDrops(temp, event.getLocation());
@ -169,7 +169,7 @@ public class BlastMining{
while(iterator3.hasNext()) while(iterator3.hasNext())
{ {
Block temp = iterator3.next(); Block temp = iterator3.next();
if(Math.random() * 100 < yield) if(Math.random() < yield)
{ {
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp)); if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation()); explosionBlockDrops(temp, event.getLocation());
@ -177,7 +177,7 @@ public class BlastMining{
} }
} }
//Drop 20% more ores //+10% ores
if(skillLevel >= 250 && skillLevel < 375) if(skillLevel >= 250 && skillLevel < 375)
{ {
event.setYield(0); event.setYield(0);
@ -186,7 +186,7 @@ public class BlastMining{
while(iterator2.hasNext()) while(iterator2.hasNext())
{ {
Block temp = iterator2.next(); Block temp = iterator2.next();
if(Math.random() * 100 < (yield + 20)) if(Math.random() < (yield + .10))
{ {
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp)); if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation()); explosionBlockDrops(temp, event.getLocation());
@ -195,7 +195,7 @@ public class BlastMining{
while(iterator3.hasNext()) while(iterator3.hasNext())
{ {
Block temp = iterator3.next(); Block temp = iterator3.next();
if(Math.random() * 100 < yield) if(Math.random() < yield)
{ {
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp)); if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation()); explosionBlockDrops(temp, event.getLocation());
@ -203,8 +203,8 @@ public class BlastMining{
} }
} }
//No debris //No debris, +15% ores
if(skillLevel >= 375 && skillLevel < 625) if(skillLevel >= 375 && skillLevel < 500)
{ {
event.setYield(0); event.setYield(0);
Iterator<Block> iterator2 = ores.iterator(); Iterator<Block> iterator2 = ores.iterator();
@ -212,7 +212,7 @@ public class BlastMining{
while(iterator2.hasNext()) while(iterator2.hasNext())
{ {
Block temp = iterator2.next(); Block temp = iterator2.next();
if(Math.random() * 100 < yield + 20) if(Math.random() < (yield + .15))
{ {
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp)); if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation()); explosionBlockDrops(temp, event.getLocation());
@ -220,8 +220,8 @@ public class BlastMining{
} }
} }
//Double Drops //No debris, +20% ores
if(skillLevel >= 625 && skillLevel < 875) if(skillLevel >= 500 && skillLevel < 625)
{ {
event.setYield(0); event.setYield(0);
Iterator<Block> iterator2 = ores.iterator(); Iterator<Block> iterator2 = ores.iterator();
@ -229,7 +229,24 @@ public class BlastMining{
while(iterator2.hasNext()) while(iterator2.hasNext())
{ {
Block temp = iterator2.next(); Block temp = iterator2.next();
if(Math.random() * 100 < yield + 20) if(Math.random() < (yield + .20))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
//Double Drops, No Debris, +25% ores
if(skillLevel >= 625 && skillLevel < 750)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() < (yield + .25))
{ {
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp)); if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation()); explosionBlockDrops(temp, event.getLocation());
@ -242,8 +259,8 @@ public class BlastMining{
} }
} }
//Triple Drops //Double Drops, No Debris, +30% ores
if(skillLevel >= 875) if(skillLevel >= 750 && skillLevel < 875)
{ {
event.setYield(0); event.setYield(0);
Iterator<Block> iterator2 = ores.iterator(); Iterator<Block> iterator2 = ores.iterator();
@ -251,7 +268,56 @@ public class BlastMining{
while(iterator2.hasNext()) while(iterator2.hasNext())
{ {
Block temp = iterator2.next(); Block temp = iterator2.next();
if(Math.random() * 100 < yield + 20) if(Math.random() < (yield + .30))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
if(Math.random() * 1000 <= skillLevel)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
}
//Triple Drops, No debris, +35% ores
if(skillLevel >= 875 && skillLevel < 1000)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() * 100 < (yield + .35))
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
if(Math.random() * 1000 <= skillLevel || skillLevel > 1000)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
if(Math.random() * 1000 <= skillLevel || skillLevel > 1000)
{
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation());
}
}
}
}
//Triple Drops, No debris, +40% ores
if(skillLevel >= 1000)
{
event.setYield(0);
Iterator<Block> iterator2 = ores.iterator();
while(iterator2.hasNext())
{
Block temp = iterator2.next();
if(Math.random() * 100 < (yield + .40))
{ {
if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp)); if(temp.getData() != 5 && plugin.misc.blockWatchList.contains(temp));
explosionBlockDrops(temp, event.getLocation()); explosionBlockDrops(temp, event.getLocation());
@ -270,7 +336,6 @@ public class BlastMining{
} }
} }
/* /*
* Bigger Bombs (Unlocked at Mining 250) * Bigger Bombs (Unlocked at Mining 250)
* *