2 ===================================================
6 -controller: ConsoleController
7 A link to the controller. Set by the ConsoleController.
10 A link to the view. Set by the ConsoleController.
13 The number of iterations of the gameLoop since the battle began.
16 Instantiates and populates Party and Fighter objects.
18 +executeNextEvent(ct: int, cont: ConsoleController): boolean
19 Query the two parties to see if there are any events that can be generated this iteration of the game loop. Return whether or not the event was executed or not.
21 +getCurrentTime(): int
22 +setCurrentTime(ct: int): void
26 +setView(v: ConsoleView): void
27 Sets the view object link. Used by ConsoleController.
29 +setController(c: ConsoleView): void
30 Sets the controller object link. Used by ConsoleController.
33 ===================================================
35 A link to the Battle. Set by constructor.
38 A link to ConsoleView. Set by constructor.
40 -ConsoleController(b: Battle, v: ConsoleView)
41 Sets the links for Battle and ConsoleView so that each of them can ConsoleController and themselves. Afterwards, the game loop starts.
43 +getCommand(f: Fighter): string
44 Prints out an event selection menu and collects a choice from the user.
47 Print out the state of affairs before the battle begins.
49 Loop until one of the parties dies, pausing for some duration each iteration. After the pause, increment the current time of the battle. Then, execute all the events that are available for execution this iteration. Print out the state of affairs.
52 ===================================================
54 A lot of the methods in this class require a lot of printing. The print outs should be compact and organized, utilizing the real estate of each line of output.
58 A link to the battle. Set by the ConsoleController.
60 -controller: ConsoleController
61 A link to the controller. Set by the ConsoleController.
65 +printParty(p: Party): void
66 Prints out the stats for all the fighters in a party. Groups those fighters together.
68 +printFighter(f: Fighter): void
69 Print out the state of the given fighter. This should include all stats and equiption.
71 +printEvent(e: Event): void
72 Print an event's stats. Nothing special, just the attacker, defender, and type.
74 +printEquiption(eq: Equiption): void
75 Print out equiption information.
77 +printEventTypeMenu(f: Fighter): void
78 Print out an enumerated list of events (menu) that a Fighter can actually do. This list can be accesed through the Fighter's getEventTypes method. Keep the same formate as printEventTypeMenu().
80 +printEnemySelectMenu(p: Party): void
81 Print out an enumerated list of fighters (menu) that a the user can select. Keep the same format as printEventTypeMenu().
84 Then print the state of the parties.
86 +setBattle(b: Battle): void
87 Sets the battle object link. Used by ConsoleController.
89 +setController(c: ConsoleController): void
90 Sets the controller object link. Used by ConsoleController.
93 ===================================================
95 The Fighter that initiated the event.
98 The Fighter affected by the event.
101 The type of event to be executed. Currently there is only "Attack".
103 +Event(atk: Fighter,def: Fighter, attackType: string)
104 Initializes and populates the event. Used by Fighter.makeEvent() either by AI or user choice.
106 +getAttacker(): Fighter
107 +getDefender(): Fighter
112 Only handles "Attack" event:
114 If the Attacker succeeds in hitting the Defender, compute the hp loss and subtract that from the defender.
117 ===================================================
119 A string representing the head equiption.
122 A string representing the armor equiption.
125 A string representing the left hand/arm equiption.
128 A string representing the right hand/arm equiption.
130 +Equiption(head: string, armor: string, left: string, right: string)
131 Initialize and populate the Equiption object.
134 +setHead(head: string): void
136 +setArmor(armor: string): void
138 +setLeft(left: string): void
140 +setRight(right: string): void
142 +computeAtkMod(): int
143 Compute Attack value modifiers from equiption data. Current hard coded.
145 +computeDefMod(): int
146 Compute Defense value modifiers from equiption data. Current hard coded.
148 +computeEvaMod(): int
149 Compute Evasion value modifiers from equiption data. Current hard coded.
153 ===================================================
154 This object represents playable and non-playable battle participants.
157 Name of the fighter. Let's keep it down to 15 characters.
160 Health Points. No more than 1,000,000.
163 Affects "Attack" events. Fall between 1 and 255.
166 Affects "Evasion." Falls between 1 and 255.
169 Time that the Fighter gets to move next.
172 Whether the user get to decide this Fighter course of action or not.
175 +setName(name:string): void
179 +setStrength(str:int): void
181 +setDexterity(dex:int): void
184 Computes attack statistic, taking into account all modifiers.
187 Computes defense statistic, taking into account all modifiers.
190 Computes evasde statistic, taking into account all modifiers.
192 +makeEvent(enemy: Party, currentTime: int, controller: ConsoleController): Event
194 If the Fighter is ready to move (when the current time is the time of the player's next move). There are two cases:
196 Case #1: Fighter is playable.
197 An event selection menu is displayed, and an event type is selected from the user through ConsoleController.
199 Case #2: Fighter is not playable
200 A random enemy (alive) from the enemy party is selected. Next, an event type is selected (at the moment "Attack" is the only type) from the list returned from getEventTypes(). Finally an Event is constructed and returned.
202 Return the None object if the Fighter is not ready to move.
205 Return true if hp is greater than 0, false otherwise.
207 +getEventTypes(): string[]
208 Return a list of event types available to this player. (Currently only return Attack) Feel free to hard code.
211 ===================================================
213 A list of fighter representing a party. Between 1 and 6.
216 Instantiate the object. Nothing special.
219 Is the party still alive? Is there a fighter in the party that's still alive?
221 +getNextEvent(enemy: Party, ctime: int, c:ConsoleController): Event
222 Find the first fighter in the party that is ready to generate an event. Return that event. If no events available, return the None object.
224 +addFighter(fighter: Fighter): boolean
225 Add a fighter to the party.
227 +getFighter(findex: int): Fighter
228 Get a fighter from the party.
231 Return a list indicating the size of the party. This should include dead members.