Skip to content

Instantly share code, notes, and snippets.

@blewert
Created April 20, 2020 12:16
Show Gist options
  • Save blewert/5310e8e0f26de51a0f1a1c7cfc72d31a to your computer and use it in GitHub Desktop.
Save blewert/5310e8e0f26de51a0f1a1c7cfc72d31a to your computer and use it in GitHub Desktop.
cur_hp = 90;
cur_ar = 10;
print("hp: " + str(cur_hp));
print("ar: " + str(cur_ar));
damage = 333.7;
print("\n-" + str(damage));
# armour
if cur_ar > 0 and damage > 0:
if damage > cur_ar:
tmpdamage = damage;
damage -= cur_ar;
cur_ar = max(0, cur_ar - tmpdamage);
else:
tmpdamage = damage;
damage -= damage;
cur_ar = max(0, cur_ar - tmpdamage);
# health
if cur_hp > 0 and damage > 0:
if damage > cur_hp:
#they're dead
cur_hp = 0;
else:
cur_hp -= damage;
print();
print("hp: " + str(cur_hp));
print("ar: " + str(cur_ar));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment