Замена изменяемой переменной в функции Embed (Discord) - PullRequest
0 голосов
/ 24 апреля 2020

Итак, у меня небольшая проблема ... Я пытаюсь уменьшить количество "зелья здоровья" в своем инвентаре всякий раз, когда использую его. Вот мой код:

if message.content == '!&use health potion':
 if Gamestarted == True:
  if Location == 'Soro':
    if Fightstarted == True:
      if PotionAmount <= 0:
        await message.channel.send(author.name + " tried to use an object they don't have!")
      if PotionAmount > 0:
        if PlayerHealth > 8000:
          PotionAmount -= 1
          PlayerHealth = 10000
          await message.channel.send(author.name + " used a **health potion** and regained 2,000 health. (10000/10000)")
          Inventory = Inventory.replace(str(PrevPotionAmount), str(PotionAmount))
          print(PotionAmount)
          print(Inventory)
        if PlayerHealth <= 8000:
          PotionAmount -= 1
          PlayerHealth = PlayerHealth + 2000
          await message.channel.send(author.name + " used a **health potion** and regained 2,000 health. (" + str(PlayerHealth) + "/10000)")
          Inventory = Inventory.replace(str(PrevPotionAmount), str(PotionAmount))
          print(PotionAmount)
          print(Inventory)

Сумма меняется до 8, но затем перестает меняться все вместе. Как я могу получить его уменьшить до 0? Если вы хотите увидеть больше кода, просто спросите. Спасибо.

(PotionAmount = 10 PrevPotionAmount = 10)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...