From 2a76d0662f9494f8469283a7b0fc72c17f40ecf6 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Fri, 9 Jan 2015 18:31:29 +0100 Subject: implement a way to define who is targetable by an action we can specify who are the targets of an action by setting the field entry->action.target it can be a combination of one or more specifiers, such as: one team an eneny self everyone Signed-off-by: Olivier Gayot --- priv_entries.h | 140 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 100 insertions(+), 40 deletions(-) (limited to 'priv_entries.h') diff --git a/priv_entries.h b/priv_entries.h index 62fe5f2..dd6ff69 100644 --- a/priv_entries.h +++ b/priv_entries.h @@ -10,13 +10,19 @@ struct entry_t white_magic_entries[] = { { .name = "Cure", .children_cnt = 0, - .f = cast_cure, - .data = NULL, + .action = { + .f = cast_cure, + .data = NULL, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Cure +", .children_cnt = 0, - .f = cast_cure, - .data = NULL, + .action = { + .f = cast_cure, + .data = NULL, + .target = TARGET_SINGLE | TARGET_TEAM, + } }, }; @@ -24,68 +30,107 @@ struct entry_t black_magic_entries[] = { { .name = "Fire", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_FIRE }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_FIRE }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Fire +", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_FIRE }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_FIRE }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Fire x", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_FIRE }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_FIRE }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Ice -", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_ICE }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_ICE }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Ice +", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_ICE }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_ICE }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Ice x", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_ICE }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_ICE }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Thunder", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_THUNDER }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_THUNDER }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Thunder +", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_THUNDER }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_THUNDER }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Thunder x", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_THUNDER }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_THUNDER }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Water", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_WATER }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_WATER }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Water + ", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_WATER }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_WATER }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Water x", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_WATER }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_WATER }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, { .name = "Choc", .children_cnt = 0, - .f = cast_element, - .data = (enum element_t []) { ELEMENT_NONE }, + .action = { + .f = cast_element, + .data = (enum element_t []) { ELEMENT_NONE }, + .target = TARGET_SINGLE | TARGET_TEAM, + }, }, }; @@ -93,23 +138,35 @@ struct entry_t object_entries[] = { { .name = "Potion", .children_cnt = 0, - .f = use_potion, - .data = (int []) { POTION }, + .action = { + .f = use_potion, + .data = (int []) { POTION }, + .target = TARGET_SINGLE, + }, }, { .name = "Potion +", .children_cnt = 0, - .f = use_potion, - .data = (int []) { POTIONPLUS }, + .action = { + .f = use_potion, + .data = (int []) { POTIONPLUS }, + .target = TARGET_SINGLE, + }, }, { .name = "Ether", .children_cnt = 0, - .f = use_ether, - .data = (int []) { ETHER }, + .action = { + .f = use_ether, + .data = (int []) { ETHER }, + .target = TARGET_SINGLE, + }, }, { .name = "Ether + ", .children_cnt = 0, - .f = use_ether, - .data = (int []) { ETHERPLUS }, + .action = { + .f = use_ether, + .data = (int []) { ETHERPLUS }, + .target = TARGET_SINGLE, + }, }, }; @@ -117,8 +174,11 @@ struct entry_t action_entries_g[] = { { .name = "Attack", .children_cnt = 0, - .f = attack, - .data = NULL, + .action = { + .f = attack, + .data = NULL, + .target = TARGET_SINGLE, + }, }, { .name = "White Magic", .children = white_magic_entries, -- cgit v1.2.3