Mercurial > sypikslang
annotate gamelib/missions.py @ 266:381fa22d217b
Fix width / height confusion buglet
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sun, 15 Dec 2013 11:43:17 +0200 |
parents | 7a6396ea2cc6 |
children |
rev | line source |
---|---|
5 | 1 # -*- coding: utf-8 -*- |
2 # vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4 | |
3 | |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
4 from random import randint, random, choice |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
5 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
6 from gamelib.constants import SUCCESS, FAILURE, GAME_WIN, M_VALS |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
7 from gamelib.schematics import cat |
209 | 8 from gamelib.research import Biogenetics |
18
0849ab5304cf
Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents:
13
diff
changeset
|
9 |
5 | 10 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
11 class Result(Exception): |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
12 """Results of a mission. |
13
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
13 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
14 This is an exception so we can throw it from inside helper methods. |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
15 """ |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
16 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
17 def __init__(self, outcome, msg, money=0, rep=0, **special): |
13
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
18 self.outcome = outcome |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
19 self.money = money |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
20 self.reputation = rep |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
21 self.text = msg |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
22 self.special = special |
13
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
23 self.applied = False |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
24 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
25 @property |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
26 def loot(self): |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
27 loot = {} |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
28 if self.money != 0: |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
29 loot['money'] = self.money |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
30 if self.reputation != 0: |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
31 loot['rep'] = self.reputation |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
32 loot.update(self.special) |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
33 loot.pop('new_milestone', None) # This one's special. |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
34 return loot |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
35 |
13
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
36 def apply(self, state): |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
37 if not self.applied: |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
38 state.money += self.money |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
39 state.reputation += self.reputation |
164
7beac783139b
Fix calling of apply_mission_special to avoid gamestate.milestone ending up as a dict.
Simon Cross <hodgestar@gmail.com>
parents:
159
diff
changeset
|
40 state.apply_mission_special(**self.special) |
13
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
41 self.applied = True |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
42 else: |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
43 raise RuntimeError('attempted to apply result twice') |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
44 |
c0966997e0c5
Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents:
10
diff
changeset
|
45 |
5 | 46 class Mission(object): |
47 """Base class for the mission objects. | |
48 Missions have a name, short description (for list displays) and | |
49 long description (which may contain clues about approaches)""" | |
50 | |
51 NAME = "Generic Mission" | |
52 SHORT_DESCRIPTION = None | |
53 LONG_DESCRIPTION = None | |
96 | 54 |
33
12c33aac7684
Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents:
32
diff
changeset
|
55 MINIMUM_REPUTATION = None |
96 | 56 MINIMUM_MILESTONE = "neighbourhood" |
124
685301e35f88
Add a minion cost to missions
Neil Muller <drnlmuller@gmail.com>
parents:
123
diff
changeset
|
57 MINIONS_REQUIRED = 1 |
5 | 58 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
59 GENERIC_FAILURE = "You fail to inspire sufficient fear." |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
60 GENERIC_SUCCESS = "Victory is sweet." |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
61 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
62 "Really? You're going in completely unequipped? How brave. And " |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
63 " foolish. And ultimately unsuccessful.") |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
64 |
22
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
65 def __init__(self, init_data=None): |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
66 self.data = {} |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
67 |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
68 if init_data is not None: |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
69 # Load stored state. |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
70 self._load_data(init_data) |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
71 else: |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
72 # New instance. |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
73 self._new_data() |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
74 |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
75 def _new_data(self): |
22
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
76 pass |
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
77 |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
78 def _load_data(self, init_data): |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
79 # Note: this does not deep-copy. |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
80 self.data = init_data.copy() |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
81 |
22
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
82 def save_data(self): |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
83 # Note: this does not deep-copy. |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
84 return self.data.copy() |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
85 |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
86 def get_data(self, key): |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
87 return self.data.get(key, None) |
22
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
88 |
192
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
89 def get_description(self): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
90 return self.LONG_DESCRIPTION |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
91 |
94
245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
Jeremy Thurgood <firxen@gmail.com>
parents:
92
diff
changeset
|
92 @classmethod |
245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
Jeremy Thurgood <firxen@gmail.com>
parents:
92
diff
changeset
|
93 def sanity_check(cls): |
245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
Jeremy Thurgood <firxen@gmail.com>
parents:
92
diff
changeset
|
94 pass |
245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
Jeremy Thurgood <firxen@gmail.com>
parents:
92
diff
changeset
|
95 |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
96 def can_attempt(self, state): |
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
97 """Can we currently attempt the mission""" |
96 | 98 if (M_VALS[self.MINIMUM_MILESTONE] > M_VALS[state.milestone]): |
99 # Our base of operations is too small | |
100 return False | |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
101 if self.get_data('completed'): |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
102 return False |
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
103 if (self.MINIMUM_REPUTATION is not None and |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
104 self.MINIMUM_REPUTATION > state.reputation): |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
105 # Don't have the reputation required |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
106 return False |
124
685301e35f88
Add a minion cost to missions
Neil Muller <drnlmuller@gmail.com>
parents:
123
diff
changeset
|
107 if self.MINIONS_REQUIRED > state.minions: |
685301e35f88
Add a minion cost to missions
Neil Muller <drnlmuller@gmail.com>
parents:
123
diff
changeset
|
108 # Need more minions! |
685301e35f88
Add a minion cost to missions
Neil Muller <drnlmuller@gmail.com>
parents:
123
diff
changeset
|
109 return False |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
110 return True |
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
111 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
112 def fail(self, msg=None, money=0, rep=0, **special): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
113 if msg is None: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
114 msg = self.GENERIC_FAILURE |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
115 raise Result(FAILURE, msg, money=money, rep=rep, **special) |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
116 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
117 def succeed(self, msg=None, money=0, rep=0, **special): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
118 if msg is None: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
119 msg = self.GENERIC_SUCCESS |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
120 raise Result(SUCCESS, msg, money=money, rep=rep, **special) |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
121 |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
122 def categorise_equipment(self, equipment): |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
123 # Categorise equipment for easier decision-making. |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
124 categorised = {} |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
125 for item in equipment: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
126 for category in item.CATEGORIES: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
127 categorised.setdefault(category, []).append(item) |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
128 return categorised |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
129 |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
130 def attempt_mission(self, equipment, state): |
5 | 131 """Attempt the mission with the given equipment list. |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
132 Returns a result object with the results of the mission.""" |
5 | 133 |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
134 # Handle error case |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
135 if self.get_data('completed'): |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
136 raise RuntimeError('Cannot attempt a completed mission') |
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
137 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
138 try: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
139 self.attempt(equipment, state) |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
140 except Result, e: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
141 return e |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
142 |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
143 def attempt(self, equipment, state): |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
144 # No equipment is usually a special case. |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
145 if not equipment: |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
146 return self.attempt_no_equipment(state) |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
147 |
241
f5d9a063013b
Fail very long equipment lists automatically
Neil Muller <drnlmuller@gmail.com>
parents:
239
diff
changeset
|
148 # Fail overly complex plans automatically |
f5d9a063013b
Fail very long equipment lists automatically
Neil Muller <drnlmuller@gmail.com>
parents:
239
diff
changeset
|
149 if len(equipment) > 10: |
f5d9a063013b
Fail very long equipment lists automatically
Neil Muller <drnlmuller@gmail.com>
parents:
239
diff
changeset
|
150 self.fail( |
f5d9a063013b
Fail very long equipment lists automatically
Neil Muller <drnlmuller@gmail.com>
parents:
239
diff
changeset
|
151 "Your plan is much too complicated, doctor. Surely there" |
f5d9a063013b
Fail very long equipment lists automatically
Neil Muller <drnlmuller@gmail.com>
parents:
239
diff
changeset
|
152 " is a more elegant solution?") |
f5d9a063013b
Fail very long equipment lists automatically
Neil Muller <drnlmuller@gmail.com>
parents:
239
diff
changeset
|
153 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
154 # Try with some equipment. |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
155 self.attempt_with(self.categorise_equipment(equipment), state) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
156 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
157 # No result, so generic failure. |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
158 self.fail() |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
159 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
160 def attempt_no_equipment(self, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
161 self.fail(self.NO_EQUIP_FAILURE) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
162 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
163 def attempt_with(self, categorised, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
164 self.fail("You can't succceed at this mission.") |
5 | 165 |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
166 def combat_power(self, categorised, cats=None): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
167 if cats is None: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
168 cats = [cat.HAND_WEAPON, cat.VEHICLE, cat.COUNTERMEASURE, |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
169 cat.INTELLIGENCE] |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
170 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
171 combat_equipment = set() |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
172 for category in cats: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
173 combat_equipment.update(categorised.get(category, [])) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
174 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
175 power = 0 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
176 for equipment in combat_equipment: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
177 power += equipment.power() |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
178 return power |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
179 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
180 def check_failure(self, categorised): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
181 equipment = set() |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
182 for items in categorised.values(): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
183 equipment.update(items) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
184 for item in equipment: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
185 if item.reliability() < random(): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
186 return item.FAILURE_TEXT |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
187 return None |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
188 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
189 def use_equipment(self, categorised, msg="Disaster strikes! %s", **loot): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
190 failure = self.check_failure(categorised) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
191 if failure is not None: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
192 self.fail(msg % (failure,), **loot) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
193 |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
194 def use_equipment_category(self, categorised, category): |
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
195 self.use_equipment({category: categorised[category]}) |
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
196 |
5 | 197 |
19
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
198 class PlaygroundBully(Mission): |
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
199 |
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
200 NAME = "Rob kids in the playground" |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
201 SHORT_DESCRIPTION = "Steal from those significantly weaker than yourself." |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
202 LONG_DESCRIPTION = ( |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
203 "It's not menancing, or lucrative, but when the bills are due, no one" |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
204 " cares how you earn the money.") |
19
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
205 |
96 | 206 MINIMUM_MILESTONE = "basement" |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
207 GENERIC_SUCCESS = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
208 "You devote your resources to robbing kids in a playpark. It's not the" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
209 " finest moment in your reign of terror, but at least you walked away" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
210 " with a surprising amount of small change.") |
96 | 211 |
32 | 212 def attempt(self, equipment, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
213 self.succeed(money=randint(90, 110), rep=-1) |
19
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
214 |
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
215 |
5 | 216 class RansomChina(Mission): |
217 | |
218 NAME = "Hold China to ransom" | |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
219 SHORT_DESCRIPTION = "Surely a path to riches and fame." |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
220 LONG_DESCRIPTION = ( |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
221 "Holding China to ransom. The rewards for successfully threatening" |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
222 " the largest country in the world are great, but the risks are" |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
223 " significant. Without some serious firepower, the chances of success" |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
224 " are small.") |
96 | 225 |
33
12c33aac7684
Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents:
32
diff
changeset
|
226 MINIMUM_REPUTATION = 100 |
96 | 227 MINIMUM_MILESTONE = "city" |
5 | 228 |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
229 def _new_data(self): |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
230 self.data['prior_attempts'] = [] |
5 | 231 |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
232 def attempt_no_equipment(self, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
233 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
234 "It takes three different interpreters before the Chinese" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
235 " government finally understand that you're trying to hold" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
236 " them ransom with... well... nothing. Nothing at all. This" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
237 " one will probably make a good anecdote at diplomatic" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
238 " cocktail parties. But not for you. No, not for you at all.", |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
239 rep=-10) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
240 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
241 def attempt_with(self, categorised, state): |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
242 dooms = categorised.get(cat.DOOMSDAY_DEVICE, []) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
243 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
244 if not dooms: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
245 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
246 "You completely fail to inspire the requisite level of" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
247 " terror. Maybe a more impressive threat will fare better.", |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
248 rep=-1) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
249 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
250 if len(dooms) > 1: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
251 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
252 "Everyone seems confused as to how you actually plan" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
253 " to cause widepsread distruction and mayhem, and" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
254 " negotiations break down. Perhaps it's better to stick" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
255 " to one weapon of mass destruction at a time.") |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
256 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
257 [doom] = dooms |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
258 if doom.NAME in self.data['prior_attempts']: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
259 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
260 "'We have devised countermeasures since last time, doctor." |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
261 " You cannot threaten us with that again.'") |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
262 |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
263 self.use_equipment(categorised, rep=randint(-5, -2)) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
264 |
237 | 265 self.data['prior_attempts'].append(doom.NAME) |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
266 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
267 "Trembling at you threat of certain doom, the Chinese" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
268 " government pays the ransom.", |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
269 money=randint(800000, 1200000), rep=10) |
5 | 270 |
271 | |
35 | 272 class ToppleThirdWorldGovernment(Mission): |
273 | |
274 NAME = "Topple a third-world government" | |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
275 SHORT_DESCRIPTION = "We could use a more amenable dictator there." |
35 | 276 LONG_DESCRIPTION = ( |
277 "It's a small and fairly useless country, but it's still an actual" | |
278 " government that can be toppled. A good test bed for some of the" | |
279 " larger toys in the armory.") | |
96 | 280 |
35 | 281 MINIMUM_REPUTATION = 50 |
282 | |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
283 GENERIC_FAILURE = ( |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
284 "Your invasion force was outclassed by the incumbent military, Not" |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
285 " surprising, since it turns out they've had a lot of practice in the" |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
286 " recent series of revolutions.") |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
287 |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
288 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
289 "The border post may be poorly guarded, but you need to bring *some*" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
290 " kind of weaponry along. Your troops sulk on the way home.") |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
291 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
292 def attempt_with(self, categorised, state): |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
293 self.use_equipment(categorised) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
294 if self.combat_power(categorised) > randint(60, 120): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
295 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
296 "The corruption and oppression continue, but at least the" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
297 " proceeds are making their way into *your* pockets. And you" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
298 " don't even have to dirty your own jackboots.", |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
299 money=randint(5000, 15000), rep=randint(3, 7)) |
35 | 300 |
301 | |
5 | 302 class RobBank(Mission): |
303 | |
304 NAME = "Rob the local bank" | |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
305 SHORT_DESCRIPTION = "A trivial challenge, but easy money." |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
306 LONG_DESCRIPTION = ( |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
307 "The security guards and local police are of minor concern. Walk in," |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
308 " clean out the vault, walk out. Couldn't be simpler.") |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
309 |
96 | 310 MINIMUM_MILESTONE = "basement" |
311 | |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
312 GENERIC_FAILURE = ( |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
313 "The bank's security arrangements are rather more impressive than you" |
171 | 314 " were led to believe. Bring bigger guns next time.") |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
315 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
316 "Your attempt to rob the bank barehanded is unsuccessful. Fortunately," |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
317 " everyone is too stunned to impede your escape.") |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
318 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
319 def attempt_with(self, categorised, state): |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
320 loot = randint(500, 1500) |
5 | 321 |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
322 self.use_equipment(categorised) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
323 |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
324 if cat.VEHICLE in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
325 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
326 "Your vehicles are impressively doom-laden, but not really" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
327 " suitable for city traffic. You intimidate the traffic" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
328 " wardens into letting you off without a fine, but by the" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
329 " time you get to the bank it's already closed.") |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
330 |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
331 if cat.PATHOGEN in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
332 if randint(5, 15) < state.reputation: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
333 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
334 "The clerk doesn't realise the threat of the vial you" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
335 " hold, and although watching him die in agony would be" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
336 " statisfying, you decide it's not worth wasting this on" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
337 " something so trivial.") |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
338 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
339 "Holding up a bank with only a small vial of clear liquid. Now" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
340 " that is power.", |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
341 money=loot, rep=1) |
10
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
342 |
175 | 343 if cat.AI in categorised: |
344 self.success( | |
345 "Your cunning AI easily penetrates the bank's computing" | |
346 " systems and transfers the money to you account.", | |
347 money=loot) | |
348 | |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
349 if self.combat_power(categorised) > randint(5, 20): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
350 self.succeed( |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
351 "The threat of your weapons is enough to inspire an impressive" |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
352 " level of cooperation. You make off with the loot.", |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
353 money=loot) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
354 |
10
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
355 |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
356 class DestroyMountRushmore(Mission): |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
357 |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
358 NAME = "Destroy Mount Rushmore" |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
359 SHORT_DESCRIPTION = "Monuments to other people? Intolerable" |
92 | 360 LONG_DESCRIPTION = ( |
361 "While potentially expensive, destroying a major monument is a" | |
362 " good way to secure your reputation.") | |
33
12c33aac7684
Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents:
32
diff
changeset
|
363 MINIMUM_REPUTATION = 20 |
10
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
364 |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
365 def attempt(self, equipment, state): |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
366 self.data['completed'] = True |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
367 self.succeed("Mount Rushmore is remarkably easy to destroy.", rep=50) |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
368 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
369 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
370 class DistributePamphlets(Mission): |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
371 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
372 NAME = "Distribute pamphlets" |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
373 SHORT_DESCRIPTION = "The populace need to be told the truth!" |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
374 LONG_DESCRIPTION = ( |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
375 "A focused pamphlet distribution campaign will combat the lies being" |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
376 " spread about you. Replacing them with better lies, of course.") |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
377 |
96 | 378 MINIMUM_MILESTONE = "basement" |
379 | |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
380 SUCCESS_MESSAGE = ( |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
381 "A small army of urchins delivers thousands of cheaply printed" |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
382 " pamphlets. %s") |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
383 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
384 def _succ(self, message, rep): |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
385 self.succeed(self.SUCCESS_MESSAGE % (message,), rep=rep) |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
386 |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
387 def attempt_no_equipment(self, state): |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
388 rep = randint(-2, 5) |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
389 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
390 if rep < 0: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
391 self._succ( |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
392 "Sadly, the populace was so annoyed by the flood of flyers" |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
393 " that nobody took any notice of the content.", rep) |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
394 if rep == 0: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
395 self._succ("Nobody seems to have noticed.", rep) |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
396 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
397 self._succ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
398 "The public seemed mildly receptive to your propaganda.", rep) |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
399 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
400 def attempt_with(self, categorised, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
401 if cat.MIND_CONTROL in categorised: |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
402 self.use_equipment_category(categorised, cat.MIND_CONTROL) |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
403 self._succ("Your creative use of science has paid off nicely.", |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
404 randint(5, 10)) |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
405 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
406 return self.attempt_no_equipment(state) |
95
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
407 |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
408 |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
409 class TakeOverTheWorld(Mission): |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
410 |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
411 NAME = "Take over the world!" |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
412 SHORT_DESCRIPTION = "It's for their own good." |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
413 LONG_DESCRIPTION = ( |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
414 "Someone has to rule the world and if it's not you it'd just be" |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
415 " someone less well qualified -- and that would be worse for" |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
416 " everyone.") |
96 | 417 |
95
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
418 MINIMUM_REPUTATION = 200 |
96 | 419 MINIMUM_MILESTONE = "city" |
95
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
420 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
421 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
422 "It's going to take more than your bare hands to take over the world!") |
95
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
423 |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
424 def attempt_with(self, categorised, state): |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
425 if cat.MIND_CONTROL not in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
426 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
427 "If you're going to take over the world, first you must" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
428 " control key elements within the populace.", rep=-5) |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
429 raise Result(GAME_WIN, "The world is yours!", rep=100) |
123
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
430 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
431 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
432 class TakeOverTheNeighbourhood(Mission): |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
433 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
434 NAME = "Take over the neighbourhood!" |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
435 SHORT_DESCRIPTION = "First step toward greatness." |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
436 LONG_DESCRIPTION = ( |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
437 "A basement lab is a good starting point, but it's getting a bit" |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
438 " cramped in here. You need to expand, but don't quite have the" |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
439 " resources to take the whole world yet. Or even the city. But the" |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
440 " neighbourhood... that's quite feasible.") |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
441 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
442 MINIMUM_REPUTATION = 20 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
443 MINIMUM_MILESTONE = "basement" |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
444 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
445 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
446 "The neighbourhood isn't very big, but you're still not going to take" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
447 " it over bare-handed.") |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
448 GENERIC_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
449 "Well, that didn't work. Maybe a better equipment selection is in" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
450 " order.") |
123
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
451 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
452 def attempt_with(self, categorised, state): |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
453 if all(c in categorised for c in (cat.MIND_CONTROL, cat.HAND_WEAPON)): |
129 | 454 self.data['completed'] = True |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
455 self.succeed( |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
456 "Guns and persuasion, that's all you need. It's early days" |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
457 " still, but you're finally out of that pokey basement and" |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
458 " have some elbow room to work with. Next step: the city!", |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
459 money=randint(1000, 2000), rep=randint(5, 15), |
207 | 460 new_milestone="neighbourhood", income=100) |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
461 |
123
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
462 if cat.HAND_WEAPON in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
463 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
464 "You'll need more than guns to win the people over. But until" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
465 " then, you can take their cash.", money=randint(100, 200)) |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
466 |
123
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
467 if cat.MIND_CONTROL in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
468 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
469 "Propaganda and persuasion are good tools, but you'll need" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
470 " some force to back them up.", rep=randint(2, 4)) |
175 | 471 |
472 | |
181 | 473 class TakeOverTheCity(Mission): |
474 NAME = "Take over the city" | |
475 SHORT_DESCRIPTION = "Time to grow" | |
476 LONG_DESCRIPTION = ( | |
477 "It's time to spread your wings and take your rightful place as" | |
478 " a major player. And what better way than by securing your base" | |
479 " of operations?") | |
480 | |
481 MINIMUM_REPUTATION = 100 | |
482 MINIMUM_MILESTONE = "neighbourhood" | |
483 | |
484 NO_EQUIP_FAILURE = ( | |
485 "You are thrown out of city hall for making a scene. The fools will" | |
486 " pay for this when you return with more firepower.") | |
487 GENERIC_FAILURE = ( | |
488 "Well, that didn't work. Maybe a better equipment selection is in" | |
489 " order.") | |
490 | |
491 def attempt_with(self, categorised, state): | |
492 if cat.DOOMSDAY_DEVICE in categorised: | |
493 self.data['completed'] = True | |
494 self.succeed( | |
495 "Overwhelming force! It works for governments, and it works" | |
496 " for you. The city cowers before you, and you finally" | |
497 " feel like you're getting somewhere. Soon, the world will" | |
498 " be yours.", money=randint(10000, 20000), | |
207 | 499 rep=randint(10, 20), new_milestone='city', income=1000) |
181 | 500 |
501 if cat.AI in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
502 self.use_equipment_category(categorised, cat.AI) |
181 | 503 self.succeed( |
504 "While the AI can't control the entire city, you can at" | |
505 " least ensure the budget is well spent", | |
506 money=randint(10000, 30000)) | |
507 | |
508 if cat.MIND_CONTROL in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
509 self.use_equipment_category(categorised, cat.MIND_CONTROL) |
181 | 510 self.succeed( |
511 "Running a city requires controlling more than just a few" | |
512 " key people. Still, making the mayor dance to your tune" | |
513 " is not without it's benefits", money=randint(3000, 7000), | |
514 rep=randint(3, 7)) | |
515 | |
516 if cat.VEHICLE in categorised: | |
517 self.fail( | |
518 "While you can muster a significant force, you don't want" | |
519 " to destroy the city in the inevitable fighting. You need" | |
520 " to ensure no-one tries to resist.") | |
521 | |
522 if cat.HAND_WEAPON in categorised: | |
523 self.fail( | |
524 "You'll need more than a handful of guns, no matter" | |
525 " how powerful, to subdue a city") | |
526 | |
527 | |
175 | 528 class ShowThemAll(Mission): |
529 | |
179 | 530 NAME = "And they called me mad!" |
175 | 531 SHORT_DESCRIPTION = "Time for revenge." |
532 LONG_DESCRIPTION = ( | |
533 "You've outgrown the chains of convention your teachers tried" | |
534 " to force you into. It's time to show the world what true" | |
535 " genius can accomplish. And what better way than with a small" | |
536 " slice of revenge?") | |
537 | |
538 MINIMUM_REPUTATION = 20 | |
539 MINIMUM_MILESTONE = "neighbourhood" | |
540 | |
541 NO_EQUIP_FAILURE = ( | |
542 "A security guard escorts you off campus after finding you clawing" | |
543 " at the science building with your bare hands. He doesn't say" | |
544 " anything, but you can already hear the gossip.") | |
545 | |
546 def attempt_no_equipment(self, state): | |
547 self.fail(self.NO_EQUIP_FAILURE, rep=-5) | |
548 | |
549 def attempt_with(self, categorised, state): | |
176 | 550 |
551 self.use_equipment(categorised) | |
552 | |
178 | 553 if cat.DOOMSDAY_DEVICE in categorised: |
175 | 554 self.data['completed'] = True |
555 self.succeed( | |
556 "The fools cower in terror at your display of power. Finally" | |
557 " they are forced to acknowledge your genius.", | |
558 rep=randint(10, 15)) | |
559 | |
560 if cat.BEAST in categorised: | |
179 | 561 if all(cat.AQUATIC in x.CATEGORIES for x in |
175 | 562 categorised[cat.BEAST]): |
176 | 563 self.fail( |
564 "While the beast is terrifying, the effect is" | |
565 " unfortuantely significantly lessened the need for a " | |
566 " large water tank, and the it's inability to move " | |
179 | 567 " independantly. Perhaps you need to rethink your plan?") |
176 | 568 else: |
175 | 569 self.data['completed'] = True |
570 self.succeed( | |
571 "Your monstrous creation rampages through campus in a" | |
572 " most statisfying way. They will not forgot this.", | |
573 rep=randint(5, 12)) | |
574 | |
575 if cat.HAND_WEAPON in categorised: | |
576 self.fail( | |
577 "Mere crude force is not the answer. You need some more" | |
578 " fitting demonstration of your power.") | |
176 | 579 |
580 | |
581 class SubvertNews(Mission): | |
582 NAME = "Subvert the news network" | |
583 SHORT_DESCRIPTION = "Stop the lies!" | |
584 LONG_DESCRIPTION = ( | |
585 "Worringly, people appear to be easily duped by the lies broadcast" | |
586 " about you. Time to fight fire with fire!") | |
587 | |
588 MINIMUM_REPUTATION = 15 | |
589 MINIMUM_MILESTONE = "neighbourhood" | |
590 | |
591 NO_EQUIP_FAILURE = ( | |
592 "You fail to even get into the building. Perhaps you need to" | |
593 " rethink your approach") | |
594 | |
595 def attempt_with(self, categorised, state): | |
596 | |
597 self.use_equipment(categorised) | |
598 | |
599 if cat.MIND_CONTROL in categorised: | |
600 self.succeed( | |
601 "With the proper equipment, it's a simple matter to" | |
602 " convince people of the correctness of your point" | |
603 " of view. If only everything were so simple", | |
604 rep=randint(5, 15)) | |
605 | |
178 | 606 if cat.AI in categorised: |
176 | 607 self.succeed( |
608 "Your AI has complete control of the broadcasters computer" | |
609 " system. After all, it's not censorship if you're stopping" | |
610 " them broadcasting blatant lies, now is it?", | |
611 rep=randint(5, 10)) | |
612 | |
178 | 613 if any(c in categorised for c in (cat.VEHICLE, cat.DOOMSDAY_DEVICE, |
614 cat.BEAST)): | |
176 | 615 self.succeed( |
616 "Cowering in fear, the broadcaster agrees to change the" | |
617 " tone of their stories.", rep=randint(2, 5)) | |
618 | |
178 | 619 if cat.HAND_WEAPON in categorised: |
176 | 620 self.fail( |
621 "The news station's security is surprisingly well prepared." | |
179 | 622 " Perhaps you should rethink your approach?", |
176 | 623 rep=-randint(5, 10)) |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
624 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
625 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
626 class RaidLab(Mission): |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
627 NAME = "Raid Rival Lab" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
628 SHORT_DESCRIPTION = "Why not let other people work for you?" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
629 LONG_DESCRIPTION = ( |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
630 "While clearly no match for your genius, sometimes your rivals stumble" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
631 " onto something interesting. Surely their results can be put to" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
632 " better use helping your plans?") |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
633 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
634 MINIMUM_MILESTONE = "neighbourhood" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
635 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
636 NO_EQUIP_FAILURE = ( |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
637 "Your rival may not be the sharpest tool in the shed, but even a" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
638 " fool invests in some defenses. You'll need to be better prepared" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
639 " in the future.") |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
640 |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
641 def _succ(self, msg, state): |
247
594c45f0f685
Don't reward science or schematics when we know everything
Neil Muller <drnlmuller@gmail.com>
parents:
241
diff
changeset
|
642 possible_rewards = ['schematic', 'science'] |
594c45f0f685
Don't reward science or schematics when we know everything
Neil Muller <drnlmuller@gmail.com>
parents:
241
diff
changeset
|
643 possible_rewards.extend(['money'] * 5) |
594c45f0f685
Don't reward science or schematics when we know everything
Neil Muller <drnlmuller@gmail.com>
parents:
241
diff
changeset
|
644 possible_rewards.extend(['nothing'] * 3) |
594c45f0f685
Don't reward science or schematics when we know everything
Neil Muller <drnlmuller@gmail.com>
parents:
241
diff
changeset
|
645 if not state.lab.new_research: |
594c45f0f685
Don't reward science or schematics when we know everything
Neil Muller <drnlmuller@gmail.com>
parents:
241
diff
changeset
|
646 possible_rewards.remove('science') |
594c45f0f685
Don't reward science or schematics when we know everything
Neil Muller <drnlmuller@gmail.com>
parents:
241
diff
changeset
|
647 if not state.lab.new_schematics: |
594c45f0f685
Don't reward science or schematics when we know everything
Neil Muller <drnlmuller@gmail.com>
parents:
241
diff
changeset
|
648 possible_rewards.remove('schematic') |
594c45f0f685
Don't reward science or schematics when we know everything
Neil Muller <drnlmuller@gmail.com>
parents:
241
diff
changeset
|
649 reward = choice(possible_rewards) |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
650 if reward == 'nothing': |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
651 self.succeed("%s Unfortunately, not only are these people working" |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
652 " on ideas you've already covered, they're flat broke." % msg, |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
653 money=0, rep=1) |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
654 elif reward == 'money': |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
655 self.succeed("%s While their research yields nothing of interest," |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
656 " you can repurpose their funding to more worthy causes." |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
657 % msg, money=randint(1000, 2000), rep=1) |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
658 elif reward == 'schematic': |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
659 self.succeed("%s You find the plans for a new device. How did" |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
660 " these fools stumble upon this?" % msg, |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
661 money=0, rep=randint(2, 5), |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
662 new_schematic=choice(state.lab.new_schematics)) |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
663 # New science |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
664 self.succeed("%s Their notes are most illuminating. You realise you" |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
665 " have sadly neglected research into this field." % msg, |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
666 money=0, rep=randint(2, 5), |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
667 new_science=choice(state.lab.new_research)) |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
668 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
669 def attempt_with(self, categorised, state): |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
670 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
671 self.use_equipment(categorised) |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
672 |
178 | 673 if cat.DOOMSDAY_DEVICE in categorised: |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
674 self.fail( |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
675 "While overwhelming force is always a tempting choice," |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
676 " total destruction of the lab will not help you cause.") |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
677 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
678 if cat.AI in categorised: |
219 | 679 self.use_equipment_category(categorised, cat.AI) |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
680 self._succ("Your AI easily takes control of the lab's network.", |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
681 state) |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
682 |
219 | 683 if cat.INTELLIGENCE in categorised: |
684 self.use_equipment_category(categorised, cat.INTELLIGENCE) | |
685 self._succ("You are able to gather all the information needed" | |
686 " to completely survert the lab defenses, making the actual" | |
239 | 687 " takeover trivial.", state) |
219 | 688 |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
689 if self.combat_power(categorised) > randint(20, 40): |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
690 self._succ( |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
691 "The resistance is stiff, but your forces prevail" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
692 " thanks to your superior technology.", state) |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
693 else: |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
694 self.fail( |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
695 "The lab is surprisingly well defended for an operation" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
696 " run by a total fool. You vow to return with a better" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
697 " prepared force.") |
183 | 698 |
699 | |
700 class TerroriseCity(Mission): | |
701 NAME = "Invade nearby city" | |
702 SHORT_DESCRIPTION = "Need more resources" | |
703 LONG_DESCRIPTION = ( | |
704 "Sometimes it's nessecary to remind people of what you can do." | |
705 " And why not do so close to home?") | |
706 | |
707 MINIMUM_MILESTONE = "city" | |
708 | |
709 NO_EQUIP_FAILURE = ( | |
710 "Attacking a city with your bare hands. Perhaps not the best" | |
711 " thought out scheme in the world. Fortunately, only your" | |
712 " pride was hurt by this failure.") | |
713 GENERIC_FAILURE = ( | |
714 "You fail to accomplish your goal. A different approach seems" | |
715 " called for.") | |
716 | |
717 def attempt_no_equipment(self, state): | |
718 self.fail(self.NO_EQUIP_FAILURE, rep=-randint(10, 15)) | |
719 | |
720 def attempt_with(self, categorised, state): | |
721 | |
722 self.use_equipment(categorised) | |
723 | |
724 if cat.DOOMSDAY_DEVICE in categorised: | |
725 self.succeed( | |
726 "Destroying the city is a simple exercies with the right" | |
727 " tools. People will tremble at the mention of your name", | |
728 rep=randint(15, 25)) | |
729 | |
730 if cat.AI in categorised: | |
731 self.succeed("Your AI easily takes control of the central" | |
732 " network. It's not that scary, but it is profitable", | |
733 money=randint(3000, 10000)) | |
734 | |
735 if cat.BEAST in categorised: | |
184 | 736 if any(cat.AQUATIC in x.CATEGORIES for x in |
737 categorised[cat.BEAST]): | |
738 rampage = 'harbour' | |
739 else: | |
740 rampage = 'streets' | |
741 self.succeed( | |
742 "Your creature's rampage through the city's %s terrifies" | |
743 " the city's inhabitants. The city council are eager to" | |
744 " pay you to rein it in. A most statisfying outcome" % rampage, | |
183 | 745 money=randint(2000, 5000), rep=randint(5, 15)) |
746 | |
747 if cat.VEHICLE in categorised: | |
748 if self.combat_power(categorised) > randint(50, 70): | |
749 self.succeed("Your overwhelming display of force cowers" | |
750 " the city. Fear of you spreads.", rep=randint(10, 20)) | |
751 else: | |
752 self.fail( | |
753 "Your forces prove unable to overcome the city's" | |
754 " defenses. This is an annoying setback, but you" | |
755 " vow to return.", rep=-randint(3, 7)) | |
756 | |
757 if cat.HAND_WEAPONS in categorised: | |
758 self.fail("A sprinkling of small arms can't overcome the city's" | |
759 " defenses. Something more impressive is required.") | |
185 | 760 |
761 | |
762 class SecureLair(Mission): | |
763 NAME = "Secure island base" | |
764 SHORT_DESCRIPTION = "A nice safe base of operations" | |
765 LONG_DESCRIPTION = ( | |
766 "It's a cliche, but there's a lot to be said for an isolated" | |
767 " and secure base of operations. You can still control your" | |
768 " city from afar. You just have to deal with the local inhabitants" | |
769 " of your chosen location, but they should not present a problem") | |
770 MINIONS_REQUIRED = 4 | |
206
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
771 MINIMUM_MILESTONE = "city" |
185 | 772 MINIMUM_REPUTATION = 50 |
773 | |
774 NO_EQUIP_FAILURE = ( | |
775 "While the local defenses are weak, even they can deal with" | |
776 " a few unarmed men. Something more suitable is required") | |
777 GENERIC_FAILURE = ( | |
778 "Your chosen tools aren't up to the task of securing the" | |
779 " island. Perhaps you need to rethink your approach") | |
780 | |
781 def attempt_no_equipment(self, state): | |
782 self.fail(self.NO_EQUIP_FAILURE, rep=-randint(10, 15)) | |
783 | |
784 def attempt_with(self, categorised, state): | |
785 | |
786 self.use_equipment(categorised) | |
787 | |
788 if cat.DOOMSDAY_DEVICE in categorised: | |
789 self.fail( | |
790 "You want to use the island afterward, and the local" | |
791 " population can provide basic labour. Something less" | |
792 " destructive is required.") | |
793 | |
794 if cat.AI in categorised: | |
795 self.fail( | |
796 "Your AI complains about the limited bandwidth and" | |
797 " inadequate computing resources of the target, then" | |
798 " goes off to sulk. A more physical approach may" | |
799 " be required.") | |
800 | |
801 msg = ( | |
802 " Afraid of the repurcusions, the people quickly build a base" | |
803 " to your specifications") | |
804 if (cat.BEAST in categorised and | |
805 self.combat_power(categorised) > randint(20, 30)): | |
806 self.data['completed'] = True | |
807 self.succeed( | |
808 "Your creature's terrifying rampage destroys all" | |
809 " resistance, and you quickly conquer the island. %s" % msg, | |
810 rep=randint(10, 15)) | |
811 | |
812 if cat.VEHICLE in categorised: | |
813 if self.combat_power(categorised) > randint(20, 30): | |
814 self.data['completed'] = True | |
815 self.succeed("Your overwhelming display of force cowers" | |
816 " the local population. The island is yours. %s" % msg, | |
817 rep=randint(10, 15)) | |
818 else: | |
819 self.fail( | |
820 "Your forces prove unable to overcome the local" | |
821 " defenses.") | |
192
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
822 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
823 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
824 class EliminateRival(Mission): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
825 NAME = "Eliminate Dr. X." |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
826 SHORT_DESCRIPTION = "A rival. Inconcievable" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
827 LONG_DESCRIPTION = None # We handle this one specially |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
828 MINIONS_REQUIRED = 3 |
206
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
829 MINIMUM_MILESTONE = "city" |
192
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
830 MINIMUM_REPUTATION = 50 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
831 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
832 NO_EQUIP_FAILURE = ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
833 "While you'd like to tear Dr. X apart with your bare hands, you" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
834 " do need to deal with his pathetic defenses first.") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
835 GENERIC_FAILURE = ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
836 "Somehow, Dr. X has thwarted your attack. You are quite surprised.") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
837 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
838 def _new_data(self): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
839 # How many times has Dr. X been beaten? |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
840 self.data['times'] = 0 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
841 self.data['turn'] = 0 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
842 self.data['seen'] = False |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
843 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
844 def get_description(self): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
845 if self.get_data('times') == 0: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
846 return ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
847 "Recently, Dr. X has made some serious claims abut his" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
848 " capabilities. While it's laughable to believe he can" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
849 " actually back up his boasts, such statements cannot go" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
850 " unpunished.") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
851 elif self.get_data('times') == 1: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
852 return ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
853 "Dr. X has returned. Hasn't he learnt from your previous" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
854 " encounter? This cannot go unpunished.") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
855 return ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
856 "Dr. X has once again appeared on the scene. You suspect" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
857 " he's mixed his DNA with that of a cockroach, but, " |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
858 " regardless of the cause, this cannot be ignored.") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
859 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
860 def can_attempt(self, state): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
861 if self.get_data('completed'): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
862 # does Dr. X return? |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
863 if (state.turn > self.get_data('turn') + 2 and |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
864 randint(0, 5) < (state.turn - self.get_data('turn'))): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
865 self.data['completed'] = False |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
866 return True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
867 else: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
868 return False |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
869 elif self.get_data('seen'): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
870 # Once he's appeared, he doesn't go unless completed |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
871 return True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
872 if super(EliminateRival, self).can_attempt(state): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
873 self.data['seen'] = True # flag as seen |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
874 return True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
875 return False |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
876 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
877 def attempt_no_equipment(self, state): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
878 self.fail(self.NO_EQUIP_FAILURE, rep=-randint(10, 15)) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
879 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
880 def attempt_with(self, categorised, state): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
881 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
882 self.use_equipment(categorised) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
883 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
884 if cat.DOOMSDAY_DEVICE in categorised: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
885 self.data['completed'] = True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
886 self.data['times'] += 1 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
887 self.data['turn'] = state.turn |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
888 self.succeed( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
889 "You crush Dr. X with your superior technology. He will" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
890 " not forgot this lesson anytime soon.", |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
891 rep=randint(10, 20)) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
892 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
893 if cat.AI in categorised: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
894 self.fail( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
895 "Subverting Dr. X's network is simple enough for your AI," |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
896 " but you are annoyed to discover that the doctor places" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
897 " little faith in computers, and there is nothing you can" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
898 " do to foil his plans this way") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
899 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
900 if (cat.BEAST in categorised and |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
901 self.combat_power(categorised) > randint(40, 60)): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
902 self.data['completed'] = True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
903 self.data['times'] += 1 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
904 self.data['turn'] = state.turn |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
905 self.succeed( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
906 "Your creature destroys Dr. X's lab. He will not quickly" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
907 " recover this setback", rep=randint(10, 20)) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
908 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
909 if cat.VEHICLE in categorised: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
910 if self.combat_power(categorised) > randint(40, 60): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
911 self.data['completed'] = True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
912 self.data['times'] += 1 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
913 self.data['turn'] = state.turn |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
914 self.succeed( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
915 "Your forces easily overcome the doctor's defenses," |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
916 " but Dr. X himself escapes. You are sure, however," |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
917 " he will present no further threat to your plans.", |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
918 rep=randint(10, 20)) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
919 else: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
920 self.succeed("Dr. X's defenses are better than you" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
921 " anticipated. You'll have to return with more" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
922 " firepower.", rep=-randint(3, 7)) |
194 | 923 |
924 | |
925 class Publish(Mission): | |
926 NAME = "Publish your results" | |
927 SHORT_DESCRIPTION = "The world must know of your genius" | |
928 LONG_DESCRIPTION = ( | |
929 "You've seen further than others. Surely you can open their" | |
930 " eyes to the truth (and secure your place in history)?") | |
931 MINIMUM_REPUTATION = 5 | |
206
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
932 MINIMUM_MILESTONE = "basement" |
194 | 933 |
934 NO_EQUIP_FAILURE = ( | |
935 "The review board rejects your paper, clearly failing to" | |
936 " realise the significant of your results") | |
937 GENERIC_FAILURE = ( | |
938 "You fail to persuade the review board of the need to publish" | |
939 " your results. Perhaps a different appraoch is required?") | |
940 | |
941 def attempt_with(self, categorised, state): | |
942 if cat.MIND_CONTROL in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
943 self.use_equipment_category(categorised, cat.MIND_CONTROL) |
194 | 944 self.data['completed'] = True |
945 self.succeed("With the correct persuasion, the review board" | |
946 " recognises the significance of your work.", | |
947 rep=randint(10, 15)) | |
195 | 948 |
949 if cat.HAND_WEAPON in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
950 self.use_equipment_category(categorised, cat.HAND_WEAPON) |
195 | 951 self.data['completed'] = True |
952 self.succeed("The review board respond favourably to a little" | |
953 " light intidimation, and your paper is accepted.", | |
954 rep=randint(10, 15)) | |
198 | 955 |
956 | |
957 class DisruptMarkets(Mission): | |
958 NAME = "Disrupt local enconomy" | |
959 SHORT_DESCRIPTION = "Creating chaos and fear." | |
960 LONG_DESCRIPTION = ( | |
961 "People place far too much value on their money. This is a weakness" | |
962 " that just begs to be exploited. And, in the chaos and fear, " | |
963 " there's almost certainly and opportunity to profit.") | |
964 MINIMUM_MILESTONE = "neighbourhood" | |
965 MINIMUM_MONEY = 2000 | |
966 | |
967 NO_EQUIP_FAILURE = ( | |
968 "You cannot beat the game just with your mind, doctor. You'll need" | |
969 " to have some extra toys") | |
970 GENERIC_FAILURE = ( | |
971 "No-one notices your efforts. Back to the drawing board") | |
972 | |
973 def can_attempt(self, state): | |
974 if state.money < self.MINIMUM_MONEY: | |
975 # You need to be in the game to cheat at it | |
976 return False | |
977 return super(DisruptMarkets, self).can_attempt(state) | |
978 | |
979 def attempt_with(self, categorised, state): | |
980 | |
201 | 981 if cat.DOOMSDAY_DEVICE in categorised: |
198 | 982 return self.fail( |
983 "While destroying the area is certainly within your" | |
984 " capabilities, and would cause wide-spread panic," | |
985 " there seems little prospect of exploiting the" | |
986 " confusion usefully at this time. You decide to" | |
987 " shelve this plan for now.") | |
988 | |
989 if cat.WEATHER_MACHINE in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
990 self.use_equipment_category(categorised, cat.WEATHER_MACHINE) |
203 | 991 self.succeed( |
198 | 992 "You cunningly use your device to disrupt the nearby farmers." |
993 " The ensuing panic buyng of supplies is easy to exploit for" | |
994 " profit.", money=randint(5000, 10000), rep=randint(5, 15)) | |
995 | |
996 if cat.AI in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
997 self.use_equipment_category(categorised, cat.AI) |
203 | 998 self.succeed( |
201 | 999 "You easily survert the local exchange's computer systems." |
198 | 1000 " It hardly seems fair to profit off such a trivial challenge" |
1001 " but there are always bills to pay", | |
1002 money=randint(5000, 10000), rep=randint(2, 5)) | |
1003 | |
1004 if cat.BEAST in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
1005 self.use_equipment_category(categorised, cat.BEAST) |
203 | 1006 self.succeed( |
198 | 1007 "Releasing the monster into the exchange certainly created" |
201 | 1008 " a stir, and there was much running and screaming, but, with" |
198 | 1009 " the exchange closing it's doors until the creature was" |
1010 " contained, there wasn't much opportunity to make a profit.", | |
1011 money=0, rep=randint(2, 5)) | |
203 | 1012 |
1013 | |
1014 class ControlMayor(Mission): | |
1015 NAME = "Control the Mayor" | |
1016 SHORT_DESCRIPTION = "Minions in high places." | |
1017 LONG_DESCRIPTION = ( | |
1018 "While the mayor powers are limited, it's a step towards controlling" | |
1019 " the entire city") | |
1020 MINIMUM_MILESTONE = "neighbourhood" | |
1021 | |
1022 def attempt_with(self, categorised, state): | |
1023 if cat.CLONE in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
1024 self.use_equipment_category(categorised, cat.CLONE) |
203 | 1025 self.data['completed'] = True |
1026 self.succeed( | |
1027 "Replacing the mayor with a copy under your control. Such" | |
1028 " a genius scheme could only come from a brain as brillant" | |
1029 " as yours.", rep=randint(10, 15)) | |
1030 if cat.MIND_CONTROL in categorised: | |
205
d8b0f07a6dbe
boilerplate common pattern
Neil Muller <drnlmuller@gmail.com>
parents:
203
diff
changeset
|
1031 self.use_equipment_category(categorised, cat.MIND_CONTROL) |
203 | 1032 self.data['completed'] = True |
1033 self.succeed( | |
1034 "Mind control. It's hardly a novel approach to the problem" | |
1035 " but who can argue with the results.", rep=randint(7, 15)) | |
1036 | |
1037 if cat.HAND_WEAPONS in categorised: | |
1038 self.fail( | |
1039 "Brute force. It seems such a crude approach. You decide" | |
1040 " this is unworthy of you and abandon the plan.") | |
1041 | |
1042 if cat.BEAST in categorised: | |
1043 self.fail( | |
1044 "In retrospect, unleashing a monster into the downtown streets" | |
1045 " was a great way to cause panic, but not a reliable method" | |
1046 " for securing the loyalties of the mayor. You return to" | |
1047 " the drawing board") | |
206
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1048 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1049 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1050 class DisruptCityServices(Mission): |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1051 NAME = "Disrupt city services" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1052 SHORT_DESCRIPTION = "Keep your name in the news" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1053 LONG_DESCRIPTION = ( |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1054 "You're not being talked about in the news. This cannot be allowed" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1055 " to continue. Spreading chaos and fear will remind people about" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1056 " your presence.") |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1057 MINIMUM_MILESTONE = "neighbourhood" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1058 MAXIMUM_REPUTATION = 10 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1059 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1060 NO_EQUIP_FAILURE = ( |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1061 "There's little one unarmed man can do to disrupt the city. You'd" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1062 " better rethink this plan.") |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1063 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1064 def can_attempt(self, state): |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1065 if state.reputation > self.MAXIMUM_REPUTATION: |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1066 return False |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1067 return super(DisruptCityServices, self).can_attempt(state) |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1068 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1069 def attempt_no_equipment(self, state): |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1070 self.fail(self.NO_EQUIP_FAILURE, rep=-1) |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1071 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1072 def attempt_with(self, categorised, state): |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1073 if cat.DOOMSDAY_DEVICE in categorised: |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1074 self.fail( |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1075 "If there's no-one left alive, there'll be no-one to" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1076 " report on your genius. Prehaps less overkill is more" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1077 " suited to the task at hand") |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1078 if cat.BEAST in categorised: |
264 | 1079 self.use_equipment_category(categorised, cat.BEAST) |
206
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1080 if any(cat.AQUATIC in x.CATEGORIES for x in |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1081 categorised[cat.BEAST]): |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1082 self.succeed( |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1083 "You release the beast into the city sewer system." |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1084 " The resulting destruction is both expensive to" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1085 " repair and very visible to the inhabitants.", |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1086 rep=randint(5, 10)) |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1087 else: |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1088 self.succeed( |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1089 "The beast causes considerable property damage, and" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1090 " takes out a local substation. It's not a stunning" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1091 " victory, but it's enough to get you name in the" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1092 " news again", rep=randint(2, 5)) |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1093 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1094 if cat.VEHICLE in categorised: |
264 | 1095 self.use_equipment_category(categorised, cat.VEHICLE) |
206
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1096 self.succeed( |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1097 "Your mobile platforms of destruction cause severe" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1098 " traffic chaos, and tie up the local traffic services" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1099 " for hours. The resulting traffic jams headline the" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1100 " evening news. It's not quite the what you were going" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1101 " for, but it's publicity", rep=randint(0, 3)) |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1102 |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1103 if cat.HAND_WEAPON in categorised: |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1104 self.fail( |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1105 "You want to be known as more than just a local gangster." |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1106 " Guns are an efficient tool, but hardly the means to" |
2b8b6c9b71eb
Add emergency reputation boost mission
Neil Muller <drnlmuller@gmail.com>
parents:
205
diff
changeset
|
1107 " securing your reputation.") |
209 | 1108 |
1109 | |
1110 class RatArmy(Mission): | |
1111 NAME = "Breed Rat Burglars" | |
1112 SHORT_DESCRIPTION = "Your furry money source" | |
1113 LONG_DESCRIPTION = ( | |
1114 "Small and easy to breed. An army of rat burgulars will provide" | |
1115 " a useful supply of steady income") | |
1116 | |
1117 def can_attempt(self, state): | |
1118 if self.get_data('completed'): | |
1119 return False | |
1120 if state.lab.meet_requirements(Biogenetics, 1): | |
1121 return True | |
1122 return False | |
1123 | |
1124 def attempt_no_equipment(self, state): | |
1125 self.data['completed'] = True | |
1126 self.succeed( | |
1127 "You breed an army of small rats, engineered to steal small" | |
1128 " change. The resulting income is not much, but still useful", | |
1129 money=0, rep=0, income=randint(10, 15)) | |
1130 | |
1131 def attempt_with(self, categorised, state): | |
1132 self.fail( | |
1133 "You're overthinking this doctor. Perhaps a simpler approach" | |
1134 " will work better?") |