| 1 |
--------------------------------------------------------------------- |
| 2 |
-- This file is part of Freedroid |
| 3 |
-- |
| 4 |
-- Freedroid is free software; you can redistribute it and/or modify |
| 5 |
-- it under the terms of the GNU General Public License as published by |
| 6 |
-- the Free Software Foundation; either version 2 of the License, or |
| 7 |
-- (at your option) any later version. |
| 8 |
-- |
| 9 |
-- Freedroid is distributed in the hope that it will be useful, |
| 10 |
-- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
-- GNU General Public License for more details. |
| 13 |
-- |
| 14 |
-- You should have received a copy of the GNU General Public License |
| 15 |
-- along with Freedroid; see the file COPYING. If not, write to the |
| 16 |
-- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 17 |
-- MA 02111-1307 USA |
| 18 |
---------------------------------------------------------------------- |
| 19 |
--[[WIKI |
| 20 |
PERSONALITY = { "Robotic" }, |
| 21 |
PURPOSE = "$$NAME$$ controls arena functions in the game.", |
| 22 |
BACKSTORY = "$$NAME$$ is the Arena Manager for the RR Resorts.", |
| 23 |
WIKI]]-- |
| 24 |
|
| 25 |
local Npc = FDrpg.get_npc() |
| 26 |
local Tux = FDrpg.get_tux() |
| 27 |
|
| 28 |
local tr_rankings = { |
| 29 |
expert = _"Expert", |
| 30 |
master = _"Master", |
| 31 |
supreme = _"Supreme", |
| 32 |
} |
| 33 |
|
| 34 |
local function start_arena(level) |
| 35 |
arena_current_level = level |
| 36 |
arena_next_wave = 1 |
| 37 |
|
| 38 |
-- Prepare the arena |
| 39 |
change_obstacle_state("Arena-ChangingRoomDoor", "opened") |
| 40 |
change_obstacle_state("Arena-RingEntrance", "opened") |
| 41 |
|
| 42 |
next("arena_start") |
| 43 |
end |
| 44 |
|
| 45 |
return { |
| 46 |
EveryTime = function() |
| 47 |
if (not has_met("Mike")) then |
| 48 |
Tux:says(_"Euh...hello?") |
| 49 |
Npc:says(_"Salutation: Welcome to the arena.") |
| 50 |
Npc:says(_"Presentation: The robot is M.I.K.E.", "NO_WAIT") |
| 51 |
Npc:says(_"Modern Interactive Kombat Executive.") |
| 52 |
Npc:says(_"Tasks: Multiple assignments have been programmed.") |
| 53 |
Npc:says(_"Suggestion: The arena enrollment program is open.") |
| 54 |
show("arena_enroll") |
| 55 |
else |
| 56 |
if (arena_current_level ~= nil) then |
| 57 |
if (arena_won) then |
| 58 |
Npc:says(_"You have won the arena.") |
| 59 |
if (arena_ranking == "expert") then |
| 60 |
arena_ranking = "master" |
| 61 |
elseif (arena_ranking == "master" and arena_current_level == "master") then |
| 62 |
arena_ranking = "supreme" |
| 63 |
end |
| 64 |
show("arena_ready") |
| 65 |
elseif (arena_withdraw) then |
| 66 |
Npc:says(_"Information: You have withdrawn the arena.") |
| 67 |
Npc:says(_"Note: You can restart it another time.") |
| 68 |
--; TRANSLATORS: This sentence use the english adage 'Better safe than sorry'. Use the equivalent adage of the language you translate. |
| 69 |
Npc:says(_"Advice: It is better to be safe than sorry.") |
| 70 |
show("arena_ready") |
| 71 |
else |
| 72 |
Npc:says(_"Information: The arena is already started.") |
| 73 |
show("arena_info_rules", "arena_info_where") hide("arena_ready") |
| 74 |
end |
| 75 |
else |
| 76 |
Npc:says_random(_"Hello.", _"Hi.") |
| 77 |
|
| 78 |
local salutations = { |
| 79 |
_"Salutations: Welcome to the arena.", |
| 80 |
_"Salutations: M.I.K.E. says hello." |
| 81 |
} |
| 82 |
if (arena_ranking ~= nil) then |
| 83 |
table.insert(salutations, _"Salutations: Greeting, Fighter.") |
| 84 |
end |
| 85 |
|
| 86 |
Npc:says_random(table.unpack(salutations)) |
| 87 |
end |
| 88 |
end |
| 89 |
|
| 90 |
show("tasks", "end") |
| 91 |
end, |
| 92 |
{ |
| 93 |
id = "arena_enroll", |
| 94 |
text = _"I want to fight.", |
| 95 |
code = function() |
| 96 |
arena_enroll = true, |
| 97 |
Npc:says(_"Excellent: New challengers are greatly appreciated.") |
| 98 |
Npc:says(_"Registration: Patience, it will take a little moment.") |
| 99 |
Npc:says(_"[b]...Analysis of the bio-signature.[/b]") |
| 100 |
Npc:says(_"[b]...Processing the ranking value.[/b]") |
| 101 |
Npc:says(_"[b]...Saving personal characteristics.[/b]") |
| 102 |
-- TODO: Tux can choose a nickname. This can let's other NPC react to it. |
| 103 |
Npc:says(_"[b]...Fighter registered.[/b]") |
| 104 |
--; TRANSLATORS: %s = Tux:get_player_name() |
| 105 |
Npc:says(_"Compliment: %s is the new challenger.", Tux:get_player_name()) |
| 106 |
-- TODO: Detect the level of Tux to set a higher ranking. |
| 107 |
arena_ranking = "expert" |
| 108 |
--; TRANSLATORS: %s is the ranking of Tux in the arena. |
| 109 |
Npc:says(_"Information: Your ranking has been established to be '%s'.", tr_rankings[arena_ranking]) |
| 110 |
Npc:says(_"Planning: Arena matches are freely scheduled.") |
| 111 |
Npc:says(_"Advice: Begin fighting when you are ready.") |
| 112 |
show("arena_ready") hide("arena_enroll") |
| 113 |
end, |
| 114 |
}, |
| 115 |
{ |
| 116 |
id = "arena_ready", |
| 117 |
text = _"I'm ready to fight.", |
| 118 |
code = function() |
| 119 |
arena_current_level = nil |
| 120 |
arena_won = false |
| 121 |
arena_withdraw = false |
| 122 |
|
| 123 |
--; TRANSLATORS: %s is the ranking of Tux in the arena. |
| 124 |
Npc:says(_"Information: Your ranking has been established to be '%s'.", tr_rankings[arena_ranking]) |
| 125 |
|
| 126 |
if (not arena_info_rank) then |
| 127 |
Npc:says(_"Explanation: The arena is divided into three rank levels.") |
| 128 |
Npc:says(_"First: Expert - the one slaves use to die at arena.") |
| 129 |
Npc:says(_"Second: Master - the audience expects a good fight.") |
| 130 |
Npc:says(_"Third: Supreme - abandon all hope if you enter here.") |
| 131 |
Npc:says(_"Every time you win, you are raised to the next rank.") |
| 132 |
Npc:says(_"Advice: Last rank has the most difficult challenge.") |
| 133 |
arena_info_rank = true |
| 134 |
end |
| 135 |
|
| 136 |
if (arena_ranking == "supreme") then |
| 137 |
Npc:says(_"Choice: You can fight at the 'Expert', 'Master' and 'Supreme' rank.") |
| 138 |
show("arena_expert", "arena_master", "arena_supreme") |
| 139 |
elseif (arena_ranking == "master") then |
| 140 |
Npc:says(_"Choice: You can fight at the 'Expert' and 'Master' rank.") |
| 141 |
show("arena_expert", "arena_master") |
| 142 |
else |
| 143 |
Npc:says(_"Beginning: You can only fight at the 'Expert' rank.") |
| 144 |
show("arena_expert") |
| 145 |
end |
| 146 |
push_topic("arena") |
| 147 |
show("arena_none") |
| 148 |
end, |
| 149 |
}, |
| 150 |
{ |
| 151 |
id = "arena_expert", |
| 152 |
topic = "arena", |
| 153 |
text = _"Let's go at 'Expert' rank.", |
| 154 |
code = function() |
| 155 |
Npc:says(_"Accepted: You have chosen the 'Expert' rank.") |
| 156 |
start_arena("expert") |
| 157 |
end, |
| 158 |
}, |
| 159 |
{ |
| 160 |
id = "arena_master", |
| 161 |
topic = "arena", |
| 162 |
text = _"Let's go at 'Master' rank.", |
| 163 |
code = function() |
| 164 |
Npc:says(_"Accepted: You have chosen 'Master' rank.") |
| 165 |
start_arena("master") |
| 166 |
end, |
| 167 |
}, |
| 168 |
{ |
| 169 |
id = "arena_supreme", |
| 170 |
topic = "arena", |
| 171 |
text = _"Let's go at 'Supreme' rank.", |
| 172 |
code = function() |
| 173 |
Npc:says(_"Accepted: You have chosen 'Supreme' rank.") |
| 174 |
start_arena("supreme") |
| 175 |
end, |
| 176 |
}, |
| 177 |
{ |
| 178 |
id = "arena_none", |
| 179 |
topic = "arena", |
| 180 |
text = _"None for now.", |
| 181 |
code = function() |
| 182 |
Npc:says(_"Accepted: You will fight later.") |
| 183 |
--; TRANSLATORS: This sentence misrepresent the english adage 'Fortune favors the brave'. Use the equivalent adage of the language you translate. |
| 184 |
Npc:says(_"Advice: Fortune favors the cautious.") |
| 185 |
hide("arena_expert", "arena_master", "arena_supreme") |
| 186 |
pop_topic("arena") |
| 187 |
end, |
| 188 |
}, |
| 189 |
{ |
| 190 |
id = "arena_start", |
| 191 |
topic = "arena", |
| 192 |
code = function() |
| 193 |
arena_starting = true |
| 194 |
|
| 195 |
if (not arena_info_rules) then |
| 196 |
next("arena_info_rules") |
| 197 |
arena_info_rules = true |
| 198 |
else |
| 199 |
next("arena_start2") |
| 200 |
end |
| 201 |
|
| 202 |
end, |
| 203 |
}, |
| 204 |
{ |
| 205 |
id = "arena_start2", |
| 206 |
topic = "arena", |
| 207 |
code = function() |
| 208 |
-- TODO: Provide information about the current wave |
| 209 |
|
| 210 |
-- TODO: Clean the arena of bot from previous fight. |
| 211 |
|
| 212 |
Npc:says(_"Preparation: Patience, it will take a little moment.") |
| 213 |
Npc:says(_"[b]...Accessing the matrix.[/b]") |
| 214 |
Npc:says(_"[b]...Initializing the environment.[/b]") |
| 215 |
Npc:says(_"[b]...Reprogramming the Arena.[/b]") |
| 216 |
Npc:says(_"Excellent: The Arena is ready.") |
| 217 |
|
| 218 |
if (not arena_info_where) then |
| 219 |
next("arena_info_where") |
| 220 |
arena_info_where = true |
| 221 |
else |
| 222 |
-- TODO: Provide 'Protip' to Tux. |
| 223 |
next("arena_start3") |
| 224 |
end |
| 225 |
end |
| 226 |
}, |
| 227 |
{ |
| 228 |
id = "arena_start3", |
| 229 |
topic = "arena", |
| 230 |
code = function() |
| 231 |
arena_starting = false |
| 232 |
|
| 233 |
pop_topic("arena") |
| 234 |
hide("arena_ready", "arena_expert", "arena_master", "arena_supreme") |
| 235 |
end_dialog() |
| 236 |
end, |
| 237 |
}, |
| 238 |
{ |
| 239 |
id = "arena_info_rules", |
| 240 |
text = _"Can you explain again?", |
| 241 |
echo_text = false, |
| 242 |
code = function() |
| 243 |
if (not arena_starting) then |
| 244 |
Tux:says(_"Can you explain again?", "NO_WAIT") |
| 245 |
end |
| 246 |
|
| 247 |
Npc:says(_"Instruction: You will fight multiple waves of bots.") |
| 248 |
Npc:says(_"Second: The wave will end when all bots are dead.") |
| 249 |
Npc:says(_"Third: Wave will be only started when you stay on the multicolor floor lamp.") |
| 250 |
Npc:says(_"Fourth: You can only withdraw between waves with the terminal at the entry.") |
| 251 |
Npc:says(_"Warning: Few waves have B.O.S.S.", "NO_WAIT") |
| 252 |
Npc:says(_"Bot Of Special Shock.") |
| 253 |
Npc:says(_"Important: B.O.S.S. are more powerful. You will be signaled to take care.") |
| 254 |
|
| 255 |
if (arena_starting) then |
| 256 |
next("arena_start2") |
| 257 |
end |
| 258 |
end, |
| 259 |
}, |
| 260 |
{ |
| 261 |
id = "arena_info_where", |
| 262 |
text = _"Where I need to go?", |
| 263 |
echo_text = false, |
| 264 |
code = function() |
| 265 |
if (not arena_starting) then |
| 266 |
Tux:says(_"Where I need to go?", "NO_WAIT") |
| 267 |
end |
| 268 |
|
| 269 |
Npc:says(_"Information: The arena is on your west in the corridor.") |
| 270 |
Npc:says(_"Direction: Continue straight ahead after the locker room.") |
| 271 |
Npc:says(_"Advice: If you see a large area surrounded by barrier, you are here.") |
| 272 |
|
| 273 |
if (arena_starting) then |
| 274 |
next("arena_start3") |
| 275 |
end |
| 276 |
end, |
| 277 |
}, |
| 278 |
{ |
| 279 |
id = "tasks", |
| 280 |
text = _"What are your tasks?", |
| 281 |
code = function() |
| 282 |
Npc:says(_"First: Control of incoming droid.") |
| 283 |
Npc:says(_"Second: Prepare the arena installation.") |
| 284 |
Npc:says(_"Third: Save and analyse combat data.") |
| 285 |
Npc:says(_"Important: Kill trespassers.") |
| 286 |
hide("tasks") |
| 287 |
end, |
| 288 |
}, |
| 289 |
{ |
| 290 |
id = "end", |
| 291 |
text = _"...", |
| 292 |
echo_text = false, |
| 293 |
code = function() |
| 294 |
-- TODO. Make Mike ask Tux to be more polite, and quit with a "good bye". |
| 295 |
-- A idea from jesusalva is to allows the traditional linarian salute. |
| 296 |
end_dialog() |
| 297 |
end, |
| 298 |
}, |
| 299 |
} |