Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "potion.h"
- #include "string.h"
- #include <iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- potion::potion()
- {
- m_name = "minor healing potion";
- m_description = "heals an ammount of health";
- m_potency = "heals 50 health";
- m_cost = 1.78;
- m_power = 50;
- }
- potion::potion(String name, string description, string potency, float cost, int power)
- {
- m_name = name;
- m_description = description;
- m_potency = potency;
- m_cost = cost;
- m_power = power;
- }
- void potion::UsePotion(int playerhealth)
- {
- playerhealth += m_power;
- }
- int potion::BuyPotion(float playercurrency)
- {
- playercurrency -= m_cost;
- return 1;
- }
- void potion::SellPotion(float playercurrency)
- {
- playercurrency += (m_cost*.75);
- }
- void potion::DisplayPotion()
- {
- cout << m_name << '\n'
- << m_description << '\n'
- << m_potency << '\n'
- << GetGold() << " gold " << GetSilver() << " silver " << endl;
- }
- int potion::GetGold()
- {
- int temp = m_cost;
- return temp;
- }
- int potion::GetSilver()
- {
- float temp = m_cost;
- int temp2 = static_cast<int>(temp);
- temp -= temp2;
- temp *= 100;
- return temp;
- }
- potion::~potion()
- {
- }
Add Comment
Please, Sign In to add comment