#include "RangedWeapon.hpp" #include "Actor.hpp" #include "Bullet.hpp" RangedWeapon::RangedWeapon(const std::string &name) : Weapon(Item::Type::RANGEDWEAPON, name) { } bool RangedWeapon::use(Actor &user, Actor &actor) { //TODO implement attack probability if (_charged) { actor.damage(user.attack() + _damage - actor.defence()); _charged = false; } return true; } bool RangedWeapon::reload(Actor &actor) { //TODO add bullet type std::list inventory = actor.inventory(); for (Item *item : inventory) { if (item->type == Item::Type::BULLET) { //TODO get the bullet // Bullet *bullet = dynamic_cast (item); break; } } // TODO remove return true; /* if (bullet->decreaseAmount(1)) { _charged = true; return true; } else { return false; } */ }