18 lines
596 B
Python
18 lines
596 B
Python
class Trait: # The trait itself.
|
|
def __init__(self, name, buff_value): # Self is needed and then defined furthermore in following commas
|
|
self.name = name # name is now a functionable variable
|
|
self.buff_value = buff_value #buff_value is now a functionable variable
|
|
|
|
def trigger_effect(self):
|
|
print(self.name + " gives a buff of", self.buff_value) # print name + text + buff value
|
|
|
|
class RewardTrait(Trait):
|
|
def set_price(self, price):
|
|
self.price = price
|
|
|
|
savant_trait = RewardTrait("Savant" , 5)
|
|
savant_trait.set_price(2000)
|
|
print(savant_trait.price)
|
|
|
|
|