annotate gamelib/missions.py @ 34:20ed2843adec

More categories.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 06 May 2012 21:40:13 +0200
parents 12c33aac7684
children 2754c453b39b
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
34
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
4 from products import HAND_WEAPON, PATHOGEN, DOOMSDAY_DEVICE
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
5
18
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
6 MAJOR_SETBACK, FAILURE, SUCCESS, MAJOR_SUCCESS, GAME_WIN = range(5)
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
7
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
8
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
9 class Result(object):
c0966997e0c5 Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents: 10
diff changeset
10 """Results of a mission"""
c0966997e0c5 Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents: 10
diff changeset
11
c0966997e0c5 Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents: 10
diff changeset
12 def __init__(self, outcome, money, reputation, msg):
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 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
14 self.money = 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
15 self.reputation = reputation
c0966997e0c5 Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents: 10
diff changeset
16 self.message = msg
c0966997e0c5 Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents: 10
diff changeset
17 self.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
18
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 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
20 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
21 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
22 state.reputation += self.reputation
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 = True
25
27570aca5d17 Fix some stupid bugs
Neil Muller <drnlmuller@gmail.com>
parents: 23
diff changeset
24 # FIXME: Hook up to the UI
27570aca5d17 Fix some stupid bugs
Neil Muller <drnlmuller@gmail.com>
parents: 23
diff changeset
25 print self.message
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
26 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
27 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
28
c0966997e0c5 Use a results object instead of tuple (will hopefully make changign stuff easier later)
Neil Muller <drnlmuller@gmail.com>
parents: 10
diff changeset
29
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
30 class Mission(object):
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
31 """Base class for the mission objects.
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
32 Missions have a name, short description (for list displays) and
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
33 long description (which may contain clues about approaches)"""
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
34
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
35 NAME = "Generic Mission"
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
36 SHORT_DESCRIPTION = None
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
37 LONG_DESCRIPTION = None
33
12c33aac7684 Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents: 32
diff changeset
38 MINIMUM_REPUTATION = None
10
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
39 available = True
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
40
22
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
41 def __init__(self, init_data=None):
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
42 pass
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
43
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
44 def save_data(self):
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
45 """Serialize the mission state for saving, etc."""
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
46 return []
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
47
10
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
48 def attempt(self, equipment, state):
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
49 """Attempt the mission with the given equipment list.
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
50
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
51 Returns a result object with the results of the mission."""
18
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
52 return Result(FAILURE, 0, 0, "You can't succceed at this mission")
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
53
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
54
19
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
55 class PlaygroundBully(Mission):
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
56
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
57 NAME = "Rob kids in the playground"
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
58 SHORT_DESCRIPTION = "Steal from those significantly weaker than yourself"
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
59 LONG_DESCRIPTION = ("It's not menancing, or lucrative, but when the bills"
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
60 " are due, no one cares how you earn the money")
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
61
32
00aff02bc6fc Product categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 25
diff changeset
62 def attempt(self, equipment, state):
19
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
63 return Result(SUCCESS, 100, -1, "You devote your resources to"
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
64 " robbing kids in a playpark. It's not the finest moment"
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
65 " in your reign of terror, but at least you walked away"
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
66 " with a surprising amount of small change.")
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
67
12085dfd9e69 Add rescue mission for the out of money case
Neil Muller <drnlmuller@gmail.com>
parents: 18
diff changeset
68
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
69 class RansomChina(Mission):
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
70
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
71 NAME = "Hold China to ransom"
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
72 SHORT_DESCRIPTION = "Surely a path to riches and fame"
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
73 LONG_DESCRIPTION = "Holding China to ransom. The rewards for" \
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
74 " successfully threatening the largest country in the world" \
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
75 " are great, but the risks are significant. Without " \
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
76 "some serious firepower, the chances of success are small."
33
12c33aac7684 Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents: 32
diff changeset
77 MINIMUM_REPUTATION = 100
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
78
22
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
79 def __init__(self, init_data=None):
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
80 # Track prior approaches to this mission
34
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
81 self._prior_attempts = set()
22
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
82 if init_data:
34
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
83 self._prior_attempts = set(init_data)
22
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
84
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
85 def save_data(self):
296ce36fa7d9 Serialize and unserialize game state and missions
Neil Muller <drnlmuller@gmail.com>
parents: 19
diff changeset
86 return self._prior_attempts
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
87
10
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
88 def attempt(self, equipment, state):
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
89 failures = []
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
90 reputation = 0
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
91 for item in equipment:
34
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
92 if item.is_a(DOOMSDAY_DEVICE):
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
93 if item.NAME not in self._prior_attempts:
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
94 self._prior_attempts.add(item.NAME)
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
95 return Result(SUCCESS, 1000000, 1, (
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
96 "Trembling at the threat of your doomsday virus,"
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
97 " the chinese government pays the ransom."))
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
98 elif item.is_a(PATHOGEN):
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
99 reputation = -1
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
100 failures.append(
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
101 "'Hah, we've developed an antidote to your"
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
102 " pathogen, doctor. You cannot threaten us with that"
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
103 " again.'")
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
104 else:
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
105 reputation = -1
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
106 failures.append(
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
107 "'Hah, we know how to deal with that particular"
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
108 " threat, doctor.'")
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
109 else:
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
110 failures.append("You fail to inspire fear with your %s"
34
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
111 % item.NAME)
18
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
112 return Result(FAILURE, 0, reputation, "\n".join(failures))
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
113
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
114
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
115 class RobBank(Mission):
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
116
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
117 NAME = "Rob the local bank"
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
118 SHORT_DESCRIPTION = "A trivial challenge, but easy money"
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
119 LONG_DESCRIPTION = "The security guards and local police are of minor" \
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
120 " concern. Walk in, clean out the vault, walk out. Couldn't be" \
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
121 " simpler."
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
122
10
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
123 def attempt(self, equipment, state):
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
124 failures = []
25
27570aca5d17 Fix some stupid bugs
Neil Muller <drnlmuller@gmail.com>
parents: 23
diff changeset
125 if not equipment:
27570aca5d17 Fix some stupid bugs
Neil Muller <drnlmuller@gmail.com>
parents: 23
diff changeset
126 return Result(FAILURE, 0, 0, "Your attempt to rob the bank"
27570aca5d17 Fix some stupid bugs
Neil Muller <drnlmuller@gmail.com>
parents: 23
diff changeset
127 " barehanded is unsuccessful. Fortunately, everyone is"
27570aca5d17 Fix some stupid bugs
Neil Muller <drnlmuller@gmail.com>
parents: 23
diff changeset
128 " too stunned to impede your escape.")
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
129 for item in equipment:
34
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
130 if item.is_a(PATHOGEN):
10
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
131 if state.reputation < 10:
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
132 failures.append("The clerk doesn't realise the threat of"
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
133 " the vial you hold, and, although watching him"
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
134 " die in agony would be statisfying, you decide"
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
135 " it's not worth wasting this on something so"
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
136 " trivial")
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
137 else:
18
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
138 return Result(SUCCESS, 1000, 0, "Holding up a bank with"
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
139 " only a small vial of clear liquid. Now that"
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
140 " is power.")
34
20ed2843adec More categories.
Jeremy Thurgood <firxen@gmail.com>
parents: 33
diff changeset
141 elif item.is_a(HAND_WEAPON):
18
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
142 return Result(SUCCESS, 1000, 0, "The threat of your weapons is"
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
143 " enough to inspire an impressive level of cooperation")
5
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
144 else:
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
145 failures.append("You fail to inspire fear with your %s"
dd9046d0680c Sketch in mission objects
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
146 % item.name)
18
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
147 return Result(FAILURE, 0, 0, "\n".join(failures))
10
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
148
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
149
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
150 class DestroyMountRushmore(Mission):
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
151
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
152 NAME = "Destroy Mount Rushmore"
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
153 SHORT_DESCRIPTION = "Monuments to other people? Intolerable"
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
154 LONG_DESCRIPTION = "While potentially expensive, destroying" \
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
155 " major monument is a good way to secure your reputation."
33
12c33aac7684 Gate certain missions by reputation.
Jeremy Thurgood <firxen@gmail.com>
parents: 32
diff changeset
156 MINIMUM_REPUTATION = 20
10
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
157
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
158 def attempt(self, equipment, state):
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
159 if not self.available:
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
160 raise RuntimeError('Cannot attempt an unavailable mission')
10
9f8def7d70d0 Rework mission objects to include reputation
Neil Muller <drnlmuller@gmail.com>
parents: 5
diff changeset
161 self.available = False
18
0849ab5304cf Add more mission result codes
Neil Muller <drnlmuller@gmail.com>
parents: 13
diff changeset
162 return Result(SUCCESS, 0, 100,
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
163 "Mount Rushmore is remarkably easy to destroy.")