Text-based Battle game [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite
1












I'm developing a text-based Kingdom management game in Python 3 where you can battle other kingdoms and have armies with a lot of troops. I need help especially in these points:



  • Types of troop (cavalry, siege unit, etc)

  • Battle options (charge, defend, flee, advance carefully)

  • Battle wounds, healing and death

  • Attack types (missile, melee etc.) depending on battle options

  • Armies can rebel

  • Defeats and victories gain points to your kingdom, others will fear you

  • When low on morale troops will flee battle or your camp, and will turn into bandits



class Character:
def __init__(self, name="Player", coins=1000):
self.name=name
self.health=100
#self.strength=0
#self.speech=0 #and also it?
#self.socialclass='' #remove it?
self.coins=coins
#self.renown=0
self.honour=0
#self.fear=0 #fear == powerpoints?
self.inventory=
#self.stamina=0 no stamina!
def status(self):
if self.health < 2:
del self
return "Died."
return "%s's current health is %d." % (self.name, self.health)
def __del__(self):
tmp=self.name
del self
return "%s is dead." % tmp
def __repr__(self):
return 'Do something with the object!'
class Troop(Character): #put it under Army?
def __init__(self, name, payment): #put types: infantry, cavalry, siege?
#what about self.faction?
Character.__init__(self)
self.name = name
self.attack='missile':0, 'melee':0, 'thrusting':0
self.defense='missile':0, 'melee':0, 'thrusting':0 #defense against...
#self.chief=chief
self.wounded=False #put xp points for training? NO
self.payment=payment
self.lvl=1
def pay(self): #move method?
if self.chief.coins < self.payment: #needs improvement for morale?
if randint(0,1):
return self.flee() #improve it!
else:
return "Soldiers are grumbling because you didn't pay them!"
self.chief.coins -= self.payment
def upgrade(self): #not necessary?
pass
def heal(self):
if self.health <
def flee(self): #move it all to Army?
self.chief=None
self.payment=None
return 'One %s fled to the woods.' % self.name
class Army:
def __init__(self, faction): #sell troops etc
#self.chief = chief #not needed?
self.faction = faction
self.morale = 100
self.troops = #put a dict here?

#self.defeats and victories?
def pay(self):
paid=0
for i in troops:
if self.faction.ruler.coins < self.payment:
self.morale -= randint(1, 5) #should be proprtional? and troop.lvl?
else:
paid+=1
return "You managed to pay %d troops." % paid #more info...
def flee(self):
if self.morale < 60:
self.troops.remove()
def attack(self):
pass
def feed(self):
pass
def punish(self, degree): #degree is func menu?
print("What kind of treatment will you impose to your soldiers? ")
types=['Let them drink and play dice all day!', "Let'em have fun but they also need to do some work...', 'Kill all lazy bastards in this camp!"] #use menu here
return result #list
def rebel(self):
if self.punish()[1] and self.morale < 40: #what about defeats? should it be outside class?
pass

class Battle: #should be a function under Army?
def __init__(self, attacker, defender):
self.attacker=attacker
self.defender=defender
def charge(self):
meleebonus=randint(1, 4)
def flee(self):
pass






share|improve this question













closed as off-topic by vnp, Mast, Hosch250, 200_success, Quill Apr 30 at 2:47


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Mast, Hosch250, 200_success, Quill
If this question can be reworded to fit the rules in the help center, please edit the question.








  • 2




    "I need help especially in these points:" Do those currently work as intended?
    – Mast
    Apr 29 at 18:06






  • 3




    Your indentation seems off. Since indentation is critical in Python programs, it has to be fixed before it can be reviewed. For example, class Troop(Character): is improperly indented.
    – Mast
    Apr 29 at 18:06










  • I know, it bugged the indentation while copy-paste my code here.
    – nelson450
    Apr 29 at 18:16










  • That's unfortunate. Please fix it.
    – Mast
    Apr 29 at 18:28






  • 1




    Already fixed by Jamal, thx!
    – nelson450
    Apr 29 at 18:52
















up vote
1
down vote

favorite
1












I'm developing a text-based Kingdom management game in Python 3 where you can battle other kingdoms and have armies with a lot of troops. I need help especially in these points:



  • Types of troop (cavalry, siege unit, etc)

  • Battle options (charge, defend, flee, advance carefully)

  • Battle wounds, healing and death

  • Attack types (missile, melee etc.) depending on battle options

  • Armies can rebel

  • Defeats and victories gain points to your kingdom, others will fear you

  • When low on morale troops will flee battle or your camp, and will turn into bandits



class Character:
def __init__(self, name="Player", coins=1000):
self.name=name
self.health=100
#self.strength=0
#self.speech=0 #and also it?
#self.socialclass='' #remove it?
self.coins=coins
#self.renown=0
self.honour=0
#self.fear=0 #fear == powerpoints?
self.inventory=
#self.stamina=0 no stamina!
def status(self):
if self.health < 2:
del self
return "Died."
return "%s's current health is %d." % (self.name, self.health)
def __del__(self):
tmp=self.name
del self
return "%s is dead." % tmp
def __repr__(self):
return 'Do something with the object!'
class Troop(Character): #put it under Army?
def __init__(self, name, payment): #put types: infantry, cavalry, siege?
#what about self.faction?
Character.__init__(self)
self.name = name
self.attack='missile':0, 'melee':0, 'thrusting':0
self.defense='missile':0, 'melee':0, 'thrusting':0 #defense against...
#self.chief=chief
self.wounded=False #put xp points for training? NO
self.payment=payment
self.lvl=1
def pay(self): #move method?
if self.chief.coins < self.payment: #needs improvement for morale?
if randint(0,1):
return self.flee() #improve it!
else:
return "Soldiers are grumbling because you didn't pay them!"
self.chief.coins -= self.payment
def upgrade(self): #not necessary?
pass
def heal(self):
if self.health <
def flee(self): #move it all to Army?
self.chief=None
self.payment=None
return 'One %s fled to the woods.' % self.name
class Army:
def __init__(self, faction): #sell troops etc
#self.chief = chief #not needed?
self.faction = faction
self.morale = 100
self.troops = #put a dict here?

#self.defeats and victories?
def pay(self):
paid=0
for i in troops:
if self.faction.ruler.coins < self.payment:
self.morale -= randint(1, 5) #should be proprtional? and troop.lvl?
else:
paid+=1
return "You managed to pay %d troops." % paid #more info...
def flee(self):
if self.morale < 60:
self.troops.remove()
def attack(self):
pass
def feed(self):
pass
def punish(self, degree): #degree is func menu?
print("What kind of treatment will you impose to your soldiers? ")
types=['Let them drink and play dice all day!', "Let'em have fun but they also need to do some work...', 'Kill all lazy bastards in this camp!"] #use menu here
return result #list
def rebel(self):
if self.punish()[1] and self.morale < 40: #what about defeats? should it be outside class?
pass

class Battle: #should be a function under Army?
def __init__(self, attacker, defender):
self.attacker=attacker
self.defender=defender
def charge(self):
meleebonus=randint(1, 4)
def flee(self):
pass






share|improve this question













closed as off-topic by vnp, Mast, Hosch250, 200_success, Quill Apr 30 at 2:47


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Mast, Hosch250, 200_success, Quill
If this question can be reworded to fit the rules in the help center, please edit the question.








  • 2




    "I need help especially in these points:" Do those currently work as intended?
    – Mast
    Apr 29 at 18:06






  • 3




    Your indentation seems off. Since indentation is critical in Python programs, it has to be fixed before it can be reviewed. For example, class Troop(Character): is improperly indented.
    – Mast
    Apr 29 at 18:06










  • I know, it bugged the indentation while copy-paste my code here.
    – nelson450
    Apr 29 at 18:16










  • That's unfortunate. Please fix it.
    – Mast
    Apr 29 at 18:28






  • 1




    Already fixed by Jamal, thx!
    – nelson450
    Apr 29 at 18:52












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I'm developing a text-based Kingdom management game in Python 3 where you can battle other kingdoms and have armies with a lot of troops. I need help especially in these points:



  • Types of troop (cavalry, siege unit, etc)

  • Battle options (charge, defend, flee, advance carefully)

  • Battle wounds, healing and death

  • Attack types (missile, melee etc.) depending on battle options

  • Armies can rebel

  • Defeats and victories gain points to your kingdom, others will fear you

  • When low on morale troops will flee battle or your camp, and will turn into bandits



class Character:
def __init__(self, name="Player", coins=1000):
self.name=name
self.health=100
#self.strength=0
#self.speech=0 #and also it?
#self.socialclass='' #remove it?
self.coins=coins
#self.renown=0
self.honour=0
#self.fear=0 #fear == powerpoints?
self.inventory=
#self.stamina=0 no stamina!
def status(self):
if self.health < 2:
del self
return "Died."
return "%s's current health is %d." % (self.name, self.health)
def __del__(self):
tmp=self.name
del self
return "%s is dead." % tmp
def __repr__(self):
return 'Do something with the object!'
class Troop(Character): #put it under Army?
def __init__(self, name, payment): #put types: infantry, cavalry, siege?
#what about self.faction?
Character.__init__(self)
self.name = name
self.attack='missile':0, 'melee':0, 'thrusting':0
self.defense='missile':0, 'melee':0, 'thrusting':0 #defense against...
#self.chief=chief
self.wounded=False #put xp points for training? NO
self.payment=payment
self.lvl=1
def pay(self): #move method?
if self.chief.coins < self.payment: #needs improvement for morale?
if randint(0,1):
return self.flee() #improve it!
else:
return "Soldiers are grumbling because you didn't pay them!"
self.chief.coins -= self.payment
def upgrade(self): #not necessary?
pass
def heal(self):
if self.health <
def flee(self): #move it all to Army?
self.chief=None
self.payment=None
return 'One %s fled to the woods.' % self.name
class Army:
def __init__(self, faction): #sell troops etc
#self.chief = chief #not needed?
self.faction = faction
self.morale = 100
self.troops = #put a dict here?

#self.defeats and victories?
def pay(self):
paid=0
for i in troops:
if self.faction.ruler.coins < self.payment:
self.morale -= randint(1, 5) #should be proprtional? and troop.lvl?
else:
paid+=1
return "You managed to pay %d troops." % paid #more info...
def flee(self):
if self.morale < 60:
self.troops.remove()
def attack(self):
pass
def feed(self):
pass
def punish(self, degree): #degree is func menu?
print("What kind of treatment will you impose to your soldiers? ")
types=['Let them drink and play dice all day!', "Let'em have fun but they also need to do some work...', 'Kill all lazy bastards in this camp!"] #use menu here
return result #list
def rebel(self):
if self.punish()[1] and self.morale < 40: #what about defeats? should it be outside class?
pass

class Battle: #should be a function under Army?
def __init__(self, attacker, defender):
self.attacker=attacker
self.defender=defender
def charge(self):
meleebonus=randint(1, 4)
def flee(self):
pass






share|improve this question













I'm developing a text-based Kingdom management game in Python 3 where you can battle other kingdoms and have armies with a lot of troops. I need help especially in these points:



  • Types of troop (cavalry, siege unit, etc)

  • Battle options (charge, defend, flee, advance carefully)

  • Battle wounds, healing and death

  • Attack types (missile, melee etc.) depending on battle options

  • Armies can rebel

  • Defeats and victories gain points to your kingdom, others will fear you

  • When low on morale troops will flee battle or your camp, and will turn into bandits



class Character:
def __init__(self, name="Player", coins=1000):
self.name=name
self.health=100
#self.strength=0
#self.speech=0 #and also it?
#self.socialclass='' #remove it?
self.coins=coins
#self.renown=0
self.honour=0
#self.fear=0 #fear == powerpoints?
self.inventory=
#self.stamina=0 no stamina!
def status(self):
if self.health < 2:
del self
return "Died."
return "%s's current health is %d." % (self.name, self.health)
def __del__(self):
tmp=self.name
del self
return "%s is dead." % tmp
def __repr__(self):
return 'Do something with the object!'
class Troop(Character): #put it under Army?
def __init__(self, name, payment): #put types: infantry, cavalry, siege?
#what about self.faction?
Character.__init__(self)
self.name = name
self.attack='missile':0, 'melee':0, 'thrusting':0
self.defense='missile':0, 'melee':0, 'thrusting':0 #defense against...
#self.chief=chief
self.wounded=False #put xp points for training? NO
self.payment=payment
self.lvl=1
def pay(self): #move method?
if self.chief.coins < self.payment: #needs improvement for morale?
if randint(0,1):
return self.flee() #improve it!
else:
return "Soldiers are grumbling because you didn't pay them!"
self.chief.coins -= self.payment
def upgrade(self): #not necessary?
pass
def heal(self):
if self.health <
def flee(self): #move it all to Army?
self.chief=None
self.payment=None
return 'One %s fled to the woods.' % self.name
class Army:
def __init__(self, faction): #sell troops etc
#self.chief = chief #not needed?
self.faction = faction
self.morale = 100
self.troops = #put a dict here?

#self.defeats and victories?
def pay(self):
paid=0
for i in troops:
if self.faction.ruler.coins < self.payment:
self.morale -= randint(1, 5) #should be proprtional? and troop.lvl?
else:
paid+=1
return "You managed to pay %d troops." % paid #more info...
def flee(self):
if self.morale < 60:
self.troops.remove()
def attack(self):
pass
def feed(self):
pass
def punish(self, degree): #degree is func menu?
print("What kind of treatment will you impose to your soldiers? ")
types=['Let them drink and play dice all day!', "Let'em have fun but they also need to do some work...', 'Kill all lazy bastards in this camp!"] #use menu here
return result #list
def rebel(self):
if self.punish()[1] and self.morale < 40: #what about defeats? should it be outside class?
pass

class Battle: #should be a function under Army?
def __init__(self, attacker, defender):
self.attacker=attacker
self.defender=defender
def charge(self):
meleebonus=randint(1, 4)
def flee(self):
pass








share|improve this question












share|improve this question




share|improve this question








edited Apr 29 at 17:57









Jamal♦

30.1k11114225




30.1k11114225









asked Apr 29 at 17:45









nelson450

91




91




closed as off-topic by vnp, Mast, Hosch250, 200_success, Quill Apr 30 at 2:47


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Mast, Hosch250, 200_success, Quill
If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by vnp, Mast, Hosch250, 200_success, Quill Apr 30 at 2:47


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Mast, Hosch250, 200_success, Quill
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 2




    "I need help especially in these points:" Do those currently work as intended?
    – Mast
    Apr 29 at 18:06






  • 3




    Your indentation seems off. Since indentation is critical in Python programs, it has to be fixed before it can be reviewed. For example, class Troop(Character): is improperly indented.
    – Mast
    Apr 29 at 18:06










  • I know, it bugged the indentation while copy-paste my code here.
    – nelson450
    Apr 29 at 18:16










  • That's unfortunate. Please fix it.
    – Mast
    Apr 29 at 18:28






  • 1




    Already fixed by Jamal, thx!
    – nelson450
    Apr 29 at 18:52












  • 2




    "I need help especially in these points:" Do those currently work as intended?
    – Mast
    Apr 29 at 18:06






  • 3




    Your indentation seems off. Since indentation is critical in Python programs, it has to be fixed before it can be reviewed. For example, class Troop(Character): is improperly indented.
    – Mast
    Apr 29 at 18:06










  • I know, it bugged the indentation while copy-paste my code here.
    – nelson450
    Apr 29 at 18:16










  • That's unfortunate. Please fix it.
    – Mast
    Apr 29 at 18:28






  • 1




    Already fixed by Jamal, thx!
    – nelson450
    Apr 29 at 18:52







2




2




"I need help especially in these points:" Do those currently work as intended?
– Mast
Apr 29 at 18:06




"I need help especially in these points:" Do those currently work as intended?
– Mast
Apr 29 at 18:06




3




3




Your indentation seems off. Since indentation is critical in Python programs, it has to be fixed before it can be reviewed. For example, class Troop(Character): is improperly indented.
– Mast
Apr 29 at 18:06




Your indentation seems off. Since indentation is critical in Python programs, it has to be fixed before it can be reviewed. For example, class Troop(Character): is improperly indented.
– Mast
Apr 29 at 18:06












I know, it bugged the indentation while copy-paste my code here.
– nelson450
Apr 29 at 18:16




I know, it bugged the indentation while copy-paste my code here.
– nelson450
Apr 29 at 18:16












That's unfortunate. Please fix it.
– Mast
Apr 29 at 18:28




That's unfortunate. Please fix it.
– Mast
Apr 29 at 18:28




1




1




Already fixed by Jamal, thx!
– nelson450
Apr 29 at 18:52




Already fixed by Jamal, thx!
– nelson450
Apr 29 at 18:52















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Greedy Best First Search implementation in Rust

Function to Return a JSON Like Objects Using VBA Collections and Arrays

C++11 CLH Lock Implementation