[Freeciv-Dev] (PR#13537) Two new unit flags
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#13537) Two new unit flags |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Mon, 25 Jul 2005 05:29:31 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13537 >
This patch adds the unit flags "BadCity" and "BadWall":
BadCity - replaces the hard-coded Pearl Harbour rule, which gives a city
defender 1 firepower and the attacker x2 firepower. This applies for all
sailing units. Since I doubt civ1 had this rule (civ1 did not have
firepower), I did not add it to the civ1 ruleset.
BadWall - if the unit attacks a city with fortifications (city wall), its
firepower is set to 1. I intend to use this in a ruleset soonish (for
cavalry).
- Per
Index: common/combat.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/combat.c,v
retrieving revision 1.60
diff -u -r1.60 combat.c
--- common/combat.c 22 Jul 2005 16:18:05 -0000 1.60
+++ common/combat.c 25 Jul 2005 12:28:12 -0000
@@ -245,18 +245,25 @@
const struct unit *defender,
int *att_fp, int *def_fp)
{
+ struct city *pcity = tile_get_city(defender->tile);
+
*att_fp = unit_type(attacker)->firepower;
*def_fp = unit_type(defender)->firepower;
/* Check CityBuster flag */
- if (unit_flag(attacker, F_CITYBUSTER)
- && tile_get_city(defender->tile)) {
+ if (unit_flag(attacker, F_CITYBUSTER) && pcity) {
*att_fp *= 2;
}
+ if (unit_flag(attacker, F_BADWALL)
+ && pcity
+ && get_city_bonus(pcity, EFT_LAND_DEFEND) > 0) {
+ *att_fp = 1;
+ }
+
/* pearl harbour - defender's firepower is reduced to one,
* attacker's is multiplied by two */
- if (is_sailing_unit(defender) && tile_get_city(defender->tile)) {
+ if (unit_flag(defender, F_BADCITY) && tile_get_city(defender->tile)) {
*att_fp *= 2;
*def_fp = 1;
}
Index: common/unittype.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.c,v
retrieving revision 1.63
diff -u -r1.63 unittype.c
--- common/unittype.c 23 Jul 2005 18:02:44 -0000 1.63
+++ common/unittype.c 25 Jul 2005 12:28:12 -0000
@@ -45,7 +45,7 @@
"Airbase", "Cities", "IgTired", "Missile_Carrier", "No_Land_Attack",
"AddToCity", "Fanatic", "GameLoss", "Unique", "Unbribable",
"Undisbandable", "SuperSpy", "NoHome", "NoVeteran", "Bombarder",
- "CityBuster", "NoBuild"
+ "CityBuster", "NoBuild", "BadWall", "BadCity"
};
static const char *role_names[] = {
"FirstBuild", "Explorer", "Hut", "HutTech", "Partisan",
Index: common/unittype.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.h,v
retrieving revision 1.54
diff -u -r1.54 unittype.h
--- common/unittype.h 23 Jul 2005 18:02:44 -0000 1.54
+++ common/unittype.h 25 Jul 2005 12:28:13 -0000
@@ -84,6 +84,8 @@
F_BOMBARDER, /* Has the ability to bombard */
F_CITYBUSTER, /* Gets double firepower against cities */
F_NOBUILD, /* Unit cannot be built (barb leader etc) */
+ F_BADWALL, /* Firepower set to 1 when attacking city wall */
+ F_BADCITY, /* Firepower set to 1 and attackers x2 when in city */
F_LAST
};
#define F_MAX 64
Index: data/civ2/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/units.ruleset,v
retrieving revision 1.45
diff -u -r1.45 units.ruleset
--- data/civ2/units.ruleset 28 Jun 2005 17:21:02 -0000 1.45
+++ data/civ2/units.ruleset 25 Jul 2005 12:28:14 -0000
@@ -1082,7 +1082,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = "Trireme"
+flags = "Trireme", "BadCity"
roles = "Ferryboat"
[unit_caravel]
@@ -1110,7 +1110,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Ferryboat", "BarbarianBoat"
[unit_galleon]
@@ -1138,7 +1138,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Ferryboat", "BarbarianBoat"
[unit_frigate]
@@ -1166,7 +1166,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Hunter"
[unit_ironclad]
@@ -1194,7 +1194,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Hunter"
[unit_destroyer]
@@ -1222,7 +1222,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Hunter"
helptext = _("\
TIP: A very fast unit, which is very useful for hunting down enemy\
@@ -1254,7 +1254,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = ""
[unit_aegis_cruiser]
@@ -1282,7 +1282,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = "AEGIS"
+flags = "AEGIS", "BadCity"
roles = ""
[unit_battleship]
@@ -1310,7 +1310,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = ""
[unit_submarine]
@@ -1338,7 +1338,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = "Partial_Invis",
+flags = "Partial_Invis", "BadCity",
"Missile_Carrier", "No_Land_Attack"
roles = "Hunter"
helptext = _("\
@@ -1404,7 +1404,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Ferryboat"
[unit_cruise_missile]
Index: data/default/units.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/units.ruleset,v
retrieving revision 1.70
diff -u -r1.70 units.ruleset
--- data/default/units.ruleset 20 Jul 2005 11:02:37 -0000 1.70
+++ data/default/units.ruleset 25 Jul 2005 12:28:15 -0000
@@ -144,6 +144,10 @@
; bombard_rate regulates its number of shots
; "CityBuster" = this unit has double firepower against cities
; "NoBuild" = this unit cannot be built
+; "BadWall" = the firepower of this unit is set to 1 if attacking a city
+; defended by a city wall (or other city building defense)
+; "BadCity" = if attacked while in a city, firepower is set to 1 and
+; attacker's firepower is doubled (the Pearl Harbour rule)
;
; Following flag strings require extra fields:
; "Paratroopers"
@@ -1134,7 +1138,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = "Trireme"
+flags = "Trireme", "BadCity"
roles = "Ferryboat"
[unit_caravel]
@@ -1162,7 +1166,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Ferryboat", "BarbarianBoat"
[unit_galleon]
@@ -1190,7 +1194,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Ferryboat", "BarbarianBoat"
[unit_frigate]
@@ -1218,7 +1222,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Hunter"
[unit_ironclad]
@@ -1246,7 +1250,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Hunter"
[unit_destroyer]
@@ -1274,7 +1278,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Hunter"
helptext = _("\
TIP: A very fast unit, which is very useful for hunting down enemy\
@@ -1306,7 +1310,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "DefendGood"
[unit_aegis_cruiser]
@@ -1334,7 +1338,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = "AEGIS"
+flags = "AEGIS", "BadCity"
roles = "DefendGood"
[unit_battleship]
@@ -1362,7 +1366,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = ""
[unit_submarine]
@@ -1390,7 +1394,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = "Partial_Invis",
+flags = "Partial_Invis", "BadCity",
"Missile_Carrier", "No_Land_Attack"
roles = "Hunter"
helptext = _("\
@@ -1423,7 +1427,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = "Carrier"
+flags = "Carrier", "BadCity"
roles = ""
helptext = _("\
TIP: Guard Carriers with a handful of fast-moving ships and a\
@@ -1456,7 +1460,7 @@
uk_shield = 1
uk_food = 0
uk_gold = 0
-flags = ""
+flags = "BadCity"
roles = "Ferryboat"
[unit_cruise_missile]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13537) Two new unit flags,
Per I. Mathisen <=
|
|