Sep-19-2017, 10:08 AM
Hello, I have to create a " weapon " with name, damage speed, range, damage/second, and the damage would change if the weapon has a gem..
here is the starter code i have:
thanks!
here is the starter code i have:
class Weapon(object): [...] class Sword(Weapon): def __init__(self, name='sword', speed=1, dmg_min=1, dmg_max=1, wrange=1, gems=, gems_nb=0): super(Sword, self).__init__(speed=speed, dmg_min=dmg_min, dmg_max=dmg_max, wrange=wrange) self.gems = gems self.gems_nb = gems_nb self.name = name return class Gem(object): [...] def infos(self): print "Name = {}".format(self.name) print "Damage range = {}".format() print "Dps = {}".format() print "Nb gems = {}".format() print "Golden gem: {}".format() excalibur = Sword('Excalibur', 10, 50, 120, 4) gold_gem = Gem("Golden gem", 100) excalibur.add_gem(gold_gem) excalibur.infos()It has to print :
Output:Name = Excalibur
Dammage range = 50-120
Dps = 1850
Nb gems = 1
Golden gem:
+100 dmg, +0 speed, +0 range.
im stuck, any help ?thanks!