Project

General

Profile

Feature #165 » 0009-Add-hut-entering-variants-of-teleport-actions.patch

S3_2 - Marko Lindqvist, 01/19/2024 08:10 PM

View differences:

common/actions.c
TRUE, TRUE,
MAK_TELEPORT, 1,
ACTION_DISTANCE_MAX, FALSE);
actions[ACTION_TELEPORT_ENTER] =
unit_action_new(ACTION_TELEPORT_ENTER,
ACTRES_TELEPORT,
TRUE, TRUE,
MAK_TELEPORT, 1,
ACTION_DISTANCE_MAX, FALSE);
actions[ACTION_TELEPORT_ENTER_CONQUER] =
unit_action_new(ACTION_TELEPORT_ENTER_CONQUER,
ACTRES_TELEPORT_CONQUER,
TRUE, TRUE,
MAK_TELEPORT, 1,
ACTION_DISTANCE_MAX, FALSE);
actions[ACTION_USER_ACTION1] =
unit_action_new(ACTION_USER_ACTION1, ACTRES_NONE,
FALSE, TRUE,
......
return "ui_name_teleport";
case ACTION_TELEPORT_CONQUER:
return "ui_name_teleport_conquer";
case ACTION_TELEPORT_ENTER:
return "ui_name_teleport_enter";
case ACTION_TELEPORT_ENTER_CONQUER:
return "ui_name_teleport_enter_conquer";
case ACTION_SPY_ESCAPE:
return "ui_name_escape";
case ACTION_USER_ACTION1:
......
/* TRANS: _Teleport (100% chance of success). */
return N_("%sTeleport%s");
case ACTION_TELEPORT_CONQUER:
/* TRANS: _Teleport to Conquer (100% chance of success). */
return N_("%sTeleport to Conquer%s");
/* TRANS: _Teleport (100% chance of success). */
return N_("%sTeleport%s");
case ACTION_TELEPORT_ENTER:
/* TRANS: _Teleport (100% chance of success). */
return N_("%sTeleport%s");
case ACTION_TELEPORT_ENTER_CONQUER:
/* TRANS: _Teleport (100% chance of success). */
return N_("%sTeleport%s");
case ACTION_SPY_ESCAPE:
/* TRANS: _Escape To Nearest City (100% chance of success). */
return N_("%sEscape To Nearest City%s");
......
return "teleport_min_range";
case ACTION_TELEPORT_CONQUER:
return "teleport_conquer_min_range";
case ACTION_TELEPORT_ENTER:
return "teleport_enter_min_range";
case ACTION_TELEPORT_ENTER_CONQUER:
return "teleport_enter_conquer_min_range";
case ACTION_USER_ACTION1:
return "user_action_1_min_range";
case ACTION_USER_ACTION2:
......
return "teleport_max_range";
case ACTION_TELEPORT_CONQUER:
return "teleport_conquer_max_range";
case ACTION_TELEPORT_ENTER:
return "teleport_enter_max_range";
case ACTION_TELEPORT_ENTER_CONQUER:
return "teleport_enter_conquer_max_range";
case ACTION_USER_ACTION1:
return "user_action_1_max_range";
case ACTION_USER_ACTION2:
......
case ACTION_UNIT_MOVE3:
case ACTION_TELEPORT:
case ACTION_TELEPORT_CONQUER:
case ACTION_TELEPORT_ENTER:
case ACTION_TELEPORT_ENTER_CONQUER:
case ACTION_SPY_ESCAPE:
/* Target kind is not ruleset changeable */
return NULL;
......
case ACTION_UNIT_MOVE3:
case ACTION_TELEPORT:
case ACTION_TELEPORT_CONQUER:
case ACTION_TELEPORT_ENTER:
case ACTION_TELEPORT_ENTER_CONQUER:
case ACTION_SPY_ESCAPE:
/* Actor consuming always is not ruleset changeable */
return NULL;
......
return "teleport_blocked_by";
case ACTION_TELEPORT_CONQUER:
return "teleport_conquer_blocked_by";
case ACTION_TELEPORT_ENTER:
return "teleport_enter_blocked_by";
case ACTION_TELEPORT_ENTER_CONQUER:
return "teleport_enter_conquer_blocked_by";
case ACTION_SPY_ESCAPE:
case ACTION_SPY_POISON:
case ACTION_SPY_POISON_ESC:
......
case ACTION_UNIT_MOVE3:
case ACTION_TELEPORT:
case ACTION_TELEPORT_CONQUER:
case ACTION_TELEPORT_ENTER:
case ACTION_TELEPORT_ENTER_CONQUER:
case ACTION_SPY_ESCAPE:
case ACTION_USER_ACTION1:
case ACTION_USER_ACTION2:
common/actions.h
#define SPECENUM_VALUE112NAME "Teleport"
#define SPECENUM_VALUE113 ACTION_TELEPORT_CONQUER
#define SPECENUM_VALUE113NAME "Teleport Conquer"
#define SPECENUM_VALUE114 ACTION_CLEAN
#define SPECENUM_VALUE114NAME "Clean"
#define SPECENUM_VALUE115 ACTION_COLLECT_RANSOM
#define SPECENUM_VALUE115NAME "Collect Ransom"
#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_VALUE114 ACTION_TELEPORT_ENTER
#define SPECENUM_VALUE114NAME "Teleport Enter"
#define SPECENUM_VALUE115 ACTION_TELEPORT_ENTER_CONQUER
#define SPECENUM_VALUE115NAME "Teleport Enter Conquer"
#define SPECENUM_VALUE116 ACTION_CLEAN
#define SPECENUM_VALUE116NAME "Clean"
#define SPECENUM_VALUE117 ACTION_COLLECT_RANSOM
#define SPECENUM_VALUE117NAME "Collect Ransom"
#define SPECENUM_VALUE118 ACTION_USER_ACTION1
#define SPECENUM_VALUE118NAME "User Action 1"
#define SPECENUM_VALUE119 ACTION_USER_ACTION2
#define SPECENUM_VALUE119NAME "User Action 2"
#define SPECENUM_VALUE120 ACTION_USER_ACTION3
#define SPECENUM_VALUE120NAME "User Action 3"
#define SPECENUM_VALUE121 ACTION_USER_ACTION4
#define SPECENUM_VALUE121NAME "User Action 4"
#define SPECENUM_BITVECTOR bv_actions
#define SPECENUM_COUNT ACTION_COUNT
#define SPECENUM_NAME_UPDATER
common/fc_types.h
#define SPECENUM_VALUE65 ACTRES_TELEPORT
#define SPECENUM_VALUE65NAME "Teleport"
#define SPECENUM_VALUE66 ACTRES_TELEPORT_CONQUER
#define SPECENUM_VALUE66NAME "Teleport Conquer"
/* Hardcoded action that's just controlled by enablers */
#define SPECENUM_VALUE67 ACTRES_ENABLER_CHECK
/* All consequences are handled as (ruleset) action data. */
doc/README.actions
* A copy of "Unit Move"
* See "Unit Move" for everything else.
"Teleport" - telepor unit to the target tile.
"Teleport" - teleport unit to the target tile.
* UI name can be set using ui_name_teleport
* any action listed in teleport_blocked_by must be impossible
* the range of legal distance between actor unit and target tile
......
* the target tile can't contain any city or units not allied to the actor
unit and all its cargo.
"Teleport Conquer" - telepor unit to the target tile and conquer it
"Teleport Conquer" - teleport unit to the target tile and conquer it
* UI name can be set using ui_name_teleport_conquer
* any action listed in teleport_conquer_blocked_by must be impossible
* the range of legal distance between actor unit and target tile
......
* the target tile can't contain any units not allied to the actor
unit and all its cargo.
"Teleport Enter" - teleport unit to the target tile.
* UI name can be set using ui_name_teleport_enter
* any action listed in teleport_enter_blocked_by must be impossible
* the range of legal distance between actor unit and target tile
must be between teleport_enter_min_range and teleport_enter_max_range
* the actor unit may not be transported (!)
* the actor unit's type must be the target tile's terrain animal if the
player's nation is an animal barbarian.
* the actor unit must be able to exist outside of a transport at the target
tile.
* the actor unit doesn't have the "CoastStrict" unit type flag or the
target tile is on or adjacent to a tile that doesn't have the
"UnsafeCoast" terrain flag.
* the actor unit can't be diplomatically forbidden from entering the target
tile.
* the target tile can't contain any city or units not allied to the actor
unit and all its cargo.
* can result in hut entry if
- the target tile has an extra with "Enter" in its rmcauses (a Hut)
- the target tile's Hut's rmreqs are fulfilled
"Teleport Enter Conquer" - teleport unit to the target tile and conquer it
* UI name can be set using ui_name_teleport_enter_conquer
* any action listed in teleport_enter_conquer_blocked_by must be impossible
* the range of legal distance between actor unit and target tile
must be between teleport_enter_conquer_min_range and
teleport_enter_conquer_max_range
* the actor unit may not be transported (!)
* the actor unit's type must be the target tile's terrain animal if the
player's nation is an animal barbarian.
* the actor unit must be able to exist outside of a transport at the target
tile.
* the actor unit doesn't have the "CoastStrict" unit type flag or the
target tile is on or adjacent to a tile that doesn't have the
"UnsafeCoast" terrain flag.
* the actor unit can't be diplomatically forbidden from entering the target
tile.
* the target tile can't contain any units not allied to the actor
unit and all its cargo.
* can result in hut entry if
- the target tile has an extra with "Enter" in its rmcauses (a Hut)
- the target tile's Hut's rmreqs are fulfilled
Actions done by a unit against all extras at a tile
===================================================
"Conquer Extras" - Claim ownership of an extra.
server/advisors/advdata.c
|| unit_can_do_action(punit, ACTION_PARADROP_FRIGHTEN_CONQUER)
|| unit_can_do_action(punit, ACTION_PARADROP_ENTER)
|| unit_can_do_action(punit, ACTION_PARADROP_ENTER_CONQUER)) {
/* TODO: Cover also teleporting */
adv->stats.units.paratroopers++;
}
if (utype_can_do_action(punit->utype, ACTION_AIRLIFT)) {
server/citytools.c
|| utype_can_do_action(unit_type_get(punit),
ACTION_PARADROP_FRIGHTEN_CONQUER)
|| utype_can_do_action(unit_type_get(punit),
ACTION_PARADROP_ENTER_CONQUER),
ACTION_PARADROP_ENTER_CONQUER)
|| utype_can_do_action(unit_type_get(punit),
ACTION_TELEPORT_ENTER_CONQUER),
FALSE, "Bad unit for city occupation.");
/* A transported unit trying to conquer a city should already have been
server/ruleset.c
ACT_SUB_RES_HUT_ENTER);
BV_SET(action_by_number(ACTION_PARADROP_ENTER_CONQUER)->sub_results,
ACT_SUB_RES_HUT_ENTER);
BV_SET(action_by_number(ACTION_TELEPORT_ENTER)->sub_results,
ACT_SUB_RES_HUT_ENTER);
BV_SET(action_by_number(ACTION_TELEPORT_ENTER_CONQUER)->sub_results,
ACT_SUB_RES_HUT_ENTER);
/* Unit Frighten Hut */
action_by_result_iterate(paction, ACTRES_HUT_FRIGHTEN) {
(4-4/4)