aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/cpp/RangedWeapon.cpp
diff options
context:
space:
mode:
authormafaldo <mafaldo@heavyhammer.home>2018-02-12 23:43:14 +0100
committermafaldo <mafaldo@heavyhammer.home>2018-02-12 23:43:14 +0100
commit3472e0de54bbfa63517de8db7d665b732389ae85 (patch)
treea3754a70c36dad94ea80877323c2b9798b5b5036 /src/main/cpp/RangedWeapon.cpp
parentAdd Actor attributes (diff)
downloadSubconscious-old-3472e0de54bbfa63517de8db7d665b732389ae85.tar.gz
Subconscious-old-3472e0de54bbfa63517de8db7d665b732389ae85.zip
Add RangedWeapon, MeleeWeapon
Diffstat (limited to '')
-rw-r--r--src/main/cpp/RangedWeapon.cpp25
1 files changed, 25 insertions, 0 deletions
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();
+}