This repository has been archived on 2022-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
LEFTONE/core/lochara/combat.h
falsycat 80b3b82332 [RELEASE] u22-v04
This version is submitted for U22 final presentation. (squashed 158 commits)
2021-02-07 00:00:00 +00:00

52 lines
1.2 KiB
C

#pragma once
#include <stdint.h>
#include "core/loeffect/effect.h"
#include "./state.h"
typedef struct lochara_base_t lochara_base_t;
typedef enum {
LOCHARA_COMBAT_ACTION_TYPE_REST,
LOCHARA_COMBAT_ACTION_TYPE_ATTACK,
LOCHARA_COMBAT_ACTION_TYPE_ATTACK_EFFECT,
} lochara_combat_action_type_t;
typedef struct {
lochara_combat_action_type_t type;
lochara_state_t state;
uint64_t duration;
union {
float damage;
loeffect_t effect;
};
} lochara_combat_action_t;
#define lochara_combat_action_rest(...) { \
.type = LOCHARA_COMBAT_ACTION_TYPE_REST, \
__VA_ARGS__ \
}
#define lochara_combat_action_attack(...) { \
.type = LOCHARA_COMBAT_ACTION_TYPE_ATTACK, \
__VA_ARGS__ \
}
#define lochara_combat_action_attack_effect(...) { \
.type = LOCHARA_COMBAT_ACTION_TYPE_ATTACK_EFFECT, \
__VA_ARGS__ \
}
void
lochara_combat_action_execute_all_attacks(
const lochara_combat_action_t* actions,
lochara_base_t* attacker
);
const lochara_combat_action_t* /* NULLABLE */
lochara_combat_action_find_by_time(
const lochara_combat_action_t* actions,
uint64_t t
);