Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
6298b37
Unit Counter Commit
gxia0005-hue Apr 25, 2026
466a838
Implement use_civ4_style_best_defender
gxia0005-hue Apr 27, 2026
5301ed6
Merge origin/master into UnitCounters (sync fork)
gxia0005-hue Apr 27, 2026
5ab9a96
Refactor terrain handling in combat odds calculation to ensure accura…
gxia0005-hue Apr 27, 2026
909d962
Change line endings to CRLF
gxia0005-hue Apr 29, 2026
efc1ccd
Turn all files' line endings to LF
gxia0005-hue Apr 29, 2026
56f08f9
renormalize files
gxia0005-hue Apr 30, 2026
7a452b0
Revert "renormalize files"
gxia0005-hue Apr 30, 2026
697ba84
Merge remote-tracking branch 'origin/merge' into merge
gxia0005-hue Apr 30, 2026
1ef481c
remove redundant method
gxia0005-hue Apr 30, 2026
da876ef
Feat: Add combat_experience condition to counter_rule
gxia0005-hue May 2, 2026
ce2df2c
Feat: Fix combat animation
gxia0005-hue May 8, 2026
dd86ea1
Fix counter-aware defender selection and combat display sync
gxia0005-hue May 8, 2026
242f4ba
Add unit counter bombard modifiers and target display handling
gxia0005-hue May 11, 2026
ab1d52b
Merge branch 'master' of https://github.com/bingyu-893/C3XUnitCounters
gxia0005-hue May 11, 2026
8caf8cc
Fix line endings
maxpetul May 14, 2026
6197fca
Merge branch 'maxpetul:master' into master
bingyu-893 May 17, 2026
7b7cffa
Fix line endings and restore unrelated master changes in PR 31
gxia0005-hue May 17, 2026
750e47a
Implement display odds
gxia0005-hue May 18, 2026
1d2a727
feat:winrate hud always displayed
gxia0005-hue May 18, 2026
22e2119
feat: Update combat winrate background.
gxia0005-hue May 18, 2026
ee873e5
Adjust winrate background size and fix ignore_terrain
gxia0005-hue May 19, 2026
21740e7
Change ignore-terrain to ignore-defensive-bonuses
gxia0005-hue May 19, 2026
ce44d9f
Add AGENTS.md
gxia0005-hue May 19, 2026
401dd79
Feat: sync with master branch and display-odds
gxia0005-hue May 19, 2026
8798d9d
Merge branch 'master' into Fix-combat-animation
gxia0005-hue May 19, 2026
2d4f29a
remove AGENT.md
gxia0005-hue May 19, 2026
ed79901
feat: fix known issue with combat animation
gxia0005-hue May 25, 2026
28d9075
Align counter defender display with combat selection
gxia0005-hue May 31, 2026
b62bd52
-Use base defender selection for counter-adjusted strengths
gxia0005-hue May 31, 2026
1e9752d
Remove temporary unit counter defender debug code.
gxia0005-hue Jun 1, 2026
db61da2
Merge branch 'master' of https://github.com/bingyu-893/C3XUnitCounters
gxia0005-hue Jun 1, 2026
9e4c09f
Use fix_line_endings.py to fix line endings in injected_code.c
gxia0005-hue Jun 1, 2026
55afbcf
Fix line endings in TEST_INJECTED_CODE_COMPILE.bat andfix_line_ending…
gxia0005-hue Jun 1, 2026
9a5fee8
Fix line endings in default.c3x_config.ini (LF -> CRLF)
gxia0005-hue Jun 6, 2026
64a4181
Merge remote-tracking branch 'maxpetul/master' into merge-maxpetul-ma…
gxia0005-hue Jun 11, 2026
7af54d3
Remove the scan of requires escort units, as it doesn't affect defend…
gxia0005-hue Jun 12, 2026
2dce20c
Added prefer_less_expensive_defenders to default.c3x_config.ini
gxia0005-hue Jun 12, 2026
5391662
Merge branch 'Fix-combat-animation'
gxia0005-hue Jun 12, 2026
933f6d1
Fix army display issue
gxia0005-hue Jun 20, 2026
4798b07
Fix army combat display: wrong unit shown and missing HP bar
gxia0005-hue Jun 26, 2026
0e4f8d9
Merge branch 'master' of https://github.com/bingyu-893/C3XUnitCounters
gxia0005-hue Jun 28, 2026
75cab2d
Fix arrow attack freeze issue
gxia0005-hue Jul 5, 2026
80ed81e
Merge branch 'master' into Fix-combat-animation
gxia0005-hue Jul 5, 2026
15343b8
Clean up unit counter selection details
gxia0005-hue Jul 6, 2026
a903f79
Fix GOG and PCG addresses for Fighter_get_odds_for_bombardment; Fix o…
maxpetul Jul 9, 2026
fddeee7
Fix example counter_rules
gxia0005-hue Jul 11, 2026
a023c1e
Merge branch 'master' of https://github.com/bingyu-893/C3XUnitCounters
gxia0005-hue Jul 11, 2026
9c43c07
Merge branch 'master' of https://github.com/bingyu-893/C3XUnitCounters
gxia0005-hue Jul 14, 2026
92f586f
Merge remote-tracking branch 'origin/master' into display-odds
gxia0005-hue Jul 16, 2026
3b177cb
Add detailed combat win rate HUD and compact mode
gxia0005-hue Jul 17, 2026
fbcf9cc
Merge branch 'maxpetul:master' into master
bingyu-893 Jul 21, 2026
319fbfd
Merge branch 'maxpetul:master' into master
bingyu-893 Jul 23, 2026
352b95f
Merge remote-tracking branch 'origin/master' into display-odds
gxia0005-hue Jul 24, 2026
fa993d2
Merge branch 'maxpetul:master' into master
bingyu-893 Jul 24, 2026
8148e9e
Merge branch 'master' into display-odds
gxia0005-hue Jul 24, 2026
3bfc9ea
Fixed an issue where the win rate for the north direction was not dis…
gxia0005-hue Jul 31, 2026
b9f8ca6
Merge branch 'maxpetul:master' into master
bingyu-893 Aug 16, 2026
2ee8a83
Merge branch 'master' into display-odds
gxia0005-hue Aug 16, 2026
9247538
fix: use actual combat logic for win-rate HUD
gxia0005-hue Aug 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Art/WinrateBackground.pcx
Binary file not shown.
Binary file added Art/WinrateDetailedBackground.pcx
Binary file not shown.
47 changes: 46 additions & 1 deletion C3X.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ enum unit_cycle_search_criteria {
UCSC_SIMILAR_NEAR_DESTINATION
};

enum combat_odds_hud_mode {
COHM_NONE = 0,
COHM_ATTACK,
COHM_BOMBARD
};

enum combat_win_rate_display_mode {
CWRDM_OFF = 0,
CWRDM_COMPACT,
CWRDM_DETAILED
};

enum no_ai_patrol_override {
NAPO_ZERO = 0,
NAPO_ONE,
Expand Down Expand Up @@ -271,7 +283,7 @@ struct counter_rule {
char * district_name; // Resolved after district configs are loaded
unsigned int self_experience_mask; // 0 = no restriction
unsigned int enemy_experience_mask; // 0 = no restriction
bool ignore_defensive_bonuses; // true = defender receives no defensive bonuses
bool ignore_defensive_bonuses; // Forward match only: defender receives no defensive bonuses

// Effects (percent values, 100 = no change)
int self_atk_pct;
Expand All @@ -282,6 +294,13 @@ struct counter_rule {
int enemy_bombard_pct;
};

struct counter_effect_summary {
int attacker_atk_pct;
int defender_def_pct;
int bombard_pct;
bool ignore_defensive_bonuses;
};

struct c3x_config {
bool enable_stack_bombard;
bool enable_disorder_warning;
Expand Down Expand Up @@ -400,6 +419,7 @@ struct c3x_config {
bool remove_land_artillery_target_restrictions;
bool allow_bombard_of_other_improvs_on_occupied_airfield;
bool show_total_city_count;
enum combat_win_rate_display_mode combat_win_rate_display_mode;
bool strengthen_forbidden_palace_ocn_effect;
int extra_unit_maintenance_per_shields;
enum special_zone_of_control_rules special_zone_of_control_rules;
Expand Down Expand Up @@ -773,6 +793,16 @@ enum c3x_label {
CL_SCIENTIFIC,
CL_SEAFARING,

// Main-screen combat odds HUD
CL_COMBAT_WIN_CHANCE,
CL_BOMBARD_DAMAGE_CHANCE,
CL_COMBAT_VS,
CL_COUNTER_ATTACK,
CL_COUNTER_DEFENSE,
CL_COUNTER_BOMBARD,
CL_COUNTER_IGNORES_DEFENSIVE_BONUSES,
CL_COUNTER_NO_EFFECT,

COUNT_C3X_LABELS
};

Expand Down Expand Up @@ -2142,6 +2172,21 @@ struct injected_state {
Unit * defender;
} counter_army_attacker_selection_ctx;

struct combat_odds_hud_state {
bool active;
enum combat_odds_hud_mode mode;
int tile_x, tile_y;
int attacker_unit_id, target_unit_id;
int attacker_unit_type_id, target_unit_type_id;
int percent_basis_points;
struct counter_effect_summary counter_effects;
char text[64];
} combat_odds_hud;
PCX_Image combat_odds_hud_compact_backdrop;
enum init_state combat_odds_hud_compact_backdrop_state;
PCX_Image combat_odds_hud_detailed_backdrop;
enum init_state combat_odds_hud_detailed_backdrop_state;

// Used to extract which unit (if any) exerted zone of control from within Fighter::apply_zone_of_control.
Unit * zoc_interceptor;

Expand Down
10 changes: 10 additions & 0 deletions Text/c3x-labels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,13 @@ Militaristic
Religious
Scientific
Seafaring

; Main-screen combat odds HUD
Win rate:
Damage rate:
vs
Attack
Defense
Bombard
Ignores defensive bonuses
No counter effect
1 change: 1 addition & 0 deletions civ_prog_objects.csv
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define, 0x5601EF, 0x56C2E3, 0x56019F, "ADDR_SCIENCE_AGE_BUG_PATCH", "void *
define, 0x4CD0B1, 0x4D5151, 0x4CD171, "ADDR_PEDIA_TEXTURE_BUG_PATCH", "void *"
define, 0x5640AC, 0x570385, 0x56405C, "ADDR_AUTORAZE_BYPASS", "void *"
repl vptr, 0x66CB50, 0x689C3C, 0x66CB50, "Leader_impl_would_raze_city", "bool (__fastcall *) (Leader * this, int edx, City * city)"
repl vptr, 0x66B444, 0x688544, 0x66B444, "Main_Screen_Form_process_mouse_hover", "void (__fastcall *) (Main_Screen_Form * this, int edx, int local_x, int local_y)"
repl vptr, 0x66B44C, 0x68854C, 0x66B44C, "Main_Screen_Form_handle_left_click_on_map_1", "void (__fastcall *) (Main_Screen_Form * this, int edx, int param_1, int param_2)"
inlead, 0x4EA210, 0x4F3000, 0x4EA2D0, "Main_Screen_Form_handle_right_click_on_tile", "void (__fastcall *) (Main_Screen_Form * this, int edx, int tile_x, int tile_y, int mouse_x, int mouse_y)"
inlead, 0x4E8850, 0x4F14E0, 0x4E8910, "Main_Screen_Form_open_right_click_menu", "void (__fastcall *) (Main_Screen_Form * this, int edx, int tile_x, int tile_y, int mouse_x, int mouse_y)"
Expand Down
5 changes: 5 additions & 0 deletions default.c3x_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ expand_civilopedia_unit_stats = true
; This option also shows 'Moves' for immobile units such as aircraft, which the base game does not
expand_right_click_menu_unit_stats = true

; Shows combat win rate in a box above the minimap when a selected human unit hovers a visible enemy target. Possible values are "off", "compact",
; and "detailed". Compact shows only the win or damage rate. Detailed also shows the units and any counter-rule attack, defense, bombard, or defensive
; bonus effects. Normal attacks show full-combat win chance. Bombard actions show the chance to deal at least 1 HP damage.
combat_win_rate_display_mode = detailed

[====================]
[=== OPTIMIZATION ===]
[====================]
Expand Down
Loading