Challenge bug fixes and improvements

- Added crumble feature to Block Lobbers
- Increased TNT height on Water Horror
- Increased Lava Run difficulty
- Fixed unclickable Bawk's Food Kit
- Fixed chickens not attacking properly on chicken attack
- Fixed dominant team not winning on team based challenges
- Fixed spectators being able to break blocks on Treasure Digger
This commit is contained in:
Thanos Paravantis 2016-07-10 13:32:24 +03:00
parent a9f41ab269
commit 5a7e7c7623
12 changed files with 132 additions and 72 deletions

View File

@ -176,8 +176,8 @@ public class BawkBawkBattles extends TeamGame implements IThrown
private static final float CHICKEN_ATTACK_SOUND_VOLUME = 1.0F;
private static final float CHICKEN_ATTACK_SOUND_PITCH = 1.3F;
private static final double CHICKEN_VELOCITY_HEIGHT = 0.4;
private static final double CHICKEN_VELOCITY_ADD = 0.4;
private static final double CHICKEN_VELOCITY_HEIGHT_MAX = 1.5;
private static final double CHICKEN_VELOCITY_ADD = 0.6;
private static final float CHICKEN_ATTACK_HITBOX_GROW = 0.8F;
private static final float CHICKEN_ATTACK_PARTICLE_OFFSET = 0.1F;
private static final float CHICKEN_ATTACK_PARTICLE_SPEED = 0.02F;
@ -1038,8 +1038,17 @@ public class BawkBawkBattles extends TeamGame implements IThrown
{
UtilEnt.CreatureLook(chicken, player);
player.playSound(chicken.getLocation(), Sound.BAT_TAKEOFF, CHICKEN_ATTACK_SOUND_VOLUME, CHICKEN_ATTACK_SOUND_PITCH);
UtilAction.velocity(chicken, UtilAlg.getTrajectory2d(chicken, player), UtilAlg.calculateVelocity(chicken.getLocation().toVector(), player.getLocation().toVector(), CHICKEN_VELOCITY_HEIGHT).length() + CHICKEN_VELOCITY_ADD, false, 0, 0, CHICKEN_VELOCITY_HEIGHT_MAX, false);
Manager.GetProjectile().AddThrow(chicken, null, this, -1, true, false, false, true, 0.8F);
UtilAction.velocity(
chicken,
UtilAlg.getTrajectory2d(chicken, player),
UtilAlg.calculateVelocity(chicken.getLocation().toVector(), player.getLocation().toVector(), CHICKEN_VELOCITY_HEIGHT).length() + CHICKEN_VELOCITY_ADD,
false,
0,
CHICKEN_VELOCITY_HEIGHT,
CHICKEN_VELOCITY_HEIGHT + 1,
false);
Manager.GetProjectile().AddThrow(chicken, null, this, -1, true, false, false, true, CHICKEN_ATTACK_HITBOX_GROW);
}
}
}

View File

@ -102,12 +102,14 @@ public abstract class Challenge implements Listener
private static final int BLOCK_BREAK_PARTICLE_COUNT = 10;
private static final int GRASS_SPAWN_CHANCE = 4;
private static final int FLOWER_SPAWN_CHANCE = 8;
private static final int FLOWER_DATA_RANGE = 7;
private static final int DOUBLE_PLANT_CHANCE = 3;
private static final int DOUBLE_PLANT_DATA_RANGE = 5;
private static final byte DOUBLE_PLANT_PART_DATA = 8;
private static final int DISPLAY_COUNT_EXPIRE_AFTER = 1000;
private static final double DISPLAY_COUNT_ELEVATION_RATE = 0.05;
private static final int DEFAULT_ARENA_SIZE = 8;
private static final int ARENA_SIZE_DIVIDER = 2;
@ -168,11 +170,6 @@ public abstract class Challenge implements Listener
{
}
protected boolean shouldDie(Player player)
{
return true;
}
public void spawn(boolean firstRun)
{
if (firstRun)
@ -313,14 +310,11 @@ public abstract class Challenge implements Listener
Player player = event.getEntity();
if (shouldDie(player))
{
Location death = player.getLocation().clone();
Data.addLostPlayer(player);
Location death = player.getLocation().clone();
Data.addLostPlayer(player);
Host.getDeathEffect().playDeath(player, death);
handleDeath(player);
}
Host.getDeathEffect().playDeath(player, death);
handleDeath(player);
}
private void handleDeath(Player player)
@ -497,7 +491,7 @@ public abstract class Challenge implements Listener
FireworkEffect.builder().with(Type.BALL_LARGE).withColor(Color.GREEN).build(),
player);
alert(player, "You have completed the challenge!", COMPLETION_TITLE_STAY_TICKS);
alert(player, C.cGreen + "You have completed the challenge!", COMPLETION_TITLE_STAY_TICKS);
player.playSound(player.getLocation(), Sound.LEVEL_UP, COMPLETION_SOUND_VOLUME, COMPLETION_SOUND_PITCH);
}
@ -701,8 +695,6 @@ public abstract class Challenge implements Listener
return block;
}
private static final int FLOWER_DATA_RANGE = 7;
private void makeFlower(Block block)
{
Material flower = Material.YELLOW_FLOWER;
@ -797,7 +789,7 @@ public abstract class Challenge implements Listener
private void elevateHologram(Hologram hologram)
{
hologram.setLocation(hologram.getLocation().add(0, 1, 0));
hologram.setLocation(hologram.getLocation().add(0, DISPLAY_COUNT_ELEVATION_RATE, 0));
}
public boolean isInsideMap(Player player)

View File

@ -202,6 +202,54 @@ public abstract class TeamChallenge extends Challenge
super.end();
}
@Override
public boolean canFinish()
{
int firstTeamAlive = 0;
for (Player firstTeamPlayer : _firstTeam.getPlayers())
{
if (isPlayerValid(firstTeamPlayer))
{
firstTeamAlive++;
}
}
int secondTeamAlive = 0;
for (Player secondTeamPlayer : _secondTeam.getPlayers())
{
if (isPlayerValid(secondTeamPlayer))
{
secondTeamAlive++;
}
}
boolean firstTeamDominant = firstTeamAlive > 0 && secondTeamAlive == 0;
boolean secondTeamDominant = secondTeamAlive > 0 && firstTeamAlive == 0;
if (firstTeamDominant)
{
for (Player firstTeamPlayer : _firstTeam.getPlayers())
{
setCompleted(firstTeamPlayer);
}
return true;
}
else if (secondTeamDominant)
{
for (Player secondTeamPlayer : _secondTeam.getPlayers())
{
setCompleted(secondTeamPlayer);
}
return true;
}
return super.canFinish();
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{

View File

@ -68,6 +68,7 @@ public class ChallengeBlockLobbers extends Challenge
"Try to knock them off the platform!");
Settings.setUseMapHeight();
Settings.setCanCruble();
}
@Override

View File

@ -38,8 +38,8 @@ public class ChallengeLavaRun extends Challenge
private static final int DISSAPEARING_BLOCKS = 10;
private static final int OBSIDIAN_LARGE_DISTANCE = 4; // blocks
private static final int DELAY_BOOST = 500; // milliseconds
private static final int DELAY_SUBTRACT = 100; // milliseconds
private static final int DELAY_BOOST = 300; // milliseconds
private static final int DELAY_SUBTRACT = 200; // milliseconds
private static final int DELAY_AFTER_DESTURCTION = 1500; // milliseconds
private static final float DESTRUCTION_SOUND_VOLUME = 2.0F;
@ -143,7 +143,7 @@ public class ChallengeLavaRun extends Challenge
_modifiedDelay += DELAY_BOOST;
}
if (_modifiedDelayMin > 0)
if (_modifiedDelayMin - DELAY_SUBTRACT > 0)
{
_modifiedDelayMin -= DELAY_SUBTRACT;
_modifiedDelay += _modifiedDelayMin;

View File

@ -52,7 +52,7 @@ public class ChallengeMilkACow extends Challenge implements NumberTracker
private static final float MILK_DELIVERY_SOUND_PITCH = 0.0F;
private static final int SCORE_DISPLAY_HEIGHT_ADD = 2;
private static final int MILKED_HOLOGRAM_HEIGHT_ADD = 2;
private static final double MILKED_HOLOGRAM_HEIGHT_ADD = 2.3;
private static final String[] HUMAN_NAMES = new String[] {
"Tom",

View File

@ -19,6 +19,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
@ -92,7 +93,7 @@ public class ChallengeRedLightGreenLight extends Challenge
Settings.setUseMapHeight();
}
@Override
public ArrayList<Location> createSpawns()
{
@ -233,6 +234,9 @@ public class ChallengeRedLightGreenLight extends Challenge
UtilEnt.CreatureLook(_villager, Host.GetSpectatorLocation());
UtilEnt.ghost(_villager, true, false);
_villager.setCustomName(C.cGreenB + "Finish Line");
_villager.setCustomNameVisible(true);
Host.CreatureAllow = false;
}

View File

@ -65,7 +65,7 @@ public class ChallengeTreasureDigger extends Challenge
"Find weapons to kill the others!");
Settings.setUseMapHeight();
Settings.setMinPlayers(CHALLENGE_PLAYERS_MIN);
//Settings.setMinPlayers(CHALLENGE_PLAYERS_MIN);
_lootChance.put(Material.BONE, 0.2);
_lootChance.put(Material.STRING, 0.2);
@ -240,7 +240,7 @@ public class ChallengeTreasureDigger extends Challenge
if (!isChallengeValid())
return;
if (!Data.isModifiedBlock(event.getBlock()))
if (!isPlayerValid(event.getPlayer()) || !Data.isModifiedBlock(event.getBlock()))
{
event.setCancelled(true);
}

View File

@ -70,7 +70,7 @@ public class ChallengeWaterHorror extends Challenge
private static final int TNT_SPAWN_INTERVAL = 2; // seconds
private static final double TNT_VELOCITY_POWER_MIN = 0.2;
private static final double TNT_VELOCITY_HEIGHT = 1.3;
private static final double TNT_VELOCITY_HEIGHT = 0.4;
private Map<Player, Boat> _boats = new HashMap<>();
private Location _dropsite;
@ -392,7 +392,7 @@ public class ChallengeWaterHorror extends Challenge
UtilAlg.calculateVelocity(dropsite.toVector(), target.toVector(), TNT_VELOCITY_HEIGHT).length() + TNT_VELOCITY_POWER_MIN,
true,
0,
0,
TNT_VELOCITY_HEIGHT,
TNT_VELOCITY_HEIGHT + 1,
false);
}

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@ -26,6 +27,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseZombie;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
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;
@ -37,19 +39,10 @@ import nautilus.game.arcade.game.games.mineware.challenge.other.ZombieWrapper;
public class ChallengeZombieInfection extends Challenge
{
private ZombieWrapper _zombie;
private Set<Player> _infected = new HashSet<>();
// The default zombie speed.
private float _defaultSpeed = 1.3F;
// The zombie speed increment rate every 10 ticks.
private float _speedIncrement = 0.2F;
// The highest zombie speed, after the limit is reached, the speed is reset to the default one.
private float _speedLimit = 3.1F;
// The zombie speed after a player has been infected.
private float _speedAfterInfection = 1.7F;
public ChallengeZombieInfection(BawkBawkBattles host)
@ -134,12 +127,6 @@ public class ChallengeZombieInfection extends Challenge
_infected.clear();
}
@Override
protected boolean shouldDie(Player player)
{
return _infected.contains(player);
}
@EventHandler
public void onUpdateZombie(UpdateEvent event)
{
@ -181,6 +168,38 @@ public class ChallengeZombieInfection extends Challenge
}
}
@EventHandler
public void onCustomDamage(CustomDamageEvent event)
{
if (!isChallengeValid())
return;
Player damagee = event.GetDamageePlayer();
if (!isPlayerValid(damagee))
return;
if (_infected.contains(event.GetDamageePlayer()))
{
event.SetCancelled("Infected");
}
else
{
if (event.GetDamage() > damagee.getHealth())
{
damagee.setHealth(0.01);
infect(damagee);
}
else if (!damagee.hasPotionEffect(PotionEffectType.SLOW) && !damagee.hasPotionEffect(PotionEffectType.CONFUSION))
{
damagee.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20, 1));
damagee.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60, 1));
}
damagee.playSound(damagee.getLocation(), Sound.SPIDER_IDLE, 2.0F, 1.0F);
}
}
@EventHandler
public void onParticleUpdate(UpdateEvent event)
{
@ -330,21 +349,7 @@ public class ChallengeZombieInfection extends Challenge
private void damage(Player player)
{
player.damage(5.0);
if (player.isDead())
{
infect(player);
}
else
{
if (!player.hasPotionEffect(PotionEffectType.SLOW) && !player.hasPotionEffect(PotionEffectType.CONFUSION))
{
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60, 1));
}
player.playSound(player.getLocation(), Sound.SPIDER_IDLE, 2.0F, 1.0F);
}
Host.Manager.GetDamage().NewDamageEvent(player, _zombie.getEntity(), null, DamageCause.ENTITY_ATTACK, 5.0, false, false, false, "Attack", "Infection");
}
}

View File

@ -25,7 +25,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.hologram.Hologram;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
@ -68,7 +67,6 @@ public class ChickenAttack
spawnChickens();
}
public void start(Player player)
{
@ -90,7 +88,6 @@ public class ChickenAttack
ensurePlayerKill(player);
}
private void ensurePlayerKill(Player player)
{
@ -111,7 +108,6 @@ public class ChickenAttack
}
}.runTaskLater(_plugin, ATTACK_EXPIRE_TICKS);
}
public void kill(Player player, boolean inform)
{
@ -165,7 +161,6 @@ public class ChickenAttack
_host.CreatureAllow = false;
}
private void setupChicken(Chicken chicken)
{
@ -178,10 +173,8 @@ public class ChickenAttack
UtilEnt.addLookAtPlayerAI(chicken, CHICKEN_LOOK_AT_PLAYER_DISTANCE);
Location loc = chicken.getLocation().add(0, 1, 0).clone();
Hologram holo = new Hologram(_host.Manager.getHologramManager(), loc, "Chicken Minion");
holo.setFollowEntity(chicken);
holo.start();
chicken.setCustomName("Chicken Minion");
chicken.setCustomNameVisible(true);
}
public boolean isGroupMember(Chicken chicken)

View File

@ -12,21 +12,23 @@ import org.bukkit.inventory.meta.SkullMeta;
import mineplex.core.common.util.UtilSkull;
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.ProgressingKit;
/**
* The default bawk bawk battles game kit.
*/
public class KitBawksFood extends Kit
public class KitBawksFood extends ProgressingKit
{
private static final byte SKULL_DATA = 3;
public KitBawksFood(ArcadeManager manager)
{
super(manager,
super(
manager,
"Bawk's Food",
"bawksfood",
KitAvailability.Free,
new String[] {
"Lord Bawk Bawk demands you follow his commands.",
@ -78,4 +80,10 @@ public class KitBawksFood extends Kit
equipment.setLeggings(leggings);
equipment.setBoots(boots);
}
@Override
public Material getIcon()
{
return Material.FEATHER;
}
}