本文整理汇总了Python中output.Output.quantity_less_than_one方法的典型用法代码示例。如果您正苦于以下问题:Python Output.quantity_less_than_one方法的具体用法?Python Output.quantity_less_than_one怎么用?Python Output.quantity_less_than_one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类output.Output
的用法示例。
在下文中一共展示了Output.quantity_less_than_one方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import quantity_less_than_one [as 别名]
def remove(self, item, price):
"""Deze is voor purchase"""
if price < 1:
Output.quantity_less_than_one()
return False
if item not in self:
Output.quantity_not_enough(item.NAME, price, item.quantity - 1)
return False
elif self[item.RAW].quantity < price:
Output.quantity_not_enough(item.NAME, price, item.quantity)
return False
else:
self[item.RAW].quantity -= price
return True
示例2: gain_experience
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import quantity_less_than_one [as 别名]
def gain_experience(self, xp_input):
"""Deze is voor xp"""
if xp_input < 1:
Output.quantity_less_than_one()
raise ValueError
if self.level.quantity < self.level.MAXIMUM:
self.experience.remaining += xp_input
self.experience.total += xp_input
Output.character_gain_xp(self.NAME, xp_input)
while self.level.next(self.experience.total) <= 0:
self.level.quantity += 1
self.level.current += 1
Output.character_gain_level(self.NAME, self.level.quantity)
示例3: add
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import quantity_less_than_one [as 别名]
def add(self, item, quantity=1, verbose=True):
"""Deze is voor find, purchase, sell, equip en unequip"""
if quantity < 1:
Output.quantity_less_than_one()
raise ValueError
if "empty" in item.RAW and item in self.inside: # de eerste keer moet hij wel alle empty's toevoegen
return # maar als ze er eenmaal inzitten hoeft dat ingame niet meer
if item in self.inside:
self.inside[item.RAW].quantity += quantity
else:
self.inside[item.RAW] = item # self[item] bestaat uit zichzelf al uit quantity = 1
self.inside[item.RAW].quantity += quantity - 1
# dus daarom, wanneer hij voor het eerst wordt toegevoegd: - 1
if verbose:
Output.add_item(quantity, item.NAME, self.NAME)
示例4: remove
# 需要导入模块: from output import Output [as 别名]
# 或者: from output.Output import quantity_less_than_one [as 别名]
def remove(self, gear, quantity=1, verbose=True):
"""Deze is voor sell en equip"""
if gear.RAW not in self.inside:
Output.no_item()
raise AttributeError
if quantity < 1:
Output.quantity_less_than_one()
raise ValueError
if gear.quantity > quantity:
gear.quantity -= quantity
elif gear.quantity == quantity:
del self.inside[gear]
else:
Output.error_quantity_not_enough()
raise ValueError
if verbose:
Output.remove_item(quantity, gear.NAME, self.NAME)