-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CS2113-W12-3 Game #8
base: master
Are you sure you want to change the base?
Changes from 110 commits
036a70c
6e85b01
0fa756a
2186b06
9d6961b
5203d4d
35f1d67
6ea5717
dfae7cd
831efee
78abdab
f98fa9d
1a8c378
d727321
6fbeb50
2c79ba1
f469445
3ad7ebf
b8be087
65b609b
d204f0a
e8a2947
261a27e
2a37db6
176742a
8ff3e4f
818b0d3
b698b4d
be32295
31e1c9f
c28a224
49fd508
c09c893
968a13b
b0d8a51
25284c5
5d619b1
d607a3c
820e4f0
e1cf92e
b7616f8
23f634f
a35ddd5
dc19728
e29ca6a
7ff603c
2cc1c85
e81b4a4
0d48db1
356fd1f
656fe23
1f6448e
9974a50
105dbca
e886a53
99e0fd6
e5c657d
6004fff
fc08505
17e961b
7ee807c
26b9ee8
3d343e7
80b0881
c525a32
83ceef4
378a8c9
2ee3ba0
d7f0615
5e2be9f
07fc075
528fa33
5662c74
93fc20c
38e5f15
96793f8
89850de
30529f7
2324237
44d7373
fb91d9a
775f381
11d4230
1931143
5901a12
1d11ab2
68a0e56
75b9306
8fcb9f1
4d735f4
2ec0599
d44a32e
bbd5e96
3187186
0a768d7
d0403ff
f2ec6f0
1777ebe
9e467a9
930b5c8
10b468d
17049b6
66086f6
bb38a77
4a58f13
cfa721f
75332e4
9379bcb
a2f5008
fa96b0c
1d88eab
11ddd9f
235c12e
67ccf80
564ecab
2568ddc
5fc3583
644dca0
64274fc
ab22511
4b2e0f7
a352d80
3fcac64
0de568d
4db9320
a5140af
e194c11
4930d2e
95e4b27
ec23abc
e865387
b4dd134
1a98f38
d11c92d
0d97985
d994f65
8b358f1
837cc8d
b91e250
372fa25
7e38424
a3ecc3d
dd6a497
e590c9c
b5a294a
ca75470
d8bb938
8564bd9
a0e2b03
65ce45e
3e1ac5f
5705511
a5a8463
643e7b6
64a29e3
5bef72c
8a026b2
4ab48b4
fc409ad
f072371
1c04025
f7fced6
fb9979d
586ce67
324f370
118c944
1658744
26f24b0
1fdde5b
2d87865
8f30dd9
1405790
81acdaf
7122104
ace9844
46a8c4d
e681e4c
642430d
4217bff
7674bbb
6406418
ea9edef
8186e10
7b5305d
43f9178
bdac5a2
e6e9e23
7a0b652
6e8b94b
5083b0a
1682427
b0c51e9
69c7490
ad1d2fe
97188a8
d1a9cde
d6b55d4
ad950be
0193fc1
b4485a0
82a69b8
431da22
9de9538
0e8ea62
3c8fc23
90d1903
9782925
b055c98
3256db6
8d78daa
5783d0b
1284464
b7de171
741ff6d
807a0aa
ec0e737
6f7a38f
59a3522
df4a3b3
23a16b9
5166212
8bc72e7
e685224
32ed01a
dd9ef8d
d7dced1
6b8fcd8
0fd2170
d1c11bb
18ca52f
06fe9b2
3c7f416
e8442f8
d0f0b7c
16016fd
a97018f
939a128
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
# About us | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
 | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
Display | Name | Github Profile | Portfolio | ||
--------|:----------:|:--------------:|:---------: | ||
 | Aarav Rawal | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Tanner Lie | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Fang Sihan | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Samuel | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
 | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,70 @@ | |
|
||
## Design & implementation | ||
|
||
### Architecture | ||
|
||
### UI Component | ||
|
||
# UserCommand feature | ||
|
||
User can type command to do things on the Map. | ||
|
||
If the user type the command, `parseCommand` function will be called. After that, the original input will be | ||
analyzed by `analyseCommand` function to see if it matches a kind of `CommandType`. Then, we will return new | ||
Command back to the main based on the command type. The Final step is to call the `execute` function. If the command | ||
is the type of `fightCommand`, we will call the execute function with one parameter `Scanner`. For all other | ||
conditions, we will call the execute function with no parameter. | ||
|
||
 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps it could be helpful to provide a few more examples of inputs and outputs for correct program behaviour |
||
### Map Component | ||
|
||
The API of this component is defined in BaseMap.java. | ||
|
||
Each map instance consists of a `currentMap` which stores a 2-dimensional array of characters which represents the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great description! |
||
printed map for the player. All maps will come with a given `height` and `width`, all of these attributes are inherited | ||
from the AMap abstract class. Currently, the `FirstMap` and `BattleInterface` classes | ||
extend AMap. `FirstMap` is the first map displayed upon entering the game and it displays the position of the player. | ||
The `BattleInterface` is the map displayed when the player interacts with an `interactable`. | ||
|
||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
|
||
### Interacting with Environment Component | ||
|
||
The API of this component is defined in InteractingCommand.java | ||
|
||
 | ||
|
||
This component happens when the user chooses to key the interact command. <br> | ||
Here is how it works: | ||
1. When the command is passed by the user, the ```CalculaChroniclesOfTheAlgorithmicKingdom``` object calls the ```Parser``` object | ||
to parse the command to call the respective commands. Here, the ```InteractingCommand``` object is created. | ||
2. The ```CalculaChroniclesOfTheAlgorithmicKingdom``` component then calls the execute() method in ```InteractingCommand```. | ||
3. It executes the method and creates other objects like ```Enemy``` and ```ShopKeaper``` components which are responsible for the | ||
entity classes in the game and also ```BattleInterface``` and ```ShopMap``` which are responsible for displaying these entities among other things. | ||
4. The ```BattleInterface``` or ```ShopKeeper``` will then read from a .txt file to store their displays by creating the ```FileReader``` object and | ||
running their respective methods. | ||
5. These displays, textboxes and player status will then be subsequently printed by the ```CalculaChroniclesOfTheAlgorithmicKingdom``` object. | ||
|
||
### Battling Component | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are very many classes and packages, the diagram is very useful to help explain. Perhaps some of the helper classes and packages can also be explained in words. |
||
|
||
The API of this component is defined in FightCommand.java. | ||
|
||
 | ||
|
||
This component happens when the user chooses to fight an enemy. <br> | ||
Here is how it works: | ||
1. When the user chooses to fight, the ```CalculaChroniclesOfTheAlgorithmicKingdom``` object calls the ```Parser``` object | ||
to parse the command to call the respective commands. Here, the ```FightCommand``` object is created. | ||
2. The ```CalculaChroniclesOfTheAlgorithmicKingdom``` object then calls the execute() method in ```FightCommand``` and enables the fighting. | ||
3. The ```MathPool``` object is created, which is responsible for the math questions to answer and another ```Ui``` object is created to interact with the user. | ||
4. In the enebleFight() method, it has a loop which asks the user math questions to answer until the player or enemy dies. The player takes damage for | ||
every wrong answer and deals damage to the enemy for every correct answer. | ||
5. In this loop, there is another loop to parse the answer given by the user, and displays an error message and the same math question | ||
until the user gives an answer which is a valid integer. | ||
6. Once either the player or enemy dies, it then exits and runs the relevant checks to eventually print the output to be shown to | ||
the user after battle, handled by ```CalculaChroniclesOfTheAlgorithmicKingdom```. | ||
|
||
## Product scope | ||
### Target user profile | ||
|
@@ -20,10 +82,10 @@ | |
|
||
## User Stories | ||
|
||
|Version| As a ... | I want to ... | So that I can ...| | ||
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
| Version | As a ... | I want to ... | So that I can ... | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good formatting |
||
|---------|----------|---------------------------|-------------------------------------------------------------| | ||
| v1.0 | new user | see usage instructions | refer to them when I forget how to use the application | | ||
| v2.0 | user | find a to-do item by name | locate a to-do without having to go through the entire list | | ||
|
||
## Non-Functional Requirements | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
@startuml | ||
|
||
box Battle Component | ||
participant "CalculaChroniclesOfTheAlgorithmicKingdom" as main | ||
participant ":UI" as ui | ||
participant ":Parser" as parser | ||
participant ":TextBox" as text | ||
participant ":FightCommand" as f | ||
participant ":PlayerStatus" as player | ||
participant ":Enemy" as e | ||
participant ":BattleInterface" as bi | ||
participant ":FileReader" as fileReader | ||
participant ":Map" as map | ||
participant ":MathPool" as mathpool | ||
|
||
activate main | ||
main -> parser : parseCommand(userCommandText) | ||
activate parser | ||
create f | ||
parser -> f | ||
activate f | ||
f --> parser | ||
deactivate f | ||
parser --> main : command class | ||
deactivate parser | ||
main -> main : executeCommand() | ||
activate main | ||
main -> f : execute() | ||
activate f | ||
f -> bi : enableFight() | ||
activate bi | ||
create mathpool | ||
bi -> mathpool | ||
activate mathpool | ||
mathpool --> bi | ||
deactivate mathpool | ||
bi -> mathpool : init() | ||
activate mathpool | ||
mathpool --> bi | ||
deactivate | ||
create ":UI" as UI | ||
bi -> UI | ||
activate UI | ||
UI --> bi | ||
deactivate UI | ||
loop player and enemy is alive | ||
bi -> player : getPlayerHealth() | ||
activate player | ||
player --> bi : player health | ||
deactivate player | ||
bi -> e : getHealth() | ||
activate e | ||
e --> bi : enemy health | ||
deactivate e | ||
bi -> UI : printPlayerStatus(currentPlayer) | ||
activate UI | ||
UI --> bi | ||
deactivate UI | ||
bi -> UI : printMap(mapData, currentEntity) | ||
activate UI | ||
UI --> bi | ||
deactivate UI | ||
bi -> mathpool : getQuestionByDifficulty(difficulty); | ||
activate mathpool | ||
mathpool --> bi : question | ||
deactivate mathpool | ||
bi -> UI : printQuestion(question) | ||
activate UI | ||
UI --> bi | ||
deactivate UI | ||
loop command is not an integer | ||
bi -> text : setNextError(error) | ||
activate text | ||
text --> bi | ||
deactivate text | ||
bi -> text : setNextInstruction(question) | ||
activate text | ||
text --> bi | ||
deactivate text | ||
bi -> UI : printTextBox() | ||
activate UI | ||
UI --> bi | ||
deactivate UI | ||
end | ||
alt correct answer | ||
bi -> bi : playerHitEnemy() | ||
else wrong answer | ||
bi -> bi : enemyHitPlayer() | ||
end | ||
end | ||
bi --> f | ||
deactivate bi | ||
alt enemy died | ||
f -> map : getInteractX() | ||
activate map | ||
map --> f : x coordinate | ||
deactivate map | ||
f -> map : getInteractY() | ||
activate map | ||
map --> f : y coordinate | ||
deactivate map | ||
f -> map : clearSpot(x coordinate, y coordinate) | ||
activate map | ||
map --> f | ||
deactivate map | ||
f -> map : handleLootingByPlayer() | ||
activate map | ||
map --> f | ||
deactivate map | ||
else player died | ||
f -> map : handleDeath(); | ||
activate map | ||
map --> f | ||
deactivate map | ||
end | ||
f --> main | ||
deactivate f | ||
deactivate main | ||
main -> main : printMessageUnderMap(userCommand, ui, playerStatus, textBox) | ||
activate main | ||
alt not calling help menu or quitting game | ||
alt show battle interface | ||
main -> ui : printEnemy(currentMap) | ||
activate ui | ||
ui --> main | ||
deactivate ui | ||
else | ||
main -> ui : printMap(currentMap) | ||
activate ui | ||
ui --> main | ||
deactivate ui | ||
end | ||
end | ||
|
||
end box | ||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
|
||
Alice -> Bob: Authentication Request | ||
Bob --> Alice: Authentication Response | ||
|
||
Alice -> Bob: Another authentication Request | ||
Alice <-- Bob: another authentication Response | ||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## AMap Class Diagram | ||
|
||
|
||
|
||
|
||
## AMap Sequence Diagram |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The developer guide does not seem to be building to the project website https://ay2324s2-cs2113-w12-3.github.io/tp/DeveloperGuide.html