Adds PUSH_BACK and SKILL_RADIUS effects to erupt skill

This commit is contained in:
Linus Probert 2019-05-14 08:27:49 +02:00
parent b00e607dec
commit ef5cd4e244
2 changed files with 14 additions and 2 deletions

View File

@ -872,8 +872,9 @@ skill_erupt(Skill *skill, SkillData *data)
mixer_play_effect(BLAST_EFFECT); mixer_play_effect(BLAST_EFFECT);
Position playerMPos = position_to_matrix_coords(&player->sprite->pos); Position playerMPos = position_to_matrix_coords(&player->sprite->pos);
for (Sint32 i = -1; i <= 1; ++i) { int range = player_has_artifact(player, SKILL_RADIUS);
for (Sint32 j = -1; j <= 1; ++j) { for (Sint32 i = -1 - range; i <= 1 + range; ++i) {
for (Sint32 j = -1 - range; j <= 1 + range; ++j) {
if (i == 0 && j == 0) if (i == 0 && j == 0)
continue; continue;
@ -886,6 +887,15 @@ skill_erupt(Skill *skill, SkillData *data)
monster_hit(r->monster, dmg); monster_hit(r->monster, dmg);
gui_log("%s takes %d damage from the explosion", r->monster->label, dmg); gui_log("%s takes %d damage from the explosion", r->monster->label, dmg);
monster_set_bleeding(r->monster); monster_set_bleeding(r->monster);
if (player_has_artifact(player, PUSH_BACK)) {
int lvl = player_has_artifact(player, PUSH_BACK);
monster_push(r->monster,
player,
rm,
VEC2D((float) (i*lvl),
(float) (j*lvl))
);
}
} }
} }
} }

View File

@ -27,6 +27,8 @@
#define VECTOR2D_UP (Vector2d) { 0, -1 } #define VECTOR2D_UP (Vector2d) { 0, -1 }
#define VECTOR2D_DOWN (Vector2d) { 0, 1 } #define VECTOR2D_DOWN (Vector2d) { 0, 1 }
#define VEC2D(x, y) (Vector2d) { x, y }
typedef struct Vector2d_t { typedef struct Vector2d_t {
float x; float x;
float y; float y;