New kit and achievement for Bacon Brawl

This commit is contained in:
Sam 2018-04-30 14:48:18 +01:00 committed by Alexander Meech
parent bd1d543344
commit 24ed1f0dd5
6 changed files with 185 additions and 11 deletions

View File

@ -853,6 +853,12 @@ public enum Achievement
new int[]{50}, new int[]{50},
AchievementCategory.BACON_BRAWL), AchievementCategory.BACON_BRAWL),
BACON_BRAWL_KILLS_IN_GAME("Pigs In Blankets", 800,
new String[]{"Bacon Brawl.KillsInGame"},
new String[]{"Kill 6 players in one game."},
new int[]{1},
AchievementCategory.BACON_BRAWL),
//Sneaky Assassins //Sneaky Assassins
SNEAKY_ASSASSINS_WINS("So So Sneaky", 600, SNEAKY_ASSASSINS_WINS("So So Sneaky", 600,
new String[]{"Sneaky Assassins.Wins"}, new String[]{"Sneaky Assassins.Wins"},

View File

@ -200,9 +200,17 @@ public enum AchievementCategory
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit", false, GameDisplay.Snake.getGameId()), Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit", false, GameDisplay.Snake.getGameId()),
BACON_BRAWL("Bacon Brawl", null, BACON_BRAWL(
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, "Bacon Brawl",
Material.PORK, 0, GameCategory.ARCADE, null, false, GameDisplay.BaconBrawl.getGameId()), null,
new StatDisplay[]
{
StatDisplay.WINS,
StatDisplay.GAMES_PLAYED,
StatDisplay.KILLS,
StatDisplay.DEATHS,
StatDisplay.GEMS_EARNED
}, Material.PORK, 0, GameCategory.ARCADE, "Chris P Bacon", false, GameDisplay.BaconBrawl.getGameId()),
MICRO_BATTLE("Micro Battle", null, MICRO_BATTLE("Micro Battle", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },

View File

@ -174,6 +174,34 @@ public enum GameKit
} }
}, },
BACON_BRAWL_CHRIS_P_BACON
(
3,
GameDisplay.BaconBrawl,
"Chris P Bacon",
null,
new String[]
{
"Guess he burnt the bacon",
C.blankLine,
click(false, "Axe to launch " + C.cGreen + "Crispy Bacon"),
"Players on fire take " + C.cGreen + "+30%" + C.cGray + "knockback."
},
new KitEntityData<>
(
Pig.class,
new ItemStack(Material.GRILLED_PORK)
),
getAchievementsFor(AchievementCategory.BACON_BRAWL)
)
{
@Override
protected void onEntitySpawn(LivingEntity entity)
{
entity.setFireTicks(Integer.MAX_VALUE);
}
},
// Barbarians // Barbarians
BARBARIANS_BRUTE BARBARIANS_BRUTE

View File

@ -4,9 +4,9 @@ import java.util.concurrent.TimeUnit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -21,11 +21,13 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.baconbrawl.kits.KitChrisPBacon;
import nautilus.game.arcade.game.games.baconbrawl.kits.KitMamaPig; import nautilus.game.arcade.game.games.baconbrawl.kits.KitMamaPig;
import nautilus.game.arcade.game.games.baconbrawl.kits.KitPig; import nautilus.game.arcade.game.games.baconbrawl.kits.KitPig;
import nautilus.game.arcade.game.games.baconbrawl.kits.KitSheepPig; import nautilus.game.arcade.game.games.baconbrawl.kits.KitSheepPig;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillsWithinGameStatTracker;
public class BaconBrawl extends SoloGame public class BaconBrawl extends SoloGame
{ {
@ -46,7 +48,8 @@ public class BaconBrawl extends SoloGame
{ {
new KitPig(manager), new KitPig(manager),
new KitMamaPig(manager), new KitMamaPig(manager),
new KitSheepPig(manager) new KitSheepPig(manager),
new KitChrisPBacon(manager)
}, DESCRIPTION); }, DESCRIPTION);
DamageTeamSelf = true; DamageTeamSelf = true;
@ -64,6 +67,10 @@ public class BaconBrawl extends SoloGame
DamageTaken DamageTaken
); );
registerStatTrackers(
new KillsWithinGameStatTracker(this, 6, "KillsInGame")
);
new CompassModule() new CompassModule()
.register(this); .register(this);
} }
@ -124,21 +131,23 @@ public class BaconBrawl extends SoloGame
} }
} }
@EventHandler @EventHandler(priority = EventPriority.HIGH)
public void knockback(CustomDamageEvent event) public void knockback(CustomDamageEvent event)
{ {
if (!IsLive()) if (!IsLive() || event.GetDamageePlayer() == null)
{ {
return; return;
} }
DamageCause cause = event.GetCause(); DamageCause cause = event.GetCause();
if (cause == DamageCause.ENTITY_ATTACK || cause == DamageCause.CUSTOM || cause == DamageCause.PROJECTILE) if (cause == DamageCause.FIRE_TICK)
{ {
LivingEntity entity = event.GetDamageeEntity(); event.SetCancelled("Fire Damage");
}
entity.setHealth(entity.getMaxHealth()); else if (cause == DamageCause.ENTITY_ATTACK || cause == DamageCause.CUSTOM || cause == DamageCause.PROJECTILE)
{
UtilPlayer.health(event.GetDamageePlayer(), event.GetDamage());
event.AddKnockback("Pig Wrestle", _knockbackMagnitude); event.AddKnockback("Pig Wrestle", _knockbackMagnitude);
} }
} }

View File

@ -0,0 +1,39 @@
package nautilus.game.arcade.game.games.baconbrawl.kits;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.game.kit.GameKit;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.baconbrawl.kits.perks.PerkCrispyBacon;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
public class KitChrisPBacon extends Kit
{
private static final Perk[] PERKS =
{
new PerkCrispyBacon()
};
public KitChrisPBacon(ArcadeManager manager)
{
super(manager, GameKit.BACON_BRAWL_CHRIS_P_BACON, PERKS);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
DisguisePig disguise = new DisguisePig(player);
disguise.setName(C.cYellow + player.getName());
disguise.setCustomNameVisible(false);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -0,0 +1,84 @@
package nautilus.game.arcade.game.games.baconbrawl.kits.perks;
import java.util.concurrent.TimeUnit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkCrispyBacon extends Perk
{
private static final long COOLDOWN = TimeUnit.SECONDS.toMillis(5);
public PerkCrispyBacon()
{
super("Crispy Bacon");
}
@EventHandler
public void playerInteract(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
{
return;
}
Player player = event.getPlayer();
ItemStack itemStack = player.getItemInHand();
if (!UtilItem.isAxe(itemStack) || !Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
Location location = player.getLocation().add(0, 1.5, 0);
location.getWorld().playSound(location, Sound.EXPLODE, 1, 0.2F);
UtilParticle.PlayParticleToAll(ParticleType.LAVA, location, 0.5F, 0.5F, 0.5F, 0, 4, ViewDist.NORMAL);
for (int i = 0; i < 3; i++)
{
Item item = player.getWorld().dropItem(location, new ItemBuilder(Material.GRILLED_PORK)
.setTitle(String.valueOf(UtilMath.r(1000)))
.build());
item.setVelocity(new Vector((Math.random() - 0.5) * 0.3, 0.4, (Math.random() - 0.5) * 0.3));
Manager.GetFire().Add(item, player, 10, 1, 5, 2, GetName(), false);
}
}
@EventHandler
public void knockbackIncrease(CustomDamageEvent event)
{
Player damgee = event.GetDamageePlayer();
Player damager = event.GetDamagerPlayer(true);
if (damgee == null || damager == null)
{
return;
}
if (hasPerk(damager) && damgee.getFireTicks() > 0)
{
event.AddKnockback(GetName(), 1.3);
}
}
}