User1035 / Sigma-storage

Only for real sigmas
0 stars 0 forks source link

Split out Monster into a stand alone class in it's own file. #6

Open jamesdonkin opened 2 weeks ago

jamesdonkin commented 2 weeks ago

I would suggest making Monster it's own class, separate from Encounters, then use them in encounters.

         monster_name = "the giant rat"
         monster_hp = 8
         monster_dm = 1
   Have something like

theMonster = GiantRat()

jamesdonkin commented 2 weeks ago

So then the games runs just the same but the monster logic is in it's own file.

jamesdonkin commented 2 weeks ago

For this to work you'll need to do other fixing up where the old monster variables are accessed. For example

def monster_attack():

Suggest changing this to:

def monster_attack(attacking_monster):

And pass in the monster doing the fighting to the method call. Then inside that block you can replace

monster_hp
monster_name

Global variables, with:

attacking_monster.health
attacking_monster.name