diff options
author | mafaldo <mafaldo@heavyhammer.home> | 2018-02-12 23:43:14 +0100 |
---|---|---|
committer | mafaldo <mafaldo@heavyhammer.home> | 2018-02-12 23:43:14 +0100 |
commit | 3472e0de54bbfa63517de8db7d665b732389ae85 (patch) | |
tree | a3754a70c36dad94ea80877323c2b9798b5b5036 /src/main/cpp | |
parent | Add Actor attributes (diff) | |
download | Subconscious-old-3472e0de54bbfa63517de8db7d665b732389ae85.tar.gz Subconscious-old-3472e0de54bbfa63517de8db7d665b732389ae85.zip |
Add RangedWeapon, MeleeWeapon
Diffstat (limited to 'src/main/cpp')
-rw-r--r-- | src/main/cpp/MeleeWeapon.cpp | 15 | ||||
-rw-r--r-- | src/main/cpp/RangedWeapon.cpp | 25 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/main/cpp/MeleeWeapon.cpp b/src/main/cpp/MeleeWeapon.cpp new file mode 100644 index 0000000..92c7632 --- /dev/null +++ b/src/main/cpp/MeleeWeapon.cpp @@ -0,0 +1,15 @@ +#include "MeleeWeapon.hpp" +#include "Actor.hpp" + +#include <string> + +MeleeWeapon::MeleeWeapon(Type t, const std::string &name) +: Weapon(name), type(t) +{ +} + +bool MeleeWeapon::use(Actor &user, Actor &actor) +{ + //TODO implement attack probability + //actor.damage(_damage); +} diff --git a/src/main/cpp/RangedWeapon.cpp b/src/main/cpp/RangedWeapon.cpp new file mode 100644 index 0000000..eb33780 --- /dev/null +++ b/src/main/cpp/RangedWeapon.cpp @@ -0,0 +1,25 @@ +#include "RangedWeapon.hpp" +#include "Actor.hpp" + +#include <string> +#include <algorithm> +#include <vector> + +RangedWeapon::RangedWeapon(const std::string &name) +: Weapon(name) +{ +} + +bool RangedWeapon::use(Actor &user, Actor &actor) +{ + //TODO implement attack probability + if (_charged) { + actor.damage(user.attack() + _damage - actor.defence()); + _charged = false; + } +} + +void RangedWeapon::reload(Actor &actor) +{ + //std::vector<Item> bullet = actor.bullet(); +} |