Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class Wojownik:
- Name = "dywan"
- Level = 0
- Exp = 500
- AExp = 0
- MaxHp = 30
- Ahp = 30
- MinDmg = 3
- MaxDmg = 6
- Names = ["Mietek", "Zenek", "Adolf", "Tadek", "Robert", "Dywan", "Bazant"]
- def __init__(self):
- self.Name = "Wojownik"
- self.Level = 0
- self.Exp = 500
- self.AExp = 0
- self.MaxHp = random.randint(20, 30)
- self.Ahp = self.MaxHp
- self.MinDmg = random.randint(1, 8)
- self.MaxDmg = self.MinDmg + random.randint(1, 3)
- def attack(self, Wojownik):
- Wojownik.Ahp = Wojownik.Ahp - random.randint(self.MinDmg, self.MaxDmg)
- def lifeSteal(self, Wojownik):
- dmg = random.randint(self.MinDmg, self.MaxDmg)/2
- Wojownik.Ahp = Wojownik.Ahp - dmg
- if self.Ahp !=self.MaxHp:
- self.Ahp = self.Ahp + dmg
- if self.Ahp > self.MaxDmg:
- self.Ahp = self.MaxHp
- def showHp(self):
- print(self.Ahp)
- def showStats(self):
- print("Nazwa: %s\n Level: %d \n Exp: %d \n AExp %d \n MaxHp: %d \n Ahp: %d \n MinDmg: %d \n MaxDmg: %d \n" %(self.Name, self.Level, self.Exp, self.AExp, self.MaxHp, self.Ahp, self.MinDmg, self.MaxDmg))
- def setName(self):
- self.Name = input("Podaj nazwe swojego wojownika")
- def setName2(self):
- self.Name = self.Names[random.randint(0, len(self.Names) - 1)]
- postac = Wojownik()
- postac.setName()
- enemies = []
- for i in range(10):
- p = Wojownik()
- p.setName2()
- enemies.append(p)
- while postac.Ahp > 0:
- for i in enemies:
- while i.Ahp > 0:
- switch = input("1 Atak \n2 Lifesteal \n3 Pokaz statystyki \n4 Samobojstwo\n")
- if switch == 1:
- postac.attack(i)
- elif switch == 2:
- postac.lifeSteal(i)
- elif switch == 3:
- postac.showStats()
- i.showStats()
- elif switch == 4:
- postac.Ahp = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement