Fixes bug with erupt pushing direction
This commit is contained in:
parent
35164a9876
commit
8fb1bbcc1e
|
@ -974,12 +974,13 @@ skill_erupt(Skill *skill, SkillData *data)
|
|||
gui_log("%s takes %d damage from the explosion", r->monster->label, result.dmg);
|
||||
monster_set_bleeding(r->monster);
|
||||
|
||||
int lvl = 1 + player_has_artifact(player, PUSH_BACK);
|
||||
int lvl = 2;//player_has_artifact(player, PUSH_BACK);
|
||||
Vector2d dir = vector2d_to_direction(&VEC2D((float) i, (float) j));
|
||||
monster_push(r->monster,
|
||||
player,
|
||||
rm,
|
||||
VEC2D((float) ((i > 0 ? 1 : -1) * lvl),
|
||||
(float) ((j > 0 ? 1 : -1) * lvl))
|
||||
VEC2D(dir.x * (float) lvl,
|
||||
dir.y * (float) lvl)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,3 +12,25 @@ vector2d_is_opposite(Vector2d v1, Vector2d v2)
|
|||
return ((v1.x > 0 && v2.x < 0) ^ (v1.y > 0 && v2.y < 0))
|
||||
|| ((v1.x < 0 && v2.x > 0) ^ (v1.y < 0 && v2.y > 0));
|
||||
}
|
||||
|
||||
Vector2d
|
||||
vector2d_to_direction(const Vector2d *vec)
|
||||
{
|
||||
Vector2d new = VEC2D(vec->x, vec->y);
|
||||
|
||||
if (new.x > 0)
|
||||
new.x = 1;
|
||||
else if (new.x == 0)
|
||||
new.x = 0;
|
||||
else
|
||||
new.x = -1;
|
||||
|
||||
if (new.y > 0)
|
||||
new.y = 1;
|
||||
else if (new.y == 0)
|
||||
new.y = 0;
|
||||
else
|
||||
new.y = -1;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -40,4 +40,7 @@ vector2d_equals(Vector2d, Vector2d);
|
|||
bool
|
||||
vector2d_is_opposite(Vector2d, Vector2d);
|
||||
|
||||
Vector2d
|
||||
vector2d_to_direction(const Vector2d*);
|
||||
|
||||
#endif // VECTOR2D_H_
|
||||
|
|
Loading…
Reference in New Issue