Kind of finished

It is possible to win and lose the game.
The boss is quite hard to beat, but it should be possible if RNGsus is with you.
Girls have an increasing chance of having a weapon based on map lvl.
Player has been nerfed.
Shields have been nerfed.
Girls' hp has been nerfed.
This commit is contained in:
2018-03-21 00:10:42 +01:00
parent 89de233b6c
commit a869cb1049
21 changed files with 221 additions and 143 deletions

View File

@@ -67,6 +67,7 @@ public class Game implements IGame {
private final ITurtle painter;
private final Printer printer;
private int numPlayers = 0;
boolean won = false;
public Game(Screen screen, ITurtle painter, Printer printer) {
this.painter = painter;
@@ -92,7 +93,7 @@ public class Game implements IGame {
// Prints some helpful information.
String[] info = {"Controls:", "WASD or arrow keys for movement", "E to pick up an item", "Q to drop an item", "1-0 to choose an item (10=0)", "N to change name", "ENTER to confirm", "R to use a ranged attack", "F to use a magic attack", "C to use a potion"};
for (int i = 0; i < info.length; i++) {
this.printer.printAt(Main.COLUMN_MAP_END + 2, 1 + i, info[i]);
this.printer.printAt(Main.COLUMN_RIGHTSIDE_START, 1 + i, info[i]);
}
}
@@ -219,7 +220,7 @@ public class Game implements IGame {
map.clean(loc);
if (target.isDestroyed()) {
if (target.isDestroyed() && currentLocation != null) {
return move(dir);
} else {
movePoints--;
@@ -285,14 +286,14 @@ public class Game implements IGame {
// *false*), and then insert a little timer delay between each non-player move
// (the timer
// is already set up in Main)
if (numPlayers == 0) {
if (numPlayers == 0 && !won) {
kill();
}
while (!actors.isEmpty()) {
// get the next player or non-player in the queue
currentActor = actors.remove(0);
if (currentActor == null) {
return false; //TODO: Find out why a girl suddenly becomes null (only after map change, not caught in beginTurn)
return false; //TODO: Find out why a girl suddenly becomes null (only after map change, not caught in beginTurn, happens randomly)
}
if (currentActor.isDestroyed()) // skip if it's dead
continue;
@@ -341,6 +342,17 @@ public class Game implements IGame {
NPC.playSound("audio/Dying-SoundBible.com-1255481835.wav");
}
public void win() { //Trigger when the boss dies
map.remove(currentLocation, currentActor);
currentActor = null;
currentLocation = null;
actors = new ArrayList<>();
loadMap("victory.txt");
map.draw(painter, printer);
NPC.playSound("audio/1_person_cheering-Jett_Rifkin-1851518140.wav");
won = true;
}
/**
* Loads a map with the desired name
*
@@ -373,6 +385,8 @@ public class Game implements IGame {
IItem item = createItem(inputGrid.get(loc));
if (item instanceof Chest) {
((Chest) item).fill(lvl);
} else if (item instanceof Girl) {
((Girl) item).giveWeapon(lvl);
}
if (item != null) {
map.add(loc, item);
@@ -631,13 +645,10 @@ public class Game implements IGame {
}
public boolean keyPressed(KeyCode code) {
// only an IPlayer/human can handle keypresses, and only if it's the human's
// turn
if (currentActor instanceof IPlayer) {
return !((IPlayer) currentActor).keyPressed(this, code);
}
return true;
}
// only an IPlayer/human can handle keypresses, and only if it's the human's
// turn
return !(currentActor instanceof IPlayer) || !((IPlayer) currentActor).keyPressed(this, code);
}
@Override
public ILocation move(GridDirection dir) {