Completes testing of phase and fixes some errors

- Fixes some information in skill tooltips
- Fixes a bug with menu mouse selections
This commit is contained in:
Linus Probert 2018-10-02 22:42:29 +02:00
parent 97ad1ddd23
commit c7c5346afc
6 changed files with 26 additions and 9 deletions

View File

@ -193,7 +193,7 @@ menu_update(Menu *m, Input *input)
if (position_in_rect(&p, &item->button->area) if (position_in_rect(&p, &item->button->area)
&& input_mousebutton_is_pressed(input, MBUTTON_LEFT)) && input_mousebutton_is_pressed(input, MBUTTON_LEFT))
{ {
item->button->event(NULL); item->button->event(item->button->usrdata);
return; return;
} }
} }

View File

@ -528,6 +528,10 @@ monster_perform_aoe_attack(Monster *m, RoomMatrix *rm)
bool bool
monster_move(Monster *m, RoomMatrix *rm, Map *map) monster_move(Monster *m, RoomMatrix *rm, Map *map)
{ {
Player *player = roommatrix_get_player(rm);
if (player && player->phase_count)
return true;
if (m->stats.hp <= 0 || m->sprite->state == SPRITE_STATE_FALLING) if (m->stats.hp <= 0 || m->sprite->state == SPRITE_STATE_FALLING)
return true; return true;

View File

@ -103,9 +103,9 @@ action_spent(Player *p)
for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) { for (size_t i = 0; i < PLAYER_SKILL_COUNT; ++i) {
if (p->skills[i] != NULL && p->skills[i]->resetCountdown > 0) if (p->skills[i] != NULL && p->skills[i]->resetCountdown > 0)
p->skills[i]->resetCountdown--; p->skills[i]->resetCountdown--;
if (p->phase_count > 0)
p->phase_count--;
} }
if (p->phase_count > 0)
p->phase_count--;
} }
} }
@ -231,7 +231,7 @@ has_collided(Player *player, RoomMatrix *matrix, Vector2d direction)
else { else {
player_collect_items(player, space); player_collect_items(player, space);
player_pickup_artifacts(player, space); player_pickup_artifacts(player, space);
if (player->phase_count) { if (!player->phase_count) {
player_interact_objects(player, space); player_interact_objects(player, space);
player_interact_traps_and_pits(player, space); player_interact_traps_and_pits(player, space);
} }

View File

@ -307,3 +307,10 @@ void roommatrix_destroy(RoomMatrix *m)
free(m); free(m);
} }
Player *
roommatrix_get_player(RoomMatrix *rm)
{
Position *pos = &rm->playerRoomPos;
return rm->spaces[pos->x][pos->y].player;
}

View File

@ -90,4 +90,7 @@ roommatrix_render_debug(RoomMatrix*, Camera*);
void void
roommatrix_destroy(RoomMatrix*); roommatrix_destroy(RoomMatrix*);
Player *
roommatrix_get_player(RoomMatrix*);
#endif // ROOMMATRIX_H_ #endif // ROOMMATRIX_H_

View File

@ -77,9 +77,10 @@ static char *trip_tooltip[] = {
"TRIP", "TRIP",
"", "",
" Trips an adjecant enemy causing him to fall (move), in", " Trips an adjecant enemy causing him to fall (move), in",
" the direction you tripped him.", " the direction you tripped it in.",
" On a successful hit the enemy will also be stunned."
"", "",
" This can be combined with traps and pits to great effect", " This can be combined with traps and pits to great effect.",
"", "",
"COOLDOWN:", "COOLDOWN:",
" 3 turns", " 3 turns",
@ -99,6 +100,7 @@ static char *backstab_tooltip[] = {
" You flip over an adjecant enemy taking it's place and", " You flip over an adjecant enemy taking it's place and",
" it taking yours, finnishing off with a stab in the back", " it taking yours, finnishing off with a stab in the back",
" of your foe.", " of your foe.",
" A successful attack will also leave the enemy stunned."
"", "",
"COOLDOWN:", "COOLDOWN:",
" 5 turns", " 5 turns",
@ -116,8 +118,8 @@ static char *phase_tooltip[] = {
"PHASE", "PHASE",
"", "",
" You phase out of existence for a time. While you are phased you", " You phase out of existence for a time. While you are phased you",
" are unaffected by gravity, traps and monsters won't see you.", " are unaffected by gravity, traps and enemies won't see you.",
" You can also pass through monsters", " You can also pass through enemies.",
"", "",
" The effect lasts for 3 turns", " The effect lasts for 3 turns",
"", "",
@ -425,7 +427,7 @@ skill_trip(Skill *skill, SkillData *data)
gui_log("You trip %s causing it to fall away from you", space->monster->lclabel); gui_log("You trip %s causing it to fall away from you", space->monster->lclabel);
monster_hit(space->monster, dmg); monster_hit(space->monster, dmg);
player_monster_kill_check(data->player, space->monster); player_monster_kill_check(data->player, space->monster);
if (space->monster->stats.hp > 0) { if (dmg && space->monster->stats.hp > 0) {
Uint32 pushCount = 1 + player_has_artifact(data->player, PUSH_BACK); Uint32 pushCount = 1 + player_has_artifact(data->player, PUSH_BACK);
for (Uint32 i = 0; i < pushCount; ++i) { for (Uint32 i = 0; i < pushCount; ++i) {
monster_push(space->monster, data->player, data->matrix, data->direction); monster_push(space->monster, data->player, data->matrix, data->direction);
@ -433,6 +435,7 @@ skill_trip(Skill *skill, SkillData *data)
break; break;
} }
} }
monster_set_state(space->monster, STUNNED, (Uint8)(1 + player_has_artifact(data->player, INCREASED_STUN)));
} }