Mercurial > sypikslang
comparison gamelib/missions.py @ 96:50f8476aa929
Some milestones.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Wed, 09 May 2012 21:43:04 +0200 |
parents | 0f437e0584f7 |
children | 7cd716328a44 |
comparison
equal
deleted
inserted
replaced
95:0f437e0584f7 | 96:50f8476aa929 |
---|---|
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 # vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4 | 2 # vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4 |
3 | 3 |
4 from random import randint | 4 from random import randint |
5 | 5 |
6 from gamelib.constants import SUCCESS, FAILURE, GAME_WIN | 6 from gamelib.constants import SUCCESS, FAILURE, GAME_WIN, M_VALS |
7 from gamelib.schematics import cat | 7 from gamelib.schematics import cat |
8 | 8 |
9 | 9 |
10 class Result(object): | 10 class Result(object): |
11 """Results of a mission""" | 11 """Results of a mission""" |
32 long description (which may contain clues about approaches)""" | 32 long description (which may contain clues about approaches)""" |
33 | 33 |
34 NAME = "Generic Mission" | 34 NAME = "Generic Mission" |
35 SHORT_DESCRIPTION = None | 35 SHORT_DESCRIPTION = None |
36 LONG_DESCRIPTION = None | 36 LONG_DESCRIPTION = None |
37 | |
37 MINIMUM_REPUTATION = None | 38 MINIMUM_REPUTATION = None |
39 MINIMUM_MILESTONE = "neighbourhood" | |
38 | 40 |
39 def __init__(self, init_data=None): | 41 def __init__(self, init_data=None): |
40 self.data = {} | 42 self.data = {} |
41 | 43 |
42 if init_data is not None: | 44 if init_data is not None: |
64 def sanity_check(cls): | 66 def sanity_check(cls): |
65 pass | 67 pass |
66 | 68 |
67 def can_attempt(self, state): | 69 def can_attempt(self, state): |
68 """Can we currently attempt the mission""" | 70 """Can we currently attempt the mission""" |
71 if (M_VALS[self.MINIMUM_MILESTONE] > M_VALS[state.milestone]): | |
72 # Our base of operations is too small | |
73 return False | |
69 if self.get_data('completed'): | 74 if self.get_data('completed'): |
70 return False | 75 return False |
71 if (self.MINIMUM_REPUTATION is not None and | 76 if (self.MINIMUM_REPUTATION is not None and |
72 self.MINIMUM_REPUTATION > state.reputation): | 77 self.MINIMUM_REPUTATION > state.reputation): |
73 # Don't have the reputation required | 78 # Don't have the reputation required |
116 SHORT_DESCRIPTION = "Steal from those significantly weaker than yourself." | 121 SHORT_DESCRIPTION = "Steal from those significantly weaker than yourself." |
117 LONG_DESCRIPTION = ( | 122 LONG_DESCRIPTION = ( |
118 "It's not menancing, or lucrative, but when the bills are due, no one" | 123 "It's not menancing, or lucrative, but when the bills are due, no one" |
119 " cares how you earn the money.") | 124 " cares how you earn the money.") |
120 | 125 |
126 MINIMUM_MILESTONE = "basement" | |
127 | |
121 def attempt(self, equipment, state): | 128 def attempt(self, equipment, state): |
122 haul = randint(90, 110) | 129 haul = randint(90, 110) |
123 return Result(SUCCESS, haul, -1, ( | 130 return Result(SUCCESS, haul, -1, ( |
124 "You devote your resources to robbing kids in a playpark." | 131 "You devote your resources to robbing kids in a playpark." |
125 " It's not the finest moment in your reign of terror, but at" | 132 " It's not the finest moment in your reign of terror, but at" |
134 LONG_DESCRIPTION = ( | 141 LONG_DESCRIPTION = ( |
135 "Holding China to ransom. The rewards for successfully threatening" | 142 "Holding China to ransom. The rewards for successfully threatening" |
136 " the largest country in the world are great, but the risks are" | 143 " the largest country in the world are great, but the risks are" |
137 " significant. Without some serious firepower, the chances of success" | 144 " significant. Without some serious firepower, the chances of success" |
138 " are small.") | 145 " are small.") |
146 | |
139 MINIMUM_REPUTATION = 100 | 147 MINIMUM_REPUTATION = 100 |
148 MINIMUM_MILESTONE = "city" | |
140 | 149 |
141 def _new_data(self): | 150 def _new_data(self): |
142 self.data['prior_attempts'] = [] | 151 self.data['prior_attempts'] = [] |
143 | 152 |
144 def attempt_no_equipment(self, state): | 153 def attempt_no_equipment(self, state): |
183 SHORT_DESCRIPTION = "We could use a more amenable dictator there." | 192 SHORT_DESCRIPTION = "We could use a more amenable dictator there." |
184 LONG_DESCRIPTION = ( | 193 LONG_DESCRIPTION = ( |
185 "It's a small and fairly useless country, but it's still an actual" | 194 "It's a small and fairly useless country, but it's still an actual" |
186 " government that can be toppled. A good test bed for some of the" | 195 " government that can be toppled. A good test bed for some of the" |
187 " larger toys in the armory.") | 196 " larger toys in the armory.") |
197 | |
188 MINIMUM_REPUTATION = 50 | 198 MINIMUM_REPUTATION = 50 |
189 | 199 |
190 def attempt_no_equipment(self, state): | 200 def attempt_no_equipment(self, state): |
191 return Result(FAILURE, 0, 0, ( | 201 return Result(FAILURE, 0, 0, ( |
192 "The border post may be poorly guarded, but you need to" | 202 "The border post may be poorly guarded, but you need to" |
213 NAME = "Rob the local bank" | 223 NAME = "Rob the local bank" |
214 SHORT_DESCRIPTION = "A trivial challenge, but easy money." | 224 SHORT_DESCRIPTION = "A trivial challenge, but easy money." |
215 LONG_DESCRIPTION = ( | 225 LONG_DESCRIPTION = ( |
216 "The security guards and local police are of minor concern. Walk in," | 226 "The security guards and local police are of minor concern. Walk in," |
217 " clean out the vault, walk out. Couldn't be simpler.") | 227 " clean out the vault, walk out. Couldn't be simpler.") |
228 | |
229 MINIMUM_MILESTONE = "basement" | |
218 | 230 |
219 def attempt_no_equipment(self, state): | 231 def attempt_no_equipment(self, state): |
220 return Result(FAILURE, 0, 0, ( | 232 return Result(FAILURE, 0, 0, ( |
221 "Your attempt to rob the bank barehanded is unsuccessful." | 233 "Your attempt to rob the bank barehanded is unsuccessful." |
222 " Fortunately, everyone is too stunned to impede your" | 234 " Fortunately, everyone is too stunned to impede your" |
273 SHORT_DESCRIPTION = "The populace need to be told the truth!" | 285 SHORT_DESCRIPTION = "The populace need to be told the truth!" |
274 LONG_DESCRIPTION = ( | 286 LONG_DESCRIPTION = ( |
275 "A focused pamphlet distribution campaign will combat the lies being" | 287 "A focused pamphlet distribution campaign will combat the lies being" |
276 " spread about you. Replacing them with better lies, of course.") | 288 " spread about you. Replacing them with better lies, of course.") |
277 | 289 |
290 MINIMUM_MILESTONE = "basement" | |
291 | |
278 SUCCESS_MESSAGE = ( | 292 SUCCESS_MESSAGE = ( |
279 "A small army of urchins delivers thousands of cheaply printed" | 293 "A small army of urchins delivers thousands of cheaply printed" |
280 " pamphlets. %s") | 294 " pamphlets. %s") |
281 | 295 |
282 def attempt_no_equipment(self, state): | 296 def attempt_no_equipment(self, state): |
310 SHORT_DESCRIPTION = "It's for their own good." | 324 SHORT_DESCRIPTION = "It's for their own good." |
311 LONG_DESCRIPTION = ( | 325 LONG_DESCRIPTION = ( |
312 "Someone has to rule the world and if it's not you it'd just be" | 326 "Someone has to rule the world and if it's not you it'd just be" |
313 " someone less well qualified -- and that would be worse for" | 327 " someone less well qualified -- and that would be worse for" |
314 " everyone.") | 328 " everyone.") |
329 | |
315 MINIMUM_REPUTATION = 200 | 330 MINIMUM_REPUTATION = 200 |
316 | 331 MINIMUM_MILESTONE = "city" |
317 SUCCESS_MESSAGE = ( | |
318 "A small army of urchins delivers thousands of cheaply printed" | |
319 " pamphlets. %s") | |
320 | 332 |
321 def attempt_no_equipment(self, state): | 333 def attempt_no_equipment(self, state): |
322 return Result(FAILURE, 0, 0, "It's going to take more than your bare" | 334 return Result(FAILURE, 0, 0, "It's going to take more than your bare" |
323 " hands to take over the world!") | 335 " hands to take over the world!") |
324 | 336 |