Apply chicken attack and completion improvements
- Chicken spectators will no longer receive the compass to prevent them from teleporting near players. - The winner of the game will not see the "You have completed the challenge." message as the game will end afterwards.
This commit is contained in:
parent
5a7e7c7623
commit
416b978c4f
@ -99,7 +99,7 @@ public class CompassAddon extends MiniPlugin
|
|||||||
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (Manager.GetGame().CompassGiveItem || Manager.isSpectator(player))
|
if (Manager.GetGame().CompassGiveItem || (Manager.GetGame().CompassGiveItemSpectators && Manager.isSpectator(player)))
|
||||||
if (!player.getInventory().contains(Material.COMPASS))
|
if (!player.getInventory().contains(Material.COMPASS))
|
||||||
{
|
{
|
||||||
if (player.getOpenInventory() == null || player.getOpenInventory().getCursor() == null || player.getOpenInventory().getCursor().getType() != Material.COMPASS)
|
if (player.getOpenInventory() == null || player.getOpenInventory().getCursor() == null || player.getOpenInventory().getCursor().getType() != Material.COMPASS)
|
||||||
|
@ -240,6 +240,7 @@ public abstract class Game implements Listener
|
|||||||
// Addons
|
// Addons
|
||||||
public boolean CompassEnabled = false;
|
public boolean CompassEnabled = false;
|
||||||
public boolean CompassGiveItem = true;
|
public boolean CompassGiveItem = true;
|
||||||
|
public boolean CompassGiveItemSpectators = true;
|
||||||
|
|
||||||
public boolean SoupEnabled = true;
|
public boolean SoupEnabled = true;
|
||||||
public boolean TeamArmor = false;
|
public boolean TeamArmor = false;
|
||||||
|
@ -261,6 +261,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
// TODO: Temporary
|
// TODO: Temporary
|
||||||
CompassEnabled = false;
|
CompassEnabled = false;
|
||||||
CompassGiveItem = false;
|
CompassGiveItem = false;
|
||||||
|
CompassGiveItemSpectators = false;
|
||||||
|
|
||||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||||
|
|
||||||
@ -956,7 +957,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
|||||||
int lost = _challenge.getData().getLostPlayers().size();
|
int lost = _challenge.getData().getLostPlayers().size();
|
||||||
int current = getPlayersAlive().size();
|
int current = getPlayersAlive().size();
|
||||||
|
|
||||||
return !_settings.isCrumbling() && lost > current / CRUMBLE_DIVIDER && lost != current;
|
return !_settings.isCrumbling() && lost > current / CRUMBLE_DIVIDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void announceCrumbling()
|
private void announceCrumbling()
|
||||||
|
@ -89,7 +89,7 @@ public abstract class Challenge implements Listener
|
|||||||
private static final double BLOCK_CENTER_ADD = 0.5;
|
private static final double BLOCK_CENTER_ADD = 0.5;
|
||||||
private static final int CRUMBLE_CHANCE = 4;
|
private static final int CRUMBLE_CHANCE = 4;
|
||||||
|
|
||||||
private static final int PLAYER_COUNT_FOR_EFFECTS = 2;
|
private static final int PLAYER_COUNT_FOR_GAME_END = 1;
|
||||||
private static final int COMPLETION_TITLE_STAY_TICKS = 30;
|
private static final int COMPLETION_TITLE_STAY_TICKS = 30;
|
||||||
private static final float COMPLETION_SOUND_VOLUME = 2.0F;
|
private static final float COMPLETION_SOUND_VOLUME = 2.0F;
|
||||||
private static final float COMPLETION_SOUND_PITCH = 1.0F;
|
private static final float COMPLETION_SOUND_PITCH = 1.0F;
|
||||||
@ -385,7 +385,7 @@ public abstract class Challenge implements Listener
|
|||||||
{
|
{
|
||||||
if (Data.isCompleted(player))
|
if (Data.isCompleted(player))
|
||||||
{
|
{
|
||||||
Host.AddGems(player, COMPLETION_GEMS, "Completed Challenge", true, true);
|
Host.AddGems(player, COMPLETION_GEMS, "Completed Challenges", true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ public abstract class Challenge implements Listener
|
|||||||
if (Data.isDone(player))
|
if (Data.isDone(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Host.getPlayersWithRemainingLives() >= PLAYER_COUNT_FOR_EFFECTS) // Check if the game is not about to end.
|
if (shouldShowEffects()) // Check if the game is not about to end.
|
||||||
{
|
{
|
||||||
if (cloak)
|
if (cloak)
|
||||||
{
|
{
|
||||||
@ -501,6 +501,25 @@ public abstract class Challenge implements Listener
|
|||||||
UtilInv.Clear(player);
|
UtilInv.Clear(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean shouldShowEffects()
|
||||||
|
{
|
||||||
|
if (Host.getPlayersWithRemainingLives() == PLAYER_COUNT_FOR_GAME_END)
|
||||||
|
{
|
||||||
|
int playerOneLives = Host.lives(getPlayersAlive().get(0));
|
||||||
|
int playerTwoLives = Host.lives(getPlayersAlive().get(1));
|
||||||
|
|
||||||
|
boolean playerOneCompleted = Data.isDone(getPlayersAlive().get(0));
|
||||||
|
boolean playerTwoCompleted = Data.isDone(getPlayersAlive().get(1));
|
||||||
|
|
||||||
|
if (!playerOneCompleted && !playerTwoCompleted && (playerOneLives == 1 || playerTwoLives == 2))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected void setCompleted(Player player)
|
protected void setCompleted(Player player)
|
||||||
{
|
{
|
||||||
setCompleted(player, false);
|
setCompleted(player, false);
|
||||||
@ -514,8 +533,6 @@ public abstract class Challenge implements Listener
|
|||||||
Data.addLostPlayer(player);
|
Data.addLostPlayer(player);
|
||||||
loseLife(player);
|
loseLife(player);
|
||||||
|
|
||||||
if (Host.getPlayersWithRemainingLives() >= PLAYER_COUNT_FOR_EFFECTS) // Check if the game is not about to end.
|
|
||||||
{
|
|
||||||
if (cloak)
|
if (cloak)
|
||||||
{
|
{
|
||||||
cloak(player, false);
|
cloak(player, false);
|
||||||
@ -524,7 +541,6 @@ public abstract class Challenge implements Listener
|
|||||||
UtilPlayer.message(player, F.main("Game", C.cRed + "You failed to complete the task."));
|
UtilPlayer.message(player, F.main("Game", C.cRed + "You failed to complete the task."));
|
||||||
Host.showLivesLeft(player);
|
Host.showLivesLeft(player);
|
||||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, LOST_SOUND_VOLUME, LOST_SOUND_PITCH);
|
player.playSound(player.getLocation(), Sound.NOTE_BASS, LOST_SOUND_VOLUME, LOST_SOUND_PITCH);
|
||||||
}
|
|
||||||
|
|
||||||
Host.Manager.GetDisguise().undisguise(player);
|
Host.Manager.GetDisguise().undisguise(player);
|
||||||
UtilPlayer.clearPotionEffects(player);
|
UtilPlayer.clearPotionEffects(player);
|
||||||
|
@ -87,13 +87,8 @@ public class ChallengeData
|
|||||||
|
|
||||||
public void removePlayer(Player player)
|
public void removePlayer(Player player)
|
||||||
{
|
{
|
||||||
if (_lost.contains(player))
|
|
||||||
_lost.remove(player);
|
_lost.remove(player);
|
||||||
|
|
||||||
if (_completed.contains(player))
|
|
||||||
_completed.remove(player);
|
_completed.remove(player);
|
||||||
|
|
||||||
if (_invisible.contains(player))
|
|
||||||
_invisible.remove(player);
|
_invisible.remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class ChallengeTreasureDigger extends Challenge
|
|||||||
"Find weapons to kill the others!");
|
"Find weapons to kill the others!");
|
||||||
|
|
||||||
Settings.setUseMapHeight();
|
Settings.setUseMapHeight();
|
||||||
//Settings.setMinPlayers(CHALLENGE_PLAYERS_MIN);
|
Settings.setMinPlayers(CHALLENGE_PLAYERS_MIN);
|
||||||
|
|
||||||
_lootChance.put(Material.BONE, 0.2);
|
_lootChance.put(Material.BONE, 0.2);
|
||||||
_lootChance.put(Material.STRING, 0.2);
|
_lootChance.put(Material.STRING, 0.2);
|
||||||
|
Loading…
Reference in New Issue
Block a user