Added achievements

This commit is contained in:
Mysticate 2015-07-14 13:31:41 -04:00
parent 3b00be33ee
commit 1e1cf6403d
12 changed files with 402 additions and 29 deletions

View File

@ -630,6 +630,52 @@ public enum Achievement
new String[]{"Kill 2 enemies while blinded from", "a single flashbang"},
new int[]{1},
AchievementCategory.MINE_STRIKE),
//Bomb Lobbers
BOMB_LOBBERS_WINS("Master Bomber", 1200,
new String[]{"Bomb Lobbers.Wins"},
new String[]{"Win 100 games of Bomb Lobbers"},
new int[] {100},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_PROFESSIONAL_LOBBER("Professional Lobber", 1000,
new String[]{"Bomb Lobbers.Thrown"},
new String[]{"Throw 2000 TNT"},
new int[]{2000},
AchievementCategory.BOMB_LOBBERS),
// BOMB_LOBBERS_REKT_X3("Rekt x3", 800,
// new String[]{"Bomb Lobbers.3Kill"},
// new String[]{"Kill 3 players with one explosion"},
// new int[]{1},
// AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_ULTIMATE_KILLER("Ultimate Killer", 800,
new String[]{"Bomb Lobbers.Killer"},
new String[]{"Kill 6 players in a single game"},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_EXPLOSION_PROOF("Jelly Skin", 1000,
new String[]{"Bomb Lobbers.JellySkin"},
new String[]{"Win a game without taking any damage."},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_BEST_TEAM("The Best Team", 800,
new String[]{"Bomb Lobbers.BestTeam"},
new String[]{"Win a game without losing a teammate"},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_BLAST_PROOF("Blast Proof", 800,
new String[]{"Bomb Lobbers.BlastProof"},
new String[]{"Win 20 games using Armorer"},
new int[]{20},
AchievementCategory.BOMB_LOBBERS)
// BOMB_LOBBERS_
;
private String _name;

View File

@ -32,11 +32,11 @@ public enum AchievementCategory
UHC("Ultra Hardcore", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "Extra Class Skills"),
Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, null),
WIZARDS("Wizards", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"),
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit"),
CASTLE_SIEGE("Castle Siege", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"),
@ -45,7 +45,7 @@ public enum AchievementCategory
BLOCK_HUNT("Block Hunt", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.GRASS, 0, GameCategory.CLASSICS, null),
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
SMASH_MOBS("Super Smash Mobs", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -57,7 +57,7 @@ public enum AchievementCategory
DRAW_MY_THING("Draw My Thing", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, null),
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -74,7 +74,7 @@ public enum AchievementCategory
DRAGON_ESCAPE("Dragon Escape", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.DRAGON_EGG, 0, GameCategory.ARCADE, null),
Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit"),
SHEEP_QUEST("Sheep Quest", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -86,7 +86,7 @@ public enum AchievementCategory
ONE_IN_THE_QUIVER("One in the Quiver", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BOW, 0, GameCategory.ARCADE, null),
Material.BOW, 0, GameCategory.ARCADE, "Slam Shooter Kit"),
SUPER_PAINTBALL("Super Paintball", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -110,7 +110,7 @@ public enum AchievementCategory
SNAKE("Snake", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.WOOL, 4, GameCategory.ARCADE, null),
Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit"),
BACON_BRAWL("Bacon Brawl", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -118,9 +118,12 @@ public enum AchievementCategory
MICRO_BATTLE("Micro Battle", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.LAVA, 0, GameCategory.ARCADE, null);
Material.LAVA, 0, GameCategory.ARCADE, null),
BOMB_LOBBERS("Bomb Lobbers", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.TNT, 0, GameCategory.ARCADE, "Waller Kit");
private String _name;
private String[] _statsToPull;
private StatDisplay[] _statDisplays;

View File

@ -17,6 +17,9 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -27,6 +30,11 @@ import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer;
import nautilus.game.arcade.game.games.lobbers.kits.KitDetonator;
import nautilus.game.arcade.game.games.lobbers.kits.KitJumper;
import nautilus.game.arcade.game.games.lobbers.kits.KitWaller;
import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBestTeam;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBlastProof;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.ChatColor;
@ -48,7 +56,10 @@ public class BombLobbers extends TeamGame
private NautHashMap<TNTPrimed, String> _throwers = new NautHashMap<TNTPrimed, String>();
private NautHashMap<TNTPrimed, GameTeam> _teams = new NautHashMap<TNTPrimed, GameTeam>();
private NautHashMap<Player, Double> _kills = new NautHashMap<Player, Double>();
@SuppressWarnings("unchecked")
public BombLobbers(ArcadeManager manager)
{
super(manager, GameType.Lobbers, new Kit[]
@ -66,10 +77,8 @@ public class BombLobbers extends TeamGame
"Last team alive wins!",
"Kaboom!"
});
DamageSelf = false;
DamageTeamSelf = false;
WorldWaterDamage = 5;
PrepareFreeze = false;
@ -83,12 +92,67 @@ public class BombLobbers extends TeamGame
ItemDrop = false;
BlockPlace = false;
DamageFall = true;
Manager.GetExplosion().SetLiquidDamage(false);
HungerSet = 20;
registerStatTrackers(new Tracker6Kill(this), new TrackerBestTeam(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this));
}
public void addKill(Player player)
{
_kills.put(player, _kills.containsKey(player) ? _kills.get(player) + 1 : 1);
}
public void addAssist(Player player)
{
_kills.put(player, _kills.containsKey(player) ? _kills.get(player) + .5 : .5);
}
public double getKills(Player player)
{
if (_kills.containsKey(player))
{
return _kills.get(player);
}
else
{
_kills.put(player, 0.0);
return 0;
}
}
@EventHandler
public void onKill(CombatDeathEvent event)
{
if (!IsLive())
return;
Player dead = UtilPlayer.searchExact(((Player) event.GetEvent().getEntity()).getName());
if (!IsAlive(dead))
return;
for (CombatComponent damager : event.GetLog().GetAttackers())
{
Player killer = UtilPlayer.searchExact(damager.GetName());
if (killer == null || !killer.isOnline())
continue;
if (IsAlive(killer))
{
if (event.GetLog().GetKiller() == damager)
{
addKill(killer);
}
else
{
addAssist(killer);
}
}
}
}
@EventHandler
@ -234,8 +298,16 @@ public class BombLobbers extends TeamGame
}
}
@EventHandler
public void nerfTNT(CustomDamageEvent event)
{
if (event.GetCause().toString().contains("EXPLOSION"))
{
event.AddMod("Armor", "Damage Nerf", -(event.GetDamage() * .333), false);
}
}
@SuppressWarnings("deprecation")
@EventHandler
public void damageBlocks(ExplosionEvent event)
{
@ -248,14 +320,49 @@ public class BombLobbers extends TeamGame
{
Block block = iterator.next();
if (block.getData() == 0)
{
block.setData((byte) 2);
iterator.remove();
}
if (!shouldRemoveFromExplosion(block))
continue;
event.GetBlocks().remove(block);
}
}
//Boolean = remove
@SuppressWarnings("deprecation")
public boolean shouldRemoveFromExplosion(Block block)
{
//Stone
if (block.getTypeId() == 1)
{
block.setTypeId(4);
return false;
}
//Stone Brick
else if (block.getTypeId() == 98)
{
block.setData((byte) 2);
return false;
}
//Grass
else if (block.getTypeId() == 2)
{
block.setTypeId(3);
return false;
}
//Wood Planks
else if (block.getTypeId() == 5)
{
block.setData((byte) 2);
return false;
}
//Other
return true;
}
private GameTeam getSide(Location entityLoc)
{
Location nearest = UtilAlg.findClosest(entityLoc, new ArrayList<Location>(_averageSpawns.values()));

View File

@ -20,7 +20,7 @@ public class KitArmorer extends Kit
public KitArmorer(ArcadeManager manager)
{
super(manager, "Armorer", KitAvailability.Free, 0, new String[]
super(manager, "Armorer", KitAvailability.Gem, 2000, new String[]
{
"He uses his expert armor-making",
"skills to block excess damage!",

View File

@ -27,9 +27,9 @@ public class KitDetonator extends Kit
public KitDetonator(ArcadeManager manager)
{
super(manager, "Detonator", KitAvailability.Free, 0, new String[]
super(manager, "Detonator", KitAvailability.Gem, 4000, new String[]
{
"He doesn't like to wait.",
"He doesn't like to wait. Max fuse of 3 and min fuse of 2.",
"",
C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Fuse Time.",
C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Fuse Time."
@ -109,7 +109,7 @@ public class KitDetonator extends Kit
//Left
else if (UtilEvent.isAction(event, ActionType.L))
{
if (amount <= 1)
if (amount <= 2)
return;
UtilInv.remove(event.getPlayer(), Material.LEVER, (byte) 0, 1);

View File

@ -17,7 +17,7 @@ public class KitWaller extends Kit
public KitWaller(ArcadeManager manager)
{
super(manager, "Waller", KitAvailability.Free, 0, new String[]
super(manager, "Waller", KitAvailability.Achievement, 0, new String[]
{
"When the times get tough,",
"build yourself a wall!"

View File

@ -35,9 +35,7 @@ public class PerkWaller extends Perk
{
super("Waller", new String[]
{
C.cYellow + "Click Block" + C.cGray + " with shovel to " + C.cGreen + "Place Wall",
C.cGray + "Walls can absorb 1 hit before breaking.",
C.cGray + "TNT that touches a wall will explode instantly."
C.cYellow + "Click Block" + C.cGray + " with shovel to " + C.cGreen + "Place Wall"
});
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class Tracker6Kill extends StatTracker<Game>
{
public Tracker6Kill(Game game)
{
super(game);
}
@EventHandler
public void onEndgame(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
if (getGame() instanceof BombLobbers)
{
for (Player player : UtilServer.getPlayers())
{
if (((BombLobbers) getGame()).getKills(player) >= 6.0)
{
addStat(player, "Killer", 1, true, false);
}
}
}
}
}

View File

@ -0,0 +1,51 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import mineplex.core.common.util.NautHashMap;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class TrackerBestTeam extends StatTracker<Game>
{
private NautHashMap<GameTeam, Integer> _teams = new NautHashMap<GameTeam, Integer>();
public TrackerBestTeam(Game game)
{
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (GameTeam team : getGame().GetTeamList())
{
_teams.put(team, team.GetPlayers(true).size());
}
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
for (GameTeam team : getGame().GetTeamList())
{
if (_teams.get(team) == team.GetPlayers(true).size())
{
for (Player player : team.GetPlayers(true))
{
addStat(player, "BestTeam", 1, true, false);
}
}
}
}
}

View File

@ -0,0 +1,35 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class TrackerBlastProof extends StatTracker<Game>
{
public TrackerBlastProof(Game game)
{
super(game);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
for (Player winner : getGame().getWinners())
{
if (getGame().GetKit(winner) instanceof KitArmorer)
{
addStat(winner, "BlastProof", 1, false, false);
}
}
}
}

View File

@ -0,0 +1,69 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import java.util.HashSet;
import java.util.Set;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class TrackerNoDamage extends StatTracker<Game>
{
private Set<String> _noDamage = new HashSet<String>();
public TrackerNoDamage(Game game)
{
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (Player player : getGame().GetPlayers(true))
{
_noDamage.add(player.getName());
}
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
for (String name : _noDamage)
{
Player player = UtilPlayer.searchExact(name);
if (player == null || !player.isOnline())
continue;
addStat(player, "JellySkin", 1, true, false);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDamage(CustomDamageEvent event)
{
if (!getGame().IsLive())
return;
if (event.GetDamageePlayer() == null || !event.GetDamageePlayer().isOnline())
return;
if (_noDamage.contains(event.GetDamageePlayer().getName()))
{
_noDamage.remove(event.GetDamageePlayer().getName());
}
}
}

View File

@ -0,0 +1,26 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.event.EventHandler;
public class TrackerTNTThrown extends StatTracker<Game>
{
public TrackerTNTThrown(Game game)
{
super(game);
}
@EventHandler
public void onThrow(TNTThrowEvent event)
{
if (!getGame().IsLive())
return;
addStat(event.getPlayer(), "Thrown", 1, false, false);
}
}