- Added new achievement 'Clutch'

- Made new achievements needed for achievement skills
This commit is contained in:
AlexTheCoder 2015-09-25 04:17:20 -04:00
parent 218aa8c584
commit 7c04e5608d
5 changed files with 82 additions and 1 deletions

View File

@ -316,6 +316,12 @@ public enum Achievement
new String[]{"Capture the Enemy Flag 20 times"},
new int[]{20},
AchievementCategory.CHAMPIONS),
CHAMPIONS_CLUTCH("Clutch", 600,
new String[]{"Champions Capture the Flag.Clutch"},
new String[]{"Kill the Enemy Flag Carrier in Sudden Death"},
new int[]{1},
AchievementCategory.CHAMPIONS),
//Paintball
SUPER_PAINTBALL_WINS("Paintball King", 600,

View File

@ -60,6 +60,8 @@ public class ClassShopManager extends MiniPlugin
Achievement.CHAMPIONS_MASS_ELECTROCUTION,
Achievement.CHAMPIONS_THE_LONGEST_SHOT,
Achievement.CHAMPIONS_WINS,
Achievement.CHAMPIONS_CAPTURES,
Achievement.CHAMPIONS_CLUTCH
});
}
}

View File

@ -23,6 +23,7 @@ import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.CapturesStatTracker;
import nautilus.game.arcade.stats.ClutchStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
@ -74,7 +75,8 @@ public class ChampionsCTF extends CaptureTheFlag
new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this),
new CapturesStatTracker(this, "Captures")
new CapturesStatTracker(this, "Captures"),
new ClutchStatTracker(this, "Clutch")
);
}

View File

@ -326,6 +326,21 @@ public class CaptureTheFlag extends TeamGame
return false;
}
public boolean isSuddenDeath()
{
return _suddenDeath;
}
public boolean isEnemyCarrier(Player check, Player stat)
{
if (GetTeam(check).GetColor() == GetTeam(stat).GetColor()) return false;
for (Flag f : _flags)
if (f.getCarrier().getName().equalsIgnoreCase(check.getName())) return true;
return false;
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.stats;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class ClutchStatTracker extends StatTracker<CaptureTheFlag>
{
private final String _stat;
public ClutchStatTracker(CaptureTheFlag game, String stat)
{
super(game);
_stat = stat;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (!getGame().isSuddenDeath())
return;
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
return;
Player killed = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (killed == null)
return;
if (!getGame().isEnemyCarrier(killed, player))
return;
addStat(player, getStat(), 1, false, false);
}
public String getStat()
{
return _stat;
}
}