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,8 +378,10 @@ public class SnowFight extends TeamGame
|
||||
//Clean
|
||||
else
|
||||
{
|
||||
meteorExplode(block);
|
||||
|
||||
block.remove();
|
||||
blockIter.remove();
|
||||
blockIter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -387,57 +393,63 @@ 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;
|
||||
|
||||
//Effect
|
||||
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(meteor.getLocation(), Sound.EXPLODE, 1, 1);
|
||||
|
||||
if (projectile.hasMetadata("Meteor"))
|
||||
|
||||
//Damage
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(meteor.getLocation(), size + 3);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
//Effect
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, projectile.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);
|
||||
|
||||
|
||||
//Damage
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getEntity().getLocation(), size + 3);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.CUSTOM, size * players.get(player), false, true, false,
|
||||
"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);
|
||||
}
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null,
|
||||
DamageCause.CUSTOM, size * players.get(player), false, true, false,
|
||||
"Ice Meteor", "Ice Meteor", false);
|
||||
|
||||
//Convert to Ice
|
||||
for(Block block : UtilBlock.getInRadius(event.getEntity().getLocation(), size).keySet())
|
||||
//Vel
|
||||
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(meteor.getLocation(), size).keySet())
|
||||
{
|
||||
int i = 20;
|
||||
while (block.getY() > 0 && i>0)
|
||||
{
|
||||
int i = 20;
|
||||
while (block.getY() > 0 && i>0)
|
||||
{
|
||||
if (block.getType() == Material.LADDER ||
|
||||
block.getType() == Material.STAINED_GLASS ||
|
||||
block.getType() == Material.STAINED_GLASS_PANE)
|
||||
block.breakNaturally();
|
||||
if (block.getType() == Material.LADDER ||
|
||||
block.getType() == Material.STAINED_GLASS ||
|
||||
block.getType() == Material.STAINED_GLASS_PANE)
|
||||
block.breakNaturally();
|
||||
|
||||
|
||||
//Has air above it
|
||||
if ((UtilBlock.solid(block) && UtilBlock.isVisible(block)) || block.isLiquid())
|
||||
block.setType(Material.PACKED_ICE);
|
||||
|
||||
//Has air above it
|
||||
if ((UtilBlock.solid(block) && UtilBlock.isVisible(block)) || block.isLiquid())
|
||||
block.setType(Material.PACKED_ICE);
|
||||
|
||||
//shuffle down
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
i--;
|
||||
}
|
||||
//shuffle down
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
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));
|
||||
@ -513,5 +524,12 @@ 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