Skip to content

Commit c9a81bf

Browse files
committed
Balancing updates
1 parent 450c039 commit c9a81bf

File tree

6 files changed

+45
-47
lines changed

6 files changed

+45
-47
lines changed

src/main/java/com/liphium/elfhunt/game/state/IngameState.java

+36-23
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.liphium.elfhunt.game.team.impl.ElfTeam;
88
import com.liphium.elfhunt.game.team.impl.HunterTeam;
99
import com.liphium.elfhunt.listener.machines.impl.PresentReceiver;
10-
import com.liphium.elfhunt.screens.ItemShopScreen;
1110
import com.liphium.elfhunt.util.LocationAPI;
1211
import com.liphium.elfhunt.util.Messages;
1312
import net.kyori.adventure.text.Component;
@@ -54,7 +53,7 @@ public void start() {
5453

5554
// Change the amount of presents based on team size
5655
final var hunterSize = Elfhunt.getInstance().getGameManager().getTeamManager().getTeam("Elves").getPlayers().size();
57-
int maxPresents = hunterSize * 10; // 10 per member of the team seems fine for 15 minutes
56+
int maxPresents = hunterSize * 4; // 4 per member of the team seems fine for 15 minutes
5857
presentsLeft = maxPresents;
5958

6059
// Give every single present receiver a random name
@@ -133,32 +132,35 @@ public void onInteract(PlayerInteractEvent event) {
133132
ItemStack usedItem = event.getItem();
134133
if (usedItem.getType().equals(Material.GRAY_DYE) && event.getClickedBlock() != null) {
135134
traps.add(new SlowTrap(event.getClickedBlock().getLocation().clone().add(0.5, 1, 0.5), team));
136-
reduceMainHandItem(event.getPlayer());
135+
reduceMainHandItem(event.getPlayer(), Material.GRAY_DYE);
137136
} else if (usedItem.getType().equals(Material.GREEN_DYE) && event.getClickedBlock() != null) {
138137
traps.add(new PoisonTrap(event.getClickedBlock().getLocation().clone().add(0.5, 1, 0.5), team));
139-
reduceMainHandItem(event.getPlayer());
138+
reduceMainHandItem(event.getPlayer(), Material.GREEN_DYE);
140139
} else if (usedItem.getType().equals(Material.FEATHER) && event.getClickedBlock() != null) {
141140
traps.add(new FlyTrap(event.getClickedBlock().getLocation().clone().add(0.5, 1, 0.5), team));
142-
reduceMainHandItem(event.getPlayer());
141+
reduceMainHandItem(event.getPlayer(), Material.FEATHER);
143142
} else if (usedItem.getType().equals(Material.LIGHT_BLUE_DYE) && event.getClickedBlock() != null) {
144143
traps.add(new FreezeTrap(event.getClickedBlock().getLocation().clone().add(0.5, 1, 0.5), team));
145-
reduceMainHandItem(event.getPlayer());
144+
reduceMainHandItem(event.getPlayer(), Material.LIGHT_BLUE_DYE);
146145
} else if (usedItem.getType().equals(Material.WHITE_DYE) && event.getClickedBlock() != null) {
147146
traps.add(new WebTrap(event.getClickedBlock().getLocation().clone().add(0.5, 1, 0.5), team));
148-
reduceMainHandItem(event.getPlayer());
149-
} else if (usedItem.getType().equals(Material.FEATHER) && event.getPlayer().getCooldown(Material.FEATHER) <= 0) {
150-
event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().normalize().multiply(event.getPlayer().isOnGround() ? 1.8 : 1.1));
151-
event.getPlayer().setCooldown(Material.FEATHER, 50);
152-
ItemShopScreen.removeAmountFromInventory(event.getPlayer(), Material.FEATHER, 1);
147+
reduceMainHandItem(event.getPlayer(), Material.WHITE_DYE);
153148
}
154149
}
155150
}
156151

157-
void reduceMainHandItem(Player player) {
158-
int amount = player.getInventory().getItemInMainHand().getAmount();
159-
if (amount == 1) {
160-
player.getInventory().setItemInMainHand(null);
161-
} else player.getInventory().getItemInMainHand().setAmount(amount - 1);
152+
void reduceMainHandItem(Player player, Material material) {
153+
if(player.getInventory().getItemInMainHand().getType() == material) {
154+
int amount = player.getInventory().getItemInMainHand().getAmount();
155+
if (amount == 1) {
156+
player.getInventory().setItemInMainHand(null);
157+
} else player.getInventory().getItemInMainHand().setAmount(amount - 1);
158+
} else if(player.getInventory().getItemInOffHand().getType() == material) {
159+
int amount = player.getInventory().getItemInOffHand().getAmount();
160+
if (amount == 1) {
161+
player.getInventory().setItemInOffHand(null);
162+
} else player.getInventory().getItemInOffHand().setAmount(amount - 1);
163+
}
162164
}
163165

164166
@Override
@@ -255,7 +257,7 @@ public void onMove(PlayerMoveEvent event) {
255257
}
256258

257259
// Kill the player in case they fell down
258-
if(event.getPlayer().getLocation().getY() <= 180) {
260+
if(event.getPlayer().getLocation().getY() <= 156) {
259261
event.getPlayer().setHealth(0);
260262
return;
261263
}
@@ -302,11 +304,19 @@ public void onPlace(BlockPlaceEvent event) {
302304
return;
303305
}
304306

305-
if(event.getBlockPlaced().getLocation().getY() >= 220) {
307+
if(event.getBlockPlaced().getLocation().getY() >= 250) {
306308
event.setCancelled(true);
307309
return;
308310
}
309311

312+
for(DroppableTrap trap : traps) {
313+
if(trap.location.distance(event.getBlock().getLocation()) <= 2) {
314+
event.getPlayer().sendMessage(Component.text("You can't place a block near a trap!", NamedTextColor.RED));
315+
event.setCancelled(true);
316+
return;
317+
}
318+
}
319+
310320
// Place a machine if it is one
311321
final var machine = Elfhunt.getInstance().getMachineManager().newMachineByMaterial(event.getBlockPlaced().getType(), event.getBlockPlaced().getLocation());
312322
if (machine != null) {
@@ -324,7 +334,8 @@ public void onPlace(BlockPlaceEvent event) {
324334
Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP,
325335
Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.SUNFLOWER,
326336
Material.LILAC, Material.ROSE_BUSH, Material.PEONY,
327-
Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.COBWEB
337+
Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.COBWEB,
338+
Material.FERN, Material.SWEET_BERRY_BUSH
328339
);
329340

330341
@Override
@@ -354,7 +365,11 @@ public void onBreak(BlockBreakEvent event) {
354365
public void onDeath(PlayerDeathEvent event) {
355366
final var player = event.getPlayer();
356367

357-
event.setKeepInventory(true);
368+
player.getInventory().clear();
369+
player.getInventory().setBoots(null);
370+
player.getInventory().setLeggings(null);
371+
player.getInventory().setChestplate(null);
372+
player.getInventory().setHelmet(null);
358373
event.deathMessage(null);
359374
event.setKeepLevel(true);
360375

@@ -390,7 +405,6 @@ public void onRespawn(PlayerRespawnEvent event) {
390405
} else {
391406
event.setRespawnLocation(Objects.requireNonNull(LocationAPI.getLocation("Elves")));
392407
}
393-
team.giveKit(event.getPlayer(), false);
394408
}
395409

396410
public void handleWin(Team team) {
@@ -424,7 +438,7 @@ public DroppableTrap(Location location, Team team, Material material) {
424438
this.location = location;
425439
this.team = team;
426440

427-
item = (Item) location.getWorld().spawnEntity(location.clone().add(0, 1, 0), EntityType.ITEM);
441+
item = (Item) location.getWorld().spawnEntity(location.clone().add(0, 0.5, 0), EntityType.ITEM);
428442
item.setItemStack(new ItemStackBuilder(material).buildStack());
429443
item.setVelocity(new Vector(0, 0, 0));
430444
item.setPickupDelay(1000000000);
@@ -472,7 +486,6 @@ public static class FreezeTrap extends DroppableTrap {
472486
@Override
473487
public void onEnter(Player player) {
474488
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 100, 255, true, false));
475-
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP_BOOST, 100, 128, true, false));
476489
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 300, 0));
477490
}
478491
}

src/main/java/com/liphium/elfhunt/game/team/impl/ElfTeam.java

-8
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ public ElfTeam() {
2222

2323
@Override
2424
public void giveKit(Player player, boolean teleport) {
25-
player.getInventory().setHelmet(new ItemStackBuilder(Material.NETHERITE_HELMET).makeUnbreakable()
26-
.addEnchantment(Enchantment.PROTECTION, 3).buildStack());
27-
28-
player.getInventory().setBoots(new ItemStackBuilder(Material.LEATHER_BOOTS).makeUnbreakable()
29-
.withLeatherColor(Color.GREEN).buildStack());
30-
31-
player.getInventory().addItem(new ItemStackBuilder(Material.STONE_SWORD).makeUnbreakable().buildStack());
32-
3325
if (teleport) {
3426
player.teleport(Objects.requireNonNull(LocationAPI.getLocation("Elves")));
3527
}

src/main/java/com/liphium/elfhunt/game/team/impl/HunterTeam.java

-8
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ public HunterTeam() {
2626

2727
@Override
2828
public void giveKit(Player player, boolean teleport) {
29-
player.getInventory().setHelmet(new ItemStackBuilder(Material.NETHERITE_HELMET).makeUnbreakable()
30-
.addEnchantment(Enchantment.PROTECTION, 3).buildStack());
31-
32-
player.getInventory().setBoots(new ItemStackBuilder(Material.LEATHER_BOOTS).makeUnbreakable()
33-
.withLeatherColor(Color.RED).buildStack());
34-
35-
player.getInventory().addItem(new ItemStackBuilder(Material.STONE_SWORD).makeUnbreakable().buildStack());
36-
3729
if (teleport) {
3830
player.teleport(Objects.requireNonNull(LocationAPI.getLocation("Hunters")));
3931
}

src/main/java/com/liphium/elfhunt/listener/machines/impl/CoinDropper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public CoinDropper(Location location, boolean breakable) {
4040
stand.setRemoveWhenFarAway(false);
4141
}
4242

43-
int count = 20, tickCount = 0;
43+
int count = 2, tickCount = 0;
4444

4545
@Override
4646
public void destroy() {

src/main/java/com/liphium/elfhunt/listener/machines/impl/PresentReceiver.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public class PresentReceiver extends Machine {
2626
"Atlas", "Animo", "Louis", "Liph", "Ritso", "Glaze", "Jumbo",
2727
"JuliPvP99", "Night", "Maya", "Theo", "Prime", "Lofi Girl", "Alex",
2828
"Steve", "Arch", "Colin", "Dani", "Dave", "David", "Eric", "Lofi Boy",
29-
"Matt", "Elon Musk", "Linus LTT", "Neko"
29+
"Matt", "Elon Musk", "Linus LTT", "Neko", "Ben Dover", "CD", "CI/CD",
30+
"Maja"
3031
));
3132

3233
/**

src/main/java/com/liphium/elfhunt/screens/ItemShopScreen.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ public enum ShopCategory {
7777
itemWithPriceCustom(new ItemStackBuilder(Material.BOW)
7878
.withName(Component.text("More Punch Bow", NamedTextColor.RED))
7979
.withEnchantments(Map.of(Enchantment.PUNCH, 2, Enchantment.INFINITY, 1))
80-
.buildStack(), 40
80+
.buildStack(), 100
8181
),
8282
itemWithPrice(Material.ARROW, "Arrow", NamedTextColor.RED, 15, 3),
83-
itemWithPrice(Material.BOW, "Crossbow", NamedTextColor.RED, 20, 1),
83+
itemWithPrice(Material.CROSSBOW, "Crossbow", NamedTextColor.RED, 50, 1),
8484
itemWithPriceCustom(new ItemStackBuilder(Material.FIREWORK_ROCKET)
8585
.withName(Component.text("Rocket", NamedTextColor.RED))
8686
.withAmount(3)
@@ -96,9 +96,8 @@ public enum ShopCategory {
9696
List.of(
9797
itemWithPrice(Material.GRAY_DYE, "Slow trap", NamedTextColor.GREEN, 25, 1),
9898
itemWithPrice(Material.GREEN_DYE, "Poison trap", NamedTextColor.GREEN, 25, 1),
99-
itemWithPrice(Material.FEATHER, "Fly trap", NamedTextColor.GREEN, 25, 1),
100-
itemWithPrice(Material.LIGHT_BLUE_DYE, "Freeze trap", NamedTextColor.GREEN, 35, 1),
101-
itemWithPrice(Material.WHITE_DYE, "Web trap", NamedTextColor.GREEN, 35, 1)
99+
itemWithPrice(Material.WHITE_DYE, "Web trap", NamedTextColor.GREEN, 35, 1),
100+
itemWithPrice(Material.LIGHT_BLUE_DYE, "Freeze trap", NamedTextColor.GREEN, 35, 1)
102101
)
103102
),
104103
TOOLS(
@@ -140,6 +139,7 @@ public enum ShopCategory {
140139
itemWithPrice(Material.SNOW_BLOCK, "Snow", NamedTextColor.WHITE, 4, 16),
141140
itemWithPrice(Material.SPRUCE_LOG, "Spruce wood", NamedTextColor.WHITE, 8, 4),
142141
itemWithPrice(Material.COBBLESTONE, "Cobblestone", NamedTextColor.WHITE, 8, 16),
142+
itemWithPrice(Material.COBWEB, "Cobweb", NamedTextColor.WHITE, 10, 1),
143143
spacer(),
144144
itemWithPrice(Material.IRON_INGOT, "Iron", NamedTextColor.WHITE, 4, 1),
145145
itemWithPrice(Material.DIAMOND, "Diamond", NamedTextColor.WHITE, 7, 1),
@@ -152,7 +152,7 @@ public enum ShopCategory {
152152
.withLore(Component.text("Coin and material droppers.", NamedTextColor.GRAY))
153153
.buildStack(),
154154
List.of(
155-
itemWithPrice(Material.GOLD_ORE, "Coin dropper", NamedTextColor.GOLD, 15, 1),
155+
itemWithPrice(Material.GOLD_ORE, "Coin dropper", NamedTextColor.GOLD, 35, 1),
156156
itemWithPrice(Material.WHITE_CONCRETE, "Iron dropper", NamedTextColor.GOLD, 20, 1),
157157
itemWithPrice(Material.RED_CONCRETE, "Redstone dropper", NamedTextColor.GOLD, 20, 1),
158158
itemWithPrice(Material.CYAN_CONCRETE, "Diamond dropper", NamedTextColor.GOLD, 30, 1),

0 commit comments

Comments
 (0)