changeset 3:6ab4f1ab9eab

Very basics of research and products.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 06 May 2012 11:59:20 +0200
parents 427cf79e9875
children 5e21bf2b6853
files gamelib/products.py gamelib/research.py
diffstat 2 files changed, 63 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gamelib/products.py	Sun May 06 11:59:20 2012 +0200
@@ -0,0 +1,30 @@
+from gamelib import research
+
+
+class Product(object):
+    NAME = None
+    PREREQUISITES = ()
+
+    def __init__(self):
+        self.points = 0
+
+    def spend_points(self, points):
+        self.points += points
+
+
+class MachineGun(Product):
+    NAME = "Machine gun"
+
+
+class TeslaGun(Product):
+    NAME = "Tesla gun"
+    PREREQUISITES = (
+        (research.Tesla, 1),
+        )
+
+
+class DoomsdayVirus(Product):
+    NAME = "Doomsday virus"
+    PREREQUISITES = (
+        (research.BioGenetics, 5),
+        )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gamelib/research.py	Sun May 06 11:59:20 2012 +0200
@@ -0,0 +1,33 @@
+class ResearchArea(object):
+    NAME = None
+    PREREQUISITES = ()
+
+    def __init__(self):
+        self.points = 0
+
+    def spend_points(self, points):
+        self.points += points
+
+
+class Tesla(ResearchArea):
+    NAME = "Tesla"
+
+
+class Robotics(ResearchArea):
+    NAME = "Robotics"
+
+
+class Rocketry(ResearchArea):
+    NAME = "Rocketry"
+
+
+class BioGenetics(ResearchArea):
+    NAME = "Biogenetics"
+
+
+class Space(ResearchArea):
+    NAME = "SPAAAAAACE!"
+    PREREQUISITES = (
+        (RoboticsResearch, 1),
+        (RocketryResearch, 2),
+        )