Skip to content

Commit

Permalink
Merge pull request #109 from B1G-SAM/Remove-Timer-Feature
Browse files Browse the repository at this point in the history
Remove timer feature
  • Loading branch information
B1G-SAM committed Apr 12, 2024
2 parents 1658744 + 1fdde5b commit 2d87865
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 15 deletions.
67 changes: 58 additions & 9 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,31 @@ math wizard.

### The Map
This game displays the character's position on a 2D grid, the player is denoted by a `P`
and the other interactable entities are denoted by other symbols.
and the other interactable entities are denoted by other symbols. The entities on the map are randomly generated in each
play through of the game.

### The Player
At all times, the player's health, money and exp is displayed at the top of the screen. Dropping the player's health
to 0 will cause the player to die and the game is over.

### The Text Box
At all times, on the bottom part of the screen, a text box will be visible and it will be visible. The text box informs
the player of narrations from the narrator, dialogue from the entities, general instructions from the user interface and
also error messages when they occur.

### Movement
Traversing the map is similar to many common computer games. We use the "WASD" system such that
entering `w` to the program shifts the player up by 1 space, entering `a` shifts the player to the left,
entering `s` shifts the player down 1 space and lastly, entering `d` shifts the player to the right by 1 space.
This movement can only take place when the 2D grid map is visible.

Additionally, should the player wish to move more than 1 space at a time, the player can modify the directional commands
by adding a number in this manner.

E.g `d 10`

The above command moves the player rightwards by 10 spaces.


### Interacting

Expand Down Expand Up @@ -55,14 +72,40 @@ questions wrong repeatedly will deplete the player's health and once the player'
the game is over. However, depleting the enemy's health to 0 will result in a victory and the player is rewarded with
some gold and exp before returning the player to the main map.


### Items

There are various consumables the player can acquire throughout the game. The items are consumable items, meaning the
item can be only used once before it is destroyed. There are 2 general types of items, the healing item and the damage
item. Healing items will recover the player's health, if the player's health is already maxed out at
100hp(health points), the healing item will OVER-HEAl and increase the player's health past the initial 100hp. Damage
items will empower the player's next attack to do increased damage on a successful hit.

### Shop

Items are purchasable at the shop denoted by a '#' on the map. Interacting with the shop causes the player to enter the
shop. Just like the enemies, the player must enter `fight` to browse the shop's items. After entering the shop, buy an
item by entering the index of the item and the item will automatically be purchased and transferred to the Inventory.
The purchase will only go through if the player has enough money. To exit the shop, the player enters `exit`.

### Inventory

The inventory of the player can only be accessed when the player is not currently interacting with an entity. To bring
up the inventory the player enters `i`. To use an item the player enters the keyword `use` followed by the index of the
item.

E.g `use 1`

To close the inventory, the player enters `close`.

### Hints

Sometimes, hints are scattered throughout the map such that some text will display just below the map to help the player,
hints are entirely passive and no user input is required for the hints to trigger.
Sometimes, hints are scattered throughout the map such that some text will display just below the map to help the
player, hints are entirely passive and no user input is required for the hints to trigger.

### Quit

Enter `q`to quit the game.
Enter `q`to quit the game. The game is automatically saved.


### Help
Expand All @@ -74,19 +117,21 @@ If you need a refresher on the controls, entering either `h` or `help` will brin
Our program can save map when you are playing the game.
Also, it will save the player status and your inventory items

### Inventory
### Reset

Should a reset be necessary, the player can completely wipe the current progress of the game and regenerate a new game
at ANY POINT IN THE GAME by entering `reset`.

In our map, there is always a shop. In the shop, you can buy things and use them to battle with the monster!





## FAQ

**Q**: How do I transfer my data to another computer?
**Q**:

**A**: {your answer here}
**A**:

## Command Summary

Expand All @@ -96,4 +141,8 @@ In our map, there is always a shop. In the shop, you can buy things and use them
`h` to print help menu
`run` to escape the battle interface
`fight` to commence a fight
all math questions have integer answers.
`i` to bring up inventory
`close` to leave inventory
`exit` to leave the shop
`reset` to reset the entire game and start a new game.
All math questions have integer answers.
3 changes: 3 additions & 0 deletions src/main/java/command/fight/FightingCommand.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package command.fight;
import command.Command;
import command.ResetCommand;
import map.BaseMap;
import map.ShopMap;

Expand Down Expand Up @@ -31,6 +32,8 @@ public void execute(Scanner in) {
currentMapForCommand.handleLootingByPlayer();
} else if (currentMapForCommand.getPlayerDeath()) {
currentMapForCommand.handleDeath();
Command deathReset = new ResetCommand();
deathReset.execute(playerStatus);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public void startGame() throws InterruptedException {
mapIndex.put(FIRST_MAP_IDENTITY, storedMaps.size() - 1);
currentMap = mapIndex.get(FIRST_MAP_IDENTITY);


long startTime = System.currentTimeMillis(); // start speed run timer

assert playerStatus != null;
ui.printPlayerStatus(playerStatus);
ui.printMap(storedMaps.get(currentMap));
Expand All @@ -105,7 +104,7 @@ public void startGame() throws InterruptedException {
printMessageUnderMap(userCommand, ui, playerStatus, textBox);
saveAllGameFile(mapStorage, playerStatusStorage, playerStatus, userCommand, inventoryItemsStorage);
if (storedMaps.get(mapIndex.get(FIRST_MAP_IDENTITY)).isWon()){
ui.printWinMessage(playerStatus, startTime);
ui.printWinMessage(playerStatus);
break;
}
} while (!userCommand.getCommandDescription().equals("TIRED") );
Expand Down
1 change: 0 additions & 1 deletion src/main/java/map/BattleInterface/BattleInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public boolean getPlayerDeath() {
public void handleDeath(){
Ui ui = new Ui();
ui.printDeathMessage();
System.exit(0);
}

public PlayerStatus getCurrentPlayer() {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void printDeathMessage(){
}


public void printWinMessage(PlayerStatus player, long startTime) throws InterruptedException {
public void printWinMessage(PlayerStatus player) throws InterruptedException {
System.out.println(" __ __ ______ __ __ __ __ ______ __ __ \n" +
"| \\ / \\ / \\ | \\ | \\ | \\ _ | \\| \\| \\ | \\\n" +
" \\$$\\ / $$| $$$$$$\\| $$ | $$ | $$ / \\ | $$ \\$$$$$$| $$\\ | $$\n" +
Expand All @@ -238,7 +238,6 @@ public void printWinMessage(PlayerStatus player, long startTime) throws Interrup
Thread.sleep(3000);
System.out.println("You Completed the game with $" + player.getPlayerMoney() + " remaining and a total" +
" of " + player.getPlayerExp() + " exp!!");
System.out.println("You completed this run in " + ((System.currentTimeMillis() - startTime) / 1000) + "s!");
Thread.sleep(3000);
System.out.println("Thank you for playing!!!");
}
Expand Down

0 comments on commit 2d87865

Please sign in to comment.