Finalizing Fishing Day Challenge.

This commit is contained in:
Thanos paravantis 2015-12-04 22:01:47 +02:00
parent eb820b4650
commit e27ce2587d

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
@ -12,6 +14,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
@ -50,7 +53,7 @@ public class ChallengeFishingDay extends Challenge
public ChallengeFishingDay(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Fishing Day", "Be the first to catch 5 fish.", "If you fail on any try, you loose.");
super(host, ChallengeType.FirstComplete, "Fishing Day", "Be the first to catch 5 fish.", "Watch out for TNT if you miss the fish!");
}
@Override
@ -122,7 +125,7 @@ public class ChallengeFishingDay extends Challenge
}
else
{
if(y == 5 && ((absX >= size - 3 && absX <= size - 1) || (absZ >= size - 3 && absZ <= size - 1)))
if(y == 5)
{
block.setType(Material.GRASS);
@ -153,7 +156,7 @@ public class ChallengeFishingDay extends Challenge
else if(y > 4 && (absX == size || absZ == size))
{
block.setType(Material.STONE);
block.setType(Material.FENCE);
}
}
@ -202,6 +205,9 @@ public class ChallengeFishingDay extends Challenge
entity.remove();
}
}
_fishing.clear();
_explosives.clear();
}
@EventHandler
@ -249,7 +255,7 @@ public class ChallengeFishingDay extends Challenge
{
if(isFishingHookEmpty(fisher, hook))
{
createExplosion(fisher);
createExplosion(fisher, hook.getLocation());
}
}
}
@ -321,7 +327,7 @@ public class ChallengeFishingDay extends Challenge
Player target = _explosives.get(event.getEntity());
if(UtilMath.offset(dropsite, target.getLocation()) <= 7.0)
if(UtilMath.offset(dropsite, target.getLocation()) <= 6.0)
{
setLost(target);
}
@ -376,18 +382,24 @@ public class ChallengeFishingDay extends Challenge
return _fishing.get(fisher) && hook.isValid() && !hook.isOnGround();
}
private void createExplosion(Player target)
private void createExplosion(Player target, Location dropsite)
{
Location dropsite = target.getLocation().add(0, 4, 0);
World world = dropsite.getWorld();
if (Recharge.Instance.use(target, "TNT Spawn", 700, false, false))
{
World world = dropsite.getWorld();
TNTPrimed explosive = world.spawn(dropsite, TNTPrimed.class);
explosive.setFuseTicks(40);
explosive.setYield(0.0F);
target.playSound(dropsite, Sound.ZOMBIE_WOODBREAK, 0.3F, 1.3F);
_explosives.put(explosive, target);
TNTPrimed explosive = world.spawn(dropsite, TNTPrimed.class);
explosive.setFuseTicks(40);
explosive.setYield(0.0F);
UtilAction.velocity(explosive, UtilAlg.getTrajectory(dropsite, target.getLocation()), 1.2D, false, 0.0D, 0.3D, 0.6D, false);
_explosives.put(explosive, target);
}
}
private void waterSplashEffect(Location location, boolean randomAmount, boolean sound)
{
int amount = 5;