You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
651 B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdbool.h>
  5. #include <encounter.h>
  6. bool playerAlive(int health){
  7. if(health > 0){
  8. return true;
  9. }
  10. else{
  11. return false;
  12. }
  13. }
  14. int playerHealth(int health, int damage){
  15. const int maxhealth = 100;
  16. health = health - damage;
  17. if(health > maxhealth){
  18. health = maxhealth;
  19. }
  20. return health;
  21. }
  22. enemy createEnemy(int health)
  23. {
  24. enemy test;
  25. test.health = health;
  26. return test;
  27. }
  28. void *setEnemyHealth(int *num, int health){
  29. *num = health;
  30. //return health;
  31. }
  32. int getEnemyHealth(enemy enemy){
  33. return enemy.health;
  34. }