From c90bfe8ac7c068b33fe4639564286befcc96a91c Mon Sep 17 00:00:00 2001
From: Clyne Sullivan <tullivan99@gmail.com>
Date: Thu, 23 Mar 2017 21:00:40 -0400
Subject: better arrows

---
 src/attack.cpp | 15 +++++++++++++++
 src/world.cpp  |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/attack.cpp b/src/attack.cpp
index 4047b0a..550b849 100644
--- a/src/attack.cpp
+++ b/src/attack.cpp
@@ -49,6 +49,21 @@ void AttackSystem::update(entityx::EntityManager& en, entityx::EventManager& ev,
 				}
 			);
 			break;
+		case AttackType::SmallBoom:
+			en.each<Position, Solid, Health>(
+				[&a](entityx::Entity e, Position& pos, Solid& dim, Health& h) {
+					(void)e;
+					if (e.has_component<Player>())
+						return;
+
+					if (inrange(a.pos.x, pos.x, pos.x + dim.width, shortSlashLength)) {
+						h.health -= a.power;
+						game::engine.getSystem<ParticleSystem>()->addMultiple(15, ParticleType::SmallBlast,
+							[&](){ return vec2(pos.x + dim.width / 2, pos.y + dim.height / 2); }, 300, 7);
+					}
+				}
+			);
+			break;
 		default:
 			break;
 		}
diff --git a/src/world.cpp b/src/world.cpp
index c41ab2a..353f4d9 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -1143,7 +1143,7 @@ void WorldSystem::detect(entityx::TimeDelta dt)
 				vel.y = 0;
 				if (e.has_component<Hit>()) {
 					game::events.emit<AttackEvent>(vec2(loc.x, loc.y),
-						AttackType::ShortSlash, e.component<Hit>()->damage);
+						AttackType::SmallBoom, e.component<Hit>()->damage);
 					e.destroy();
 				}
 				if (!vel.grounded) {
-- 
cgit v1.2.3