forked from NotAShelf/rogged
42 lines
1.3 KiB
C
42 lines
1.3 KiB
C
#ifndef PLAYER_H
|
|
#define PLAYER_H
|
|
|
|
#include "common.h"
|
|
|
|
// Initialize player at position
|
|
void player_init(Player *p, int x, int y);
|
|
|
|
// Apply status effects, healing, etc
|
|
void player_on_move(Player *p);
|
|
|
|
// Find a living enemy at tile (x, y); returns NULL if none
|
|
Enemy *player_find_enemy_at(Enemy *enemies, int count, int x, int y);
|
|
|
|
// Player attacks enemy (deal damage)
|
|
void player_attack(Player *p, Enemy *e);
|
|
|
|
// Get item at floor position (x, y), returns NULL if none
|
|
Item *get_item_at_floor(Item *items, int count, int x, int y);
|
|
|
|
// Pick up item, return 1 if successful, 0 if failed (full/invalid)
|
|
int player_pickup(Player *p, Item *i);
|
|
|
|
// Use item (potions only - weapons/armor are equipped)
|
|
void player_use_item(Player *p, Item *i);
|
|
|
|
// Use first available potion in inventory, return 1 if used
|
|
int player_use_first_item(Player *p);
|
|
|
|
// Get item at inventory index, returns NULL if invalid
|
|
Item *player_get_inventory_item(Player *p, int index);
|
|
|
|
// Remove item from inventory at index (shifts remaining items)
|
|
void player_remove_inventory_item(Player *p, int index);
|
|
|
|
// Equip weapon/armor from inventory, return 1 if successful
|
|
int player_equip_item(Player *p, int inv_index);
|
|
|
|
// Drop item from inventory at index (returns it to floor), return 1 if successful
|
|
int player_drop_item(Player *p, int inv_index, Item *items, int item_count);
|
|
|
|
#endif // PLAYER_H
|