Commit 1c49f827 authored by nschroeder1771's avatar nschroeder1771
Browse files

Added super harvester to instructions and created the setup for the class....

Added super harvester to instructions and created the setup for the class. Still need to add the condition in which it dies and the doctests.
parent 1744d80c
......@@ -115,6 +115,7 @@ class UnitType(Enum):
THROWER = 'THROWER'
SUPER_HARVESTER = 'SUPER HARVESTER'
class Insect(object):
"""
An Insect, the base class of Ant and Bee, has health and damage and also a Place.
......@@ -280,8 +281,15 @@ class Harvester(Ant):
"""
game_state.food += self.production
class SuperHarvester(Harvester):
def __init__(self, unit_type, food_cost, health, production):
super().__init__(unit_type, food_cost, health, production)
def act(self, game_state):
super().act(self, game_state)
class Thrower(Ant):
"""
......@@ -483,7 +491,7 @@ class GameState(object):
Make a player move to place an Ant based on the given archetype at the given Place. Return that Ant, or None if
the Ant could not be placed. Ants can only be placed on empty Places.
"""
if ant_archetype is None or place.defender is not None or len(place.bees) > 0 or\
if ant_archetype is None or place.defender is not None or len(place.bees) > 0 or \
self.food < ant_archetype.food_cost:
return None
self.food -= ant_archetype.food_cost
......@@ -497,7 +505,7 @@ class GameState(object):
"""
if ant is not None:
assert ant.place is not None, f'Cannot sacrifice {ant}, which is already dead'
assert any(place.defender is ant for place in self.places),\
assert any(place.defender is ant for place in self.places), \
f'Cannot sacrifice {ant}, which belongs to a different game'
ant.reduce_health(ant.health)
......
......@@ -112,7 +112,7 @@ class Game(BoxLayout):
ants_vs_some_bees.UnitType.BEE: 'assets/bee.gif',
ants_vs_some_bees.UnitType.HARVESTER: 'assets/ant_harvester.gif',
ants_vs_some_bees.UnitType.THROWER: 'assets/ant_medium.gif',
ants_vs_some_bees.UnitType.SUPER_HARVESTER: 'ant_fire.gif'
ants_vs_some_bees.UnitType.SUPER_HARVESTER: 'assets/ant_fire.gif'
}
LEAF_SPRITE_FILENAMES = {
ants_vs_some_bees.UnitType.THROWER: 'assets/leaf_green.gif',
......
......@@ -98,6 +98,9 @@ ScreenManager:
CaptionedSprite:
source: 'assets/ant_medium.gif'
text: 'An leaf thrower costs 7 food units to deploy and dies after throwing four leaves. It will only throw leaves outward, away from the queen.'
CaptionedSprite:
source: 'assets/ant_fire.gif'
text: 'A super harvester ant costs 5 food units to deploy, but produces 2 units of food per turn.'
Paragraph:
text: 'To sacrifice an ant, which can be useful if you need space for new deployments, select the sacrifice tool and tap on the ant you want to sacrifice.'
Paragraph:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment