Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/vikingsClasses.cpython-39.pyc
Binary file not shown.
71 changes: 62 additions & 9 deletions vikingsClasses.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,77 @@

# Soldier

#to test the soldier you do python3 name_of_file

class Soldier:
pass
def __init__(self, health, strength): #arguments
self.health = health
self.strength = strength

# Viking
def attack(self):
return self.strength

def receiveDamage(self, damage):
#self.damage = damage - don't need to use
self.health = self.health - damage


class Viking:
pass
# Viking

# Saxon
class Viking(Soldier):
def __init__(self, name, health, strength):
super().__init__(health, strength)
self.name = name

def receiveDamage(self, damage):
#self.damage = damage
#self.health = self.health - self.damage
self.health = self.health - damage
if self.health > 0:
return (f"{self.name} has received {damage} points of damage")
else:
return (f"{self.name} has died in act of combat")

def battleCry(self):
return "Odin Owns You All!"

# Saxon

class Saxon:
pass
class Saxon(Soldier):
def receiveDamage(self, damage):
self.health = self.health - damage
if self.health > 0:
return (f"A Saxon has received {damage} points of damage")
else:
return (f"A Saxon has died in combat")


# War

class War():

vikingArmy = []
saxonArmy = []

def addViking(self,Viking):
self.vikingArmy.append(1)
def addSaxon(self, Saxon):
self.saxonArmy.append(1)

def vikingAttack(self):
receiveDamage = self.strength
if self.health > 0:
return (f"{self.name} has received {damage} points of damage")
else:
return (f"{self.name} has died in act of combat")

def saxonAttack():

class War:
def showStatus():
if len(self.saxonArmy) == 0:
return "Vikings have won the war of the century!"
if len(self.vikingArmy) == 0:
return "Saxons have fought for their lives and survive another day..."
else:
return "Vikings and Saxons are still in the thick of battle."

pass