Added Dragon Escape

fixed kit availability for runner
SSM: wither skel projectile continues after releasing block
SSM: nerfed blizzard
SSM: reduced gem price of a few kits
This commit is contained in:
Chiss 2013-09-06 15:58:58 +10:00
parent 9fcda443e1
commit 213b1efb0c
24 changed files with 556 additions and 442 deletions

View File

@ -1,6 +1,7 @@
package mineplex.core.explosion;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -271,4 +272,54 @@ public class Explosion extends MiniPlugin
{
return _explosionBlocks;
}
public void BlockExplosion(Collection<Block> blockSet, Location mid)
{
if (blockSet.isEmpty())
return;
//Save
final HashMap<Block, Entry<Integer, Byte>> blocks = new HashMap<Block, Entry<Integer, Byte>>();
for (Block cur : blockSet)
{
if (cur.getTypeId() == 0)
continue;
blocks.put(cur, new AbstractMap.SimpleEntry<Integer, Byte>(cur.getTypeId(), cur.getData()));
if (cur.getTypeId() != 98 || cur.getData() != 0)
cur.setTypeId(0);
}
//DELAY
final Location fLoc = mid;
_plugin.getServer().getScheduler().runTaskLater(_plugin, new Runnable()
{
public void run()
{
//Launch
for (Block cur : blocks.keySet())
{
if (blocks.get(cur).getKey() == 98)
if (blocks.get(cur).getValue() == 0)
continue;
double chance = 0.2 + (double)_explosionBlocks.size()/(double)120;
if (Math.random() > Math.min(0.85, chance))
{
FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue());
Vector vec = UtilAlg.getTrajectory(fLoc, fall.getLocation());
if (vec.getY() < 0) vec.setY(vec.getY() * -1);
UtilAction.velocity(fall, vec, 0.5 + 0.25*Math.random(), false, 0, 0.4 + 0.20*Math.random(), 10, false);
_explosionBlocks.add(fall);
}
}
}
}, 1);
}
}

View File

@ -204,6 +204,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _donationManager;
}
public Explosion GetExplosion()
{
return _explosionManager;
}
public Fire GetFire()
{
return _fire;

View File

@ -6,6 +6,7 @@ import org.bukkit.ChatColor;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.minigames.dragons.Dragons;
import nautilus.game.arcade.game.minigames.escape.DragonEscape;
import nautilus.game.arcade.game.minigames.evolution.Evolution;
import nautilus.game.arcade.game.minigames.mineware.MineWare;
import nautilus.game.arcade.game.minigames.quiver.Quiver;
@ -13,7 +14,6 @@ import nautilus.game.arcade.game.minigames.snowfight.SnowFight;
import nautilus.game.arcade.game.minigames.runner.Runner;
import nautilus.game.arcade.game.minigames.spleef.Spleef;
import nautilus.game.arcade.game.minigames.turfforts.TurfForts;
import nautilus.game.arcade.game.minigames.undeadescape.UndeadEscape;
import nautilus.game.arcade.game.standalone.bridge.Bridge;
import nautilus.game.arcade.game.standalone.castlesiege.CastleSiege;
import nautilus.game.arcade.game.standalone.smash.SuperSmash;
@ -41,7 +41,7 @@ public class GameFactory
else if (gameType == GameType.Smash) return new SuperSmash(_manager);
else if (gameType == GameType.Spleef) return new Spleef(_manager);
else if (gameType == GameType.TurfForts) return new TurfForts(_manager);
else if (gameType == GameType.UndeadEscape) return new UndeadEscape(_manager);
else if (gameType == GameType.DragonEscape) return new DragonEscape(_manager);
else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager);
else return null;
}

View File

@ -10,7 +10,7 @@ public enum GameType
Evolution("Evolution"),
Smash("Super Smash Mobs"),
Spleef("Super Spleef"),
UndeadEscape("Undead Escape"),
DragonEscape("Dragon Escape"),
Quiver("One in the Quiver"),
Runner("Runner"),
SnowFight("Snow Fight"),

View File

@ -129,6 +129,7 @@ public abstract class Game implements Listener
public boolean CreatureAllowOverride = false;
public int WorldTimeSet = -1;
public boolean WorldWeatherEnabled = false;
public int WorldHeightLimit = 0;
public int HungerSet = -1;

View File

@ -75,19 +75,6 @@ public abstract class SoloGame extends Game
if (_places.size() >= 3)
AddGems(_places.get(2), 10, "3rd Place", false);
/*
int sections = _places.size()/10;
for (int i=0 ; i<5 ; i++)
{
for (int j=i*sections ; j < j*sections + sections ; j++)
{
AddGems(_places.get(j), 5-i, "Top " + ((i+1)*10) + "%", false);
}
}
*/
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);

View File

@ -39,7 +39,7 @@ public class DragonData
Location = dragon.getLocation();
}
public void Update()
public void Move()
{
Turn();

View File

@ -29,6 +29,7 @@ import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.minigames.dragons.kits.*;
import nautilus.game.arcade.game.minigames.dragons.DragonData;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkSparkler;
@ -174,7 +175,7 @@ public class Dragons extends SoloGame
for (DragonData data : _dragons.values())
{
data.Target();
data.Update();
data.Move();
}
}

View File

@ -0,0 +1,316 @@
package nautilus.game.arcade.game.minigames.escape;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.minigames.escape.DragonEscapeData;
import nautilus.game.arcade.game.minigames.quiver.kits.KitBrawler;
import nautilus.game.arcade.game.standalone.bridge.kits.KitBeserker;
import nautilus.game.arcade.kit.Kit;
public class DragonEscape extends SoloGame
{
private ArrayList<DragonScore> _ranks = new ArrayList<DragonScore>();
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
private Location _dragon;
private ArrayList<Location> _waypoints;
private DragonEscapeData _dragonData;
public DragonEscape(ArcadeManager manager)
{
super(manager, GameType.DragonEscape,
new Kit[]
{
new KitBrawler(manager)
},
new String[]
{
"Douglas the Dragon is after you!",
"RUN!!!!!!!!!!",
"Last player alive wins!"
});
this.DamagePvP = false;
this.HungerSet = 20;
}
@Override
public void ParseData()
{
_dragon = WorldData.GetDataLocs("RED").get(0);
_waypoints = new ArrayList<Location>();
//Order Waypoints
Location last = _dragon;
while (!WorldData.GetDataLocs("BLACK").isEmpty())
{
Location best = null;
double bestDist = 0;
//Get Best
for (Location loc : WorldData.GetDataLocs("BLACK"))
{
double dist = UtilMath.offset(loc, last);
if (best == null || dist < bestDist)
{
best = loc;
bestDist = dist;
}
}
_waypoints.add(best);
WorldData.GetDataLocs("BLACK").remove(best);
best.subtract(new Vector(0,1,0));
last = best;
}
}
@EventHandler
public void SpawnDragon(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
this.CreatureAllowOverride = true;
EnderDragon dragon = _dragon.getWorld().spawn(_dragon, EnderDragon.class);
this.CreatureAllowOverride = false;
dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon");
_dragonData = new DragonEscapeData(this, dragon, _waypoints.get(0));
}
@EventHandler
public void MoveDragon(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (_dragonData == null)
return;
_dragonData.Target = _waypoints.get(Math.min(_waypoints.size()-1, (GetWaypointIndex(_dragonData.Location) + 1)));
_dragonData.Move();
Manager.GetExplosion().BlockExplosion(UtilBlock.getInRadius(_dragonData.Location, 10d).keySet(), _dragonData.Location);
}
@EventHandler
public void UpdateScores(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (_dragonData == null)
return;
double dragonScore = GetScore(_dragonData.Dragon);
for (Player player : GetPlayers(true))
{
double playerScore = GetScore(player);
if (player.getLocation().getY() < 50)
player.damage(50);
if (dragonScore > playerScore)
{
player.damage(50);
}
else
{
SetScore(player, playerScore);
}
}
}
public void SetScore(Player player, double playerScore)
{
//Rank
for (DragonScore score : _ranks)
{
if (score.Player.equals(player))
{
score.Score = playerScore;
return;
}
}
_ranks.add(new DragonScore(player, playerScore));
}
public double GetScore(Entity ent)
{
int index = GetWaypointIndex(ent.getLocation());
double score = 10000 * index;
score -= UtilMath.offset(ent.getLocation(), _waypoints.get(Math.min(_waypoints.size()-1, index+1)));
return score;
}
public int GetWaypointIndex(Location loc)
{
int best = -1;
double bestDist = 0;
for (int i=0 ; i<_waypoints.size() ; i++)
{
Location waypoint = _waypoints.get(i);
double dist = UtilMath.offset(waypoint, loc);
if (best == -1 || dist < bestDist)
{
best = i;
bestDist = dist;
}
}
return best;
}
private void SortScores()
{
for (int i=0 ; i<_ranks.size() ; i++)
{
for (int j=_ranks.size()-1 ; j>0 ; j--)
{
if (_ranks.get(j).Score > _ranks.get(j-1).Score)
{
DragonScore temp = _ranks.get(j);
_ranks.set(j, _ranks.get(j-1));
_ranks.set(j-1, temp);
}
}
}
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
//Wipe Last
for (String string : _lastScoreboard)
GetScoreboard().resetScores(Bukkit.getOfflinePlayer(string));
_lastScoreboard.clear();
SortScores();
//Write New
for (int i=0 ; i<_ranks.size() ; i++)
{
DragonScore score = _ranks.get(i);
ChatColor col = ChatColor.GREEN;
if (!IsAlive(score.Player))
col = ChatColor.RED;
String out = i+1 + " " + col + score.Player.getName();
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(16-i);
}
}
@Override
public Location GetSpectatorLocation()
{
if (SpectatorSpawn == null)
{
SpectatorSpawn = new Location(this.WorldData.World, 0,0,0);
}
Vector vec = new Vector(0,0,0);
double count = 0;
for (Player player : GetPlayers(true))
{
count++;
vec.add(player.getLocation().toVector());
}
if (count == 0)
count++;
vec.multiply(1d/count);
SpectatorSpawn.setX(vec.getX());
SpectatorSpawn.setY(vec.getY() + 10);
SpectatorSpawn.setZ(vec.getZ());
return SpectatorSpawn;
}
@Override
public void EndCheck()
{
if (!IsLive())
return;
if (GetPlayers(true).size() <= 0)
{
//Announce
AnnounceEnd(_places);
//Gems
if (_places.size() >= 1)
AddGems(_places.get(0), 20, "1st Place", false);
if (_places.size() >= 2)
AddGems(_places.get(1), 15, "2nd Place", false);
if (_places.size() >= 3)
AddGems(_places.get(2), 10, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
//End
SetState(GameState.End);
}
}
}

View File

@ -0,0 +1,72 @@
package nautilus.game.arcade.game.minigames.escape;
import mineplex.core.common.util.UtilAlg;
import org.bukkit.Location;
import org.bukkit.entity.EnderDragon;
import org.bukkit.util.Vector;
public class DragonEscapeData
{
public DragonEscape Host;
public EnderDragon Dragon;
public Location Target = null;
public Location Location = null;
public float Pitch = 0;
public Vector Velocity = new Vector(0,0,0);
public DragonEscapeData(DragonEscape host, EnderDragon dragon, Location target)
{
Host = host;
Dragon = dragon;
Location temp = dragon.getLocation();
temp.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(dragon.getLocation(), target)));
dragon.teleport(temp);
Velocity = dragon.getLocation().getDirection().setY(0).normalize();
Pitch = UtilAlg.GetPitch(dragon.getLocation().getDirection());
Location = dragon.getLocation();
}
public void Move()
{
Turn();
double timeSpeed = 0.16 + (System.currentTimeMillis() - Host.GetStateTime())/3000000d;
System.out.println(timeSpeed);
Location.add(Velocity.clone().multiply(timeSpeed));
Location.add(0, -Pitch, 0);
Location.setPitch(-1 * Pitch);
Location.setYaw(180 + UtilAlg.GetYaw(Velocity));
Dragon.teleport(Location);
}
private void Turn()
{
//Pitch
float desiredPitch = UtilAlg.GetPitch(UtilAlg.getTrajectory(Location, Target));
if (desiredPitch < Pitch) Pitch = (float)(Pitch - 0.05);
if (desiredPitch > Pitch) Pitch = (float)(Pitch + 0.05);
if (Pitch > 0.5) Pitch = 0.5f;
if (Pitch < -0.5) Pitch = -0.5f;
//Flat
Vector desired = UtilAlg.getTrajectory2d(Location, Target);
desired.subtract(UtilAlg.Normalize(new Vector(Velocity.getX(), 0, Velocity.getZ())));
desired.multiply(0.2);
Velocity.add(desired);
//Speed
UtilAlg.Normalize(Velocity);
}
}

View File

@ -0,0 +1,15 @@
package nautilus.game.arcade.game.minigames.escape;
import org.bukkit.entity.Player;
public class DragonScore
{
public org.bukkit.entity.Player Player;
public double Score;
public DragonScore(Player player, double i)
{
Player = player;
Score = i;
}
}

View File

@ -0,0 +1,40 @@
package nautilus.game.arcade.game.minigames.escape.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitLeaper extends Kit
{
public KitLeaper(ArcadeManager manager)
{
super(manager, "Jumper", KitAvailability.Free,
new String[]
{
"Leap to avoid falling to your death!"
},
new Perk[]
{
new PerkLeap("Leap", 1.2, 1.2, 8000)
},
EntityType.ZOMBIE,
new ItemStack(Material.STONE_AXE));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
}
}

View File

@ -18,16 +18,16 @@ public class KitLeaper extends Kit
{
public KitLeaper(ArcadeManager manager)
{
super(manager, "Leaper", KitAvailability.Free,
super(manager, "Jumper", KitAvailability.Free,
new String[]
{
"Evade and kill using your powerful leap!"
"Evade and kill using your double jump!"
},
new Perk[]
{
new PerkLeap("Leap", 1.2, 1.0, 8000)
new PerkDoubleJump("Double Jump", 0.9, 0.9, true)
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));

View File

@ -16,7 +16,7 @@ public class KitArcher extends Kit
{
public KitArcher(ArcadeManager manager)
{
super(manager, "Archer", KitAvailability.Free,
super(manager, "Archer", KitAvailability.Green,
new String[]
{

View File

@ -19,7 +19,7 @@ public class KitFrosty extends Kit
{
public KitFrosty(ArcadeManager manager)
{
super(manager, "Frosty", KitAvailability.Free,
super(manager, "Frosty", KitAvailability.Blue,
new String[]
{

View File

@ -1,152 +0,0 @@
package nautilus.game.arcade.game.minigames.undeadescape;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
import org.bukkit.Location;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class GiantData
{
public UndeadEscape Host;
public EnderDragon Dragon;
public Entity TargetEntity = null;
public Location Target = null;
public Location Location = null;
public float Pitch = 0;
public Vector Velocity = new Vector(0,0,0);
public double RangeBest = 1000;
public long RangeTime = 0;
public GiantData(UndeadEscape host, EnderDragon dragon)
{
Host = host;
Dragon = dragon;
Velocity = dragon.getLocation().getDirection().setY(0).normalize();
Pitch = UtilAlg.GetPitch(dragon.getLocation().getDirection());
Location = dragon.getLocation();
}
public void Update()
{
Turn();
Location.add(Velocity);
Location.add(0, -Pitch, 0);
Location.setPitch(-1 * Pitch);
Location.setYaw(180 + UtilAlg.GetYaw(Velocity));
Dragon.teleport(Location);
}
private void Turn()
{
//Pitch
float desiredPitch = UtilAlg.GetPitch(UtilAlg.getTrajectory(Location, Target));
if (desiredPitch < Pitch) Pitch = (float)(Pitch - 0.05);
if (desiredPitch > Pitch) Pitch = (float)(Pitch + 0.05);
if (Pitch > 0.5) Pitch = 0.5f;
if (Pitch < -0.5) Pitch = -0.5f;
//Flat
Vector desired = UtilAlg.getTrajectory2d(Location, Target);
desired.subtract(UtilAlg.Normalize(new Vector(Velocity.getX(), 0, Velocity.getZ())));
desired.multiply(0.075);
Velocity.add(desired);
//Speed
UtilAlg.Normalize(Velocity);
}
public void Target()
{
if (TargetEntity != null)
{
if (!TargetEntity.isValid())
{
TargetEntity = null;
}
else
{
Target = TargetEntity.getLocation().subtract(0, 8, 0);
}
return;
}
if (Target == null)
{
TargetSky();
}
if (UtilMath.offset(Location, Target) < 4)
{
//Target Player
if (Target.getY() >= Host.GetSpectatorLocation().getY())
{
TargetPlayer();
}
//Target Sky
else
{
TargetSky();
}
}
TargetTimeout();
}
public void TargetTimeout()
{
if (UtilMath.offset(Location, Target)+1 < RangeBest)
{
RangeTime = System.currentTimeMillis();
RangeBest = UtilMath.offset(Location, Target);
}
else
{
if (UtilTime.elapsed(RangeTime, 10000))
{
TargetSky();
}
}
}
public void TargetSky()
{
RangeBest = 9000;
RangeTime = System.currentTimeMillis();
Target = Host.GetSpectatorLocation().clone().add(50 - UtilMath.r(100), 20 + UtilMath.r(30), 50 - UtilMath.r(100));
}
public void TargetPlayer()
{
RangeBest = 9000;
RangeTime = System.currentTimeMillis();
Player player = Host.GetPlayers(true).get(UtilMath.r(Host.GetPlayers(true).size()));
Target = player.getLocation();
Target.add(UtilAlg.getTrajectory(Location, Target).multiply(4));
}
public void HitByArrow()
{
TargetSky();
}
}

View File

@ -1,245 +0,0 @@
package nautilus.game.arcade.game.minigames.undeadescape;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Creature;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Giant;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.standalone.bridge.kits.KitBeserker;
import nautilus.game.arcade.kit.Kit;
public class UndeadEscape extends SoloGame
{
private Location _giantStart;
private Location _giantEnd;
private Creature _giant = null;
public UndeadEscape(ArcadeManager manager)
{
super(manager, GameType.UndeadEscape,
new Kit[]
{
new KitBeserker(manager)
},
new String[]
{
"RUN!!!!!!!"
});
this.DamagePvP = false;
}
@Override
public void ParseData()
{
if (!WorldData.GetDataLocs("BLACK").isEmpty())
_giantStart = WorldData.GetDataLocs("BLACK").get(0);
if (!WorldData.GetDataLocs("WHITE").isEmpty())
_giantEnd = WorldData.GetDataLocs("WHITE").get(0);
}
@EventHandler
public void GiantTarget(EntityTargetEvent event)
{
if (_giant == null)
return;
if (event.getEntity().equals(_giant))
event.setCancelled(true);
}
@EventHandler
public void GiantDamage(EntityDamageEvent event)
{
if (_giant == null)
return;
if (event.getEntity().equals(_giant))
event.setCancelled(true);
}
@EventHandler
public void GiantCombust(EntityCombustEvent event)
{
if (_giant == null)
return;
if (event.getEntity().equals(_giant))
event.setCancelled(true);
}
@EventHandler
public void GiantMove(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (GetState() != GameState.Live)
return;
if (!UtilTime.elapsed(GetStateTime(), 5000))
return;
if (_giant == null || !_giant.isValid())
{
if (_giant != null)
_giant.remove();
CreatureAllowOverride = true;
_giant = _giantStart.getWorld().spawn(_giantStart, Giant.class);
CreatureAllowOverride = false;
}
//Move
double rate = 0.075 + ((System.currentTimeMillis() - this.GetStateTime())/100000d);
Location target = _giant.getLocation().add(UtilAlg.getTrajectory(_giantStart, _giantEnd).multiply(rate));
_giant.teleport(target);
/*
EntityCreature ec = ((CraftCreature)_giant).getHandle();
Navigation nav = ec.getNavigation();
Location loc = _giant.getLocation().add(UtilAlg.getTrajectory(_giantStart, _giantEnd).multiply(1));
nav.a(loc.getX(), loc.getY(), loc.getZ(), 2f + Math.min(2f, (float)()));
*/
}
@EventHandler
public void GiantGroan(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (GetState() != GameState.Live)
return;
if (_giant == null)
return;
if (Math.random() > 0.75)
return;
_giant.getWorld().playSound(_giant.getEyeLocation(), Sound.ZOMBIE_IDLE, 5f, 0.5f + (float)(Math.random()));
}
@EventHandler
public void GiantKill(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (_giant == null)
return;
for (Player player : GetPlayers(true))
{
if (UtilMath.offset2d(player, _giant) < 7)
{
player.damage(50);
}
}
}
@EventHandler
public void GiantBlocks(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (GetState() != GameState.Live)
return;
if (_giant == null)
return;
for (int x=-7 ; x<=7 ; x++)
{
for (int z=-7 ; z<=7 ; z++)
{
for (int y=0 ; y<=15 ; y++)
{
Block block = _giant.getWorld().getBlockAt(
_giant.getLocation().getBlockX()+x,
_giant.getLocation().getBlockY()+y,
_giant.getLocation().getBlockZ()+z);
if (block.getTypeId() == 0)
continue;
final Material mat = block.getType();
final byte data = block.getData();
final Location loc = block.getLocation().add(0.5, 0.5, 0.5);
block.setTypeId(0);
Manager.GetPlugin().getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
{
public void run()
{
FallingBlock fall = loc.getWorld().spawnFallingBlock(loc, mat, data);
Vector vec = UtilAlg.getTrajectory(_giant, fall);
if (vec.getY() < 0) vec.setY(vec.getY() * -1);
vec.add(new Vector(0.2 - Math.random()*0.4,0.2 - Math.random()*0.4,0.2 - Math.random()*0.4));
UtilAction.velocity(fall, vec, 0.75 + 0.25*Math.random(), false, 0, 0.4 + 0.20*Math.random(), 10, false);
}
}, 1);
}
}
}
}
@Override
public Location GetSpectatorLocation()
{
if (SpectatorSpawn == null)
{
SpectatorSpawn = new Location(this.WorldData.World, 0,0,0);
}
Vector vec = new Vector(0,0,0);
double count = 0;
for (Player player : GetPlayers(true))
{
count++;
vec.add(player.getLocation().toVector());
}
vec.multiply(1d/count);
SpectatorSpawn.setX(vec.getX());
SpectatorSpawn.setY(vec.getY() + 10);
SpectatorSpawn.setZ(vec.getZ());
return SpectatorSpawn;
}
//@Override
//public void EndCheck()
//{}
}

View File

@ -77,13 +77,11 @@ public class SuperSmash extends SoloGame
this.HungerSet = 20;
this.PrepareFreeze = false;
this.CompassEnabled = true;
this.SpawnDistanceRequirement = 16;
this.InventoryOpen = true;
this.InventoryOpen = false;
}
@EventHandler(priority = EventPriority.HIGH)

View File

@ -105,6 +105,6 @@ public class KitBlaze extends SmashKit
@Override
public int GetCost()
{
return 8000;
return 6000;
}
}

View File

@ -32,9 +32,9 @@ public class KitSnowman extends SmashKit
new Perk[]
{
new PerkSmashStats(6, 1.4, 0.4, 6),
new PerkSmashStats(5, 1.4, 0.4, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkDamageSnow(3, 1.5),
new PerkDamageSnow(3, 1.25),
new PerkArcticAura(),
new PerkBlizzard(),
new PerkIcePath(),
@ -91,6 +91,6 @@ public class KitSnowman extends SmashKit
@Override
public int GetCost()
{
return 6000;
return 5000;
}
}

View File

@ -31,7 +31,7 @@ public class KitWitherSkeleton extends SmashKit
new Perk[]
{
new PerkSmashStats(6, 1.1, 0.3, 6),
new PerkSmashStats(6, 1.2, 0.3, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkWitherSkull(),
new PerkWitherImage(),

View File

@ -46,7 +46,7 @@ public class PerkBlizzard extends Perk
if (!Kit.HasKit(player))
continue;
player.setExp((float) Math.min(0.999, player.getExp()+0.008));
player.setExp((float) Math.min(0.999, player.getExp()+0.007));
}
}

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Location;
@ -15,6 +16,7 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -32,7 +34,8 @@ import nautilus.game.arcade.kit.Perk;
public class PerkWitherSkull extends Perk
{
private HashMap<WitherSkull, Player> _active = new HashMap<WitherSkull, Player>();
private HashMap<WitherSkull, Vector> _active = new HashMap<WitherSkull, Vector>();
private HashSet<Player> _ignoreControl = new HashSet<Player>();
public PerkWitherSkull()
{
@ -70,13 +73,16 @@ public class PerkWitherSkull extends Perk
WitherSkull skull = player.launchProjectile(WitherSkull.class);
skull.setDirection(player.getLocation().getDirection());
_active.put(skull, player);
_active.put(skull, player.getLocation().getDirection());
//Sound
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 1f, 1f);
//Inform
UtilPlayer.message(player, F.main("Skill", "You launched " + F.skill(GetName()) + "."));
//Control
_ignoreControl.remove(player);
}
@EventHandler
@ -90,7 +96,7 @@ public class PerkWitherSkull extends Perk
while (skullIterator.hasNext())
{
WitherSkull skull = skullIterator.next();
Player player = _active.get(skull);
Player player = (Player)skull.getShooter();
if (!skull.isValid())
{
@ -99,18 +105,17 @@ public class PerkWitherSkull extends Perk
continue;
}
if (player.isBlocking())
if (player.isBlocking() && !_ignoreControl.contains(player))
{
skull.setDirection(player.getLocation().getDirection());
skull.setVelocity(player.getLocation().getDirection().multiply(0.6));
_active.put(skull, player.getLocation().getDirection().multiply(0.6));
}
else
{
Explode(skull, skull.getLocation(), player);
skullIterator.remove();
skull.remove();
continue;
_ignoreControl.add(player);
skull.setDirection(_active.get(skull));
skull.setVelocity(_active.get(skull));
}
}
}
@ -138,8 +143,6 @@ public class PerkWitherSkull extends Perk
event.SetCancelled("Wither Skull Cancel");
}
@EventHandler(priority = EventPriority.LOWEST)
public void DirectHitDamage(CustomDamageEvent event)
{

View File

@ -696,6 +696,28 @@ public class GameFlagManager implements Listener
}
}
@EventHandler
public void WorldWeather(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
Game game = Manager.GetGame();
if (game == null) return;
if (!game.WorldWeatherEnabled)
{
if (game.WorldData != null)
{
if (game.WorldData.World != null)
{
game.WorldData.World.setStorm(false);
game.WorldData.World.setThundering(false);
}
}
}
}
@EventHandler
public void WorldWaterDamage(UpdateEvent event)
{