Advertisement
Guest User

fighter.cpp

a guest
Oct 17th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. // Submit this file.
  2. // You must use this exact file name.
  3.  
  4. #include "Fighter.h"
  5. using namespace std;
  6.  
  7. Fighter::Fighter(){
  8. name = "NONE";
  9. str= 1;
  10. hp= 60;
  11. weapon="None";
  12. money=0;
  13. }
  14.  
  15. Fighter::Fighter(string name,int str,int hp){
  16. this->name=name;
  17. this->str = str;
  18. this->hp=hp;
  19. money=1000;
  20. weapon=Weapon("NONE");
  21. }
  22. string Fighter::getName()const{
  23. return name;
  24. }
  25.  
  26. int Fighter::getStr()const{
  27. return str;
  28. }
  29.  
  30. int Fighter::getHp()const{
  31. return hp;
  32. }
  33.  
  34. int Fighter::getMoney()const{
  35. return money;
  36. }
  37.  
  38. Weapon& Fighter::getWeapon(){
  39. return weapon;
  40. }
  41.  
  42. bool Fighter::setWeapon(const Weapon& weapon){
  43. this->weapon=weapon;
  44. this->weapon.setFighterName("this->name");
  45. return true;
  46. }
  47.  
  48. bool Fighter::removeWeapon(){
  49. if(weapon=="None"){
  50. return false;
  51. }
  52. weapon.setFighterName="None";
  53. weapon="None";
  54. return true;
  55. }
  56. void Fighter::addMoney(int amount){
  57. money+=amount;
  58. }
  59.  
  60. bool Fighter::removeMoney(int amount){
  61. if(money<=0){
  62. return false;
  63. }
  64. money-=amount;
  65. return true;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement