Fixing boss not despawning bug, scoreboard end bug and some achievements.
This commit is contained in:
parent
18ab3d0f5b
commit
4958ce347d
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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++;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -41,7 +41,10 @@ public class DumbledontStatTracker extends StatTracker<TypeWars>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,14 @@ public class PerfectionistStatTracker extends StatTracker<TypeWars>
|
||||
|
||||
private HashMap<String, Long> _wordsRecently;
|
||||
private ArrayList<Player> _players;
|
||||
private HashMap<Player, Integer> _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<TypeWars>
|
||||
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<TypeWars>
|
||||
for(Player player : _players)
|
||||
{
|
||||
if(player.isOnline())
|
||||
addStat(player, "Perfectionist", 1, true, false);
|
||||
{
|
||||
if(_playerWords.get(player) >= 5)
|
||||
addStat(player, "Perfectionist", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user