diff --git a/src/input.c b/src/input.c index 7593dbc..a53db62 100644 --- a/src/input.c +++ b/src/input.c @@ -120,11 +120,11 @@ get_event_mousebutton(SDL_Event *event) Uint32 key = 0; switch (event->button.button) { case SDL_BUTTON_LEFT: - key = MBUTTON_LEFT; + key = MBUTTON_LEFT; break; case SDL_BUTTON_MIDDLE: - key = MBUTTON_MIDDLE; + key = MBUTTON_MIDDLE; break; case SDL_BUTTON_RIGHT: - key = MBUTTON_RIGHT; + key = MBUTTON_RIGHT; break; default: key = 0; } diff --git a/src/monster.c b/src/monster.c index 2c1742f..2012dae 100644 --- a/src/monster.c +++ b/src/monster.c @@ -556,7 +556,7 @@ monster_drop_loot(Monster *monster, Map *map, Player *player) // TODO: This should not occur every time // Debug code. - Artifact *a = artifact_create(CHARGE_THROUGH); + Artifact *a = artifact_create(FEAR_INDUCING); a->sprite->pos = monster->sprite->pos; linkedlist_append(&map->artifacts, a); } @@ -595,9 +595,15 @@ monster_set_behaviour(Monster *m, MonsterBehaviour behaviour) } void -monster_set_stunned(Monster *m) +monster_set_state(Monster *m, StateType state) { - monster_state_change(m, STUNNED); + monster_state_change(m, state); +} + +void +monster_push(Monster *m, RoomMatrix *rm, Vector2d dir) +{ + move(m, rm, dir); } void diff --git a/src/monster.h b/src/monster.h index bd4bfc2..7242b20 100644 --- a/src/monster.h +++ b/src/monster.h @@ -97,7 +97,10 @@ void monster_set_behaviour(Monster *, MonsterBehaviour behaviour); void -monster_set_stunned(Monster *m); +monster_set_state(Monster *m, StateType state); + +void +monster_push(Monster *, RoomMatrix*, Vector2d dir); void monster_destroy(Monster*); diff --git a/src/player.c b/src/player.c index 928587a..4ab42b5 100644 --- a/src/player.c +++ b/src/player.c @@ -148,6 +148,20 @@ has_collided(Player *player, RoomMatrix *matrix, Vector2d direction) } player_monster_kill_check(player, space->monster); + if (space->monster->stats.hp > 0) { + if (get_random(10) < player_has_artifact(player, PUSH_BACK)) { + gui_log("The force of your blow sends %s reeling", + space->monster->lclabel); + monster_push(space->monster, matrix, direction); + } + + if (get_random(10) < player_has_artifact(player, FEAR_INDUCING)) { + gui_log("%s shivers with fear at the sight of you", + space->monster->label); + monster_set_state(space->monster, SCARED); + } + } + action_spent(player); } else if (collided) { diff --git a/src/skill.c b/src/skill.c index 69a551b..fb833d4 100644 --- a/src/skill.c +++ b/src/skill.c @@ -205,7 +205,7 @@ skill_bash(Skill *skill, SkillData *data) gui_log("You hit for %u damage", dmg); if (monster->stats.hp > 0) { gui_log("%s seems dazed and confused", monster->label); - monster_set_stunned(monster); + monster_set_state(monster, STUNNED); } mixer_play_effect(SLAM); data->player->stat_data.hits += 1;