Implement building champion, remove quick climber and enhance chicken attack
Building Champion achievement was implemented as a replacement for quick climber achievement, since quick climber is almost impossible to complete in public games. Build Champion is based on Build Race challenge, and it requires players to place all blocks in their inventory, within 15 seconds. Moreover, chicken minions can now attack players, even if they are stuck in the water.
This commit is contained in:
parent
76f161f9ed
commit
e77bee5cd8
@ -763,9 +763,15 @@ public enum Achievement
|
||||
new int[] {5},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_QUICK_CLIMBER("Quick Climber", 500,
|
||||
new String[]{"Bawk Bawk Battles.QuickClimber"},
|
||||
new String[]{C.cGray + "King of the Ladder Challenge", "Climb the ladder without", "getting knocked off by others"},
|
||||
// BAWK_BAWK_BATTLES_QUICK_CLIMBER("Quick Climber", 500,
|
||||
// new String[]{"Bawk Bawk Battles.QuickClimber"},
|
||||
// new String[]{C.cGray + "King of the Ladder Challenge", "Climb the ladder without", "getting knocked off by others"},
|
||||
// new int[] {3},
|
||||
// AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_BUILDING_CHAMPION("Building Champion", 500,
|
||||
new String[]{"Bawk Bawk Battles.BuildingChampion"},
|
||||
new String[]{C.cGray + "Build Race Challenge", "Place all blocks in your", "inventory within 15 seconds"},
|
||||
new int[] {3},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
|
@ -119,12 +119,12 @@ import nautilus.game.arcade.game.games.mineware.effect.DeathEffectData;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.kit.KitBawksFood;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.BouncingShadowTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.BuildingChampionTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.DragonKingTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.EliteArcherTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.MilkManTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.PinataMasterTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.PixelNinjaTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.QuickClimberTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.SurfUpTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.TagMasterTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.tracker.VeteranTracker;
|
||||
@ -189,7 +189,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
/*
|
||||
* Changes
|
||||
* - Refactoring
|
||||
* - Improve Zombie Infection
|
||||
* - Improve Scoreboard
|
||||
*
|
||||
* Bugs
|
||||
@ -198,13 +197,10 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
* - Some players spawn into the void on Lava Run
|
||||
* - // Zombie Infection can disguise spectators as Zombies
|
||||
* - // Egg smash dragon eggs stay on the map
|
||||
* - Chicken Attack chickens are getting stuck in water
|
||||
* - // "Next challenge will begin shortly" message also displays on players in chicken island
|
||||
* - 918 null pointer exception
|
||||
* - Array index out of bounds during challenge rotation
|
||||
* - Achievement for not getting hit in king of the ladder is impossible in public games
|
||||
* - Players sometimes gain a life when dying (not confirmed)
|
||||
* - Block lobbers needs a slightly bigger platform
|
||||
* - // Spectators being teleported over and over to the same location in certain games (no knockback aura around the game area)
|
||||
* - No suitable challenge was found ends the game, does not give exp
|
||||
* - Chicken platform needs water reducing (add lilipads?)
|
||||
@ -265,12 +261,12 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
registerStatTrackers(
|
||||
new BouncingShadowTracker(this),
|
||||
new BuildingChampionTracker(this),
|
||||
new DragonKingTracker(this),
|
||||
new EliteArcherTracker(this),
|
||||
new MilkManTracker(this),
|
||||
new PinataMasterTracker(this),
|
||||
new PixelNinjaTracker(this),
|
||||
new QuickClimberTracker(this),
|
||||
new SurfUpTracker(this),
|
||||
new TagMasterTracker(this),
|
||||
new VeteranTracker(this));
|
||||
@ -1098,24 +1094,16 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
for (Player player : _chickenTeam.GetPlayers(true))
|
||||
{
|
||||
Chicken chicken = UtilMath.randomElement(_chickenAttack.getChickens());
|
||||
Material feetType = chicken.getLocation().getBlock().getType();
|
||||
|
||||
if (!chicken.isOnGround())
|
||||
if (!chicken.isOnGround() && feetType != Material.STATIONARY_WATER && feetType != Material.WATER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilEnt.CreatureLook(chicken, player);
|
||||
|
||||
UtilAction.velocity(chicken, UtilAlg.getTrajectory(chicken, player).multiply(1.5D).setY(0.3D));
|
||||
|
||||
Manager.GetProjectile().AddThrow(
|
||||
chicken,
|
||||
null,
|
||||
this,
|
||||
-1,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
0.8F);
|
||||
Manager.GetProjectile().AddThrow(chicken, null, this, -1, true, false, false, true, 0.8F);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1130,9 +1118,10 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
for (Chicken chicken : _chickenAttack.getChickens())
|
||||
{
|
||||
Block below = chicken.getLocation().getBlock().getRelative(BlockFace.DOWN); // Detect when falling into the void.
|
||||
Material feetType = chicken.getLocation().getBlock().getType();
|
||||
Block below = chicken.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||
|
||||
if (!chicken.isOnGround() && !below.isEmpty())
|
||||
if (!chicken.isOnGround() && feetType != Material.STATIONARY_WATER && feetType != Material.WATER && !below.isEmpty())
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FLAME, chicken.getLocation(), 0.1F, 0.1F, 0.1F, 0.02F, 1, ViewDist.NORMAL);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.mineware.challenge.type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
@ -12,6 +13,7 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -24,12 +26,15 @@ import mineplex.core.common.util.UtilTextMiddle;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.LogicTracker;
|
||||
|
||||
/**
|
||||
* A challenge based on fast block placement.
|
||||
*/
|
||||
public class ChallengeBuildRace extends Challenge
|
||||
public class ChallengeBuildRace extends Challenge implements LogicTracker
|
||||
{
|
||||
private List<Player> _speedTracker = new ArrayList<>();
|
||||
|
||||
// The amount of blocks for every hotbar slot.
|
||||
private int _inventoryBlockAmount = 5;
|
||||
|
||||
@ -92,7 +97,7 @@ public class ChallengeBuildRace extends Challenge
|
||||
Host.BlockPlaceAllow.add(allowed.getId());
|
||||
}
|
||||
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
for (Player player : getPlayersAlive())
|
||||
{
|
||||
setupInventoryContents(player);
|
||||
}
|
||||
@ -177,11 +182,32 @@ public class ChallengeBuildRace extends Challenge
|
||||
{
|
||||
if (items.get(0).getAmount() == 1)
|
||||
{
|
||||
trackSpeed(player);
|
||||
setCompleted(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
_speedTracker.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
private void trackSpeed(Player player)
|
||||
{
|
||||
long startTime = Settings.getStartTime();
|
||||
long finishTime = System.currentTimeMillis();
|
||||
|
||||
if (finishTime <= startTime + 15000)
|
||||
{
|
||||
_speedTracker.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupInventoryContents(Player player)
|
||||
{
|
||||
ArrayList<Material> shuffledMaterials = new ArrayList<Material>(Arrays.asList(_materials));
|
||||
@ -201,4 +227,10 @@ public class ChallengeBuildRace extends Challenge
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData(Player player)
|
||||
{
|
||||
return _speedTracker.contains(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenge.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
@ -12,7 +11,6 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -25,14 +23,12 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.ChallengeType;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.LogicTracker;
|
||||
|
||||
/**
|
||||
* A challenge based on climbling ladders.
|
||||
*/
|
||||
public class ChallengeKingOfTheLadder extends Challenge implements LogicTracker
|
||||
public class ChallengeKingOfTheLadder extends Challenge
|
||||
{
|
||||
private List<Player> _hitTracker = new ArrayList<>();
|
||||
private Location _winCornerA;
|
||||
private Location _winCornerB;
|
||||
|
||||
@ -211,13 +207,6 @@ public class ChallengeKingOfTheLadder extends Challenge implements LogicTracker
|
||||
{
|
||||
event.SetCancelled("Fall damage");
|
||||
}
|
||||
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
|
||||
if (!_hitTracker.contains(damagee))
|
||||
{
|
||||
_hitTracker.add(damagee);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -231,19 +220,4 @@ public class ChallengeKingOfTheLadder extends Challenge implements LogicTracker
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!isChallengeValid())
|
||||
return;
|
||||
|
||||
_hitTracker.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData(Player player)
|
||||
{
|
||||
return !_hitTracker.contains(player);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package nautilus.game.arcade.game.games.mineware.tracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeBuildRace;
|
||||
|
||||
/**
|
||||
* A tracker for the Building Champion achievement.
|
||||
* <br>
|
||||
* <br>
|
||||
* <b>Challenge:</b> Build Race
|
||||
* <br>
|
||||
* <b>Goal:</b> Place all blocks in your inventory within 15 seconds
|
||||
*/
|
||||
public class BuildingChampionTracker extends ChallengeStatTracker
|
||||
{
|
||||
public BuildingChampionTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void track(Challenge challenge)
|
||||
{
|
||||
if (challenge instanceof ChallengeBuildRace)
|
||||
{
|
||||
ChallengeBuildRace buildRace = (ChallengeBuildRace) challenge;
|
||||
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
{
|
||||
if (buildRace.hasData(player) && buildRace.getData().isDone(player))
|
||||
{
|
||||
System.out.println("Building Champion: " + player.getName());
|
||||
addStat(player, "BuildingChampion", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware.tracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenge.type.ChallengeKingOfTheLadder;
|
||||
|
||||
/**
|
||||
* A tracker for the Quick Climber achievement.
|
||||
* <br>
|
||||
* <br>
|
||||
* <b>Challenge:</b> King of the Ladder
|
||||
* <br>
|
||||
* <b>Goal:</b> Climb the ladder without getting knocked off by others
|
||||
*/
|
||||
public class QuickClimberTracker extends ChallengeStatTracker
|
||||
{
|
||||
public QuickClimberTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void track(Challenge challenge)
|
||||
{
|
||||
if (challenge instanceof ChallengeKingOfTheLadder)
|
||||
{
|
||||
ChallengeKingOfTheLadder kotl = (ChallengeKingOfTheLadder) challenge;
|
||||
|
||||
for (Player player : getGame().GetPlayers(true))
|
||||
{
|
||||
if (kotl.hasData(player) && kotl.getData().isDone(player))
|
||||
{
|
||||
System.out.println("Quick Climber: " + player.getName());
|
||||
addStat(player, "QuickClimber", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user