Project

General

Profile

Feature #1149 ยป 0078-Rename-Pearl-Harbour-rule-as-Pearl-Harbor.patch

Marko Lindqvist, 11/21/2024 03:49 AM

View differences:

ai/default/daimilitary.c
fp = unit_type_get(punit)->firepower;
if (unit_has_type_flag(punit, UTYF_BADCITYDEFENDER)) {
/* Attacker firepower doubled, defender firepower set to
* game.info.low_firepower_pearl_harbour at max. */
defense *= MIN(fp, game.info.low_firepower_pearl_harbour);
* game.info.low_firepower_pearl_harbor at max. */
defense *= MIN(fp, game.info.low_firepower_pearl_harbor);
defense /= 2;
} else {
defense *= fp;
......
/* Sea and helicopters often have their firepower set to low firepower when
* defending. We can't have such units as defenders. */
if (utype_has_flag(punittype, UTYF_BADCITYDEFENDER)) {
fp = MIN(fp, game.info.low_firepower_pearl_harbour);
fp = MIN(fp, game.info.low_firepower_pearl_harbor);
}
if (((struct unit_type_ai *)utype_ai_data(punittype, ait))->low_firepower) {
fp = MIN(fp, game.info.low_firepower_combat_bonus);
common/combat.c
*att_fp = MIN(*att_fp, game.info.low_firepower_badwallattacker);
}
/* pearl harbour - defender's firepower is reduced,
* attacker's is multiplied by two */
/* pearl harbor - defender's firepower is reduced,
* attacker's is multiplied by two */
if (unit_has_type_flag(defender, UTYF_BADCITYDEFENDER)
&& tile_city(unit_tile(defender))) {
*att_fp *= 2;
*def_fp = MIN(*def_fp, game.info.low_firepower_pearl_harbour);
*def_fp = MIN(*def_fp, game.info.low_firepower_pearl_harbor);
}
/*
common/networking/packets.def
BOOL combat_odds_scaled_veterancy;
BOOL damage_reduces_bombard_rate;
UINT8 low_firepower_badwallattacker;
UINT8 low_firepower_pearl_harbour;
UINT8 low_firepower_pearl_harbor;
UINT8 low_firepower_combat_bonus;
UINT8 low_firepower_nonnat_bombard;
UINT8 nuke_pop_loss_pct;
data/alien/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/alien/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/civ1/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 10
low_firepower_pearl_harbor = 10
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/civ1/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/civ2/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/civ2/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/civ2civ3/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/civ2civ3/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/classic/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/classic/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/goldkeep/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/goldkeep/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/granularity/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/granularity/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/multiplayer/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/multiplayer/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/ruledit/comments-3.3.txt
; attacking a city\n\
; defended by a city wall (or other city building defense)\n\
; \"BadCityDefender\" = if attacked while in a city, firepower is set to 1\n\
; and firepower of attacker is doubled (the Pearl Harbour\n\
; and firepower of attacker is doubled (the Pearl Harbor\n\
; rule)\n\
; \"BarbarianOnly\" = only barbarians can build this unit\n\
; \"Shield2Gold\" = Switch from shield upkeep to gold upkeep possible\n\
......
; If firepower is already lower than this, it won`t be affected.\
"
low_firepower_pearl_harbour = "\n\
low_firepower_pearl_harbor = "\n\
; When the defender has BadCityDefender flag, and it`s\n\
; defending on a city tile, attacker`s firepower is doubled\n\
; and defenders firepower is reduced to this value.\n\
data/sandbox/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/sandbox/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/stub/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/stub/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
data/webperimental/game.ruleset
; defending on a city tile, attacker`s firepower is doubled
; and defenders firepower is reduced to this value.
; If firepower is already lower than this, it won`t be affected.
low_firepower_pearl_harbour = 1
low_firepower_pearl_harbor = 1
; When the opponent has LowFirepower combat bonus against
; a unit, it`s firepower is reduced to this value.
data/webperimental/units.ruleset
; attacking a city
; defended by a city wall (or other city building defense)
; "BadCityDefender" = if attacked while in a city, firepower is set to 1
; and firepower of attacker is doubled (the Pearl Harbour
; and firepower of attacker is doubled (the Pearl Harbor
; rule)
; "BarbarianOnly" = only barbarians can build this unit
; "Shield2Gold" = Switch from shield upkeep to gold upkeep possible
server/ruleset/ruleload.c
if (ok) {
const char *tus_text;
int pharbor_default;
/* section: combat_rules */
/* Section: combat_rules */
game.info.tired_attack
= secfile_lookup_bool_default(file, RS_DEFAULT_TIRED_ATTACK,
"combat_rules.tired_attack");
......
game.info.low_firepower_badwallattacker
= secfile_lookup_int_default(file, 1,
"combat_rules.low_firepower_badwallattacker");
game.info.low_firepower_pearl_harbour
= secfile_lookup_int_default(file, 1,
"combat_rules.low_firepower_pearl_harbour");
if (compat->compat_mode && compat->version < RSFORMAT_3_3) {
pharbor_default
= secfile_lookup_int_default(file, 1,
"combat_rules.low_firepower_pearl_harbour");
} else {
pharbor_default = 1;
}
game.info.low_firepower_pearl_harbor
= secfile_lookup_int_default(file, pharbor_default,
"combat_rules.low_firepower_pearl_harbor");
game.info.low_firepower_combat_bonus
= secfile_lookup_int_default(file, 1,
"combat_rules.low_firepower_combat_bonus");
tools/ruleutil/comments.c
char *combat_rules_scaled_veterancy;
char *combat_rules_damage_reduces_bombard_rate;
char *combat_rules_low_fp_badwallattacker;
char *combat_rules_low_fp_pearl_harbour;
char *combat_rules_low_fp_pearl_harbor;
char *combat_rules_low_fp_combat_bonus;
char *combat_rules_low_fp_nonnat_bombard;
char *combat_rules_nuke_pop_loss;
......
"entrydoc.damage_reduces_bombard_rate");
comment_load(comments_storage.combat_rules_low_fp_badwallattacker, comment_file,
"entrydoc.low_firepower_badwallattacker");
comment_load(comments_storage.combat_rules_low_fp_pearl_harbour, comment_file,
"entrydoc.low_firepower_pearl_harbour");
comment_load(comments_storage.combat_rules_low_fp_pearl_harbor, comment_file,
"entrydoc.low_firepower_pearl_harbor");
comment_load(comments_storage.combat_rules_low_fp_combat_bonus, comment_file,
"entrydoc.low_firepower_combat_bonus");
comment_load(comments_storage.combat_rules_low_fp_nonnat_bombard, comment_file,
......
}
/**********************************************************************//**
Write combat_rules low_firepower_pearl_harbour settings header.
Write combat_rules low_firepower_pearl_harbor settings header.
**************************************************************************/
void comment_combat_rules_low_fp_pearl_harbour(struct section_file *sfile)
void comment_combat_rules_low_fp_pearl_harbor(struct section_file *sfile)
{
comment_entry_write(sfile,
comments_storage.combat_rules_low_fp_pearl_harbour,
comments_storage.combat_rules_low_fp_pearl_harbor,
"combat_rules");
}
tools/ruleutil/comments.h
void comment_combat_rules_scaled_veterancy(struct section_file *sfile);
void comment_combat_rules_damage_reduces_bombard_rate(struct section_file *sfile);
void comment_combat_rules_low_fp_badwallattacker(struct section_file *sfile);
void comment_combat_rules_low_fp_pearl_harbour(struct section_file *sfile);
void comment_combat_rules_low_fp_pearl_harbor(struct section_file *sfile);
void comment_combat_rules_low_fp_combat_bonus(struct section_file *sfile);
void comment_combat_rules_low_fp_nonnat_bombard(struct section_file *sfile);
void comment_combat_rules_nuke_pop_loss(struct section_file *sfile);
tools/ruleutil/rulesave.c
}
save_default_int(sfile, game.info.low_firepower_badwallattacker, 1,
"combat_rules.low_firepower_badwallattacker", nullptr);
if (game.info.low_firepower_pearl_harbour != 1) {
comment_combat_rules_low_fp_pearl_harbour(sfile);
if (game.info.low_firepower_pearl_harbor != 1) {
comment_combat_rules_low_fp_pearl_harbor(sfile);
}
save_default_int(sfile, game.info.low_firepower_pearl_harbour, 1,
"combat_rules.low_firepower_pearl_harbour", nullptr);
save_default_int(sfile, game.info.low_firepower_pearl_harbor, 1,
"combat_rules.low_firepower_pearl_harbor", nullptr);
if (game.info.low_firepower_combat_bonus != 1) {
comment_combat_rules_low_fp_combat_bonus(sfile);
}
    (1-1/1)