From 0d811272cc9e25a1d489927dbc6705250fd346a8 Mon Sep 17 00:00:00 2001 From: Chiss Date: Wed, 27 Nov 2013 11:52:20 +1100 Subject: [PATCH] final HG fix :D --- .../game/games/hungergames/HungerGames.java | 51 +++++++++++-------- .../game/arcade/kit/perks/PerkWolfPet.java | 37 +++++++++++++- 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java index b485b47b4..48467fb16 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java @@ -18,6 +18,7 @@ import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Chest; +import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Firework; import org.bukkit.entity.ItemFrame; @@ -752,15 +753,6 @@ public class HungerGames extends SoloGame MapUtil.ChunkBlockChange(loc, id, data); - //Save Red - if (!_redMap.containsKey(loc.getBlockX())) - _redMap.put(loc.getBlockX(), new HashMap>()); - - if (!_redMap.get(loc.getBlockX()).containsKey(loc.getBlockY())) - _redMap.get(loc.getBlockX()).put(loc.getBlockY(), new HashSet()); - - _redMap.get(loc.getBlockX()).get(loc.getBlockY()).add(loc.getBlockZ()); - //Old Style /* if (true) @@ -810,7 +802,7 @@ public class HungerGames extends SoloGame @EventHandler public void RedChunkUpdate(UpdateEvent event) { - if (event.getType() != UpdateType.FASTER) + if (event.getType() != UpdateType.FAST) return; if (!IsLive()) @@ -845,14 +837,18 @@ public class HungerGames extends SoloGame //Base Score, 1 per block double score = change.Changes.size(); - //Time Score, 1 per second - score += (System.currentTimeMillis() - change.Time)/1000d; + //Time Score, multiply block score by 1 + 0.5 per second + score = score * (1 + (System.currentTimeMillis() - change.Time)/200d); //Distance Divisor - int x = Math.abs(player.getLocation().getChunk().getX() - change.Chunk.getX()); - int z = Math.abs(player.getLocation().getChunk().getZ() - change.Chunk.getZ()); - double dist = Math.sqrt(x*x + z*z); - score = score/dist; + double dist = 0.5; + if (!player.getLocation().getChunk().equals(change.Chunk)) + { + int x = Math.abs(player.getLocation().getChunk().getX() - change.Chunk.getX()); + int z = Math.abs(player.getLocation().getChunk().getZ() - change.Chunk.getZ()); + dist = Math.sqrt(x*x + z*z); + } + score = score/(dist*dist); if (bestId == -1 || score > bestScore) { @@ -887,6 +883,15 @@ public class HungerGames extends SoloGame public void SetRed(Location loc) { + //Save Red + if (!_redMap.containsKey(loc.getBlockX())) + _redMap.put(loc.getBlockX(), new HashMap>()); + + if (!_redMap.get(loc.getBlockX()).containsKey(loc.getBlockY())) + _redMap.get(loc.getBlockX()).put(loc.getBlockY(), new HashSet()); + + _redMap.get(loc.getBlockX()).get(loc.getBlockY()).add(loc.getBlockZ()); + //Red if (_spreadType == 0) { @@ -895,7 +900,10 @@ public class HungerGames extends SoloGame //Snow else if (_spreadType == 1) { - if (loc.getBlock().getType() == Material.LEAVES) RedChangeBlock(loc, 79, (byte)0); + if (loc.getBlock().getType() == Material.LEAVES) //RedChangeBlock(loc, 79, (byte)0); + { + + } else if (loc.getBlock().getTypeId() == 8 || loc.getBlock().getTypeId() == 9) RedChangeBlock(loc, 79, (byte)0); else if (loc.getBlock().getTypeId() == 10 || loc.getBlock().getTypeId() == 11) RedChangeBlock(loc, 49, (byte)0); else RedChangeBlock(loc, 80, (byte)0); @@ -944,8 +952,11 @@ public class HungerGames extends SoloGame //Snow else if (_spreadType == 1) { + if (Math.random() > 0.95) + player.playEffect(block.getLocation().add(0, 1, 0), Effect.STEP_SOUND, Material.SNOW_BLOCK); + if (Math.random() > 0.8) - { + { Vector traj = UtilAlg.getTrajectory(block.getLocation().add(0.5, 1.5, 0.5), player.getLocation()); Snowball ball = player.getWorld().spawn(block.getLocation().add(0.5, 1.5, 0.5).subtract(traj.clone().multiply(8 + UtilMath.r(8))), Snowball.class); @@ -987,7 +998,7 @@ public class HungerGames extends SoloGame if (near) { - player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.2f, 0f); + player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.5f, 0f); if (!_redOutTime.containsKey(player)) { @@ -1597,6 +1608,4 @@ public class HungerGames extends SoloGame _helpIndex = (_helpIndex + 1)%_help.length; } - - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index fde9b6424..8acd2474e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -8,12 +8,15 @@ import org.bukkit.DyeColor; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf; +import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; import org.bukkit.entity.Wolf; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; @@ -33,6 +36,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; import net.minecraft.server.v1_6_R3.EntityCreature; import net.minecraft.server.v1_6_R3.Navigation; @@ -99,7 +103,7 @@ public class PerkWolfPet extends Perk wolf.setCollarColor(DyeColor.GREEN); wolf.playEffect(EntityEffect.WOLF_HEARTS); - wolf.setMaxHealth(24); + wolf.setMaxHealth(18); wolf.setHealth(wolf.getMaxHealth()); if (_baby) @@ -308,4 +312,35 @@ public class PerkWolfPet extends Perk wolves.clear(); } + + public boolean IsMinion(Entity ent) + { + for (ArrayList minions : _wolfMap.values()) + { + for (Wolf minion : minions) + { + if (ent.equals(minion)) + { + return true; + } + } + } + + return false; + } + + @EventHandler + public void Damage(CustomDamageEvent event) + { + if (event.GetDamagerEntity(true) == null) + return; + + if (!IsMinion(event.GetDamagerEntity(true))) + return; + + double damage = 4; + + event.AddMod("Wolf Minion", "Negate", -event.GetDamageInitial(), false); + event.AddMod("Wolf Minion", "Damage", damage, false); + } }