comparison gamelib/gamestate.py @ 161:6fdc985429a7

Display research advice.
author Jeremy Thurgood <firxen@gmail.com>
date Fri, 11 May 2012 22:29:23 +0200
parents f4601492020b
children 4bbd4a1879f8
comparison
equal deleted inserted replaced
160:7eead0d85497 161:6fdc985429a7
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4 2 # vim:fileencoding=utf-8 ai ts=4 sts=4 et sw=4
3 3
4 """The actual game state object""" 4 """The actual game state object"""
5
6 from random import choice
5 7
6 from gamelib import missions, lab 8 from gamelib import missions, lab
7 from gamelib.game_base import get_subclasses 9 from gamelib.game_base import get_subclasses
8 from gamelib.constants import M_VALS, INFO 10 from gamelib.constants import M_VALS, INFO
9 11
37 self.points += 1 + M_VALS[self.milestone] * 2 39 self.points += 1 + M_VALS[self.milestone] * 2
38 self.minions += 1 + M_VALS[self.milestone] * 2 40 self.minions += 1 + M_VALS[self.milestone] * 2
39 self.turn += 1 41 self.turn += 1
40 self.cur_missions = [] 42 self.cur_missions = []
41 self.cur_allocation = [] 43 self.cur_allocation = []
44 # Suggest research
45 basic_research, suggestions = self.lab.suggest_research()
46 if basic_research:
47 suggestions.append(None)
48 self.advice = choice(suggestions)
49 if self.advice is None:
50 self.advice = ("Leave some researchers unassigned."
51 " They might turn up something cool.")
52 else:
53 self.advice = "Our work in %s is looking promising." % (
54 self.advice.NAME,)
42 55
43 def get_available_equipment(self): 56 def get_available_equipment(self):
44 """Return a list of equipment we can produce and afford""" 57 """Return a list of equipment we can produce and afford"""
45 available = [x for x in self.lab.science 58 available = [x for x in self.lab.science
46 if x.SCIENCE_TYPE == 'schematic' and x.COST <= self.money] 59 if x.SCIENCE_TYPE == 'schematic' and x.COST <= self.money]