annotate gamelib/missions.py @ 209:5ca97ed09738

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