From fdefa0ed3dfe7d6ae86a596aeda86cfc944bb240 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 18 Sep 2023 11:38:45 +0300 Subject: [PATCH 30/30] Fake generalize "Teleport" action Add "Teleport 2" and "Teleport 3" actions. See osdn #48657 Signed-off-by: Marko Lindqvist --- common/actions.c | 32 ++++++++++++++++++++++++++++++++ common/actions.h | 33 ++++++++++++++++++--------------- doc/README.actions | 14 ++++++++++++++ 3 files changed, 64 insertions(+), 15 deletions(-) diff --git a/common/actions.c b/common/actions.c index ea90cac973..51ab9994fb 100644 --- a/common/actions.c +++ b/common/actions.c @@ -1486,6 +1486,14 @@ static void hard_code_actions(void) unit_action_new(ACTION_TELEPORT, ACTRES_TELEPORT, TRUE, TRUE, MAK_TELEPORT, 1, 1, FALSE); + actions[ACTION_TELEPORT2] = + unit_action_new(ACTION_TELEPORT2, ACTRES_TELEPORT, + TRUE, TRUE, + MAK_TELEPORT, 1, 1, FALSE); + actions[ACTION_TELEPORT3] = + unit_action_new(ACTION_TELEPORT3, ACTRES_TELEPORT, + TRUE, TRUE, + MAK_TELEPORT, 1, 1, FALSE); actions[ACTION_GAIN_VETERANCY] = unit_action_new(ACTION_GAIN_VETERANCY, ACTRES_ENABLER_CHECK, TRUE, FALSE, @@ -6880,6 +6888,10 @@ const char *action_ui_name_ruleset_var_name(int act) return "ui_name_unit_move_3"; case ACTION_TELEPORT: return "ui_name_teleport"; + case ACTION_TELEPORT2: + return "ui_name_teleport_2"; + case ACTION_TELEPORT3: + return "ui_name_teleport_3"; case ACTION_SPY_ESCAPE: return "ui_name_escape"; case ACTION_USER_ACTION1: @@ -7195,6 +7207,8 @@ const char *action_ui_name_default(int act) /* TRANS: Regular _Move (100% chance of success). */ return N_("Regular %sMove%s"); case ACTION_TELEPORT: + case ACTION_TELEPORT2: + case ACTION_TELEPORT3: /* TRANS: _Teleport (100% chance of success). */ return N_("%sTeleport%s"); case ACTION_SPY_ESCAPE: @@ -7347,6 +7361,10 @@ const char *action_min_range_ruleset_var_name(int act) return "nuke_units_min_range"; case ACTION_TELEPORT: return "teleport_min_range"; + case ACTION_TELEPORT2: + return "teleport_2_min_range"; + case ACTION_TELEPORT3: + return "teleport_3_min_range"; case ACTION_USER_ACTION1: return "user_action_1_min_range"; case ACTION_USER_ACTION2: @@ -7587,6 +7605,10 @@ const char *action_max_range_ruleset_var_name(int act) return "airlift_max_range"; case ACTION_TELEPORT: return "teleport_max_range"; + case ACTION_TELEPORT2: + return "teleport_2_max_range"; + case ACTION_TELEPORT3: + return "teleport_3_max_range"; case ACTION_USER_ACTION1: return "user_action_1_max_range"; case ACTION_USER_ACTION2: @@ -7812,6 +7834,8 @@ const char *action_target_kind_ruleset_var_name(int act) case ACTION_UNIT_MOVE2: case ACTION_UNIT_MOVE3: case ACTION_TELEPORT: + case ACTION_TELEPORT2: + case ACTION_TELEPORT3: case ACTION_SPY_ESCAPE: case ACTION_GAIN_VETERANCY: /* Target kind is not ruleset changeable */ @@ -8251,6 +8275,8 @@ const char *action_actor_consuming_always_ruleset_var_name(action_id act) case ACTION_UNIT_MOVE2: case ACTION_UNIT_MOVE3: case ACTION_TELEPORT: + case ACTION_TELEPORT2: + case ACTION_TELEPORT3: case ACTION_GAIN_VETERANCY: case ACTION_SPY_ESCAPE: /* Actor consuming always is not ruleset changeable */ @@ -8334,6 +8360,10 @@ const char *action_blocked_by_ruleset_var_name(const struct action *act) return "move_3_blocked_by"; case ACTION_TELEPORT: return "teleport_blocked_by"; + case ACTION_TELEPORT2: + return "teleport_2_blocked_by"; + case ACTION_TELEPORT3: + return "teleport_3_blocked_by"; case ACTION_SPY_ESCAPE: case ACTION_SPY_POISON: case ACTION_SPY_POISON_ESC: @@ -8573,6 +8603,8 @@ action_post_success_forced_ruleset_var_name(const struct action *act) case ACTION_UNIT_MOVE2: case ACTION_UNIT_MOVE3: case ACTION_TELEPORT: + case ACTION_TELEPORT2: + case ACTION_TELEPORT3: case ACTION_GAIN_VETERANCY: case ACTION_SPY_ESCAPE: case ACTION_USER_ACTION1: diff --git a/common/actions.h b/common/actions.h index d586c85dde..e30a1aa796 100644 --- a/common/actions.h +++ b/common/actions.h @@ -276,25 +276,28 @@ const char *gen_action_name_update_cb(const char *old_name); #define SPECENUM_VALUE109NAME "Unit Move 2" #define SPECENUM_VALUE110 ACTION_UNIT_MOVE3 #define SPECENUM_VALUE110NAME "Unit Move 3" -#define SPECENUM_VALUE111 ACTION_CLEAN -#define SPECENUM_VALUE111NAME "Clean" -/* TODO: Move next to "Move" */ -#define SPECENUM_VALUE112 ACTION_TELEPORT -#define SPECENUM_VALUE112NAME "Teleport" +#define SPECENUM_VALUE111 ACTION_TELEPORT +#define SPECENUM_VALUE111NAME "Teleport" +#define SPECENUM_VALUE112 ACTION_TELEPORT2 +#define SPECENUM_VALUE112NAME "Teleport2" +#define SPECENUM_VALUE113 ACTION_TELEPORT3 +#define SPECENUM_VALUE113NAME "Teleport3" +#define SPECENUM_VALUE114 ACTION_CLEAN +#define SPECENUM_VALUE114NAME "Clean" /* Enabler checks only */ -#define SPECENUM_VALUE113 ACTION_GAIN_VETERANCY -#define SPECENUM_VALUE113NAME "Gain Veterancy" +#define SPECENUM_VALUE115 ACTION_GAIN_VETERANCY +#define SPECENUM_VALUE115NAME "Gain Veterancy" /* User actions */ -#define SPECENUM_VALUE114 ACTION_USER_ACTION1 -#define SPECENUM_VALUE114NAME "User Action 1" -#define SPECENUM_VALUE115 ACTION_USER_ACTION2 -#define SPECENUM_VALUE115NAME "User Action 2" -#define SPECENUM_VALUE116 ACTION_USER_ACTION3 -#define SPECENUM_VALUE116NAME "User Action 3" -#define SPECENUM_VALUE117 ACTION_USER_ACTION4 -#define SPECENUM_VALUE117NAME "User Action 4" +#define SPECENUM_VALUE116 ACTION_USER_ACTION1 +#define SPECENUM_VALUE116NAME "User Action 1" +#define SPECENUM_VALUE117 ACTION_USER_ACTION2 +#define SPECENUM_VALUE117NAME "User Action 2" +#define SPECENUM_VALUE118 ACTION_USER_ACTION3 +#define SPECENUM_VALUE118NAME "User Action 3" +#define SPECENUM_VALUE119 ACTION_USER_ACTION4 +#define SPECENUM_VALUE119NAME "User Action 4" #define SPECENUM_BITVECTOR bv_actions #define SPECENUM_COUNT ACTION_COUNT #define SPECENUM_NAME_UPDATER diff --git a/doc/README.actions b/doc/README.actions index 04ba593d28..d337ab9d93 100644 --- a/doc/README.actions +++ b/doc/README.actions @@ -1413,6 +1413,20 @@ Actions done by a unit against a tile * the target tile can't contain any city or units not allied to the actor unit and all its cargo. +"Teleport 2" - telepor unit to the target tile. +* UI name can be set using ui_name_teleport_2 +* any action listed in teleport_2_blocked_by must be impossible +* the range of legal distance between actor unit and target tile + must be between teleport_2_min_range and teleport_2_max_range +* See "Teleport" for everything else. + +"Teleport 3" - telepor unit to the target tile. +* UI name can be set using ui_name_teleport_3 +* any action listed in teleport_3_blocked_by must be impossible +* the range of legal distance between actor unit and target tile + must be between teleport_3_min_range and teleport_3_max_range +* See "Teleport" for everything else. + Actions done by a unit against all extras at a tile =================================================== "Conquer Extras" - Claim ownership of an extra. -- 2.40.1