Continues #2 Adds PUSH_BACK impl
This commit is contained in:
parent
ac7dada0d5
commit
0aacdd2d84
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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*);
|
||||
|
|
14
src/player.c
14
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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue