phantasia

Phantasia - 2D SDL3 RPG prototype.
git clone git://git.beep.wimdupont.com/phantasia.git
Log | Files | Refs | README | LICENSE

battle.h (1363B)


      1 #ifndef PH_GAME_BATTLE_H
      2 #define PH_GAME_BATTLE_H
      3 
      4 #include "game/content.h"
      5 
      6 enum { PH_BATTLE_ORDER_COUNT = 6 };
      7 
      8 typedef enum {
      9 	PH_BATTLE_COMMAND,
     10 	PH_BATTLE_MAGIC,
     11 	PH_BATTLE_PLAYER_ACTION,
     12 	PH_BATTLE_ENEMY_ACTION,
     13 } PhBattlePhase;
     14 
     15 typedef enum {
     16 	PH_BATTLE_CONTINUE,
     17 	PH_BATTLE_READY,
     18 	PH_BATTLE_VICTORY,
     19 	PH_BATTLE_DEFEAT,
     20 } PhBattleResult;
     21 
     22 typedef enum {
     23 	PH_BATTLE_FIGHT,
     24 	PH_BATTLE_MAGICK,
     25 	PH_BATTLE_ITEM,
     26 	PH_BATTLE_COMMAND_COUNT,
     27 } PhBattleCommand;
     28 
     29 typedef struct {
     30 	int enemy_index;
     31 	PhBattleCommand command;
     32 	int spell;
     33 	int item_id;
     34 	int resolved;
     35 	int xp_reward;
     36 	int loot_item_id;
     37 	int loot_amount;
     38 	int player_ctb;
     39 	int enemy_ctb;
     40 	int current_actor;
     41 	int action_delay;
     42 	float timer;
     43 	PhBattlePhase phase;
     44 	char message[64];
     45 } PhBattle;
     46 
     47 void ph_battle_begin(PhBattle *battle, const PhWorld *world, int enemy_index);
     48 void ph_battle_select(PhBattle *battle, PhWorld *world);
     49 void ph_battle_cast(PhBattle *battle, PhWorld *world);
     50 void ph_battle_cancel(PhBattle *battle);
     51 PhBattleResult ph_battle_update(PhBattle *battle, PhWorld *world, float dt,
     52 	int transition);
     53 void ph_battle_order(const PhBattle *battle, const PhWorld *world,
     54 	int order[PH_BATTLE_ORDER_COUNT]);
     55 const PhSpellDef *ph_spell_def(int id);
     56 const PhSpellDef *ph_battle_spell(const PhBattle *battle);
     57 float ph_battle_lunge(const PhBattle *battle, PhBattlePhase phase);
     58 
     59 #endif