Mercurial > sypikslang
annotate gamelib/missions.py @ 192:57bf6a5e31cb
A rival appears on the scene
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 12 May 2012 15:18:28 +0200 |
parents | 59bd6f2e0ec2 |
children | cb57ccc8f119 |
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 |
18
0849ab5304cf
Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents:
13
diff
changeset
|
8 |
5 | 9 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
10 class Result(Exception): |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
11 """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
|
12 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
13 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
|
14 """ |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
15 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
16 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
|
17 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
|
18 self.money = money |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
19 self.reputation = rep |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
20 self.text = msg |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
21 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
|
22 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
|
23 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
24 @property |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
25 def loot(self): |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
26 loot = {} |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
27 if self.money != 0: |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
28 loot['money'] = self.money |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
29 if self.reputation != 0: |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
30 loot['rep'] = self.reputation |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
31 loot.update(self.special) |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
32 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
|
33 return loot |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
34 |
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
|
35 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
|
36 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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 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
|
42 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
|
43 |
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 |
5 | 45 class Mission(object): |
46 """Base class for the mission objects. | |
47 Missions have a name, short description (for list displays) and | |
48 long description (which may contain clues about approaches)""" | |
49 | |
50 NAME = "Generic Mission" | |
51 SHORT_DESCRIPTION = None | |
52 LONG_DESCRIPTION = None | |
96 | 53 |
33
12c33aac7684
Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents:
32
diff
changeset
|
54 MINIMUM_REPUTATION = None |
96 | 55 MINIMUM_MILESTONE = "neighbourhood" |
124
685301e35f88
Add a minion cost to missions
Neil Muller <drnlmuller@gmail.com>
parents:
123
diff
changeset
|
56 MINIONS_REQUIRED = 1 |
5 | 57 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
58 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
|
59 GENERIC_SUCCESS = "Victory is sweet." |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
60 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
61 "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
|
62 " foolish. And ultimately unsuccessful.") |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
63 |
22
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
64 def __init__(self, init_data=None): |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
65 self.data = {} |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
66 |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
67 if init_data is not None: |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
68 # Load stored state. |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
69 self._load_data(init_data) |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
70 else: |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
71 # New instance. |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
72 self._new_data() |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
73 |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
74 def _new_data(self): |
22
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
75 pass |
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
76 |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
77 def _load_data(self, init_data): |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
78 # Note: this does not deep-copy. |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
79 self.data = init_data.copy() |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
80 |
22
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
81 def save_data(self): |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
82 # Note: this does not deep-copy. |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
83 return self.data.copy() |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
84 |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
85 def get_data(self, key): |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
86 return self.data.get(key, None) |
22
296ce36fa7d9
Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents:
19
diff
changeset
|
87 |
192
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
88 def get_description(self): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
89 return self.LONG_DESCRIPTION |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
90 |
94
245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
Jeremy Thurgood <firxen@gmail.com>
parents:
92
diff
changeset
|
91 @classmethod |
245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
Jeremy Thurgood <firxen@gmail.com>
parents:
92
diff
changeset
|
92 def sanity_check(cls): |
245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
Jeremy Thurgood <firxen@gmail.com>
parents:
92
diff
changeset
|
93 pass |
245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
Jeremy Thurgood <firxen@gmail.com>
parents:
92
diff
changeset
|
94 |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
95 def can_attempt(self, state): |
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
96 """Can we currently attempt the mission""" |
96 | 97 if (M_VALS[self.MINIMUM_MILESTONE] > M_VALS[state.milestone]): |
98 # Our base of operations is too small | |
99 return False | |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
100 if self.get_data('completed'): |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
101 return False |
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
102 if (self.MINIMUM_REPUTATION is not None and |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
103 self.MINIMUM_REPUTATION > state.reputation): |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
104 # Don't have the reputation required |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
105 return False |
124
685301e35f88
Add a minion cost to missions
Neil Muller <drnlmuller@gmail.com>
parents:
123
diff
changeset
|
106 if self.MINIONS_REQUIRED > state.minions: |
685301e35f88
Add a minion cost to missions
Neil Muller <drnlmuller@gmail.com>
parents:
123
diff
changeset
|
107 # Need more minions! |
685301e35f88
Add a minion cost to missions
Neil Muller <drnlmuller@gmail.com>
parents:
123
diff
changeset
|
108 return False |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
109 return True |
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
110 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
111 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
|
112 if msg is None: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
113 msg = self.GENERIC_FAILURE |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
114 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
|
115 |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
116 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
|
117 if msg is None: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
118 msg = self.GENERIC_SUCCESS |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
119 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
|
120 |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
121 def categorise_equipment(self, equipment): |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
122 # Categorise equipment for easier decision-making. |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
123 categorised = {} |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
124 for item in equipment: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
125 for category in item.CATEGORIES: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
126 categorised.setdefault(category, []).append(item) |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
127 return categorised |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
128 |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
129 def attempt_mission(self, equipment, state): |
5 | 130 """Attempt the mission with the given equipment list. |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
131 Returns a result object with the results of the mission.""" |
5 | 132 |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
133 # Handle error case |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
134 if self.get_data('completed'): |
41
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
135 raise RuntimeError('Cannot attempt a completed mission') |
e285b1e31a08
Add can_attempt method for future flexibility
Neil Muller <drnlmuller@gmail.com>
parents:
36
diff
changeset
|
136 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
137 try: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
138 self.attempt(equipment, state) |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
139 except Result, e: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
140 return e |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
141 |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
142 def attempt(self, equipment, state): |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
143 # No equipment is usually a special case. |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
144 if not equipment: |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
145 return self.attempt_no_equipment(state) |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
146 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
147 # Try with some equipment. |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
148 self.attempt_with(self.categorise_equipment(equipment), state) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
149 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
150 # No result, so generic failure. |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
151 self.fail() |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
152 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
153 def attempt_no_equipment(self, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
154 self.fail(self.NO_EQUIP_FAILURE) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
155 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
156 def attempt_with(self, categorised, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
157 self.fail("You can't succceed at this mission.") |
5 | 158 |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
159 def combat_power(self, categorised, cats=None): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
160 if cats is None: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
161 cats = [cat.HAND_WEAPON, cat.VEHICLE, cat.COUNTERMEASURE, |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
162 cat.INTELLIGENCE] |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
163 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
164 combat_equipment = set() |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
165 for category in cats: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
166 combat_equipment.update(categorised.get(category, [])) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
167 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
168 power = 0 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
169 for equipment in combat_equipment: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
170 power += equipment.power() |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
171 return power |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
172 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
173 def check_failure(self, categorised): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
174 equipment = set() |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
175 for items in categorised.values(): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
176 equipment.update(items) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
177 for item in equipment: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
178 if item.reliability() < random(): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
179 return item.FAILURE_TEXT |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
180 return None |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
181 |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
182 def use_equipment(self, categorised, msg="Disaster strikes! %s", **loot): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
183 failure = self.check_failure(categorised) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
184 if failure is not None: |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
185 self.fail(msg % (failure,), **loot) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
186 |
5 | 187 |
19
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
188 class PlaygroundBully(Mission): |
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
189 |
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
190 NAME = "Rob kids in the playground" |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
191 SHORT_DESCRIPTION = "Steal from those significantly weaker than yourself." |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
192 LONG_DESCRIPTION = ( |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
193 "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
|
194 " 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
|
195 |
96 | 196 MINIMUM_MILESTONE = "basement" |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
197 GENERIC_SUCCESS = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
198 "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
|
199 " 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
|
200 " with a surprising amount of small change.") |
96 | 201 |
32 | 202 def attempt(self, equipment, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
203 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
|
204 |
12085dfd9e69
Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents:
18
diff
changeset
|
205 |
5 | 206 class RansomChina(Mission): |
207 | |
208 NAME = "Hold China to ransom" | |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
209 SHORT_DESCRIPTION = "Surely a path to riches and fame." |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
210 LONG_DESCRIPTION = ( |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
211 "Holding China to ransom. The rewards for successfully threatening" |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
212 " 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
|
213 " significant. Without some serious firepower, the chances of success" |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
214 " are small.") |
96 | 215 |
33
12c33aac7684
Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents:
32
diff
changeset
|
216 MINIMUM_REPUTATION = 100 |
96 | 217 MINIMUM_MILESTONE = "city" |
5 | 218 |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
219 def _new_data(self): |
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
220 self.data['prior_attempts'] = [] |
5 | 221 |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
222 def attempt_no_equipment(self, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
223 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
224 "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
|
225 " 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
|
226 " 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
|
227 " 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
|
228 " 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
|
229 rep=-10) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
230 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
231 def attempt_with(self, categorised, state): |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
232 dooms = categorised.get(cat.DOOMSDAY_DEVICE, []) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
233 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
234 if not dooms: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
235 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
236 "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
|
237 " 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
|
238 rep=-1) |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
239 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
240 if len(dooms) > 1: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
241 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
242 "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
|
243 " to cause widepsread distruction and mayhem, and" |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
244 " 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
|
245 " 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
|
246 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
247 [doom] = dooms |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
248 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
|
249 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
250 "'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
|
251 " You cannot threaten us with that again.'") |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
252 |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
253 self.use_equipment(categorised, rep=randint(-5, -2)) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
254 |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
255 self.data['prior_attempts'].add(doom.NAME) |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
256 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
257 "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
|
258 " government pays the ransom.", |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
259 money=randint(800000, 1200000), rep=10) |
5 | 260 |
261 | |
35 | 262 class ToppleThirdWorldGovernment(Mission): |
263 | |
264 NAME = "Topple a third-world government" | |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
265 SHORT_DESCRIPTION = "We could use a more amenable dictator there." |
35 | 266 LONG_DESCRIPTION = ( |
267 "It's a small and fairly useless country, but it's still an actual" | |
268 " government that can be toppled. A good test bed for some of the" | |
269 " larger toys in the armory.") | |
96 | 270 |
35 | 271 MINIMUM_REPUTATION = 50 |
272 | |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
273 GENERIC_FAILURE = ( |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
274 "Your invasion force was outclassed by the incumbent military, Not" |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
275 " 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
|
276 " recent series of revolutions.") |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
277 |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
278 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
279 "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
|
280 " 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
|
281 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
282 def attempt_with(self, categorised, state): |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
283 self.use_equipment(categorised) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
284 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
|
285 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
286 "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
|
287 " 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
|
288 " 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
|
289 money=randint(5000, 15000), rep=randint(3, 7)) |
35 | 290 |
291 | |
5 | 292 class RobBank(Mission): |
293 | |
294 NAME = "Rob the local bank" | |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
295 SHORT_DESCRIPTION = "A trivial challenge, but easy money." |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
296 LONG_DESCRIPTION = ( |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
297 "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
|
298 " 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
|
299 |
96 | 300 MINIMUM_MILESTONE = "basement" |
301 | |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
302 GENERIC_FAILURE = ( |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
303 "The bank's security arrangements are rather more impressive than you" |
171 | 304 " 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
|
305 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
306 "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
|
307 " everyone is too stunned to impede your escape.") |
36
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
308 |
efc4f90cfd63
Mission refactoring and research fix.
Jeremy Thurgood <firxen@gmail.com>
parents:
35
diff
changeset
|
309 def attempt_with(self, categorised, state): |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
310 loot = randint(500, 1500) |
5 | 311 |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
312 self.use_equipment(categorised) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
313 |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
314 if cat.VEHICLE in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
315 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
316 "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
|
317 " 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
|
318 " 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
|
319 " 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
|
320 |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
321 if cat.PATHOGEN in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
322 if randint(5, 15) < state.reputation: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
323 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
324 "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
|
325 " 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
|
326 " 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
|
327 " something so trivial.") |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
328 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
329 "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
|
330 " that is power.", |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
331 money=loot, rep=1) |
10
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
332 |
175 | 333 if cat.AI in categorised: |
334 self.success( | |
335 "Your cunning AI easily penetrates the bank's computing" | |
336 " systems and transfers the money to you account.", | |
337 money=loot) | |
338 | |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
339 if self.combat_power(categorised) > randint(5, 20): |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
340 self.succeed( |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
341 "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
|
342 " level of cooperation. You make off with the loot.", |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
343 money=loot) |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
344 |
10
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
345 |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
346 class DestroyMountRushmore(Mission): |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
347 |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
348 NAME = "Destroy Mount Rushmore" |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
349 SHORT_DESCRIPTION = "Monuments to other people? Intolerable" |
92 | 350 LONG_DESCRIPTION = ( |
351 "While potentially expensive, destroying a major monument is a" | |
352 " good way to secure your reputation.") | |
33
12c33aac7684
Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents:
32
diff
changeset
|
353 MINIMUM_REPUTATION = 20 |
10
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
354 |
9f8def7d70d0
Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents:
5
diff
changeset
|
355 def attempt(self, equipment, state): |
91
c57b5b46d3e0
Better mission data management.
Jeremy Thurgood <firxen@gmail.com>
parents:
86
diff
changeset
|
356 self.data['completed'] = True |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
357 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
|
358 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
359 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
360 class DistributePamphlets(Mission): |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
361 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
362 NAME = "Distribute pamphlets" |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
363 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
|
364 LONG_DESCRIPTION = ( |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
365 "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
|
366 " 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
|
367 |
96 | 368 MINIMUM_MILESTONE = "basement" |
369 | |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
370 SUCCESS_MESSAGE = ( |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
371 "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
|
372 " pamphlets. %s") |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
373 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
374 def _succ(self, message, rep): |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
375 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
|
376 |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
377 def attempt_no_equipment(self, state): |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
378 rep = randint(-2, 5) |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
379 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
380 if rep < 0: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
381 self._succ( |
85
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
382 "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
|
383 " 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
|
384 if rep == 0: |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
385 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
|
386 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
387 self._succ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
388 "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
|
389 |
182fce9f70b6
Propaganda! Also, a fix to blueprint breakthroughs.
Jeremy Thurgood <firxen@gmail.com>
parents:
80
diff
changeset
|
390 def attempt_with(self, categorised, state): |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
391 if cat.MIND_CONTROL in categorised: |
159
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
392 self.use_equipment( |
f1efd252e8b0
Equipment power in missions.
Jeremy Thurgood <firxen@gmail.com>
parents:
138
diff
changeset
|
393 {cat.MIND_CONTROL: categorised[cat.MIND_CONTROL]}) |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
394 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
|
395 randint(5, 10)) |
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 return self.attempt_no_equipment(state) |
95
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
398 |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
399 |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
400 class TakeOverTheWorld(Mission): |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
401 |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
402 NAME = "Take over the world!" |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
403 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
|
404 LONG_DESCRIPTION = ( |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
405 "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
|
406 " 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
|
407 " everyone.") |
96 | 408 |
95
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
409 MINIMUM_REPUTATION = 200 |
96 | 410 MINIMUM_MILESTONE = "city" |
95
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
411 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
412 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
413 "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
|
414 |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
415 def attempt_with(self, categorised, state): |
0f437e0584f7
Add mission for taking over the world.
Simon Cross <hodgestar@gmail.com>
parents:
94
diff
changeset
|
416 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
|
417 self.fail( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
418 "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
|
419 " 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
|
420 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
|
421 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
422 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
423 class TakeOverTheNeighbourhood(Mission): |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
424 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
425 NAME = "Take over the neighbourhood!" |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
426 SHORT_DESCRIPTION = "First step toward greatness." |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
427 LONG_DESCRIPTION = ( |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
428 "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
|
429 " 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
|
430 " 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
|
431 " neighbourhood... that's quite feasible.") |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
432 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
433 MINIMUM_REPUTATION = 20 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
434 MINIMUM_MILESTONE = "basement" |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
435 |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
436 NO_EQUIP_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
437 "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
|
438 " it over bare-handed.") |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
439 GENERIC_FAILURE = ( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
440 "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
|
441 " order.") |
123
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
442 |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
443 def attempt_with(self, categorised, state): |
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
444 if all(c in categorised for c in (cat.MIND_CONTROL, cat.HAND_WEAPON)): |
129 | 445 self.data['completed'] = True |
138
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
446 self.succeed( |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
447 "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
|
448 " 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
|
449 " 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
|
450 money=randint(1000, 2000), rep=randint(5, 15), |
14917385a0fd
Better handling of mission results and turn-end messages.
Jeremy Thurgood <firxen@gmail.com>
parents:
137
diff
changeset
|
451 new_milestone="neighbourhood") |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
452 |
123
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
453 if cat.HAND_WEAPON in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
454 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
455 "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
|
456 " 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
|
457 |
123
7cd716328a44
Take over the neighbourgood!
Jeremy Thurgood <firxen@gmail.com>
parents:
96
diff
changeset
|
458 if cat.MIND_CONTROL in categorised: |
137
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
459 self.succeed( |
fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
Jeremy Thurgood <firxen@gmail.com>
parents:
129
diff
changeset
|
460 "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
|
461 " some force to back them up.", rep=randint(2, 4)) |
175 | 462 |
463 | |
181 | 464 class TakeOverTheCity(Mission): |
465 NAME = "Take over the city" | |
466 SHORT_DESCRIPTION = "Time to grow" | |
467 LONG_DESCRIPTION = ( | |
468 "It's time to spread your wings and take your rightful place as" | |
469 " a major player. And what better way than by securing your base" | |
470 " of operations?") | |
471 | |
472 MINIMUM_REPUTATION = 100 | |
473 MINIMUM_MILESTONE = "neighbourhood" | |
474 | |
475 NO_EQUIP_FAILURE = ( | |
476 "You are thrown out of city hall for making a scene. The fools will" | |
477 " pay for this when you return with more firepower.") | |
478 GENERIC_FAILURE = ( | |
479 "Well, that didn't work. Maybe a better equipment selection is in" | |
480 " order.") | |
481 | |
482 def attempt_with(self, categorised, state): | |
483 if cat.DOOMSDAY_DEVICE in categorised: | |
484 self.data['completed'] = True | |
485 self.succeed( | |
486 "Overwhelming force! It works for governments, and it works" | |
487 " for you. The city cowers before you, and you finally" | |
488 " feel like you're getting somewhere. Soon, the world will" | |
489 " be yours.", money=randint(10000, 20000), | |
490 rep=randint(10, 20), new_milestone='city') | |
491 | |
492 if cat.AI in categorised: | |
493 self.use_equipment( | |
494 {cat.AI: categorised[cat.AI]}) | |
495 self.succeed( | |
496 "While the AI can't control the entire city, you can at" | |
497 " least ensure the budget is well spent", | |
498 money=randint(10000, 30000)) | |
499 | |
500 if cat.MIND_CONTROL in categorised: | |
501 self.use_equipment( | |
502 {cat.MIND_CONTROL: categorised[cat.MIND_CONTROL]}) | |
503 self.succeed( | |
504 "Running a city requires controlling more than just a few" | |
505 " key people. Still, making the mayor dance to your tune" | |
506 " is not without it's benefits", money=randint(3000, 7000), | |
507 rep=randint(3, 7)) | |
508 | |
509 if cat.VEHICLE in categorised: | |
510 self.fail( | |
511 "While you can muster a significant force, you don't want" | |
512 " to destroy the city in the inevitable fighting. You need" | |
513 " to ensure no-one tries to resist.") | |
514 | |
515 if cat.HAND_WEAPON in categorised: | |
516 self.fail( | |
517 "You'll need more than a handful of guns, no matter" | |
518 " how powerful, to subdue a city") | |
519 | |
520 | |
175 | 521 class ShowThemAll(Mission): |
522 | |
179 | 523 NAME = "And they called me mad!" |
175 | 524 SHORT_DESCRIPTION = "Time for revenge." |
525 LONG_DESCRIPTION = ( | |
526 "You've outgrown the chains of convention your teachers tried" | |
527 " to force you into. It's time to show the world what true" | |
528 " genius can accomplish. And what better way than with a small" | |
529 " slice of revenge?") | |
530 | |
531 MINIMUM_REPUTATION = 20 | |
532 MINIMUM_MILESTONE = "neighbourhood" | |
533 | |
534 NO_EQUIP_FAILURE = ( | |
535 "A security guard escorts you off campus after finding you clawing" | |
536 " at the science building with your bare hands. He doesn't say" | |
537 " anything, but you can already hear the gossip.") | |
538 | |
539 def attempt_no_equipment(self, state): | |
540 self.fail(self.NO_EQUIP_FAILURE, rep=-5) | |
541 | |
542 def attempt_with(self, categorised, state): | |
176 | 543 |
544 self.use_equipment(categorised) | |
545 | |
178 | 546 if cat.DOOMSDAY_DEVICE in categorised: |
175 | 547 self.data['completed'] = True |
548 self.succeed( | |
549 "The fools cower in terror at your display of power. Finally" | |
550 " they are forced to acknowledge your genius.", | |
551 rep=randint(10, 15)) | |
552 | |
553 if cat.BEAST in categorised: | |
179 | 554 if all(cat.AQUATIC in x.CATEGORIES for x in |
175 | 555 categorised[cat.BEAST]): |
176 | 556 self.fail( |
557 "While the beast is terrifying, the effect is" | |
558 " unfortuantely significantly lessened the need for a " | |
559 " large water tank, and the it's inability to move " | |
179 | 560 " independantly. Perhaps you need to rethink your plan?") |
176 | 561 else: |
175 | 562 self.data['completed'] = True |
563 self.succeed( | |
564 "Your monstrous creation rampages through campus in a" | |
565 " most statisfying way. They will not forgot this.", | |
566 rep=randint(5, 12)) | |
567 | |
568 if cat.HAND_WEAPON in categorised: | |
569 self.fail( | |
570 "Mere crude force is not the answer. You need some more" | |
571 " fitting demonstration of your power.") | |
176 | 572 |
573 | |
574 class SubvertNews(Mission): | |
575 NAME = "Subvert the news network" | |
576 SHORT_DESCRIPTION = "Stop the lies!" | |
577 LONG_DESCRIPTION = ( | |
578 "Worringly, people appear to be easily duped by the lies broadcast" | |
579 " about you. Time to fight fire with fire!") | |
580 | |
581 MINIMUM_REPUTATION = 15 | |
582 MINIMUM_MILESTONE = "neighbourhood" | |
583 | |
584 NO_EQUIP_FAILURE = ( | |
585 "You fail to even get into the building. Perhaps you need to" | |
586 " rethink your approach") | |
587 | |
588 def attempt_with(self, categorised, state): | |
589 | |
590 self.use_equipment(categorised) | |
591 | |
592 if cat.MIND_CONTROL in categorised: | |
593 self.succeed( | |
594 "With the proper equipment, it's a simple matter to" | |
595 " convince people of the correctness of your point" | |
596 " of view. If only everything were so simple", | |
597 rep=randint(5, 15)) | |
598 | |
178 | 599 if cat.AI in categorised: |
176 | 600 self.succeed( |
601 "Your AI has complete control of the broadcasters computer" | |
602 " system. After all, it's not censorship if you're stopping" | |
603 " them broadcasting blatant lies, now is it?", | |
604 rep=randint(5, 10)) | |
605 | |
178 | 606 if any(c in categorised for c in (cat.VEHICLE, cat.DOOMSDAY_DEVICE, |
607 cat.BEAST)): | |
176 | 608 self.succeed( |
609 "Cowering in fear, the broadcaster agrees to change the" | |
610 " tone of their stories.", rep=randint(2, 5)) | |
611 | |
178 | 612 if cat.HAND_WEAPON in categorised: |
176 | 613 self.fail( |
614 "The news station's security is surprisingly well prepared." | |
179 | 615 " Perhaps you should rethink your approach?", |
176 | 616 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
|
617 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
618 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
619 class RaidLab(Mission): |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
620 NAME = "Raid Rival Lab" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
621 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
|
622 LONG_DESCRIPTION = ( |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
623 "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
|
624 " 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
|
625 " 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
|
626 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
627 MINIMUM_MILESTONE = "neighbourhood" |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
628 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
629 NO_EQUIP_FAILURE = ( |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
630 "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
|
631 " 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
|
632 " in the future.") |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
633 |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
634 def _succ(self, msg, state): |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
635 reward = choice(('schematic', 'science', |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
636 'money', 'money', 'money', 'money', 'money', |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
637 'nothing', 'nothing', 'nothing')) |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
638 if reward == 'nothing': |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
639 self.succeed("%s Unfortunately, not only are these people working" |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
640 " 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
|
641 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
|
642 elif reward == 'money': |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
643 self.succeed("%s While their research yields nothing of interest," |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
644 " you can repurpose their funding to more worthy causes." |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
645 % 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
|
646 elif reward == 'schematic': |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
647 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
|
648 " these fools stumble upon this?" % msg, |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
649 money=0, rep=randint(2, 5), |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
650 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
|
651 # New science |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
652 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
|
653 " have sadly neglected research into this field." % msg, |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
654 money=0, rep=randint(2, 5), |
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
655 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
|
656 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
657 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
|
658 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
659 self.use_equipment(categorised) |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
660 |
178 | 661 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
|
662 self.fail( |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
663 "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
|
664 " 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
|
665 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
666 if cat.AI in categorised: |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
667 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
|
668 state) |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
669 |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
670 if self.combat_power(categorised) > randint(20, 40): |
180
8868ac7ece8b
Tweak steal research mission
Neil Muller <drnlmuller@gmail.com>
parents:
179
diff
changeset
|
671 self._succ( |
177
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
672 "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
|
673 " 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
|
674 else: |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
675 self.fail( |
4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
Neil Muller <drnlmuller@gmail.com>
parents:
176
diff
changeset
|
676 "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
|
677 " 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
|
678 " prepared force.") |
183 | 679 |
680 | |
681 class TerroriseCity(Mission): | |
682 NAME = "Invade nearby city" | |
683 SHORT_DESCRIPTION = "Need more resources" | |
684 LONG_DESCRIPTION = ( | |
685 "Sometimes it's nessecary to remind people of what you can do." | |
686 " And why not do so close to home?") | |
687 | |
688 MINIMUM_MILESTONE = "city" | |
689 | |
690 NO_EQUIP_FAILURE = ( | |
691 "Attacking a city with your bare hands. Perhaps not the best" | |
692 " thought out scheme in the world. Fortunately, only your" | |
693 " pride was hurt by this failure.") | |
694 GENERIC_FAILURE = ( | |
695 "You fail to accomplish your goal. A different approach seems" | |
696 " called for.") | |
697 | |
698 def attempt_no_equipment(self, state): | |
699 self.fail(self.NO_EQUIP_FAILURE, rep=-randint(10, 15)) | |
700 | |
701 def attempt_with(self, categorised, state): | |
702 | |
703 self.use_equipment(categorised) | |
704 | |
705 if cat.DOOMSDAY_DEVICE in categorised: | |
706 self.succeed( | |
707 "Destroying the city is a simple exercies with the right" | |
708 " tools. People will tremble at the mention of your name", | |
709 rep=randint(15, 25)) | |
710 | |
711 if cat.AI in categorised: | |
712 self.succeed("Your AI easily takes control of the central" | |
713 " network. It's not that scary, but it is profitable", | |
714 money=randint(3000, 10000)) | |
715 | |
716 if cat.BEAST in categorised: | |
184 | 717 if any(cat.AQUATIC in x.CATEGORIES for x in |
718 categorised[cat.BEAST]): | |
719 rampage = 'harbour' | |
720 else: | |
721 rampage = 'streets' | |
722 self.succeed( | |
723 "Your creature's rampage through the city's %s terrifies" | |
724 " the city's inhabitants. The city council are eager to" | |
725 " pay you to rein it in. A most statisfying outcome" % rampage, | |
183 | 726 money=randint(2000, 5000), rep=randint(5, 15)) |
727 | |
728 if cat.VEHICLE in categorised: | |
729 if self.combat_power(categorised) > randint(50, 70): | |
730 self.succeed("Your overwhelming display of force cowers" | |
731 " the city. Fear of you spreads.", rep=randint(10, 20)) | |
732 else: | |
733 self.fail( | |
734 "Your forces prove unable to overcome the city's" | |
735 " defenses. This is an annoying setback, but you" | |
736 " vow to return.", rep=-randint(3, 7)) | |
737 | |
738 if cat.HAND_WEAPONS in categorised: | |
739 self.fail("A sprinkling of small arms can't overcome the city's" | |
740 " defenses. Something more impressive is required.") | |
185 | 741 |
742 | |
743 class SecureLair(Mission): | |
744 NAME = "Secure island base" | |
745 SHORT_DESCRIPTION = "A nice safe base of operations" | |
746 LONG_DESCRIPTION = ( | |
747 "It's a cliche, but there's a lot to be said for an isolated" | |
748 " and secure base of operations. You can still control your" | |
749 " city from afar. You just have to deal with the local inhabitants" | |
750 " of your chosen location, but they should not present a problem") | |
751 MINIONS_REQUIRED = 4 | |
752 MINIMUM_MILESTONE = 'city' | |
753 MINIMUM_REPUTATION = 50 | |
754 | |
755 NO_EQUIP_FAILURE = ( | |
756 "While the local defenses are weak, even they can deal with" | |
757 " a few unarmed men. Something more suitable is required") | |
758 GENERIC_FAILURE = ( | |
759 "Your chosen tools aren't up to the task of securing the" | |
760 " island. Perhaps you need to rethink your approach") | |
761 | |
762 def attempt_no_equipment(self, state): | |
763 self.fail(self.NO_EQUIP_FAILURE, rep=-randint(10, 15)) | |
764 | |
765 def attempt_with(self, categorised, state): | |
766 | |
767 self.use_equipment(categorised) | |
768 | |
769 if cat.DOOMSDAY_DEVICE in categorised: | |
770 self.fail( | |
771 "You want to use the island afterward, and the local" | |
772 " population can provide basic labour. Something less" | |
773 " destructive is required.") | |
774 | |
775 if cat.AI in categorised: | |
776 self.fail( | |
777 "Your AI complains about the limited bandwidth and" | |
778 " inadequate computing resources of the target, then" | |
779 " goes off to sulk. A more physical approach may" | |
780 " be required.") | |
781 | |
782 msg = ( | |
783 " Afraid of the repurcusions, the people quickly build a base" | |
784 " to your specifications") | |
785 if (cat.BEAST in categorised and | |
786 self.combat_power(categorised) > randint(20, 30)): | |
787 self.data['completed'] = True | |
788 self.succeed( | |
789 "Your creature's terrifying rampage destroys all" | |
790 " resistance, and you quickly conquer the island. %s" % msg, | |
791 rep=randint(10, 15)) | |
792 | |
793 if cat.VEHICLE in categorised: | |
794 if self.combat_power(categorised) > randint(20, 30): | |
795 self.data['completed'] = True | |
796 self.succeed("Your overwhelming display of force cowers" | |
797 " the local population. The island is yours. %s" % msg, | |
798 rep=randint(10, 15)) | |
799 else: | |
800 self.fail( | |
801 "Your forces prove unable to overcome the local" | |
802 " defenses.") | |
192
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
803 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
804 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
805 class EliminateRival(Mission): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
806 NAME = "Eliminate Dr. X." |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
807 SHORT_DESCRIPTION = "A rival. Inconcievable" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
808 LONG_DESCRIPTION = None # We handle this one specially |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
809 MINIONS_REQUIRED = 3 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
810 MINIMUM_MILESTONE = 'city' |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
811 MINIMUM_REPUTATION = 50 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
812 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
813 NO_EQUIP_FAILURE = ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
814 "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
|
815 " 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
|
816 GENERIC_FAILURE = ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
817 "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
|
818 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
819 def _new_data(self): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
820 # How many times has Dr. X been beaten? |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
821 self.data['times'] = 0 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
822 self.data['turn'] = 0 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
823 self.data['seen'] = False |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
824 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
825 def get_description(self): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
826 if self.get_data('times') == 0: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
827 return ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
828 "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
|
829 " 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
|
830 " 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
|
831 " unpunished.") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
832 elif self.get_data('times') == 1: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
833 return ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
834 "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
|
835 " encounter? This cannot go unpunished.") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
836 return ( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
837 "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
|
838 " 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
|
839 " regardless of the cause, this cannot be ignored.") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
840 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
841 def can_attempt(self, state): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
842 if self.get_data('completed'): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
843 # does Dr. X return? |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
844 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
|
845 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
|
846 self.data['completed'] = False |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
847 return True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
848 else: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
849 return False |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
850 elif self.get_data('seen'): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
851 # 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
|
852 return True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
853 if super(EliminateRival, self).can_attempt(state): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
854 self.data['seen'] = True # flag as seen |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
855 return True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
856 return False |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
857 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
858 def attempt_no_equipment(self, state): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
859 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
|
860 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
861 def attempt_with(self, categorised, state): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
862 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
863 self.use_equipment(categorised) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
864 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
865 if cat.DOOMSDAY_DEVICE in categorised: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
866 self.data['completed'] = True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
867 self.data['times'] += 1 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
868 self.data['turn'] = state.turn |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
869 self.succeed( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
870 "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
|
871 " not forgot this lesson anytime soon.", |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
872 rep=randint(10, 20)) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
873 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
874 if cat.AI in categorised: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
875 self.fail( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
876 "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
|
877 " 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
|
878 " 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
|
879 " do to foil his plans this way") |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
880 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
881 if (cat.BEAST in categorised and |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
882 self.combat_power(categorised) > randint(40, 60)): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
883 self.data['completed'] = True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
884 self.data['times'] += 1 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
885 self.data['turn'] = state.turn |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
886 self.succeed( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
887 "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
|
888 " recover this setback", rep=randint(10, 20)) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
889 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
890 if cat.VEHICLE in categorised: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
891 if self.combat_power(categorised) > randint(40, 60): |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
892 self.data['completed'] = True |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
893 self.data['times'] += 1 |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
894 self.data['turn'] = state.turn |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
895 self.succeed( |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
896 "Your forces easily overcome the doctor's defenses," |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
897 " 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
|
898 " 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
|
899 rep=randint(10, 20)) |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
900 else: |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
901 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
|
902 " anticipated. You'll have to return with more" |
57bf6a5e31cb
A rival appears on the scene
Neil Muller <drnlmuller@gmail.com>
parents:
185
diff
changeset
|
903 " firepower.", rep=-randint(3, 7)) |