forked from nus-cs2113-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from B1G-SAM/DG-Edit
Add shopmap to dg
- Loading branch information
Showing
6 changed files
with
58 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
|
||
@startuml | ||
hide circle | ||
class ShopMap { | ||
- currentPlayer : PlayerStatus | ||
- currentTextBox : TextBox | ||
- currentEntity : ShopKeeper | ||
+ ShopMap(player : PlayerStatus, text : TextBox, shopKeeper : ShopKeeper) | ||
+ initMap(givenWidth : int, givenHeight : int) : void | ||
+ queueTextBox() : void | ||
+ enableFight() : void | ||
+ getEntityDeath() : boolean | ||
+ getPlayerDeath() : boolean | ||
+ handleDeath() : void | ||
+ handleLootingByPlayer() : void | ||
} | ||
actor Player | ||
participant "ShopMap" as Shop | ||
participant "Ui" as UI | ||
participant "TextBox" as TextBox | ||
participant "Scanner" as Scanner | ||
|
||
Player -> Shop : enableFight(Scanner) | ||
activate Shop | ||
|
||
class PlayerStatus { | ||
} | ||
Shop -> TextBox : queueTextBox() | ||
activate TextBox | ||
TextBox -> TextBox : setNextNarration("You are greeted...") | ||
TextBox -> TextBox : setNextDialogue(currentEntity.getDefaultMessage() + formatShop()) | ||
TextBox -> TextBox : setNextInstruction("Give the shopkeeper...") | ||
deactivate TextBox | ||
|
||
class TextBox { | ||
} | ||
loop while answerCommand != "exit" | ||
Shop -> UI : printPlayerStatus(currentPlayer) | ||
Shop -> UI : printShopKeeper(currentEntity) | ||
Shop -> UI : printTextBox(currentTextBox) | ||
UI -> Player : await command | ||
Player -> Scanner : answerCommand = in.nextLine().trim() | ||
Scanner -> Shop | ||
|
||
class ShopKeeper { | ||
} | ||
alt if answerCommand matches "\\d+" | ||
Shop -> Shop : processPurchase(answerCommand) | ||
else if answerCommand == "run" | ||
TextBox -> TextBox : setNextError("Invalid command...") | ||
else | ||
TextBox -> TextBox : setNextError("Invalid command...") | ||
end if | ||
|
||
ShopMap --> PlayerStatus : -currentPlayer | ||
ShopMap --> TextBox : -currentTextBox | ||
ShopMap --> ShopKeeper : -currentEntity | ||
Shop -> TextBox : prepareNextDialogue() | ||
TextBox -> Player : Display updated dialogue/instruction | ||
end | ||
|
||
Shop -> TextBox : clearAll() | ||
TextBox -> TextBox : setNextNarration("You exited the shop!!") | ||
deactivate Shop | ||
@enduml | ||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters