Project

General

Profile

Feature #391 ยป 0049-Replace-CanEscape-unit-type-flag-with-internal-actio.patch

Marko Lindqvist, 04/01/2024 03:00 AM

View differences:

client/helpdata.c
BULLET_SPACE);
} requirement_vector_iterate_end;
if (utype_has_flag(utype, UTYF_CANESCAPE)) {
CATLSTR(buf, bufsz, _("%s Can escape once stack defender is lost.\n"),
BULLET);
}
if (utype_has_flag(utype, UTYF_CANKILLESCAPING)) {
CATLSTR(buf, bufsz, _("%s Can pursue escaping units and kill them.\n"),
BULLET);
common/actions.c
unit_action_new(ACTION_GAIN_VETERANCY, ACTRES_ENABLER_CHECK,
TRUE, FALSE,
MAK_STAYS, 0, 0, FALSE);
actions[ACTION_ESCAPE] =
unit_action_new(ACTION_ESCAPE, ACTRES_ENABLER_CHECK,
TRUE, FALSE,
MAK_STAYS, 0, 0, FALSE);
actions[ACTION_USER_ACTION1] =
unit_action_new(ACTION_USER_ACTION1, ACTRES_NONE,
FALSE, TRUE,
......
case ACTION_USER_ACTION4:
return "ui_name_user_action_4";
case ACTION_GAIN_VETERANCY:
case ACTION_ESCAPE:
fc_assert(!action_id_is_internal(act)); /* Fail always */
break;
case ACTION_COUNT:
......
return N_("%sUser Action 4%s");
case ACTION_GAIN_VETERANCY:
return N_("%sGain Veterancy%s");
case ACTION_ESCAPE:
return N_("%sEscape%s");
case ACTION_COUNT:
fc_assert(act != ACTION_COUNT);
break;
......
case ACTION_UNIT_MOVE3:
case ACTION_SPY_ESCAPE:
case ACTION_GAIN_VETERANCY:
case ACTION_ESCAPE:
/* Min range is not ruleset changeable */
return NULL;
case ACTION_NUKE:
......
case ACTION_UNIT_MOVE3:
case ACTION_SPY_ESCAPE:
case ACTION_GAIN_VETERANCY:
case ACTION_ESCAPE:
/* Max range is not ruleset changeable */
return NULL;
case ACTION_HELP_WONDER:
......
case ACTION_TELEPORT_ENTER_CONQUER:
case ACTION_SPY_ESCAPE:
case ACTION_GAIN_VETERANCY:
case ACTION_ESCAPE:
/* Target kind is not ruleset changeable */
return NULL;
case ACTION_NUKE:
......
case ACTION_TELEPORT_FRIGHTEN_CONQUER:
case ACTION_TELEPORT_ENTER:
case ACTION_TELEPORT_ENTER_CONQUER:
case ACTION_GAIN_VETERANCY:
case ACTION_SPY_ESCAPE:
case ACTION_GAIN_VETERANCY:
case ACTION_ESCAPE:
/* Actor consuming always is not ruleset changeable */
return NULL;
case ACTION_FOUND_CITY:
......
case ACTION_HUT_FRIGHTEN3:
case ACTION_HUT_FRIGHTEN4:
case ACTION_GAIN_VETERANCY:
case ACTION_ESCAPE:
case ACTION_USER_ACTION1:
case ACTION_USER_ACTION2:
case ACTION_USER_ACTION3:
......
case ACTION_TELEPORT_FRIGHTEN_CONQUER:
case ACTION_TELEPORT_ENTER:
case ACTION_TELEPORT_ENTER_CONQUER:
case ACTION_GAIN_VETERANCY:
case ACTION_SPY_ESCAPE:
case ACTION_GAIN_VETERANCY:
case ACTION_ESCAPE:
case ACTION_USER_ACTION1:
case ACTION_USER_ACTION2:
case ACTION_USER_ACTION3:
common/unittype.h
/* Unit can't be built in scenarios where founding new cities is prevented. */
#define SPECENUM_VALUE26 UTYF_NEWCITY_GAMES_ONLY
#define SPECENUM_VALUE26NAME N_("?unitflag:NewCityGamesOnly")
/* Can escape when killstack occours */
#define SPECENUM_VALUE27 UTYF_CANESCAPE
#define SPECENUM_VALUE27NAME N_("?unitflag:CanEscape")
/* Can kill escaping units */
#define SPECENUM_VALUE28 UTYF_CANKILLESCAPING
#define SPECENUM_VALUE28NAME N_("?unitflag:CanKillEscaping")
#define SPECENUM_VALUE27 UTYF_CANKILLESCAPING
#define SPECENUM_VALUE27NAME N_("?unitflag:CanKillEscaping")
/* Makes random movement, not under player control */
#define SPECENUM_VALUE29 UTYF_RANDOM_MOVEMENT
#define SPECENUM_VALUE29NAME N_("?unitflag:RandomMovement")
#define SPECENUM_VALUE28 UTYF_RANDOM_MOVEMENT
#define SPECENUM_VALUE28NAME N_("?unitflag:RandomMovement")
/* Do not show flag for the unit */
#define SPECENUM_VALUE30 UTYF_FLAGLESS
#define SPECENUM_VALUE30NAME N_("?unitflag:Flagless")
#define SPECENUM_VALUE31 UTYF_PROVIDES_RANSOM
#define SPECENUM_VALUE31NAME N_("?unitflag:ProvidesRansom")
#define SPECENUM_VALUE32 UTYF_USER_FLAG_1
#define SPECENUM_VALUE33 UTYF_USER_FLAG_2
#define SPECENUM_VALUE34 UTYF_USER_FLAG_3
#define SPECENUM_VALUE35 UTYF_USER_FLAG_4
#define SPECENUM_VALUE36 UTYF_USER_FLAG_5
#define SPECENUM_VALUE37 UTYF_USER_FLAG_6
#define SPECENUM_VALUE38 UTYF_USER_FLAG_7
#define SPECENUM_VALUE39 UTYF_USER_FLAG_8
#define SPECENUM_VALUE40 UTYF_USER_FLAG_9
#define SPECENUM_VALUE41 UTYF_USER_FLAG_10
#define SPECENUM_VALUE42 UTYF_USER_FLAG_11
#define SPECENUM_VALUE43 UTYF_USER_FLAG_12
#define SPECENUM_VALUE44 UTYF_USER_FLAG_13
#define SPECENUM_VALUE45 UTYF_USER_FLAG_14
#define SPECENUM_VALUE46 UTYF_USER_FLAG_15
#define SPECENUM_VALUE47 UTYF_USER_FLAG_16
#define SPECENUM_VALUE48 UTYF_USER_FLAG_17
#define SPECENUM_VALUE49 UTYF_USER_FLAG_18
#define SPECENUM_VALUE50 UTYF_USER_FLAG_19
#define SPECENUM_VALUE51 UTYF_USER_FLAG_20
#define SPECENUM_VALUE52 UTYF_USER_FLAG_21
#define SPECENUM_VALUE53 UTYF_USER_FLAG_22
#define SPECENUM_VALUE54 UTYF_USER_FLAG_23
#define SPECENUM_VALUE55 UTYF_USER_FLAG_24
#define SPECENUM_VALUE56 UTYF_USER_FLAG_25
#define SPECENUM_VALUE57 UTYF_USER_FLAG_26
#define SPECENUM_VALUE58 UTYF_USER_FLAG_27
#define SPECENUM_VALUE59 UTYF_USER_FLAG_28
#define SPECENUM_VALUE60 UTYF_USER_FLAG_29
#define SPECENUM_VALUE61 UTYF_USER_FLAG_30
#define SPECENUM_VALUE62 UTYF_USER_FLAG_31
#define SPECENUM_VALUE63 UTYF_USER_FLAG_32
#define SPECENUM_VALUE64 UTYF_USER_FLAG_33
#define SPECENUM_VALUE65 UTYF_USER_FLAG_34
#define SPECENUM_VALUE66 UTYF_USER_FLAG_35
#define SPECENUM_VALUE67 UTYF_USER_FLAG_36
#define SPECENUM_VALUE68 UTYF_USER_FLAG_37
#define SPECENUM_VALUE69 UTYF_USER_FLAG_38
#define SPECENUM_VALUE70 UTYF_USER_FLAG_39
#define SPECENUM_VALUE71 UTYF_USER_FLAG_40
#define SPECENUM_VALUE72 UTYF_USER_FLAG_41
#define SPECENUM_VALUE73 UTYF_USER_FLAG_42
#define SPECENUM_VALUE74 UTYF_USER_FLAG_43
#define SPECENUM_VALUE75 UTYF_USER_FLAG_44
#define SPECENUM_VALUE76 UTYF_USER_FLAG_45
#define SPECENUM_VALUE77 UTYF_USER_FLAG_46
#define SPECENUM_VALUE78 UTYF_USER_FLAG_47
#define SPECENUM_VALUE79 UTYF_USER_FLAG_48
#define SPECENUM_VALUE80 UTYF_USER_FLAG_49
#define SPECENUM_VALUE81 UTYF_USER_FLAG_50
#define SPECENUM_VALUE82 UTYF_USER_FLAG_51
#define SPECENUM_VALUE29 UTYF_FLAGLESS
#define SPECENUM_VALUE29NAME N_("?unitflag:Flagless")
#define SPECENUM_VALUE30 UTYF_PROVIDES_RANSOM
#define SPECENUM_VALUE30NAME N_("?unitflag:ProvidesRansom")
#define SPECENUM_VALUE31 UTYF_USER_FLAG_1
#define SPECENUM_VALUE32 UTYF_USER_FLAG_2
#define SPECENUM_VALUE33 UTYF_USER_FLAG_3
#define SPECENUM_VALUE34 UTYF_USER_FLAG_4
#define SPECENUM_VALUE35 UTYF_USER_FLAG_5
#define SPECENUM_VALUE36 UTYF_USER_FLAG_6
#define SPECENUM_VALUE37 UTYF_USER_FLAG_7
#define SPECENUM_VALUE38 UTYF_USER_FLAG_8
#define SPECENUM_VALUE39 UTYF_USER_FLAG_9
#define SPECENUM_VALUE40 UTYF_USER_FLAG_10
#define SPECENUM_VALUE41 UTYF_USER_FLAG_11
#define SPECENUM_VALUE42 UTYF_USER_FLAG_12
#define SPECENUM_VALUE43 UTYF_USER_FLAG_13
#define SPECENUM_VALUE44 UTYF_USER_FLAG_14
#define SPECENUM_VALUE45 UTYF_USER_FLAG_15
#define SPECENUM_VALUE46 UTYF_USER_FLAG_16
#define SPECENUM_VALUE47 UTYF_USER_FLAG_17
#define SPECENUM_VALUE48 UTYF_USER_FLAG_18
#define SPECENUM_VALUE49 UTYF_USER_FLAG_19
#define SPECENUM_VALUE50 UTYF_USER_FLAG_20
#define SPECENUM_VALUE51 UTYF_USER_FLAG_21
#define SPECENUM_VALUE52 UTYF_USER_FLAG_22
#define SPECENUM_VALUE53 UTYF_USER_FLAG_23
#define SPECENUM_VALUE54 UTYF_USER_FLAG_24
#define SPECENUM_VALUE55 UTYF_USER_FLAG_25
#define SPECENUM_VALUE56 UTYF_USER_FLAG_26
#define SPECENUM_VALUE57 UTYF_USER_FLAG_27
#define SPECENUM_VALUE58 UTYF_USER_FLAG_28
#define SPECENUM_VALUE59 UTYF_USER_FLAG_29
#define SPECENUM_VALUE60 UTYF_USER_FLAG_30
#define SPECENUM_VALUE61 UTYF_USER_FLAG_31
#define SPECENUM_VALUE62 UTYF_USER_FLAG_32
#define SPECENUM_VALUE63 UTYF_USER_FLAG_33
#define SPECENUM_VALUE64 UTYF_USER_FLAG_34
#define SPECENUM_VALUE65 UTYF_USER_FLAG_35
#define SPECENUM_VALUE66 UTYF_USER_FLAG_36
#define SPECENUM_VALUE67 UTYF_USER_FLAG_37
#define SPECENUM_VALUE68 UTYF_USER_FLAG_38
#define SPECENUM_VALUE69 UTYF_USER_FLAG_39
#define SPECENUM_VALUE70 UTYF_USER_FLAG_40
#define SPECENUM_VALUE71 UTYF_USER_FLAG_41
#define SPECENUM_VALUE72 UTYF_USER_FLAG_42
#define SPECENUM_VALUE73 UTYF_USER_FLAG_43
#define SPECENUM_VALUE74 UTYF_USER_FLAG_44
#define SPECENUM_VALUE75 UTYF_USER_FLAG_45
#define SPECENUM_VALUE76 UTYF_USER_FLAG_46
#define SPECENUM_VALUE77 UTYF_USER_FLAG_47
#define SPECENUM_VALUE78 UTYF_USER_FLAG_48
#define SPECENUM_VALUE79 UTYF_USER_FLAG_49
#define SPECENUM_VALUE80 UTYF_USER_FLAG_50
#define SPECENUM_VALUE81 UTYF_USER_FLAG_51
#define SPECENUM_VALUE82 UTYF_USER_FLAG_52
/* Note that first role must have value next to last flag */
#define UTYF_LAST_USER_FLAG UTYF_USER_FLAG_51
#define UTYF_LAST_USER_FLAG UTYF_USER_FLAG_52
#define MAX_NUM_USER_UNIT_FLAGS (UTYF_LAST_USER_FLAG - UTYF_USER_FLAG_1 + 1)
#define SPECENUM_NAMEOVERRIDE
#define SPECENUM_NAME_UPDATER
data/alien/actions.ruleset
escape_city = "Transport Embark", "Enter Hut", "Enter Hut 2", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark", "Enter Hut", "Enter Hut 2",
; "Unit Move"
data/alien/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/civ1/actions.ruleset
escape_city = "Transport Embark", "Enter Hut", "Enter Hut 2", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark", "Enter Hut", "Enter Hut 2",
; "Unit Move"
data/civ1/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/civ2/actions.ruleset
"Frighten Hut", "Frighten Hut 2", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark", "Enter Hut", "Enter Hut 2",
; "Frighten Hut", "Unit Move"
data/civ2/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/civ2civ3/actions.ruleset
"Frighten Hut", "Frighten Hut 2", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark",
; "Enter Hut", "Enter Hut 2",
; "Frighten Hut", "Unit Move"
data/civ2civ3/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/classic/actions.ruleset
"Frighten Hut", "Frighten Hut 2", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark",
; "Conquer Extras", "Conquer Extras 2",
; "Enter Hut", "Enter Hut 2",
data/classic/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/goldkeep/actions.ruleset
"Frighten Hut", "Frighten Hut 2", "Unit Move"
; The unit's stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark",
; "Conquer Extras", "Conquer Extras 2",
; "Enter Hut", "Enter Hut 2",
data/goldkeep/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/granularity/actions.ruleset
escape_city = "Transport Embark", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark", "Unit Move"
; If poison_empties_food_stock is set to TRUE a successful "Poison City"
data/granularity/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/multiplayer/actions.ruleset
"Frighten Hut", "Frighten Hut 2", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark",
; "Conquer Extras", "Conquer Extras 2",
; "Enter Hut", "Enter Hut 2",
data/multiplayer/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/ruledit/comments-3.3.txt
; \"NewCityGamesOnly\" = unit can\'t be built on scenarios where founding new cities\n\
; is not allowed. Give this flag to units that would make no sense\n\
; to have in a game with such a scenario\n\
; \"CanEscape\" = this unit has, given that certain conditions are\n\
; fulfilled, a 50% chance to escape rather than being\n\
; killed when killstack is enabled and the defender of its\n\
; tile is defeated. The conditions are that it has more move\n\
; points than required to move to an adjacent tile plus the\n\
; attackers move points and that the attacker doesn\'t have\n\
; the \"CanKillEscaping\" unit type flag.\n\
; \"CanKillEscaping\" = an attack from this unit ignores the \"CanEscape\" unit\n\
; type flag.\n\
; \"CanKillEscaping\" = an attack from this unit prevents the \"Escape\" action.\n\
; \"Provoking\" = a unit considering to auto attack this unit will choose to\n\
; do so even if has better odds when defending against it\n\
; then when attacking it. Applies when the autoattack server\n\
......
; This section has comments documenting user (custom) flag types
utype = "\
; Names for custom unit type flags. There can be up to 51 of these.\n\
; Names for custom unit type flags. There can be up to 52 of these.\n\
; name = rule name; In some circumstances user may see this\n\
; as part of some sentences, so try to make it descriptive\n\
; and sensible.\n\
data/sandbox/actions.ruleset
"Frighten Hut", "Frighten Hut 2", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark",
; "Enter Hut", "Enter Hut 2",
; "Frighten Hut", "Unit Move"
data/sandbox/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/stub/actions.ruleset
; escape_city = "Enter Hut", "Frighten Hut", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark", "Unit Move"
; If poison_empties_food_stock is set to TRUE a successful "Poison City"
data/stub/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
data/webperimental/actions.ruleset
escape_city = "Transport Embark", "Enter Hut", "Frighten Hut", "Unit Move"
; The unit`s stack has been defeated and is scheduled for execution but the
; unit has the CanEscape unit type flag. Evaluated against an adjacent tile.
; unit can do Escape action. Evaluated against an adjacent tile.
;unit_stack_death = "Transport Embark", "Conquer Extras",
; "Enter Hut", "Frighten Hut", "Unit Move"
data/webperimental/units.ruleset
format_version = 40
[control]
; Names for custom unit type flags. There can be up to 51 of these.
; Names for custom unit type flags. There can be up to 52 of these.
; name = rule name; In some circumstances user may see this
; as part of some sentences, so try to make it descriptive
; and sensible.
......
; "NewCityGamesOnly" = unit can't be built on scenarios where founding new cities
; is not allowed. Give this flag to units that would make no sense
; to have in a game with such a scenario
; "CanEscape" = this unit has, given that certain conditions are
; fulfilled, a 50% chance to escape rather than being
; killed when killstack is enabled and the defender of its
; tile is defeated. The conditions are that it has more move
; points than required to move to an adjacent tile plus the
; attackers move points and that the attacker doesn't have
; the "CanKillEscaping" unit type flag.
; "CanKillEscaping" = an attack from this unit ignores the "CanEscape" unit
; type flag.
; "CanKillEscaping" = an attack from this unit prevents the "Escape" action.
; "Provoking" = a unit considering to auto attack this unit will choose to
; do so even if has better odds when defending against it
; then when attacking it. Applies when the autoattack server
gen_headers/enums/actions_enums.def
# Enabler checks only
ACTION_GAIN_VETERANCY "Gain Veterancy"
ACTION_ESCAPE "Escape"
# User actions
ACTION_USER_ACTION1 "User Action 1"
server/ruleset/rscompat.c
const char *name;
const char *helptxt;
} new_flags_33[] = {
{ N_("NoVeteran"), N_("May acquire veteran status.") }
{ N_("NoVeteran"), N_("May acquire veteran status.") },
{ N_("CanEscape"), N_("Can try to escape stack death.") }
};
enough_new_user_flags(new_flags_33, unit_type,
......
**************************************************************************/
void rscompat_postprocess(struct rscompat_info *info)
{
struct action_enabler *enabler;
struct requirement e_req;
if (!info->compat_mode || info->version >= RSFORMAT_CURRENT) {
/* There isn't anything here that should be done outside of compat
* mode. */
......
}
} unit_type_iterate_end;
enabler = action_enabler_new();
enabler->action = ACTION_ESCAPE;
e_req = req_from_str("UnitFlag", "Local", FALSE, TRUE, FALSE,
"CanEscape");
requirement_vector_append(&enabler->actor_reqs, e_req);
action_enabler_add(enabler);
/* Upgrade existing effects. Done before new effects are added to prevent
* the new effects from being upgraded by accident. */
iterate_effect_cache(effect_list_compat_cb, info);
server/unittools.c
&& is_unit_reachable_at(vunit, pkiller, deftile)) {
escaped = FALSE;
if (unit_has_type_flag(vunit, UTYF_CANESCAPE)
if (is_action_enabled_unit_on_self(ACTION_ESCAPE, vunit)
&& !unit_has_type_flag(pkiller, UTYF_CANKILLESCAPING)
&& vunit->hp > 0
&& vunit->moves_left > pkiller->moves_left
    (1-1/1)