Mercurial > sypikslang
diff gamelib/missions.py @ 177:4bbd4a1879f8
Plagiarism! (Only be sure, please, to always call it research)
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 12 May 2012 11:23:22 +0200 |
parents | 32ef26f410b8 |
children | 52cc28b429b7 |
line wrap: on
line diff
--- a/gamelib/missions.py Sat May 12 10:29:36 2012 +0200 +++ b/gamelib/missions.py Sat May 12 11:23:22 2012 +0200 @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4 -from random import randint, random +from random import randint, random, choice from gamelib.constants import SUCCESS, FAILURE, GAME_WIN, M_VALS from gamelib.schematics import cat @@ -553,3 +553,65 @@ "The news station's security is surprisingly well prepared." " Prehaps you should rethink your approach?", rep=-randint(5, 10)) + + +class RaidLab(Mission): + NAME = "Raid Rival Lab" + SHORT_DESCRIPTION = "Why not let other people work for you?" + LONG_DESCRIPTION = ( + "While clearly no match for your genius, sometimes your rivals stumble" + " onto something interesting. Surely their results can be put to" + " better use helping your plans?") + + MINIMUM_MILESTONE = "neighbourhood" + + NO_EQUIP_FAILURE = ( + "Your rival may not be the sharpest tool in the shed, but even a" + " fool invests in some defenses. You'll need to be better prepared" + " in the future.") + + def succeed(self, msg, state): + reward = choice(('schematic', 'science', + 'money', 'money', 'money', 'money', 'money', + 'nothing', 'nothing', 'nothing')) + if reward == 'nothing': + msg = msg + (" Unfortunately, not only are these people working" + " on ideas you've already covered, they're flat broke.") + raise Result(SUCCESS, msg, money=0, rep=1) + elif reward == 'money': + msg = msg + (" While their research yields nothing of interest," + " you can repurpose their funding to more worthy causes.") + raise Result(SUCCESS, msg, money=randint(1000, 2000), rep=1) + elif reward == 'schematic': + msg = msg + (" You find the plans for a new device. How did" + " these fools stumble upon this?") + raise Result(SUCCESS, msg, meoney=0, repo=randint(2, 5), + new_schematic=choice(state.lab.new_schematics)) + # New science + msg = msg + (" Their notes are most illuminating. You realise you have" + " sadly neglected research into this field.") + raise Result(SUCCESS, msg, money=0, rep=randint(2, 5), + new_science=choice(state.lab.new_research)) + + def attempt_with(self, categorised, state): + + self.use_equipment(categorised) + + if cat.DOOM in categorised: + self.fail( + "While overwhelming force is always a tempting choice," + " total destruction of the lab will not help you cause.") + + if cat.AI in categorised: + self.succeed("Your AI easily takes control of the lab's network.", + state) + + if self.combat_power(categorised) > randint(20, 40): + self.succeed( + "The resistance is stiff, but your forces prevail" + " thanks to your superior technology.", state) + else: + self.fail( + "The lab is surprisingly well defended for an operation" + " run by a total fool. You vow to return with a better" + " prepared force.")