aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/cpp')
-rw-r--r--src/main/cpp/MeleeWeapon.cpp15
-rw-r--r--src/main/cpp/RangedWeapon.cpp25
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();
+}