From 4958ce347da1ab054b8c1eba9984c72d27ec2b8b Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 12 Nov 2015 18:41:40 +0100 Subject: [PATCH] Fixing boss not despawning bug, scoreboard end bug and some achievements. --- .../arcade/game/games/typewars/Minion.java | 12 ++++- .../game/games/typewars/MinionType.java | 4 +- .../arcade/game/games/typewars/TypeWars.java | 54 ++++++++++++++++--- .../games/typewars/spells/SpellFirebomb.java | 7 ++- .../typewars/stats/DumbledontStatTracker.java | 5 +- .../stats/PerfectionistStatTracker.java | 13 ++++- 6 files changed, 80 insertions(+), 15 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 9d0c8c05a..fcb2403e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -83,7 +83,7 @@ public class Minion "Concrete", "Carriage", "Pressure", "Practice", "Commerce", "Windmill", "Cheetah", "Mercury", "Octopus", "Canyons", "Pavement", "Auxilary", "Demolish", "Maintain", "Barbeque", "Parmesan", "Vulture", "America", "Printer", "Seventy", "Joystick", "Marshall", "Franklin", "Umbrella", "Contract", "Warthog", "Turtles", "Ireland", "Titanic", "Hundred", - "Sppeaker", "Suitcase", "Michigan", "Darkness", "Separate", "Puzzled", "Ocelots", "Germany", "Vanilla", "Million", + "Speaker", "Suitcase", "Michigan", "Darkness", "Separate", "Puzzled", "Ocelots", "Germany", "Vanilla", "Million", "Figurine", "Mandarin", "Arkansas", "Ethernet", "Eligible", "Shocked", "Creeper", "Chillie", "Tornado", "Billion", "Boundary", "Anteater", "Colorado", "Everyday", "Fraction", "Figures", "Zombies", "Jamaica", "Seaweed", "Twitter", "Birthday", "Sunshine", "Virginia", "Surprise", "Compound", "Pillows", "Leather", "Bermuda", "Craters", "Waiting", @@ -166,6 +166,7 @@ public class Minion private int _money; private float _walkSpeed; private boolean _spawned; + private double _tagHight; private int _size; @@ -190,6 +191,7 @@ public class Minion _type = randomType(); _walkSpeed = _type.getWalkSpeed(); + _tagHight = _type.getTagHight(); _die = false; _killed = false; _frame = 0; @@ -357,6 +359,7 @@ public class Minion public void despawn(Player player, boolean killed) { + _money = _money + 1; if(_lives > 1) { _lives = _lives - 1; @@ -364,10 +367,12 @@ public class Minion if(_type == MinionType.WITHER) { _size = _size + 100; + _tagHight = _tagHight - 0.15; } else { _size = _size -1; + _tagHight = _tagHight - 0.1; } return; } @@ -576,6 +581,11 @@ public class Minion { return _spawnID; } + + public double getTagHight() + { + return _tagHight; + } public void setTarget(Location location) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index 1f3f9a4ca..a80d1fc5f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -35,8 +35,8 @@ public enum MinionType HORSE(10, MinionSize.HARD, EntityType.HORSE, 6, 9, (float) (0.7 + (0.1*10)), 3, 0D, Material.APPLE, DisguiseHorse.class), ENDERMAN(10, MinionSize.HARD, EntityType.ENDERMAN, 9, 12, (float) (0.7 + (0.1*4)), 3, 1D, Material.ENDER_STONE, DisguiseEnderman.class), - WITHER(1, MinionSize.BOSS, EntityType.WITHER, 5, 5, (float) (0.7 + (0.1*2)), 15, 2D, Material.NETHER_STAR, DisguiseWither.class), - SLIME(1, MinionSize.BOSS, EntityType.SLIME, 5, 5, (float) (0.7 + (0.1*2)), 15, 3D, Material.SLIME_BALL, DisguiseSlime.class), + WITHER(1, MinionSize.BOSS, EntityType.WITHER, 5, 5, (float) (0.7 + (0.1*2)), 1, 2D, Material.NETHER_STAR, DisguiseWither.class), + SLIME(1, MinionSize.BOSS, EntityType.SLIME, 5, 5, (float) (0.7 + (0.1*2)), 1, 3D, Material.SLIME_BALL, DisguiseSlime.class), SPIDER_JOKEY(1, MinionSize.FREAK, EntityType.SPIDER, 10, 13, (float) (0.7 + (0.1*7)), 10, 1D, Material.APPLE, DisguiseSpider.class, DisguiseSkeleton.class), CHICKEN_JOKEY(1, MinionSize.FREAK, EntityType.CHICKEN, 10, 13, (float) (0.7 + (0.1*7)), 10, 1D, Material.APPLE, DisguiseChicken.class, DisguiseZombie.class); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index baedceacf..e7895cfd6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -100,8 +100,8 @@ public class TypeWars extends TeamGame }, new String[] { - "Type as fast as you can", - "to kill the evil minions." + "Protect your Giant!", + "Type Minions' names to kill them." }); this.DeathOut = false; @@ -177,10 +177,14 @@ public class TypeWars extends TeamGame _moneyMap.put(player, 0); } + if(event.GetState() == GameState.Prepare) + { + UtilTextMiddle.display("", "Protect your Giant! Type Minions' names to kill them.", 20, 100, 20, UtilServer.getPlayers()); + } + if(event.GetState() != GameState.Live) return; - UtilTextMiddle.display("", "Protect your Giant from minions! Type their names to kill them.", 20, 100, 20, UtilServer.getPlayers()); initSpawns(); prepareGiants(); @@ -324,7 +328,7 @@ public class TypeWars extends TeamGame for(MinionSize type : MinionSize.values()) { - if(type.getDisplayItem().getDurability() == event.getItem().getDurability()) + if(type.getDisplayItem().getType() == event.getItem().getType() && type.getDisplayItem().getDurability() == event.getItem().getDurability()) { if(type.getCost() > _moneyMap.get(event.getPlayer())) { @@ -473,7 +477,23 @@ public class TypeWars extends TeamGame } } Hologram hologram = minion.getHologram(); - hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + 2.3, 0)); + hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getTagHight() + 2.3, 0)); + } + } + + @EventHandler + public void checkDeadMinions(UpdateEvent event) + { + if(GetState() != GameState.Live && GetState() != GameState.End) + return; + + if(event.getType() != UpdateType.FASTER) + return; + + for(Minion minion : _deadMinions) + { + if(!minion.getEntity().isDead()) + minion.despawn(null, false); } } @@ -734,6 +754,21 @@ public class TypeWars extends TeamGame minionIterator.remove(); } + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + + for(GameTeam team : GetTeamList()) + { + Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); + Scoreboard.Write(team.GetColor() + "Health: " + Math.round(getScore(team))); + Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); + Scoreboard.WriteBlank(); + } + + Scoreboard.Draw(); + //End Manager.GetCreature().SetDisableCustomDrops(false); SetState(GameState.End); @@ -922,7 +957,7 @@ public class TypeWars extends TeamGame for(GameTeam team : GetTeamList()) { Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); - Scoreboard.Write(team.GetColor() + "Health: " + getScore(team)); + Scoreboard.Write(team.GetColor() + "Health: " + Math.round(getScore(team))); Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); Scoreboard.WriteBlank(); } @@ -1003,8 +1038,11 @@ public class TypeWars extends TeamGame continue; minion.despawn(player, true); - minionIterator.remove(); - _deadMinions.add(minion); + if(!minion.hasLives()) + { + minionIterator.remove(); + _deadMinions.add(minion); + } } i++; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java index b69d1dabb..2da5791b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java @@ -46,8 +46,11 @@ public class SpellFirebomb extends Spell } minion.despawn(player, true); - minionIterator.remove(); - getTypeWars().getDeadMinions().add(minion); + if(!minion.hasLives()) + { + minionIterator.remove(); + getTypeWars().getDeadMinions().add(minion); + } } return true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java index ea84f1eb0..2549690a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java @@ -41,7 +41,10 @@ public class DumbledontStatTracker extends StatTracker for(Player player : _players) { if(player.isOnline()) - addStat(player, "Dumbledont", 1, true, false); + { + if(event.GetGame().GetTeam(player) == event.GetGame().WinnerTeam) + addStat(player, "Dumbledont", 1, true, false); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java index fae291179..8ffeb57a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java @@ -17,12 +17,14 @@ public class PerfectionistStatTracker extends StatTracker private HashMap _wordsRecently; private ArrayList _players; + private HashMap _playerWords; public PerfectionistStatTracker(TypeWars game) { super(game); _wordsRecently = new HashMap<>(); _players = new ArrayList<>(); + _playerWords = new HashMap<>(); } @EventHandler @@ -31,6 +33,12 @@ public class PerfectionistStatTracker extends StatTracker if(event.isSuccessful()) { _wordsRecently.put(event.getAttempt().toUpperCase(), System.currentTimeMillis()); + + if(!_playerWords.containsKey(event.getPlayer())) + _playerWords.put(event.getPlayer(), 1); + + int words = _playerWords.get(event.getPlayer()); + _playerWords.put(event.getPlayer(), words + 1); } else { @@ -60,7 +68,10 @@ public class PerfectionistStatTracker extends StatTracker for(Player player : _players) { if(player.isOnline()) - addStat(player, "Perfectionist", 1, true, false); + { + if(_playerWords.get(player) >= 5) + addStat(player, "Perfectionist", 1, true, false); + } } } }