mirror of https://github.com/bgiraudr/Adoranda.git
items design + check has pp left
This commit is contained in:
parent
48392fe623
commit
1513502e0b
Binary file not shown.
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 458 B |
Binary file not shown.
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 461 B |
|
@ -58,11 +58,12 @@ void reset_pp(struct Player *player);
|
|||
void check_level(struct Player *player, int prec_level);
|
||||
void add_xp(struct Player *player, int xp);
|
||||
int select_capacity(struct Player *player, char* context, bool allow_back);
|
||||
void add_pp(struct Player *player, int amount);
|
||||
bool add_pp(struct Player *player, int amount);
|
||||
void change_type(struct Player *player, struct Type type);
|
||||
bool has_move(struct Player *player, struct Move move);
|
||||
int get_nb_eventzone(struct Player *player);
|
||||
bool check_eventzone(struct Player *player, int id);
|
||||
int get_nb_eventdialog(struct Player *player);
|
||||
bool check_eventdialog(struct Player *player, int id);
|
||||
void player_step_back(struct Player *player);
|
||||
void player_step_back(struct Player *player);
|
||||
bool has_pp_left(struct Player *player);
|
|
@ -48,8 +48,7 @@ bool handle_event(struct Game *game, char const *event)
|
|||
}
|
||||
else if(!strncmp(event, "pp:", 3)) {
|
||||
event += 3;
|
||||
add_pp(game->player, atoi(event));
|
||||
return true;
|
||||
return add_pp(game->player, atoi(event));
|
||||
}
|
||||
else if(!strncmp(event, "type:", 5)) {
|
||||
event += 5;
|
||||
|
|
26
src/player.c
26
src/player.c
|
@ -233,13 +233,25 @@ void add_xp(struct Player *player, int xp) {
|
|||
check_level(player, prec);
|
||||
}
|
||||
|
||||
void add_pp(struct Player *player, int amount) {
|
||||
int selection = select_capacity(player, "Choisir une capacité", false);
|
||||
player->moves[selection]->pp += amount;
|
||||
if(player->moves[selection]->pp > player->moves[selection]->init_pp) player->moves[selection]->pp = player->moves[selection]->init_pp;
|
||||
draw_text(50, DHEIGHT-47, C_BLACK, "Vous regagnez %d PPs sur %s", amount, player->moves[selection]->name);
|
||||
dupdate();
|
||||
wait_for_input(KEY_SHIFT);
|
||||
bool has_pp_left(struct Player *player) {
|
||||
int index = get_nb_moves(player);
|
||||
for(int i = 0; i < index; i++) {
|
||||
if(player->moves[i]->pp < player->moves[i]->init_pp) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool add_pp(struct Player *player, int amount) {
|
||||
if(has_pp_left(player)) {
|
||||
int selection = select_capacity(player, "Choisir une capacité", false);
|
||||
player->moves[selection]->pp += amount;
|
||||
if(player->moves[selection]->pp > player->moves[selection]->init_pp) player->moves[selection]->pp = player->moves[selection]->init_pp;
|
||||
draw_text(50, DHEIGHT-47, C_BLACK, "Vous regagnez %d PPs sur %s", amount, player->moves[selection]->name);
|
||||
dupdate();
|
||||
wait_for_input(KEY_SHIFT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void change_type(struct Player *player, struct Type type) {
|
||||
|
|
Loading…
Reference in New Issue