<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40591 >
A number of players do not appreciate the removal of the "tired" attack penalty (units attack strength reduced if they attack with 1/3 or 2/3 moves left), including myself. When I brought this up on the longturn site, http://www.longturn.org/ltxiv#comment-6674 it was generally agreed that there should be at least some kind of option to allow the old behaviour, if server operators/ruleset makers desire it. So the attached patch makes the proper minimal additions to the combat and ruleset code for 2.2, introducting a combat_rules.tired_attack field in the game.ruleset file and updating packet definitions. The civ1, civ2, and default rulesets are also updated to make use of the field (enabled, enabled, and disabled respectively). ----------------------------------------------------------------------- 行け!弛み無くて死なない戦士。
common/combat.c | 4 ++++ common/game.h | 2 ++ common/packets.def | 1 + data/civ1/game.ruleset | 8 +++++++- data/civ2/game.ruleset | 8 +++++++- data/default/game.ruleset | 8 +++++++- server/ruleset.c | 5 +++++ version.in | 2 +- 8 files changed, 34 insertions(+), 4 deletions(-) diff --git a/common/combat.c b/common/combat.c index 486ee9a..70432d7 100644 --- a/common/combat.c +++ b/common/combat.c @@ -375,6 +375,10 @@ int base_get_attack_power(const struct unit_type *punittype, power = punittype->attack_strength * POWER_FACTOR; power *= punittype->veteran[veteran].power_fact; + if (game.info.tired_attack && moves_left < SINGLE_MOVE) { + power = (power * moves_left) / SINGLE_MOVE; + } + return power; } diff --git a/common/game.h b/common/game.h index 6b83c88..4e75ece 100644 --- a/common/game.h +++ b/common/game.h @@ -210,6 +210,8 @@ bool setting_class_is_changeable(enum sset_class class); #define GAME_DEFAULT_SLOW_INVASIONS TRUE +#define GAME_DEFAULT_TIRED_ATTACK FALSE + #define GAME_DEFAULT_DIPLOMACY 0 #define GAME_MIN_DIPLOMACY 0 #define GAME_MAX_DIPLOMACY 4 diff --git a/common/packets.def b/common/packets.def index 6dec219..60fa2e9 100644 --- a/common/packets.def +++ b/common/packets.def @@ -443,6 +443,7 @@ PACKET_GAME_INFO=15; sc UINT8 tech_leakage; YEAR tech_cost_double_year; BOOL killstack; + BOOL tired_attack; UINT8 upgrade_veteran_loss; UINT8 autoupgrade_veteran_loss; UINT16 incite_improvement_factor; diff --git a/data/civ1/game.ruleset b/data/civ1/game.ruleset index b5940eb..27d70e6 100644 --- a/data/civ1/game.ruleset +++ b/data/civ1/game.ruleset @@ -104,7 +104,13 @@ total_factor = 100 ;not inside a city, fortress or airbase, all units in the same tile are ;destroyed along with the defender. This is the freeciv default. ;If this options is set to 0, only the defender unit is destroyed. -killstack = 1 +killstack = 1 + +;If tired_attack is set to 1, units that attack with only 1/3 or 2/3 moves +;left will have their attack power reduced by 2/3 or 1/3 respectively. If +;this is set to 0 units will attack with full strength even if they have +;only fractional moves left. +tired_attack = 1 [teams] names = diff --git a/data/civ2/game.ruleset b/data/civ2/game.ruleset index 87ab099..c1cdf3c 100644 --- a/data/civ2/game.ruleset +++ b/data/civ2/game.ruleset @@ -98,7 +98,13 @@ total_factor = 100 ;not inside a city, fortress or airbase, all units in the same tile are ;destroyed along with the defender. This is the freeciv default. ;If this options is set to 0, only the defender unit is destroyed. -killstack = 1 +killstack = 1 + +;If tired_attack is set to 1, units that attack with only 1/3 or 2/3 moves +;left will have their attack power reduced by 2/3 or 1/3 respectively. If +;this is set to 0 units will attack with full strength even if they have +;only fractional moves left. +tired_attack = 1 [teams] names = diff --git a/data/default/game.ruleset b/data/default/game.ruleset index d454e90..0d7d4ef 100644 --- a/data/default/game.ruleset +++ b/data/default/game.ruleset @@ -125,7 +125,13 @@ slow_invasions = 1 ;not inside a city, fortress or airbase, all units in the same tile are ;destroyed along with the defender. This is the freeciv default. ;If this options is set to 0, only the defender unit is destroyed. -killstack = 1 +killstack = 1 + +;If tired_attack is set to 1, units that attack with only 1/3 or 2/3 moves +;left will have their attack power reduced by 2/3 or 1/3 respectively. If +;this is set to 0 units will attack with full strength even if they have +;only fractional moves left. +tired_attack = 0 [teams] names = diff --git a/server/ruleset.c b/server/ruleset.c index 01994a8..7cf3784 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -3108,6 +3108,11 @@ static void load_ruleset_game(void) /* Enable/Disable killstack */ game.info.killstack = secfile_lookup_bool(&file, "combat_rules.killstack"); + /* Enable/Disable tired attack penalty */ + game.info.tired_attack + = secfile_lookup_bool_default(&file, GAME_DEFAULT_TIRED_ATTACK, + "combat_rules.tired_attack"); + svec = secfile_lookup_str_vec(&file, &game.info.num_teams, "teams.names"); game.info.num_teams = MIN(MAX_NUM_TEAMS, game.info.num_teams); if (game.info.num_teams <= 0) { diff --git a/version.in b/version.in index e6a4ee4..74ff39e 100644 --- a/version.in +++ b/version.in @@ -23,5 +23,5 @@ RELEASE_MONTH=3 # - Avoid adding a new mandatory capability to the development branch for # as long as possible. We want to maintain network compatibility with # the stable branch for as long as possible. -NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel.2008.Dec.04" +NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel.2008.Dec.08" NETWORK_CAPSTRING_OPTIONAL=""
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev