Added kits + achievements. Hurrah!

This commit is contained in:
Mysticate 2015-08-26 13:19:17 -06:00
parent 988382375f
commit cfdb0dfa4f
33 changed files with 663 additions and 50 deletions

View File

@ -666,7 +666,49 @@ public enum Achievement
new String[]{"Bomb Lobbers.Direct Hit"},
new String[]{"Get 50 direct hits"},
new int[]{50},
AchievementCategory.BOMB_LOBBERS)
AchievementCategory.BOMB_LOBBERS),
EVOLUTION_WINS("Expert Evolver", 1200,
new String[]{"Evolution.Wins"},
new String[]{"Win 20 games of Evolution"},
new int[]{20},
AchievementCategory.EVOLUTION),
EVOLUTION_NO_DEATHS("Perfect Game", 2000,
new String[]{"Evolution.NoDeaths"},
new String[]{"Win a game withing dying"},
new int[]{1},
AchievementCategory.EVOLUTION),
EVOLUTION_STEALTH("Stealth Mastah", 1000,
new String[]{"Evolution.Stealth"},
new String[]{"Win without taking any", "damage while evolving"},
new int[1],
AchievementCategory.EVOLUTION),
EVOLUTION_RAMPAGE("Rampage", 800,
new String[]{"Evolution.Rampage"},
new String[]{"Get 3 kills within 5 seconds", "of each other"},
new int[1],
AchievementCategory.EVOLUTION),
EVOLUTION_MELEE("Melee Monster", 1000,
new String[]{"Evolution.MeleeOnly"},
new String[]{"Win without using any abilities"},
new int[1],
AchievementCategory.EVOLUTION),
EVOLUTION_SKILLS("Ability Assassin", 1000,
new String[]{"Evolution.AbilityOnly"},
new String[]{"Win without any melee attacks"},
new int[1],
AchievementCategory.EVOLUTION),
EVOLUTION_EVOLVEKILL("No Evolve 5 U", 800,
new String[]{"Evolution.EvolveKill"},
new String[]{"Kill 50 people while they", "Are trying to evolve"},
new int[50],
AchievementCategory.EVOLUTION)
;

View File

@ -2,9 +2,6 @@ package mineplex.core.achievement;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@ -12,6 +9,9 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public enum AchievementCategory
{
GLOBAL("Global", null,
@ -122,7 +122,11 @@ public enum AchievementCategory
BOMB_LOBBERS("Bomb Lobbers", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit");
Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit"),
EVOLUTION("Evolution", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit");
private String _name;
private String[] _statsToPull;

View File

@ -33,18 +33,29 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAttemptingTickEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent;
import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager;
import nautilus.game.arcade.game.games.evolution.kits.KitAbility;
import nautilus.game.arcade.game.games.evolution.kits.KitEvolveSpeed;
import nautilus.game.arcade.game.games.evolution.kits.KitHealth;
import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze;
import nautilus.game.arcade.game.games.evolution.mobs.KitChicken;
import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper;
import nautilus.game.arcade.game.games.evolution.mobs.KitGolem;
import nautilus.game.arcade.game.games.evolution.mobs.KitSlime;
import nautilus.game.arcade.game.games.evolution.mobs.KitSpider;
import nautilus.game.arcade.game.games.evolution.trackers.KillsWhileEvolvingTracker;
import nautilus.game.arcade.game.games.evolution.trackers.NoAbilityTracker;
import nautilus.game.arcade.game.games.evolution.trackers.NoDamageWhileEvolvingTracker;
import nautilus.game.arcade.game.games.evolution.trackers.NoMeleeTracker;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillFastStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -78,6 +89,7 @@ public class Evolution extends SoloGame
private ArrayList<Player> _evolutionsAvailable = new ArrayList<Player>();
private NautHashMap<String, Float> _chargingExp = new NautHashMap<String, Float>();
@SuppressWarnings("unchecked")
public Evolution(ArcadeManager manager)
{
super(manager, GameType.Evolution, new EvoKit[0], new String[0]);
@ -96,7 +108,10 @@ public class Evolution extends SoloGame
ArrayList<Kit> allKits = new ArrayList<Kit>();
allKits.addAll(_mobKits);
//TODO Add regular kits
allKits.add(new KitAbility(Manager));
allKits.add(new KitEvolveSpeed(Manager));
allKits.add(new KitHealth(Manager));
setKits(allKits.toArray(new Kit[0]));
@ -104,7 +119,7 @@ public class Evolution extends SoloGame
{
"You can evolve every kill.",
"Each evolution has unique skills.",
"First to get through " + GetKits().length + " evolutions wins!"
"First to get through " + _mobKits.size() + " evolutions wins!"
};
DamageTeamSelf = true;
@ -129,6 +144,15 @@ public class Evolution extends SoloGame
CreatureAllow = false;
DeathMessages = false;
registerStatTrackers(
new WinWithoutDyingStatTracker(this, "NoDeaths"),
new NoDamageWhileEvolvingTracker(this),
new KillFastStatTracker(this, 3, 5, "Rampage"),
new NoAbilityTracker(this),
new NoMeleeTracker(this),
new KillsWhileEvolvingTracker(this)
);
}
public EvolveManager getEvolve()
@ -188,7 +212,7 @@ public class Evolution extends SoloGame
for (Player player : GetPlayers(true))
{
_tokens.put(player.getName(), new EvoToken(player));
_tokens.put(player.getName(), new EvoToken(player, GetKit(player)));
upgradeKit(player, false);
}
@ -232,9 +256,10 @@ public class Evolution extends SoloGame
if (!IsAlive(player))
return;
EvoKit newKit = (EvoKit) GetKits()[getScore(player)];
EvoKit newKit = _mobKits.get(getScore(player));
SetKit(player, newKit, false);
_tokens.get(player.getName()).SupplementKit.ApplyKit(player);
if (give)
{
@ -242,6 +267,18 @@ public class Evolution extends SoloGame
}
}
@Override
public boolean HasKit(Player player, Kit kit)
{
if (super.HasKit(player, kit))
return true;
if (!_tokens.containsKey(player.getName()))
return false;
return _tokens.get(player.getName()).SupplementKit.equals(kit);
}
@EventHandler
public void startEvolve(EvolutionBeginEvent event)
{
@ -282,7 +319,7 @@ public class Evolution extends SoloGame
}
}
if (increaseScore(event.getPlayer()) >= GetKits().length)
if (increaseScore(event.getPlayer()) >= _mobKits.size())
{
ScoreboardUpdate(new UpdateEvent(UpdateType.FAST));
@ -306,19 +343,10 @@ public class Evolution extends SoloGame
Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire();
}
if (getScore(event.getPlayer()) >= GetKits().length)
if (getScore(event.getPlayer()) >= _mobKits.size())
{
End();
}
// Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
// {
// @Override
// public void run()
// {
// GetKit(event.getPlayer()).ApplyKit(event.getPlayer());
// }
// }, 4);
}
@EventHandler
@ -427,6 +455,9 @@ public class Evolution extends SoloGame
public void run()
{
GetKit(player).ApplyKit(player);
if (_tokens.containsKey(player.getName()))
_tokens.get(player.getName()).SupplementKit.ApplyKit(player);
}
}, 0);
}
@ -502,10 +533,14 @@ public class Evolution extends SoloGame
{
UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Crouch to Evolve", 0, 60, 20, player);
}
}
}
public boolean isAttemptingEvolve(Player player)
{
return _chargingExp.containsKey(player.getName());
}
//Boolean remove
private boolean onEvolveAttempting(Player player)
{
@ -527,15 +562,14 @@ public class Evolution extends SoloGame
token.LifeKills = 0;
EvoKit from = (EvoKit) GetKits()[token.Level];
EvoKit to = (EvoKit) GetKits()[token.Level + 1 >= GetKits().length ? token.Level : token.Level + 1]; //Account for the score increase after evolve
EvoKit from = (EvoKit) _mobKits.get(token.Level);
EvoKit to = (EvoKit) _mobKits.get(token.Level + 1 >= _mobKits.size() ? token.Level : token.Level + 1); //Account for the score increase after evolve
_evolve.addEvolve(Manager.getHologramManager(), player, from, to);
return true;
}
if (Manager.GetCondition().HasCondition(player, ConditionType.SPEED, "Kill"))
Manager.GetCondition().GetActiveCondition(player, ConditionType.SPEED).Expire();
Manager.GetCondition().EndCondition(player, ConditionType.SPEED, "Kill");
if (!hasEvolvingEffects(player))
addEvolvingEffects(player);
@ -543,7 +577,12 @@ public class Evolution extends SoloGame
int kills = _tokens.get(player.getName()).LifeKills;
if (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG)
_chargingExp.put(player.getName(), (float) Math.min(exp + Math.min(.022, .012 + (kills <= 0 ? 0 : (.003 * (kills - 1)))), .9999F));
{
EvolutionAttemptingTickEvent tickEvent = new EvolutionAttemptingTickEvent(player, (float) Math.min(.022, .012 + (kills <= 0 ? 0 : (.003 * (kills - 1)))));
Bukkit.getPluginManager().callEvent(tickEvent);
_chargingExp.put(player.getName(), (float) Math.min(exp + tickEvent.getProgress(), .9999F));
}
UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player);
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1, _chargingExp.get(player.getName()) + 1);
@ -714,12 +753,14 @@ public class Evolution extends SoloGame
Scoreboard.Reset();
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGold + C.Bold + "First to " + _mobKits.size());
for (Player player : GetPlayers(true))
{
Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true);
}
Scoreboard.Draw();
}
}

View File

@ -15,9 +15,30 @@ public class EvolutionAbilityUseEvent extends PlayerEvent implements Cancellable
private boolean _cancelled = false;
public EvolutionAbilityUseEvent(Player who)
private String _ability;
private long _cooldown;
public EvolutionAbilityUseEvent(Player who, String ability, long cooldown)
{
super(who);
_ability = ability;
_cooldown = cooldown;
}
public String getAbility()
{
return _ability;
}
public long getCooldown()
{
return _cooldown;
}
public void setCooldown(long cooldown)
{
_cooldown = cooldown;
}
@Override

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.game.games.evolution.events;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class EvolutionAttemptingTickEvent extends PlayerEvent
{
/**
* @author Mysticate
*/
private static HandlerList _handlers = new HandlerList();
private static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private float _progress;
public EvolutionAttemptingTickEvent(Player who, float _progress)
{
super(who);
}
public float getProgress()
{
return _progress;
}
public void setProgress(float progress)
{
_progress = progress;
}
}

View File

@ -10,6 +10,7 @@ public class EvolutionEndEvent extends PlayerEvent implements Cancellable
/**
* @author Mysticate
*/
private static HandlerList _handlers = new HandlerList();
private boolean _cancelled = false;

View File

@ -1,8 +1,36 @@
package nautilus.game.arcade.game.games.evolution.kits;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.evolution.kits.perks.PerkCooldownEVO;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitAbility extends Kit
{
/**
* @author Mysticate
*/
public KitAbility(ArcadeManager manager)
{
super(manager, "Ability Master", KitAvailability.Free, new String[]
{
"Your DNA allows you to chop cooldown times!"
}, new Perk[]
{
new PerkCooldownEVO()
}, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.FEATHER));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.evolution.kits;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.evolution.kits.perks.PerkEvolveSpeedEVO;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitEvolveSpeed extends Kit
{
/**
* @author Mysticate
*/
public KitEvolveSpeed(ArcadeManager manager)
{
super(manager, "Quick Evolver", KitAvailability.Gem, 4000, new String[]
{
"You always had dreams of growing up..."
}, new Perk[]
{
new PerkEvolveSpeedEVO()
}, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,53 @@
package nautilus.game.arcade.game.games.evolution.kits;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.F;
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.PerkKillHealth;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitHealth extends Kit
{
/**
* @author Mysticate
*/
public KitHealth(ArcadeManager manager)
{
super(manager, "Health Harvester", KitAvailability.Achievement, new String[]
{
"Harvest health every day..."
}, new Perk[]
{
new PerkKillHealth("Health Harvester", new String[]
{
"You regain " + F.elem("100% Health") + " health on kill."
}, 1000, true)
}, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
setAchievementRequirements(new Achievement[]
{
Achievement.EVOLUTION_EVOLVEKILL,
Achievement.EVOLUTION_MELEE,
Achievement.EVOLUTION_NO_DEATHS,
Achievement.EVOLUTION_RAMPAGE,
Achievement.EVOLUTION_SKILLS,
Achievement.EVOLUTION_STEALTH,
Achievement.EVOLUTION_WINS
}
);
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,37 @@
package nautilus.game.arcade.game.games.evolution.kits.perks;
import mineplex.core.common.util.F;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.event.EventHandler;
public class PerkCooldownEVO extends Perk
{
/**
* @author Mysticate
*/
public PerkCooldownEVO()
{
super("Cooldown", new String[]
{
"All ability cooldowns are reduced by" + F.elem("1/3") + "."
});
}
@EventHandler
public void onAbility(EvolutionAbilityUseEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!Manager.IsAlive(event.getPlayer()))
return;
if (!Kit.HasKit(event.getPlayer()))
return;
event.setCooldown((long) (event.getCooldown() * .666));
}
}

View File

@ -0,0 +1,37 @@
package nautilus.game.arcade.game.games.evolution.kits.perks;
import mineplex.core.common.util.F;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAttemptingTickEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.event.EventHandler;
public class PerkEvolveSpeedEVO extends Perk
{
/**
* @author Mysticate
*/
public PerkEvolveSpeedEVO()
{
super("Speedy", new String[]
{
"You evolve " + F.elem("25%") + " faster."
});
}
@EventHandler
public void onAbility(EvolutionAttemptingTickEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!Manager.IsAlive(event.getPlayer()))
return;
if (!Kit.HasKit(event.getPlayer()))
return;
event.setProgress((float) (event.getProgress() * 1.25));
}
}

View File

@ -17,6 +17,10 @@ import org.bukkit.entity.Player;
public class KitBlaze extends EvoKit
{
/**
* @author Mysticate
*/
public KitBlaze(ArcadeManager manager)
{
super(manager, "Blaze", new String[]

View File

@ -26,6 +26,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class KitChicken extends EvoKit
{
/**
* @author Mysticate
*/
public KitChicken(ArcadeManager manager)
{
super(manager, "Chicken", new String[]
@ -71,7 +75,7 @@ public class KitChicken extends EvoKit
if (!UtilGear.isMat(event.getItem(), Material.FEATHER))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer());
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer(), "Egg", 0);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())

View File

@ -15,6 +15,10 @@ import org.bukkit.entity.Player;
public class KitCreeper extends EvoKit
{
/**
* @author Mysticate
*/
public KitCreeper(ArcadeManager manager)
{
super(manager, "Creeper", new String[]

View File

@ -4,6 +4,10 @@ package nautilus.game.arcade.game.games.evolution.mobs;
public class KitEnderman
//extends EvoKit
{
/**
* @author Mysticate
*/
// public KitEnderman(ArcadeManager manager)
// {
// super(manager, "Enderman", new String[]{""}, 20, 10, new Perk[]{

View File

@ -16,6 +16,10 @@ import org.bukkit.entity.Player;
public class KitGolem extends EvoKit
{
/**
* @author Mysticate
*/
public KitGolem(ArcadeManager manager)
{
super(manager, "Iron Golem", new String[]

View File

@ -4,6 +4,10 @@ package nautilus.game.arcade.game.games.evolution.mobs;
public class KitSkeleton
//extends EvoKit
{
/**
* @author Mysticate
*/
// public KitSkeleton(ArcadeManager manager)
// {
// super(manager, "Skeletal Archer",

View File

@ -16,6 +16,10 @@ import org.bukkit.entity.Player;
public class KitSlime extends EvoKit
{
/**
* @author Mysticate
*/
public KitSlime(ArcadeManager manager)
{
super(manager, "Slime", new String[]

View File

@ -4,6 +4,10 @@ package nautilus.game.arcade.game.games.evolution.mobs;
public class KitSnowman
//extends EvoKit
{
/**
* @author Mysticate
*/
// public KitSnowman(ArcadeManager manager)
// {
// super(manager, "Snowman",

View File

@ -18,6 +18,10 @@ import org.bukkit.entity.Player;
public class KitSpider extends EvoKit
{
/**
* @author Mysticate
*/
public KitSpider(ArcadeManager manager)
{
super(manager, "Spider", new String[]

View File

@ -4,6 +4,10 @@ package nautilus.game.arcade.game.games.evolution.mobs;
public class KitWolf
//extends EvoKit
{
/**
* @author Mysticate
*/
// public KitWolf(ArcadeManager manager)
// {
// super(manager, "Wolf",

View File

@ -21,7 +21,6 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.data.BlockTossData;
import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent;
import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent;
import org.bukkit.Bukkit;
@ -74,7 +73,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 6000);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
@ -97,13 +96,9 @@ public class PerkBlockTossEVO extends Perk implements IThrown
return;
}
if (!Recharge.Instance.use(event.getPlayer(), GetName(), 6000, true, true))
if (!Recharge.Instance.use(event.getPlayer(), useEvent.getAbility(), useEvent.getCooldown(), true, true))
return;
//Event
PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData());
UtilServer.getServer().getPluginManager().callEvent(blockEvent);
//Block to Data
int id = grab.getTypeId();
byte data = grab.getData();

View File

@ -62,13 +62,13 @@ public class PerkBounceEVO extends Perk
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 7000);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), 7000, true, true))
if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true))
return;
UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.5, 1.6, true);

View File

@ -66,7 +66,7 @@ public class PerkDoubleJumpEVO extends Perk
if (player.getGameMode() == GameMode.CREATIVE)
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 0);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())

View File

@ -60,13 +60,13 @@ public class PerkFlamingSwordEVO extends Perk
if (_active.containsKey(event.getPlayer()))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer());
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer(), GetName(), 5000);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(event.getPlayer(), GetName(), 5000, true, true))
if (!Recharge.Instance.use(event.getPlayer(), useEvent.getAbility(), useEvent.getCooldown(), true, true))
return;
_active.put(event.getPlayer(), System.currentTimeMillis());
@ -104,7 +104,7 @@ public class PerkFlamingSwordEVO extends Perk
continue;
}
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(entry.getKey());
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(entry.getKey(), GetName(), 0);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())

View File

@ -62,13 +62,13 @@ public class PerkPounceEVO extends Perk
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 6000);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), 6000, true, true))
if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true))
return;
UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 1.8, false);

View File

@ -79,13 +79,13 @@ public class PerkSiesmicSlamEVO extends Perk
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 7000);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), 7000, true, true))
if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true))
return;
//Action

View File

@ -62,13 +62,13 @@ public class PerkSulphurBombEVO extends Perk implements IThrown
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 3000);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())
return;
if (!Recharge.Instance.use(player, GetName(), 3000, true, true))
if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true))
return;
event.setCancelled(true);

View File

@ -56,7 +56,7 @@ public class PerkWebEVO extends Perk implements IThrown
if (!Kit.HasKit(player))
return;
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 0);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
if (useEvent.isCancelled())

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.evolution.trackers;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class KillsWhileEvolvingTracker extends StatTracker<Evolution>
{
/**
* @author Mysticate
*/
public KillsWhileEvolvingTracker(Evolution game)
{
super(game);
}
@EventHandler
public void onDamage(CombatDeathEvent event)
{
if (!getGame().IsLive())
return;
Player damagee = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
Player damager = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (damagee == null || damager == null)
return;
if (!getGame().IsAlive(damagee) || !getGame().IsAlive(damager))
return;
if (getGame().isAttemptingEvolve(damagee))
addStat(damager, "EvolveKill", 1, false, false);
}
}

View File

@ -0,0 +1,61 @@
package nautilus.game.arcade.game.games.evolution.trackers;
import java.util.ArrayList;
import java.util.List;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class NoAbilityTracker extends StatTracker<Evolution>
{
/**
* @author Mysticate
*/
private ArrayList<String> _out = new ArrayList<String>();
public NoAbilityTracker(Evolution game)
{
super(game);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onEvolutionAbility(EvolutionAbilityUseEvent event)
{
if (!getGame().IsLive())
return;
if (!getGame().IsAlive(event.getPlayer()))
return;
if (!_out.contains(event.getPlayer().getName()))
_out.add(event.getPlayer().getName());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
List<Player> winners = getGame().getWinners();
if (winners == null)
return;
for (Player winner : winners)
{
if (_out.contains(winner.getName()))
continue;
addStat(winner, "MeleeOnly", 1, true, false);
}
}
}

View File

@ -0,0 +1,68 @@
package nautilus.game.arcade.game.games.evolution.trackers;
import java.util.ArrayList;
import java.util.List;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class NoDamageWhileEvolvingTracker extends StatTracker<Evolution>
{
/**
* @author Mysticate
*/
private ArrayList<String> _out = new ArrayList<String>();
public NoDamageWhileEvolvingTracker(Evolution game)
{
super(game);
}
@EventHandler
public void onDamage(CustomDamageEvent event)
{
if (!getGame().IsLive())
return;
Player player = event.GetDamageePlayer();
if (player == null)
return;
if (!getGame().IsAlive(player))
return;
if (getGame().isAttemptingEvolve(player))
{
if (!_out.contains(player.getName()))
_out.add(player.getName());
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
List<Player> winners = getGame().getWinners();
if (winners == null)
return;
for (Player winner : winners)
{
if (_out.contains(winner.getName()))
continue;
addStat(winner, "Stealth", 1, true, false);
}
}
}

View File

@ -0,0 +1,68 @@
package nautilus.game.arcade.game.games.evolution.trackers;
import java.util.ArrayList;
import java.util.List;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class NoMeleeTracker extends StatTracker<Evolution>
{
/**
* @author Mysticate
*/
private ArrayList<String> _out = new ArrayList<String>();
public NoMeleeTracker(Evolution game)
{
super(game);
}
@EventHandler
public void onDamage(CustomDamageEvent event)
{
if (!getGame().IsLive())
return;
Player player = event.GetDamagerPlayer(false);
if (player == null)
return;
if (!getGame().IsAlive(player))
return;
if (event.GetReason().equalsIgnoreCase("Attack"))
{
if (!_out.contains(player.getName()))
_out.add(player.getName());
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
List<Player> winners = getGame().getWinners();
if (winners == null)
return;
for (Player winner : winners)
{
if (_out.contains(winner.getName()))
continue;
addStat(winner, "AbilityOnly", 1, true, false);
}
}
}