DONE!
This commit is contained in:
parent
5c632a1e3a
commit
ed3bea8e85
@ -63,6 +63,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
@ -284,11 +285,14 @@ public class SnowFight extends TeamGame
|
||||
{
|
||||
Player player = UtilAlg.Random(players);
|
||||
|
||||
Location location = player.getLocation();
|
||||
|
||||
//random offset to player location
|
||||
Location location = player.getLocation().add(
|
||||
(Math.random() - 0.5) * 24,
|
||||
if (Math.random() > 0.1)
|
||||
location.add(
|
||||
(Math.random() - 0.5) * 32,
|
||||
0,
|
||||
(Math.random() - 0.5) * 24);
|
||||
(Math.random() - 0.5) * 32);
|
||||
|
||||
//highest block!
|
||||
location = WorldData.World.getHighestBlockAt(location).getLocation().add(0.5, 0, 0.5);
|
||||
@ -374,6 +378,8 @@ public class SnowFight extends TeamGame
|
||||
//Clean
|
||||
else
|
||||
{
|
||||
meteorExplode(block);
|
||||
|
||||
block.remove();
|
||||
blockIter.remove();
|
||||
}
|
||||
@ -387,22 +393,29 @@ public class SnowFight extends TeamGame
|
||||
|
||||
Entity projectile = event.getEntity();
|
||||
|
||||
if (projectile.hasMetadata("Meteor"))
|
||||
{
|
||||
meteorExplode(projectile);
|
||||
_meteorSet.remove(projectile);
|
||||
}
|
||||
}
|
||||
|
||||
public void meteorExplode(Entity meteor)
|
||||
{
|
||||
float timePassed = (System.currentTimeMillis() - (getGameLiveTime() + _meteorTime))/1000f;
|
||||
|
||||
float multiplier = 1 + Math.min(3f, timePassed / 60f);
|
||||
|
||||
float size = 1.5f + multiplier;
|
||||
|
||||
if (projectile.hasMetadata("Meteor"))
|
||||
{
|
||||
//Effect
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers());
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, meteor.getLocation(), 0.5f, 0.5f, 0.5f, 0, 5, ViewDist.MAX, UtilServer.getPlayers());
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
player.playSound(projectile.getLocation(), Sound.EXPLODE, 1, 1);
|
||||
player.playSound(meteor.getLocation(), Sound.EXPLODE, 1, 1);
|
||||
|
||||
|
||||
//Damage
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getEntity().getLocation(), size + 3);
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(meteor.getLocation(), size + 3);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
//Damage Event
|
||||
@ -411,11 +424,11 @@ public class SnowFight extends TeamGame
|
||||
"Ice Meteor", "Ice Meteor", false);
|
||||
|
||||
//Vel
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getEntity(), player), 1.2 * players.get(player), false, 0, 0.4, 1, true);
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(meteor, player), 1.2 * players.get(player), false, 0, 0.4, 1, true);
|
||||
}
|
||||
|
||||
//Convert to Ice
|
||||
for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet())
|
||||
for(Block block : UtilBlock.getInRadius(meteor.getLocation(), size).keySet())
|
||||
{
|
||||
int i = 20;
|
||||
while (block.getY() > 0 && i>0)
|
||||
@ -435,9 +448,8 @@ public class SnowFight extends TeamGame
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectile.remove();
|
||||
meteor.remove();
|
||||
}
|
||||
|
||||
|
||||
@ -452,7 +464,6 @@ public class SnowFight extends TeamGame
|
||||
|
||||
for(Player player : GetPlayers(true))
|
||||
{
|
||||
//XXX DO BETTER CHECK, hanging off block, ladders, etc.
|
||||
if(isOnIce(player))
|
||||
{
|
||||
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, null, DamageCause.CUSTOM, 1, false, true, true, "Ice", "Ice", false));
|
||||
@ -514,4 +525,11 @@ public class SnowFight extends TeamGame
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void meteorStart(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getPlayer().isOp() && event.getMessage().equals("/meteor"))
|
||||
_meteorTime = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user