|
|
@ -15,6 +15,7 @@ |
|
|
|
#include "rituals.hpp" |
|
|
|
#include "rituals.hpp" |
|
|
|
#include "battle.hpp" |
|
|
|
#include "battle.hpp" |
|
|
|
#include <iostream> |
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
#include "shaders.hpp" |
|
|
|
|
|
|
|
|
|
|
|
using std::string; |
|
|
|
using std::string; |
|
|
|
using namespace fmt; |
|
|
|
using namespace fmt; |
|
|
@ -176,6 +177,7 @@ void System::death(GameLevel &level, components::ComponentMap& components) { |
|
|
|
world.remove<Personality>(ent); |
|
|
|
world.remove<Personality>(ent); |
|
|
|
world.remove<ai::EntityAI>(ent); |
|
|
|
world.remove<ai::EntityAI>(ent); |
|
|
|
world.remove<Animation>(ent); |
|
|
|
world.remove<Animation>(ent); |
|
|
|
|
|
|
|
world.remove<SpriteEffect>(ent); |
|
|
|
|
|
|
|
|
|
|
|
if(auto snd = world.get_if<Sound>(ent)) { |
|
|
|
if(auto snd = world.get_if<Sound>(ent)) { |
|
|
|
sound::stop(snd->attack); |
|
|
|
sound::stop(snd->attack); |
|
|
@ -235,6 +237,11 @@ void System::combat(GameLevel &level) { |
|
|
|
player_combat.attack(enemy.combat), 0 |
|
|
|
player_combat.attack(enemy.combat), 0 |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(result.player_did > 0) { |
|
|
|
|
|
|
|
auto effect = shaders::get("flame"); |
|
|
|
|
|
|
|
world.set<SpriteEffect>(enemy.entity, {100, effect}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(enemy.ai.wants_to("kill_enemy")) { |
|
|
|
if(enemy.ai.wants_to("kill_enemy")) { |
|
|
|
result.enemy_did = enemy.combat.attack(player_combat); |
|
|
|
result.enemy_did = enemy.combat.attack(player_combat); |
|
|
|
animate_entity(world, enemy.entity); |
|
|
|
animate_entity(world, enemy.entity); |
|
|
@ -390,3 +397,20 @@ std::wstring System::draw_map(GameLevel level, size_t view_x, size_t view_y, int |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<sf::Shader> System::sprite_effect(GameLevel &level, DinkyECS::Entity entity) { |
|
|
|
|
|
|
|
if(level.world->has<SpriteEffect>(entity)) { |
|
|
|
|
|
|
|
auto& se = level.world->get<SpriteEffect>(entity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(se.frames > 0) { |
|
|
|
|
|
|
|
se.frames--; |
|
|
|
|
|
|
|
return se.effect; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
level.world->remove<SpriteEffect>(entity); |
|
|
|
|
|
|
|
return nullptr; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return nullptr; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|