[Freeciv-Dev] (PR#8483) killstack and damage patch (fix 1)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#8483) killstack and damage patch (fix 1) |
From: |
"LoboGris" <molv@xxxxxxxxxxxxxx> |
Date: |
Sun, 11 Apr 2004 00:12:03 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8483 >
-------------------------------------------------------------------------
Description: two new ruleset options that modifies combat rules
Observation: common/packets.def was modified. Don't forget to run
common/generate_packets.py after patch applied.
killstack:
;If this is set to 1, all units in the same tile of a killed unit will
;be killed (unless they are on a fortress, airbase or city). This is the
;freeciv default.
;If this options is set to 0, units are killed one by one,
;except by nuclear weapons, of course.
damage:
; If damage is set to a large number (e.g. 255), a battle ends until one
; of the units is destroyed. This is the freeciv default.
; If is set to a low number instead (e.g. 15), both units can survive after
; one attack. Adjust this number at taste. For numbers less than or equal 1
; the efect is the same.
diff -Nur freeciv-orig-cvs/common/combat.c freeciv-killstack/common/combat.c
--- freeciv-orig-cvs/common/combat.c 2004-03-17 21:39:51.000000000 -0300
+++ freeciv-killstack/common/combat.c 2004-04-10 22:46:17.000000000 -0300
@@ -662,5 +662,6 @@
{
return !(map_get_city(x, y) != NULL
|| map_has_special(x, y, S_FORTRESS)
- || map_has_special(x, y, S_AIRBASE));
+ || map_has_special(x, y, S_AIRBASE)
+ || !(game.rgame.killstack));
}
diff -Nur freeciv-orig-cvs/common/game.h freeciv-killstack/common/game.h
--- freeciv-orig-cvs/common/game.h 2004-03-27 20:26:37.000000000 -0300
+++ freeciv-killstack/common/game.h 2004-04-10 22:49:20.000000000 -0300
@@ -203,6 +203,9 @@
* Advances given to all players at game start.
*/
int global_init_techs[MAX_NUM_TECH_LIST];
+
+ int killstack;
+ int damage;
} rgame;
struct {
diff -Nur freeciv-orig-cvs/common/packets.def
freeciv-killstack/common/packets.def
--- freeciv-orig-cvs/common/packets.def 2004-04-09 20:29:59.000000000 -0300
+++ freeciv-killstack/common/packets.def 2004-04-10 22:46:17.000000000
-0300
@@ -968,6 +968,9 @@
UINT8 tech_leakage;
TECH_LIST global_init_techs[MAX_NUM_TECH_LIST];
+ UINT8 killstack;
+ UINT8 damage;
+
UINT8 trireme_loss_chance[MAX_VET_LEVELS]; add-cap(veteran)
UINT8 work_veteran_chance[MAX_VET_LEVELS]; add-cap(veteran)
UINT8 veteran_chance[MAX_VET_LEVELS]; add-cap(veteran)
diff -Nur freeciv-orig-cvs/data/civ1/game.ruleset
freeciv-killstack/data/civ1/game.ruleset
--- freeciv-orig-cvs/data/civ1/game.ruleset 2004-03-27 20:26:38.000000000
-0300
+++ freeciv-killstack/data/civ1/game.ruleset 2004-04-10 22:50:47.000000000
-0300
@@ -79,3 +79,19 @@
improvement_factor = 1
unit_factor = 1
total_factor = 100
+
+[combat_rules]
+;If this is set to 1, all units in the same tile of a killed unit will
+;be killed (unless they are on a fortress, airbase or city). This is the
+;freeciv default.
+;If this options is set to 0, units are killed one by one,
+;except by nuclear weapons, of course.
+killstack = 1
+
+; If damage is set to a large number (e.g. 255), a battle ends until one
+; of the units is destroyed. This is the freeciv default.
+; If is set to a low number instead (e.g. 15), both units can survive after
+; one attack. Adjust this number at taste. For numbers less than or equal 1
+; the efect is the same.
+damage = 255
+
diff -Nur freeciv-orig-cvs/data/civ2/game.ruleset
freeciv-killstack/data/civ2/game.ruleset
--- freeciv-orig-cvs/data/civ2/game.ruleset 2004-03-27 20:26:39.000000000
-0300
+++ freeciv-killstack/data/civ2/game.ruleset 2004-04-10 22:51:30.000000000
-0300
@@ -79,3 +79,18 @@
improvement_factor = 1
unit_factor = 1
total_factor = 100
+
+[combat_rules]
+;If this is set to 1, all units in the same tile of a killed unit will
+;be killed (unless they are on a fortress, airbase or city). This is the
+;freeciv default.
+;If this options is set to 0, units are killed one by one,
+;except by nuclear weapons, of course.
+killstack = 1
+
+; If damage is set to a large number (e.g. 255), a battle ends until one
+; of the units is destroyed. This is the freeciv default.
+; If is set to a low number instead (e.g. 15), both units can survive after
+; one attack. Adjust this number at taste. For numbers less than or equal 1
+; the efect is the same.
+damage = 255
diff -Nur freeciv-orig-cvs/data/default/game.ruleset
freeciv-killstack/data/default/game.ruleset
--- freeciv-orig-cvs/data/default/game.ruleset 2004-03-27 20:26:39.000000000
-0300
+++ freeciv-killstack/data/default/game.ruleset 2004-04-10 22:51:46.000000000
-0300
@@ -84,3 +84,18 @@
improvement_factor = 1
unit_factor = 1
total_factor = 100
+
+[combat_rules]
+;If this is set to 1, all units in the same tile of a killed unit will
+;be killed (unless they are on a fortress, airbase or city). This is the
+;freeciv default.
+;If this options is set to 0, units are killed one by one,
+;except by nuclear weapons, of course.
+killstack = 1
+
+; If damage is set to a large number (e.g. 255), a battle ends until one
+; of the units is destroyed. This is the freeciv default.
+; If is set to a low number instead (e.g. 15), both units can survive after
+; one attack. Adjust this number at taste. For numbers less than or equal 1
+; the efect is the same.
+damage = 255
diff -Nur freeciv-orig-cvs/data/helpdata.txt freeciv-killstack/data/helpdata.txt
--- freeciv-orig-cvs/data/helpdata.txt 2003-12-24 01:30:41.000000000 -0300
+++ freeciv-killstack/data/helpdata.txt 2004-04-10 22:46:17.000000000 -0300
@@ -899,6 +899,9 @@
[help_combat]
name = _("Combat")
text = _("\
+Default Combat Rules
+--------------------- \
+"), _("\
When one unit attacks another unit, either the attacker will be \
destroyed, or the defender will be destroyed -- never both (unless \
the attacker was a missile). The outcome depends on several \
@@ -993,6 +996,27 @@
defender.\
")
+[help_combat_modifying]
+name = _(" Modifying Combat Rules")
+text = _("
+Modifying Combat Rules
+--------------------- \
+"), _("\
+The combat rules described before can be modified by changing the \
+following modifiers in game.ruleset, section combat_rules: \
+"), _("\
+ - killstack. (default: 1) If set to 0, units in the same tile of a \
+lost defender are not destroyed. \
+"), _("\
+ - damage. (default: 255) This modifier allows to regulate the damage \
+that can be dealt to both units in an attack. Even if this modifier \
+is low enough, both units can survive in an attack. Note that the \
+cost of units must be higher in that case, to prevent unit \
+proliferation. For the default behavior, a large number must be \
+assigned to this modifier (e.g. 255). Try numbers like 15 to test \
+results. \
+")
+
[help_combat_example_1]
name = _(" Combat example 1")
text = _("\
diff -Nur freeciv-orig-cvs/server/ruleset.c freeciv-killstack/server/ruleset.c
--- freeciv-orig-cvs/server/ruleset.c 2004-03-27 20:26:40.000000000 -0300
+++ freeciv-killstack/server/ruleset.c 2004-04-10 22:46:17.000000000 -0300
@@ -2670,6 +2670,8 @@
lookup_tech_list(&file, "options", "global_init_techs",
game.rgame.global_init_techs, filename);
+ game.rgame.killstack = secfile_lookup_int(&file, "combat_rules.killstack");
+ game.rgame.damage = secfile_lookup_int(&file, "combat_rules.damage");
section_file_check_unused(&file, filename);
section_file_free(&file);
}
@@ -3078,6 +3080,8 @@
memcpy(misc_p.global_init_techs, game.rgame.global_init_techs,
sizeof(misc_p.global_init_techs));
+ misc_p.killstack = game.rgame.killstack;
+ misc_p.damage = game.rgame.damage;
lsend_packet_ruleset_game(dest, &misc_p);
}
diff -Nur freeciv-orig-cvs/server/unittools.c
freeciv2-feb2004/server/unittools.c
--- freeciv-orig-cvs/server/unittools.c 2004-02-21 21:48:51.000000000 -0300
+++ freeciv2-feb2004/server/unittools.c 2004-02-21 21:52:12.000000000 -0300
@@ -146,6 +146,8 @@
int defensepower = get_total_defense_power(attacker,defender);
int attack_firepower, defense_firepower;
+ int attack_counter=game.rgame.damage;
+
get_modified_firepower(attacker, defender,
&attack_firepower, &defense_firepower);
@@ -156,12 +158,13 @@
} else if (defensepower == 0) {
defender->hp=0;
}
- while (attacker->hp>0 && defender->hp>0) {
+ while (attacker->hp>0 && defender->hp>0 && attack_counter>0 ) {
if (myrand(attackpower+defensepower) >= defensepower) {
defender->hp -= attack_firepower;
} else {
attacker->hp -= defense_firepower;
}
+ attack_counter--;
}
if (attacker->hp<0) attacker->hp = 0;
if (defender->hp<0) defender->hp = 0;
- [Freeciv-Dev] Re: (PR#8483) killstack and damage patch, Jason Short, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack and damage patch, LoboGris, 2004/04/11
- [Freeciv-Dev] (PR#8483) killstack and damage patch (fix 1),
LoboGris <=
- [Freeciv-Dev] Re: (PR#8483) killstack and damage patch, LoboGris, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack and damage patch, imbaczek@xxxxxxxxxxxxxx, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack and damage patch, Per I. Mathisen, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack and damage patch, Jason Short, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack and damage patch, LoboGris, 2004/04/11
- [Freeciv-Dev] (PR#8483) killstack patch (fix 2), LoboGris, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack patch (fix 2), Mike Kaufman, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack patch (fix 2), LoboGris, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack patch (fix 2), LoboGris, 2004/04/11
- [Freeciv-Dev] Re: (PR#8483) killstack and damage patch, Raimar Falke, 2004/04/12
|
|