# HG changeset patch # User Neil Muller # Date 1336425641 -7200 # Node ID 52913ba12988118a468e3d96b639136e8cbebabd # Parent 9aa0252fb6e411c6eb747d820e3030c38d58ed3b Check for multiple points in can_spend diff -r 9aa0252fb6e4 -r 52913ba12988 gamelib/game_base.py --- a/gamelib/game_base.py Mon May 07 23:13:05 2012 +0200 +++ b/gamelib/game_base.py Mon May 07 23:20:41 2012 +0200 @@ -22,7 +22,7 @@ def spend_point(self): self.points += 1 - def can_spend(self, lab): + def can_spend(self, lab, spend): return True @classmethod diff -r 9aa0252fb6e4 -r 52913ba12988 gamelib/lab.py --- a/gamelib/lab.py Mon May 07 23:13:05 2012 +0200 +++ b/gamelib/lab.py Mon May 07 23:20:41 2012 +0200 @@ -66,7 +66,7 @@ # First, allocate the points. for thing in things: assert thing in self.science - assert thing.can_spend(self) + assert thing.can_spend(self, 1) thing.spend_point() # Next, check for schematic breakthroughs and upgrades diff -r 9aa0252fb6e4 -r 52913ba12988 gamelib/schematics.py --- a/gamelib/schematics.py Mon May 07 23:13:05 2012 +0200 +++ b/gamelib/schematics.py Mon May 07 23:20:41 2012 +0200 @@ -30,8 +30,8 @@ BASE_POWER = None POWER_INCREMENT = None - def can_spend(self, lab): - extra = self.UPGRADE_REQUIREMENT * self.points + 1 + def can_spend(self, lab, spend): + extra = self.UPGRADE_REQUIREMENT * self.points + spend return lab.meet_requirements(self, extra) def is_a(self, category): @@ -62,7 +62,7 @@ def spend_point(self): raise NotImplementedError() - def can_spend(self, lab): + def can_spend(self, lab, spend): return False diff -r 9aa0252fb6e4 -r 52913ba12988 gamelib/tests/repl_game.py --- a/gamelib/tests/repl_game.py Mon May 07 23:13:05 2012 +0200 +++ b/gamelib/tests/repl_game.py Mon May 07 23:20:41 2012 +0200 @@ -19,7 +19,7 @@ print "Science:" self.science = [] for science in self.game.lab.science: - if science.can_spend(self.game.lab): + if science.can_spend(self.game.lab, 1): self.science.append(science) print " %s. %s (%s)" % ( len(self.science), science.NAME, science.points)