﻿# =============================================================================
# Grand Remembrance -- A Game of Thrones submod var hooks
# =============================================================================
# GENERATED by dev/scripts/gen_override_files.py (submod extensibility layer).
#
# Overrides the six EMPTY base hook effects defined in the base mod's generated
# common/scripted_effects/gr_chronicle_replay_effects.txt. CK3 resolves
# same-named scripted_effects by load order (last file wins); the zz_ filename
# prefix guarantees this file loads AFTER the base generated file, so these
# bodies replace the empty base stubs.
#
# Each hook enumerates this submod's 59 gr_agot_* vars and mirrors the base
# per-var pattern for the corresponding lifecycle step. See the override
# contract block in the base gr_chronicle_replay_effects.txt.
#
# Var set extracted mechanically: every gr_agot_* var set/changed in this mod's
# common/on_action/*.txt + events/gr_obituary_events.txt, UNION every one read
# in events/gr_obituary_replay_events.txt. No re-derivation by hand.
# =============================================================================

gr_submod_page_vars_effect = {
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_authoritative } } scope:chronicle_page = { set_variable = { name = gr_agot_authoritative value = scope:gr_page_source.var:gr_agot_authoritative } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_bank_defaulted } } scope:chronicle_page = { set_variable = { name = gr_agot_bank_defaulted value = scope:gr_page_source.var:gr_agot_bank_defaulted } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_bank_died_in_debt } } scope:chronicle_page = { set_variable = { name = gr_agot_bank_died_in_debt value = scope:gr_page_source.var:gr_agot_bank_died_in_debt } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_bank_founder } } scope:chronicle_page = { set_variable = { name = gr_agot_bank_founder value = scope:gr_page_source.var:gr_agot_bank_founder } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_bank_ib_shareholder } } scope:chronicle_page = { set_variable = { name = gr_agot_bank_ib_shareholder value = scope:gr_page_source.var:gr_agot_bank_ib_shareholder } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_broke_vows } } scope:chronicle_page = { set_variable = { name = gr_agot_broke_vows value = scope:gr_page_source.var:gr_agot_broke_vows } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_burned } } scope:chronicle_page = { set_variable = { name = gr_agot_burned value = scope:gr_page_source.var:gr_agot_burned } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_crippled } } scope:chronicle_page = { set_variable = { name = gr_agot_crippled value = scope:gr_page_source.var:gr_agot_crippled } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_deserter } } scope:chronicle_page = { set_variable = { name = gr_agot_deserter value = scope:gr_page_source.var:gr_agot_deserter } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_dragon_dreams } } scope:chronicle_page = { set_variable = { name = gr_agot_dragon_dreams value = scope:gr_page_source.var:gr_agot_dragon_dreams } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_dragonless } } scope:chronicle_page = { set_variable = { name = gr_agot_dragonless value = scope:gr_page_source.var:gr_agot_dragonless } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_dragonrider } } scope:chronicle_page = { set_variable = { name = gr_agot_dragonrider value = scope:gr_page_source.var:gr_agot_dragonrider } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_dragonslayer } } scope:chronicle_page = { set_variable = { name = gr_agot_dragonslayer value = scope:gr_page_source.var:gr_agot_dragonslayer } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_dragonwidowed } } scope:chronicle_page = { set_variable = { name = gr_agot_dragonwidowed value = scope:gr_page_source.var:gr_agot_dragonwidowed } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_faith } } scope:chronicle_page = { set_variable = { name = gr_agot_faith value = scope:gr_page_source.var:gr_agot_faith } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_fire_obsessed } } scope:chronicle_page = { set_variable = { name = gr_agot_fire_obsessed value = scope:gr_page_source.var:gr_agot_fire_obsessed } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_govt_new } } scope:chronicle_page = { set_variable = { name = gr_agot_govt_new value = scope:gr_page_source.var:gr_agot_govt_new } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_govt_old } } scope:chronicle_page = { set_variable = { name = gr_agot_govt_old value = scope:gr_page_source.var:gr_agot_govt_old } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_greensight } } scope:chronicle_page = { set_variable = { name = gr_agot_greensight value = scope:gr_page_source.var:gr_agot_greensight } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_greyscale } } scope:chronicle_page = { set_variable = { name = gr_agot_greyscale value = scope:gr_page_source.var:gr_agot_greyscale } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_half_blind } } scope:chronicle_page = { set_variable = { name = gr_agot_half_blind value = scope:gr_page_source.var:gr_agot_half_blind } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_heritage } } scope:chronicle_page = { set_variable = { name = gr_agot_heritage value = scope:gr_page_source.var:gr_agot_heritage } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_inquisitive } } scope:chronicle_page = { set_variable = { name = gr_agot_inquisitive value = scope:gr_page_source.var:gr_agot_inquisitive } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_iron_throne } } scope:chronicle_page = { set_variable = { name = gr_agot_iron_throne value = scope:gr_page_source.var:gr_agot_iron_throne } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_kingsguard } } scope:chronicle_page = { set_variable = { name = gr_agot_kingsguard value = scope:gr_page_source.var:gr_agot_kingsguard } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_kinslayer_accidental } } scope:chronicle_page = { set_variable = { name = gr_agot_kinslayer_accidental value = scope:gr_page_source.var:gr_agot_kinslayer_accidental } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_knight } } scope:chronicle_page = { set_variable = { name = gr_agot_knight value = scope:gr_page_source.var:gr_agot_knight } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_maester } } scope:chronicle_page = { set_variable = { name = gr_agot_maester value = scope:gr_page_source.var:gr_agot_maester } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_mute } } scope:chronicle_page = { set_variable = { name = gr_agot_mute value = scope:gr_page_source.var:gr_agot_mute } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_nightswatch } } scope:chronicle_page = { set_variable = { name = gr_agot_nightswatch value = scope:gr_page_source.var:gr_agot_nightswatch } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_nw_lifestyle } } scope:chronicle_page = { set_variable = { name = gr_agot_nw_lifestyle value = scope:gr_page_source.var:gr_agot_nw_lifestyle } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_one_handed } } scope:chronicle_page = { set_variable = { name = gr_agot_one_handed value = scope:gr_page_source.var:gr_agot_one_handed } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_paramour } } scope:chronicle_page = { set_variable = { name = gr_agot_paramour value = scope:gr_page_source.var:gr_agot_paramour } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_religious_role } } scope:chronicle_page = { set_variable = { name = gr_agot_religious_role value = scope:gr_page_source.var:gr_agot_religious_role } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_rude } } scope:chronicle_page = { set_variable = { name = gr_agot_rude value = scope:gr_page_source.var:gr_agot_rude } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_scurvy } } scope:chronicle_page = { set_variable = { name = gr_agot_scurvy value = scope:gr_page_source.var:gr_agot_scurvy } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_shivers } } scope:chronicle_page = { set_variable = { name = gr_agot_shivers value = scope:gr_page_source.var:gr_agot_shivers } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_spider } } scope:chronicle_page = { set_variable = { name = gr_agot_spider value = scope:gr_page_source.var:gr_agot_spider } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_squire } } scope:chronicle_page = { set_variable = { name = gr_agot_squire value = scope:gr_page_source.var:gr_agot_squire } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_stripped_knight } } scope:chronicle_page = { set_variable = { name = gr_agot_stripped_knight value = scope:gr_page_source.var:gr_agot_stripped_knight } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_sub_kingdom_count } } scope:chronicle_page = { set_variable = { name = gr_agot_sub_kingdom_count value = scope:gr_page_source.var:gr_agot_sub_kingdom_count } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_the_mark } } scope:chronicle_page = { set_variable = { name = gr_agot_the_mark value = scope:gr_page_source.var:gr_agot_the_mark } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_uncouth } } scope:chronicle_page = { set_variable = { name = gr_agot_uncouth value = scope:gr_page_source.var:gr_agot_uncouth } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_blackfyre } } scope:chronicle_page = { set_variable = { name = gr_agot_war_blackfyre value = scope:gr_page_source.var:gr_agot_war_blackfyre } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_daemon } } scope:chronicle_page = { set_variable = { name = gr_agot_war_daemon value = scope:gr_page_source.var:gr_agot_war_daemon } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_dragon } } scope:chronicle_page = { set_variable = { name = gr_agot_war_dragon value = scope:gr_page_source.var:gr_agot_war_dragon } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_dragon_tier } } scope:chronicle_page = { set_variable = { name = gr_agot_war_dragon_tier value = scope:gr_page_source.var:gr_agot_war_dragon_tier } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_duskendale } } scope:chronicle_page = { set_variable = { name = gr_agot_war_duskendale value = scope:gr_page_source.var:gr_agot_war_duskendale } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_eradicate } } scope:chronicle_page = { set_variable = { name = gr_agot_war_eradicate value = scope:gr_page_source.var:gr_agot_war_eradicate } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_faegon } } scope:chronicle_page = { set_variable = { name = gr_agot_war_faegon value = scope:gr_page_source.var:gr_agot_war_faegon } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_independence } } scope:chronicle_page = { set_variable = { name = gr_agot_war_independence value = scope:gr_page_source.var:gr_agot_war_independence } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_ninepenny } } scope:chronicle_page = { set_variable = { name = gr_agot_war_ninepenny value = scope:gr_page_source.var:gr_agot_war_ninepenny } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_pirate } } scope:chronicle_page = { set_variable = { name = gr_agot_war_pirate value = scope:gr_page_source.var:gr_agot_war_pirate } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_ranging } } scope:chronicle_page = { set_variable = { name = gr_agot_war_ranging value = scope:gr_page_source.var:gr_agot_war_ranging } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_rebellion } } scope:chronicle_page = { set_variable = { name = gr_agot_war_rebellion value = scope:gr_page_source.var:gr_agot_war_rebellion } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_reyne } } scope:chronicle_page = { set_variable = { name = gr_agot_war_reyne value = scope:gr_page_source.var:gr_agot_war_reyne } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_slavery } } scope:chronicle_page = { set_variable = { name = gr_agot_war_slavery value = scope:gr_page_source.var:gr_agot_war_slavery } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_succession } } scope:chronicle_page = { set_variable = { name = gr_agot_war_succession value = scope:gr_page_source.var:gr_agot_war_succession } } }
	if = { limit = { scope:gr_page_source = { has_variable = gr_agot_war_wall_reclaim } } scope:chronicle_page = { set_variable = { name = gr_agot_war_wall_reclaim value = scope:gr_page_source.var:gr_agot_war_wall_reclaim } } }
}


gr_submod_begin_session_vars_effect = {
	if = { limit = { has_variable = gr_agot_authoritative } set_variable = { name = gr_bak_gr_agot_authoritative value = var:gr_agot_authoritative } }
	if = { limit = { has_variable = gr_agot_bank_defaulted } set_variable = { name = gr_bak_gr_agot_bank_defaulted value = var:gr_agot_bank_defaulted } }
	if = { limit = { has_variable = gr_agot_bank_died_in_debt } set_variable = { name = gr_bak_gr_agot_bank_died_in_debt value = var:gr_agot_bank_died_in_debt } }
	if = { limit = { has_variable = gr_agot_bank_founder } set_variable = { name = gr_bak_gr_agot_bank_founder value = var:gr_agot_bank_founder } }
	if = { limit = { has_variable = gr_agot_bank_ib_shareholder } set_variable = { name = gr_bak_gr_agot_bank_ib_shareholder value = var:gr_agot_bank_ib_shareholder } }
	if = { limit = { has_variable = gr_agot_broke_vows } set_variable = { name = gr_bak_gr_agot_broke_vows value = var:gr_agot_broke_vows } }
	if = { limit = { has_variable = gr_agot_burned } set_variable = { name = gr_bak_gr_agot_burned value = var:gr_agot_burned } }
	if = { limit = { has_variable = gr_agot_crippled } set_variable = { name = gr_bak_gr_agot_crippled value = var:gr_agot_crippled } }
	if = { limit = { has_variable = gr_agot_deserter } set_variable = { name = gr_bak_gr_agot_deserter value = var:gr_agot_deserter } }
	if = { limit = { has_variable = gr_agot_dragon_dreams } set_variable = { name = gr_bak_gr_agot_dragon_dreams value = var:gr_agot_dragon_dreams } }
	if = { limit = { has_variable = gr_agot_dragonless } set_variable = { name = gr_bak_gr_agot_dragonless value = var:gr_agot_dragonless } }
	if = { limit = { has_variable = gr_agot_dragonrider } set_variable = { name = gr_bak_gr_agot_dragonrider value = var:gr_agot_dragonrider } }
	if = { limit = { has_variable = gr_agot_dragonslayer } set_variable = { name = gr_bak_gr_agot_dragonslayer value = var:gr_agot_dragonslayer } }
	if = { limit = { has_variable = gr_agot_dragonwidowed } set_variable = { name = gr_bak_gr_agot_dragonwidowed value = var:gr_agot_dragonwidowed } }
	if = { limit = { has_variable = gr_agot_faith } set_variable = { name = gr_bak_gr_agot_faith value = var:gr_agot_faith } }
	if = { limit = { has_variable = gr_agot_fire_obsessed } set_variable = { name = gr_bak_gr_agot_fire_obsessed value = var:gr_agot_fire_obsessed } }
	if = { limit = { has_variable = gr_agot_govt_new } set_variable = { name = gr_bak_gr_agot_govt_new value = var:gr_agot_govt_new } }
	if = { limit = { has_variable = gr_agot_govt_old } set_variable = { name = gr_bak_gr_agot_govt_old value = var:gr_agot_govt_old } }
	if = { limit = { has_variable = gr_agot_greensight } set_variable = { name = gr_bak_gr_agot_greensight value = var:gr_agot_greensight } }
	if = { limit = { has_variable = gr_agot_greyscale } set_variable = { name = gr_bak_gr_agot_greyscale value = var:gr_agot_greyscale } }
	if = { limit = { has_variable = gr_agot_half_blind } set_variable = { name = gr_bak_gr_agot_half_blind value = var:gr_agot_half_blind } }
	if = { limit = { has_variable = gr_agot_heritage } set_variable = { name = gr_bak_gr_agot_heritage value = var:gr_agot_heritage } }
	if = { limit = { has_variable = gr_agot_inquisitive } set_variable = { name = gr_bak_gr_agot_inquisitive value = var:gr_agot_inquisitive } }
	if = { limit = { has_variable = gr_agot_iron_throne } set_variable = { name = gr_bak_gr_agot_iron_throne value = var:gr_agot_iron_throne } }
	if = { limit = { has_variable = gr_agot_kingsguard } set_variable = { name = gr_bak_gr_agot_kingsguard value = var:gr_agot_kingsguard } }
	if = { limit = { has_variable = gr_agot_kinslayer_accidental } set_variable = { name = gr_bak_gr_agot_kinslayer_accidental value = var:gr_agot_kinslayer_accidental } }
	if = { limit = { has_variable = gr_agot_knight } set_variable = { name = gr_bak_gr_agot_knight value = var:gr_agot_knight } }
	if = { limit = { has_variable = gr_agot_maester } set_variable = { name = gr_bak_gr_agot_maester value = var:gr_agot_maester } }
	if = { limit = { has_variable = gr_agot_mute } set_variable = { name = gr_bak_gr_agot_mute value = var:gr_agot_mute } }
	if = { limit = { has_variable = gr_agot_nightswatch } set_variable = { name = gr_bak_gr_agot_nightswatch value = var:gr_agot_nightswatch } }
	if = { limit = { has_variable = gr_agot_nw_lifestyle } set_variable = { name = gr_bak_gr_agot_nw_lifestyle value = var:gr_agot_nw_lifestyle } }
	if = { limit = { has_variable = gr_agot_one_handed } set_variable = { name = gr_bak_gr_agot_one_handed value = var:gr_agot_one_handed } }
	if = { limit = { has_variable = gr_agot_paramour } set_variable = { name = gr_bak_gr_agot_paramour value = var:gr_agot_paramour } }
	if = { limit = { has_variable = gr_agot_religious_role } set_variable = { name = gr_bak_gr_agot_religious_role value = var:gr_agot_religious_role } }
	if = { limit = { has_variable = gr_agot_rude } set_variable = { name = gr_bak_gr_agot_rude value = var:gr_agot_rude } }
	if = { limit = { has_variable = gr_agot_scurvy } set_variable = { name = gr_bak_gr_agot_scurvy value = var:gr_agot_scurvy } }
	if = { limit = { has_variable = gr_agot_shivers } set_variable = { name = gr_bak_gr_agot_shivers value = var:gr_agot_shivers } }
	if = { limit = { has_variable = gr_agot_spider } set_variable = { name = gr_bak_gr_agot_spider value = var:gr_agot_spider } }
	if = { limit = { has_variable = gr_agot_squire } set_variable = { name = gr_bak_gr_agot_squire value = var:gr_agot_squire } }
	if = { limit = { has_variable = gr_agot_stripped_knight } set_variable = { name = gr_bak_gr_agot_stripped_knight value = var:gr_agot_stripped_knight } }
	if = { limit = { has_variable = gr_agot_sub_kingdom_count } set_variable = { name = gr_bak_gr_agot_sub_kingdom_count value = var:gr_agot_sub_kingdom_count } }
	if = { limit = { has_variable = gr_agot_the_mark } set_variable = { name = gr_bak_gr_agot_the_mark value = var:gr_agot_the_mark } }
	if = { limit = { has_variable = gr_agot_uncouth } set_variable = { name = gr_bak_gr_agot_uncouth value = var:gr_agot_uncouth } }
	if = { limit = { has_variable = gr_agot_war_blackfyre } set_variable = { name = gr_bak_gr_agot_war_blackfyre value = var:gr_agot_war_blackfyre } }
	if = { limit = { has_variable = gr_agot_war_daemon } set_variable = { name = gr_bak_gr_agot_war_daemon value = var:gr_agot_war_daemon } }
	if = { limit = { has_variable = gr_agot_war_dragon } set_variable = { name = gr_bak_gr_agot_war_dragon value = var:gr_agot_war_dragon } }
	if = { limit = { has_variable = gr_agot_war_dragon_tier } set_variable = { name = gr_bak_gr_agot_war_dragon_tier value = var:gr_agot_war_dragon_tier } }
	if = { limit = { has_variable = gr_agot_war_duskendale } set_variable = { name = gr_bak_gr_agot_war_duskendale value = var:gr_agot_war_duskendale } }
	if = { limit = { has_variable = gr_agot_war_eradicate } set_variable = { name = gr_bak_gr_agot_war_eradicate value = var:gr_agot_war_eradicate } }
	if = { limit = { has_variable = gr_agot_war_faegon } set_variable = { name = gr_bak_gr_agot_war_faegon value = var:gr_agot_war_faegon } }
	if = { limit = { has_variable = gr_agot_war_independence } set_variable = { name = gr_bak_gr_agot_war_independence value = var:gr_agot_war_independence } }
	if = { limit = { has_variable = gr_agot_war_ninepenny } set_variable = { name = gr_bak_gr_agot_war_ninepenny value = var:gr_agot_war_ninepenny } }
	if = { limit = { has_variable = gr_agot_war_pirate } set_variable = { name = gr_bak_gr_agot_war_pirate value = var:gr_agot_war_pirate } }
	if = { limit = { has_variable = gr_agot_war_ranging } set_variable = { name = gr_bak_gr_agot_war_ranging value = var:gr_agot_war_ranging } }
	if = { limit = { has_variable = gr_agot_war_rebellion } set_variable = { name = gr_bak_gr_agot_war_rebellion value = var:gr_agot_war_rebellion } }
	if = { limit = { has_variable = gr_agot_war_reyne } set_variable = { name = gr_bak_gr_agot_war_reyne value = var:gr_agot_war_reyne } }
	if = { limit = { has_variable = gr_agot_war_slavery } set_variable = { name = gr_bak_gr_agot_war_slavery value = var:gr_agot_war_slavery } }
	if = { limit = { has_variable = gr_agot_war_succession } set_variable = { name = gr_bak_gr_agot_war_succession value = var:gr_agot_war_succession } }
	if = { limit = { has_variable = gr_agot_war_wall_reclaim } set_variable = { name = gr_bak_gr_agot_war_wall_reclaim value = var:gr_agot_war_wall_reclaim } }
}


gr_submod_clear_vars_effect = {
	if = { limit = { has_variable = gr_agot_authoritative } remove_variable = gr_agot_authoritative }
	if = { limit = { has_variable = gr_agot_bank_defaulted } remove_variable = gr_agot_bank_defaulted }
	if = { limit = { has_variable = gr_agot_bank_died_in_debt } remove_variable = gr_agot_bank_died_in_debt }
	if = { limit = { has_variable = gr_agot_bank_founder } remove_variable = gr_agot_bank_founder }
	if = { limit = { has_variable = gr_agot_bank_ib_shareholder } remove_variable = gr_agot_bank_ib_shareholder }
	if = { limit = { has_variable = gr_agot_broke_vows } remove_variable = gr_agot_broke_vows }
	if = { limit = { has_variable = gr_agot_burned } remove_variable = gr_agot_burned }
	if = { limit = { has_variable = gr_agot_crippled } remove_variable = gr_agot_crippled }
	if = { limit = { has_variable = gr_agot_deserter } remove_variable = gr_agot_deserter }
	if = { limit = { has_variable = gr_agot_dragon_dreams } remove_variable = gr_agot_dragon_dreams }
	if = { limit = { has_variable = gr_agot_dragonless } remove_variable = gr_agot_dragonless }
	if = { limit = { has_variable = gr_agot_dragonrider } remove_variable = gr_agot_dragonrider }
	if = { limit = { has_variable = gr_agot_dragonslayer } remove_variable = gr_agot_dragonslayer }
	if = { limit = { has_variable = gr_agot_dragonwidowed } remove_variable = gr_agot_dragonwidowed }
	if = { limit = { has_variable = gr_agot_faith } remove_variable = gr_agot_faith }
	if = { limit = { has_variable = gr_agot_fire_obsessed } remove_variable = gr_agot_fire_obsessed }
	if = { limit = { has_variable = gr_agot_govt_new } remove_variable = gr_agot_govt_new }
	if = { limit = { has_variable = gr_agot_govt_old } remove_variable = gr_agot_govt_old }
	if = { limit = { has_variable = gr_agot_greensight } remove_variable = gr_agot_greensight }
	if = { limit = { has_variable = gr_agot_greyscale } remove_variable = gr_agot_greyscale }
	if = { limit = { has_variable = gr_agot_half_blind } remove_variable = gr_agot_half_blind }
	if = { limit = { has_variable = gr_agot_heritage } remove_variable = gr_agot_heritage }
	if = { limit = { has_variable = gr_agot_inquisitive } remove_variable = gr_agot_inquisitive }
	if = { limit = { has_variable = gr_agot_iron_throne } remove_variable = gr_agot_iron_throne }
	if = { limit = { has_variable = gr_agot_kingsguard } remove_variable = gr_agot_kingsguard }
	if = { limit = { has_variable = gr_agot_kinslayer_accidental } remove_variable = gr_agot_kinslayer_accidental }
	if = { limit = { has_variable = gr_agot_knight } remove_variable = gr_agot_knight }
	if = { limit = { has_variable = gr_agot_maester } remove_variable = gr_agot_maester }
	if = { limit = { has_variable = gr_agot_mute } remove_variable = gr_agot_mute }
	if = { limit = { has_variable = gr_agot_nightswatch } remove_variable = gr_agot_nightswatch }
	if = { limit = { has_variable = gr_agot_nw_lifestyle } remove_variable = gr_agot_nw_lifestyle }
	if = { limit = { has_variable = gr_agot_one_handed } remove_variable = gr_agot_one_handed }
	if = { limit = { has_variable = gr_agot_paramour } remove_variable = gr_agot_paramour }
	if = { limit = { has_variable = gr_agot_religious_role } remove_variable = gr_agot_religious_role }
	if = { limit = { has_variable = gr_agot_rude } remove_variable = gr_agot_rude }
	if = { limit = { has_variable = gr_agot_scurvy } remove_variable = gr_agot_scurvy }
	if = { limit = { has_variable = gr_agot_shivers } remove_variable = gr_agot_shivers }
	if = { limit = { has_variable = gr_agot_spider } remove_variable = gr_agot_spider }
	if = { limit = { has_variable = gr_agot_squire } remove_variable = gr_agot_squire }
	if = { limit = { has_variable = gr_agot_stripped_knight } remove_variable = gr_agot_stripped_knight }
	if = { limit = { has_variable = gr_agot_sub_kingdom_count } remove_variable = gr_agot_sub_kingdom_count }
	if = { limit = { has_variable = gr_agot_the_mark } remove_variable = gr_agot_the_mark }
	if = { limit = { has_variable = gr_agot_uncouth } remove_variable = gr_agot_uncouth }
	if = { limit = { has_variable = gr_agot_war_blackfyre } remove_variable = gr_agot_war_blackfyre }
	if = { limit = { has_variable = gr_agot_war_daemon } remove_variable = gr_agot_war_daemon }
	if = { limit = { has_variable = gr_agot_war_dragon } remove_variable = gr_agot_war_dragon }
	if = { limit = { has_variable = gr_agot_war_dragon_tier } remove_variable = gr_agot_war_dragon_tier }
	if = { limit = { has_variable = gr_agot_war_duskendale } remove_variable = gr_agot_war_duskendale }
	if = { limit = { has_variable = gr_agot_war_eradicate } remove_variable = gr_agot_war_eradicate }
	if = { limit = { has_variable = gr_agot_war_faegon } remove_variable = gr_agot_war_faegon }
	if = { limit = { has_variable = gr_agot_war_independence } remove_variable = gr_agot_war_independence }
	if = { limit = { has_variable = gr_agot_war_ninepenny } remove_variable = gr_agot_war_ninepenny }
	if = { limit = { has_variable = gr_agot_war_pirate } remove_variable = gr_agot_war_pirate }
	if = { limit = { has_variable = gr_agot_war_ranging } remove_variable = gr_agot_war_ranging }
	if = { limit = { has_variable = gr_agot_war_rebellion } remove_variable = gr_agot_war_rebellion }
	if = { limit = { has_variable = gr_agot_war_reyne } remove_variable = gr_agot_war_reyne }
	if = { limit = { has_variable = gr_agot_war_slavery } remove_variable = gr_agot_war_slavery }
	if = { limit = { has_variable = gr_agot_war_succession } remove_variable = gr_agot_war_succession }
	if = { limit = { has_variable = gr_agot_war_wall_reclaim } remove_variable = gr_agot_war_wall_reclaim }
}


gr_submod_end_session_vars_effect = {
	# Clear display vars first...
	if = { limit = { has_variable = gr_agot_authoritative } remove_variable = gr_agot_authoritative }
	if = { limit = { has_variable = gr_agot_bank_defaulted } remove_variable = gr_agot_bank_defaulted }
	if = { limit = { has_variable = gr_agot_bank_died_in_debt } remove_variable = gr_agot_bank_died_in_debt }
	if = { limit = { has_variable = gr_agot_bank_founder } remove_variable = gr_agot_bank_founder }
	if = { limit = { has_variable = gr_agot_bank_ib_shareholder } remove_variable = gr_agot_bank_ib_shareholder }
	if = { limit = { has_variable = gr_agot_broke_vows } remove_variable = gr_agot_broke_vows }
	if = { limit = { has_variable = gr_agot_burned } remove_variable = gr_agot_burned }
	if = { limit = { has_variable = gr_agot_crippled } remove_variable = gr_agot_crippled }
	if = { limit = { has_variable = gr_agot_deserter } remove_variable = gr_agot_deserter }
	if = { limit = { has_variable = gr_agot_dragon_dreams } remove_variable = gr_agot_dragon_dreams }
	if = { limit = { has_variable = gr_agot_dragonless } remove_variable = gr_agot_dragonless }
	if = { limit = { has_variable = gr_agot_dragonrider } remove_variable = gr_agot_dragonrider }
	if = { limit = { has_variable = gr_agot_dragonslayer } remove_variable = gr_agot_dragonslayer }
	if = { limit = { has_variable = gr_agot_dragonwidowed } remove_variable = gr_agot_dragonwidowed }
	if = { limit = { has_variable = gr_agot_faith } remove_variable = gr_agot_faith }
	if = { limit = { has_variable = gr_agot_fire_obsessed } remove_variable = gr_agot_fire_obsessed }
	if = { limit = { has_variable = gr_agot_govt_new } remove_variable = gr_agot_govt_new }
	if = { limit = { has_variable = gr_agot_govt_old } remove_variable = gr_agot_govt_old }
	if = { limit = { has_variable = gr_agot_greensight } remove_variable = gr_agot_greensight }
	if = { limit = { has_variable = gr_agot_greyscale } remove_variable = gr_agot_greyscale }
	if = { limit = { has_variable = gr_agot_half_blind } remove_variable = gr_agot_half_blind }
	if = { limit = { has_variable = gr_agot_heritage } remove_variable = gr_agot_heritage }
	if = { limit = { has_variable = gr_agot_inquisitive } remove_variable = gr_agot_inquisitive }
	if = { limit = { has_variable = gr_agot_iron_throne } remove_variable = gr_agot_iron_throne }
	if = { limit = { has_variable = gr_agot_kingsguard } remove_variable = gr_agot_kingsguard }
	if = { limit = { has_variable = gr_agot_kinslayer_accidental } remove_variable = gr_agot_kinslayer_accidental }
	if = { limit = { has_variable = gr_agot_knight } remove_variable = gr_agot_knight }
	if = { limit = { has_variable = gr_agot_maester } remove_variable = gr_agot_maester }
	if = { limit = { has_variable = gr_agot_mute } remove_variable = gr_agot_mute }
	if = { limit = { has_variable = gr_agot_nightswatch } remove_variable = gr_agot_nightswatch }
	if = { limit = { has_variable = gr_agot_nw_lifestyle } remove_variable = gr_agot_nw_lifestyle }
	if = { limit = { has_variable = gr_agot_one_handed } remove_variable = gr_agot_one_handed }
	if = { limit = { has_variable = gr_agot_paramour } remove_variable = gr_agot_paramour }
	if = { limit = { has_variable = gr_agot_religious_role } remove_variable = gr_agot_religious_role }
	if = { limit = { has_variable = gr_agot_rude } remove_variable = gr_agot_rude }
	if = { limit = { has_variable = gr_agot_scurvy } remove_variable = gr_agot_scurvy }
	if = { limit = { has_variable = gr_agot_shivers } remove_variable = gr_agot_shivers }
	if = { limit = { has_variable = gr_agot_spider } remove_variable = gr_agot_spider }
	if = { limit = { has_variable = gr_agot_squire } remove_variable = gr_agot_squire }
	if = { limit = { has_variable = gr_agot_stripped_knight } remove_variable = gr_agot_stripped_knight }
	if = { limit = { has_variable = gr_agot_sub_kingdom_count } remove_variable = gr_agot_sub_kingdom_count }
	if = { limit = { has_variable = gr_agot_the_mark } remove_variable = gr_agot_the_mark }
	if = { limit = { has_variable = gr_agot_uncouth } remove_variable = gr_agot_uncouth }
	if = { limit = { has_variable = gr_agot_war_blackfyre } remove_variable = gr_agot_war_blackfyre }
	if = { limit = { has_variable = gr_agot_war_daemon } remove_variable = gr_agot_war_daemon }
	if = { limit = { has_variable = gr_agot_war_dragon } remove_variable = gr_agot_war_dragon }
	if = { limit = { has_variable = gr_agot_war_dragon_tier } remove_variable = gr_agot_war_dragon_tier }
	if = { limit = { has_variable = gr_agot_war_duskendale } remove_variable = gr_agot_war_duskendale }
	if = { limit = { has_variable = gr_agot_war_eradicate } remove_variable = gr_agot_war_eradicate }
	if = { limit = { has_variable = gr_agot_war_faegon } remove_variable = gr_agot_war_faegon }
	if = { limit = { has_variable = gr_agot_war_independence } remove_variable = gr_agot_war_independence }
	if = { limit = { has_variable = gr_agot_war_ninepenny } remove_variable = gr_agot_war_ninepenny }
	if = { limit = { has_variable = gr_agot_war_pirate } remove_variable = gr_agot_war_pirate }
	if = { limit = { has_variable = gr_agot_war_ranging } remove_variable = gr_agot_war_ranging }
	if = { limit = { has_variable = gr_agot_war_rebellion } remove_variable = gr_agot_war_rebellion }
	if = { limit = { has_variable = gr_agot_war_reyne } remove_variable = gr_agot_war_reyne }
	if = { limit = { has_variable = gr_agot_war_slavery } remove_variable = gr_agot_war_slavery }
	if = { limit = { has_variable = gr_agot_war_succession } remove_variable = gr_agot_war_succession }
	if = { limit = { has_variable = gr_agot_war_wall_reclaim } remove_variable = gr_agot_war_wall_reclaim }
	# ...then restore the player's own pre-session values.
	if = { limit = { has_variable = gr_bak_gr_agot_authoritative } set_variable = { name = gr_agot_authoritative value = var:gr_bak_gr_agot_authoritative } remove_variable = gr_bak_gr_agot_authoritative }
	if = { limit = { has_variable = gr_bak_gr_agot_bank_defaulted } set_variable = { name = gr_agot_bank_defaulted value = var:gr_bak_gr_agot_bank_defaulted } remove_variable = gr_bak_gr_agot_bank_defaulted }
	if = { limit = { has_variable = gr_bak_gr_agot_bank_died_in_debt } set_variable = { name = gr_agot_bank_died_in_debt value = var:gr_bak_gr_agot_bank_died_in_debt } remove_variable = gr_bak_gr_agot_bank_died_in_debt }
	if = { limit = { has_variable = gr_bak_gr_agot_bank_founder } set_variable = { name = gr_agot_bank_founder value = var:gr_bak_gr_agot_bank_founder } remove_variable = gr_bak_gr_agot_bank_founder }
	if = { limit = { has_variable = gr_bak_gr_agot_bank_ib_shareholder } set_variable = { name = gr_agot_bank_ib_shareholder value = var:gr_bak_gr_agot_bank_ib_shareholder } remove_variable = gr_bak_gr_agot_bank_ib_shareholder }
	if = { limit = { has_variable = gr_bak_gr_agot_broke_vows } set_variable = { name = gr_agot_broke_vows value = var:gr_bak_gr_agot_broke_vows } remove_variable = gr_bak_gr_agot_broke_vows }
	if = { limit = { has_variable = gr_bak_gr_agot_burned } set_variable = { name = gr_agot_burned value = var:gr_bak_gr_agot_burned } remove_variable = gr_bak_gr_agot_burned }
	if = { limit = { has_variable = gr_bak_gr_agot_crippled } set_variable = { name = gr_agot_crippled value = var:gr_bak_gr_agot_crippled } remove_variable = gr_bak_gr_agot_crippled }
	if = { limit = { has_variable = gr_bak_gr_agot_deserter } set_variable = { name = gr_agot_deserter value = var:gr_bak_gr_agot_deserter } remove_variable = gr_bak_gr_agot_deserter }
	if = { limit = { has_variable = gr_bak_gr_agot_dragon_dreams } set_variable = { name = gr_agot_dragon_dreams value = var:gr_bak_gr_agot_dragon_dreams } remove_variable = gr_bak_gr_agot_dragon_dreams }
	if = { limit = { has_variable = gr_bak_gr_agot_dragonless } set_variable = { name = gr_agot_dragonless value = var:gr_bak_gr_agot_dragonless } remove_variable = gr_bak_gr_agot_dragonless }
	if = { limit = { has_variable = gr_bak_gr_agot_dragonrider } set_variable = { name = gr_agot_dragonrider value = var:gr_bak_gr_agot_dragonrider } remove_variable = gr_bak_gr_agot_dragonrider }
	if = { limit = { has_variable = gr_bak_gr_agot_dragonslayer } set_variable = { name = gr_agot_dragonslayer value = var:gr_bak_gr_agot_dragonslayer } remove_variable = gr_bak_gr_agot_dragonslayer }
	if = { limit = { has_variable = gr_bak_gr_agot_dragonwidowed } set_variable = { name = gr_agot_dragonwidowed value = var:gr_bak_gr_agot_dragonwidowed } remove_variable = gr_bak_gr_agot_dragonwidowed }
	if = { limit = { has_variable = gr_bak_gr_agot_faith } set_variable = { name = gr_agot_faith value = var:gr_bak_gr_agot_faith } remove_variable = gr_bak_gr_agot_faith }
	if = { limit = { has_variable = gr_bak_gr_agot_fire_obsessed } set_variable = { name = gr_agot_fire_obsessed value = var:gr_bak_gr_agot_fire_obsessed } remove_variable = gr_bak_gr_agot_fire_obsessed }
	if = { limit = { has_variable = gr_bak_gr_agot_govt_new } set_variable = { name = gr_agot_govt_new value = var:gr_bak_gr_agot_govt_new } remove_variable = gr_bak_gr_agot_govt_new }
	if = { limit = { has_variable = gr_bak_gr_agot_govt_old } set_variable = { name = gr_agot_govt_old value = var:gr_bak_gr_agot_govt_old } remove_variable = gr_bak_gr_agot_govt_old }
	if = { limit = { has_variable = gr_bak_gr_agot_greensight } set_variable = { name = gr_agot_greensight value = var:gr_bak_gr_agot_greensight } remove_variable = gr_bak_gr_agot_greensight }
	if = { limit = { has_variable = gr_bak_gr_agot_greyscale } set_variable = { name = gr_agot_greyscale value = var:gr_bak_gr_agot_greyscale } remove_variable = gr_bak_gr_agot_greyscale }
	if = { limit = { has_variable = gr_bak_gr_agot_half_blind } set_variable = { name = gr_agot_half_blind value = var:gr_bak_gr_agot_half_blind } remove_variable = gr_bak_gr_agot_half_blind }
	if = { limit = { has_variable = gr_bak_gr_agot_heritage } set_variable = { name = gr_agot_heritage value = var:gr_bak_gr_agot_heritage } remove_variable = gr_bak_gr_agot_heritage }
	if = { limit = { has_variable = gr_bak_gr_agot_inquisitive } set_variable = { name = gr_agot_inquisitive value = var:gr_bak_gr_agot_inquisitive } remove_variable = gr_bak_gr_agot_inquisitive }
	if = { limit = { has_variable = gr_bak_gr_agot_iron_throne } set_variable = { name = gr_agot_iron_throne value = var:gr_bak_gr_agot_iron_throne } remove_variable = gr_bak_gr_agot_iron_throne }
	if = { limit = { has_variable = gr_bak_gr_agot_kingsguard } set_variable = { name = gr_agot_kingsguard value = var:gr_bak_gr_agot_kingsguard } remove_variable = gr_bak_gr_agot_kingsguard }
	if = { limit = { has_variable = gr_bak_gr_agot_kinslayer_accidental } set_variable = { name = gr_agot_kinslayer_accidental value = var:gr_bak_gr_agot_kinslayer_accidental } remove_variable = gr_bak_gr_agot_kinslayer_accidental }
	if = { limit = { has_variable = gr_bak_gr_agot_knight } set_variable = { name = gr_agot_knight value = var:gr_bak_gr_agot_knight } remove_variable = gr_bak_gr_agot_knight }
	if = { limit = { has_variable = gr_bak_gr_agot_maester } set_variable = { name = gr_agot_maester value = var:gr_bak_gr_agot_maester } remove_variable = gr_bak_gr_agot_maester }
	if = { limit = { has_variable = gr_bak_gr_agot_mute } set_variable = { name = gr_agot_mute value = var:gr_bak_gr_agot_mute } remove_variable = gr_bak_gr_agot_mute }
	if = { limit = { has_variable = gr_bak_gr_agot_nightswatch } set_variable = { name = gr_agot_nightswatch value = var:gr_bak_gr_agot_nightswatch } remove_variable = gr_bak_gr_agot_nightswatch }
	if = { limit = { has_variable = gr_bak_gr_agot_nw_lifestyle } set_variable = { name = gr_agot_nw_lifestyle value = var:gr_bak_gr_agot_nw_lifestyle } remove_variable = gr_bak_gr_agot_nw_lifestyle }
	if = { limit = { has_variable = gr_bak_gr_agot_one_handed } set_variable = { name = gr_agot_one_handed value = var:gr_bak_gr_agot_one_handed } remove_variable = gr_bak_gr_agot_one_handed }
	if = { limit = { has_variable = gr_bak_gr_agot_paramour } set_variable = { name = gr_agot_paramour value = var:gr_bak_gr_agot_paramour } remove_variable = gr_bak_gr_agot_paramour }
	if = { limit = { has_variable = gr_bak_gr_agot_religious_role } set_variable = { name = gr_agot_religious_role value = var:gr_bak_gr_agot_religious_role } remove_variable = gr_bak_gr_agot_religious_role }
	if = { limit = { has_variable = gr_bak_gr_agot_rude } set_variable = { name = gr_agot_rude value = var:gr_bak_gr_agot_rude } remove_variable = gr_bak_gr_agot_rude }
	if = { limit = { has_variable = gr_bak_gr_agot_scurvy } set_variable = { name = gr_agot_scurvy value = var:gr_bak_gr_agot_scurvy } remove_variable = gr_bak_gr_agot_scurvy }
	if = { limit = { has_variable = gr_bak_gr_agot_shivers } set_variable = { name = gr_agot_shivers value = var:gr_bak_gr_agot_shivers } remove_variable = gr_bak_gr_agot_shivers }
	if = { limit = { has_variable = gr_bak_gr_agot_spider } set_variable = { name = gr_agot_spider value = var:gr_bak_gr_agot_spider } remove_variable = gr_bak_gr_agot_spider }
	if = { limit = { has_variable = gr_bak_gr_agot_squire } set_variable = { name = gr_agot_squire value = var:gr_bak_gr_agot_squire } remove_variable = gr_bak_gr_agot_squire }
	if = { limit = { has_variable = gr_bak_gr_agot_stripped_knight } set_variable = { name = gr_agot_stripped_knight value = var:gr_bak_gr_agot_stripped_knight } remove_variable = gr_bak_gr_agot_stripped_knight }
	if = { limit = { has_variable = gr_bak_gr_agot_sub_kingdom_count } set_variable = { name = gr_agot_sub_kingdom_count value = var:gr_bak_gr_agot_sub_kingdom_count } remove_variable = gr_bak_gr_agot_sub_kingdom_count }
	if = { limit = { has_variable = gr_bak_gr_agot_the_mark } set_variable = { name = gr_agot_the_mark value = var:gr_bak_gr_agot_the_mark } remove_variable = gr_bak_gr_agot_the_mark }
	if = { limit = { has_variable = gr_bak_gr_agot_uncouth } set_variable = { name = gr_agot_uncouth value = var:gr_bak_gr_agot_uncouth } remove_variable = gr_bak_gr_agot_uncouth }
	if = { limit = { has_variable = gr_bak_gr_agot_war_blackfyre } set_variable = { name = gr_agot_war_blackfyre value = var:gr_bak_gr_agot_war_blackfyre } remove_variable = gr_bak_gr_agot_war_blackfyre }
	if = { limit = { has_variable = gr_bak_gr_agot_war_daemon } set_variable = { name = gr_agot_war_daemon value = var:gr_bak_gr_agot_war_daemon } remove_variable = gr_bak_gr_agot_war_daemon }
	if = { limit = { has_variable = gr_bak_gr_agot_war_dragon } set_variable = { name = gr_agot_war_dragon value = var:gr_bak_gr_agot_war_dragon } remove_variable = gr_bak_gr_agot_war_dragon }
	if = { limit = { has_variable = gr_bak_gr_agot_war_dragon_tier } set_variable = { name = gr_agot_war_dragon_tier value = var:gr_bak_gr_agot_war_dragon_tier } remove_variable = gr_bak_gr_agot_war_dragon_tier }
	if = { limit = { has_variable = gr_bak_gr_agot_war_duskendale } set_variable = { name = gr_agot_war_duskendale value = var:gr_bak_gr_agot_war_duskendale } remove_variable = gr_bak_gr_agot_war_duskendale }
	if = { limit = { has_variable = gr_bak_gr_agot_war_eradicate } set_variable = { name = gr_agot_war_eradicate value = var:gr_bak_gr_agot_war_eradicate } remove_variable = gr_bak_gr_agot_war_eradicate }
	if = { limit = { has_variable = gr_bak_gr_agot_war_faegon } set_variable = { name = gr_agot_war_faegon value = var:gr_bak_gr_agot_war_faegon } remove_variable = gr_bak_gr_agot_war_faegon }
	if = { limit = { has_variable = gr_bak_gr_agot_war_independence } set_variable = { name = gr_agot_war_independence value = var:gr_bak_gr_agot_war_independence } remove_variable = gr_bak_gr_agot_war_independence }
	if = { limit = { has_variable = gr_bak_gr_agot_war_ninepenny } set_variable = { name = gr_agot_war_ninepenny value = var:gr_bak_gr_agot_war_ninepenny } remove_variable = gr_bak_gr_agot_war_ninepenny }
	if = { limit = { has_variable = gr_bak_gr_agot_war_pirate } set_variable = { name = gr_agot_war_pirate value = var:gr_bak_gr_agot_war_pirate } remove_variable = gr_bak_gr_agot_war_pirate }
	if = { limit = { has_variable = gr_bak_gr_agot_war_ranging } set_variable = { name = gr_agot_war_ranging value = var:gr_bak_gr_agot_war_ranging } remove_variable = gr_bak_gr_agot_war_ranging }
	if = { limit = { has_variable = gr_bak_gr_agot_war_rebellion } set_variable = { name = gr_agot_war_rebellion value = var:gr_bak_gr_agot_war_rebellion } remove_variable = gr_bak_gr_agot_war_rebellion }
	if = { limit = { has_variable = gr_bak_gr_agot_war_reyne } set_variable = { name = gr_agot_war_reyne value = var:gr_bak_gr_agot_war_reyne } remove_variable = gr_bak_gr_agot_war_reyne }
	if = { limit = { has_variable = gr_bak_gr_agot_war_slavery } set_variable = { name = gr_agot_war_slavery value = var:gr_bak_gr_agot_war_slavery } remove_variable = gr_bak_gr_agot_war_slavery }
	if = { limit = { has_variable = gr_bak_gr_agot_war_succession } set_variable = { name = gr_agot_war_succession value = var:gr_bak_gr_agot_war_succession } remove_variable = gr_bak_gr_agot_war_succession }
	if = { limit = { has_variable = gr_bak_gr_agot_war_wall_reclaim } set_variable = { name = gr_agot_war_wall_reclaim value = var:gr_bak_gr_agot_war_wall_reclaim } remove_variable = gr_bak_gr_agot_war_wall_reclaim }
}


gr_submod_restore_vars_effect = {
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_authoritative } } set_variable = { name = gr_agot_authoritative value = var:gr_replay_page.var:gr_agot_authoritative } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_bank_defaulted } } set_variable = { name = gr_agot_bank_defaulted value = var:gr_replay_page.var:gr_agot_bank_defaulted } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_bank_died_in_debt } } set_variable = { name = gr_agot_bank_died_in_debt value = var:gr_replay_page.var:gr_agot_bank_died_in_debt } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_bank_founder } } set_variable = { name = gr_agot_bank_founder value = var:gr_replay_page.var:gr_agot_bank_founder } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_bank_ib_shareholder } } set_variable = { name = gr_agot_bank_ib_shareholder value = var:gr_replay_page.var:gr_agot_bank_ib_shareholder } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_broke_vows } } set_variable = { name = gr_agot_broke_vows value = var:gr_replay_page.var:gr_agot_broke_vows } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_burned } } set_variable = { name = gr_agot_burned value = var:gr_replay_page.var:gr_agot_burned } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_crippled } } set_variable = { name = gr_agot_crippled value = var:gr_replay_page.var:gr_agot_crippled } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_deserter } } set_variable = { name = gr_agot_deserter value = var:gr_replay_page.var:gr_agot_deserter } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_dragon_dreams } } set_variable = { name = gr_agot_dragon_dreams value = var:gr_replay_page.var:gr_agot_dragon_dreams } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_dragonless } } set_variable = { name = gr_agot_dragonless value = var:gr_replay_page.var:gr_agot_dragonless } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_dragonrider } } set_variable = { name = gr_agot_dragonrider value = var:gr_replay_page.var:gr_agot_dragonrider } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_dragonslayer } } set_variable = { name = gr_agot_dragonslayer value = var:gr_replay_page.var:gr_agot_dragonslayer } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_dragonwidowed } } set_variable = { name = gr_agot_dragonwidowed value = var:gr_replay_page.var:gr_agot_dragonwidowed } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_faith } } set_variable = { name = gr_agot_faith value = var:gr_replay_page.var:gr_agot_faith } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_fire_obsessed } } set_variable = { name = gr_agot_fire_obsessed value = var:gr_replay_page.var:gr_agot_fire_obsessed } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_govt_new } } set_variable = { name = gr_agot_govt_new value = var:gr_replay_page.var:gr_agot_govt_new } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_govt_old } } set_variable = { name = gr_agot_govt_old value = var:gr_replay_page.var:gr_agot_govt_old } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_greensight } } set_variable = { name = gr_agot_greensight value = var:gr_replay_page.var:gr_agot_greensight } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_greyscale } } set_variable = { name = gr_agot_greyscale value = var:gr_replay_page.var:gr_agot_greyscale } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_half_blind } } set_variable = { name = gr_agot_half_blind value = var:gr_replay_page.var:gr_agot_half_blind } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_heritage } } set_variable = { name = gr_agot_heritage value = var:gr_replay_page.var:gr_agot_heritage } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_inquisitive } } set_variable = { name = gr_agot_inquisitive value = var:gr_replay_page.var:gr_agot_inquisitive } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_iron_throne } } set_variable = { name = gr_agot_iron_throne value = var:gr_replay_page.var:gr_agot_iron_throne } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_kingsguard } } set_variable = { name = gr_agot_kingsguard value = var:gr_replay_page.var:gr_agot_kingsguard } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_kinslayer_accidental } } set_variable = { name = gr_agot_kinslayer_accidental value = var:gr_replay_page.var:gr_agot_kinslayer_accidental } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_knight } } set_variable = { name = gr_agot_knight value = var:gr_replay_page.var:gr_agot_knight } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_maester } } set_variable = { name = gr_agot_maester value = var:gr_replay_page.var:gr_agot_maester } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_mute } } set_variable = { name = gr_agot_mute value = var:gr_replay_page.var:gr_agot_mute } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_nightswatch } } set_variable = { name = gr_agot_nightswatch value = var:gr_replay_page.var:gr_agot_nightswatch } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_nw_lifestyle } } set_variable = { name = gr_agot_nw_lifestyle value = var:gr_replay_page.var:gr_agot_nw_lifestyle } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_one_handed } } set_variable = { name = gr_agot_one_handed value = var:gr_replay_page.var:gr_agot_one_handed } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_paramour } } set_variable = { name = gr_agot_paramour value = var:gr_replay_page.var:gr_agot_paramour } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_religious_role } } set_variable = { name = gr_agot_religious_role value = var:gr_replay_page.var:gr_agot_religious_role } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_rude } } set_variable = { name = gr_agot_rude value = var:gr_replay_page.var:gr_agot_rude } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_scurvy } } set_variable = { name = gr_agot_scurvy value = var:gr_replay_page.var:gr_agot_scurvy } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_shivers } } set_variable = { name = gr_agot_shivers value = var:gr_replay_page.var:gr_agot_shivers } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_spider } } set_variable = { name = gr_agot_spider value = var:gr_replay_page.var:gr_agot_spider } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_squire } } set_variable = { name = gr_agot_squire value = var:gr_replay_page.var:gr_agot_squire } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_stripped_knight } } set_variable = { name = gr_agot_stripped_knight value = var:gr_replay_page.var:gr_agot_stripped_knight } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_sub_kingdom_count } } set_variable = { name = gr_agot_sub_kingdom_count value = var:gr_replay_page.var:gr_agot_sub_kingdom_count } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_the_mark } } set_variable = { name = gr_agot_the_mark value = var:gr_replay_page.var:gr_agot_the_mark } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_uncouth } } set_variable = { name = gr_agot_uncouth value = var:gr_replay_page.var:gr_agot_uncouth } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_blackfyre } } set_variable = { name = gr_agot_war_blackfyre value = var:gr_replay_page.var:gr_agot_war_blackfyre } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_daemon } } set_variable = { name = gr_agot_war_daemon value = var:gr_replay_page.var:gr_agot_war_daemon } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_dragon } } set_variable = { name = gr_agot_war_dragon value = var:gr_replay_page.var:gr_agot_war_dragon } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_dragon_tier } } set_variable = { name = gr_agot_war_dragon_tier value = var:gr_replay_page.var:gr_agot_war_dragon_tier } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_duskendale } } set_variable = { name = gr_agot_war_duskendale value = var:gr_replay_page.var:gr_agot_war_duskendale } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_eradicate } } set_variable = { name = gr_agot_war_eradicate value = var:gr_replay_page.var:gr_agot_war_eradicate } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_faegon } } set_variable = { name = gr_agot_war_faegon value = var:gr_replay_page.var:gr_agot_war_faegon } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_independence } } set_variable = { name = gr_agot_war_independence value = var:gr_replay_page.var:gr_agot_war_independence } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_ninepenny } } set_variable = { name = gr_agot_war_ninepenny value = var:gr_replay_page.var:gr_agot_war_ninepenny } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_pirate } } set_variable = { name = gr_agot_war_pirate value = var:gr_replay_page.var:gr_agot_war_pirate } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_ranging } } set_variable = { name = gr_agot_war_ranging value = var:gr_replay_page.var:gr_agot_war_ranging } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_rebellion } } set_variable = { name = gr_agot_war_rebellion value = var:gr_replay_page.var:gr_agot_war_rebellion } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_reyne } } set_variable = { name = gr_agot_war_reyne value = var:gr_replay_page.var:gr_agot_war_reyne } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_slavery } } set_variable = { name = gr_agot_war_slavery value = var:gr_replay_page.var:gr_agot_war_slavery } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_succession } } set_variable = { name = gr_agot_war_succession value = var:gr_replay_page.var:gr_agot_war_succession } }
	if = { limit = { var:gr_replay_page = { has_variable = gr_agot_war_wall_reclaim } } set_variable = { name = gr_agot_war_wall_reclaim value = var:gr_replay_page.var:gr_agot_war_wall_reclaim } }
}


gr_submod_prune_vars_effect = {
	if = { limit = { has_variable = gr_agot_authoritative } remove_variable = gr_agot_authoritative }
	if = { limit = { has_variable = gr_agot_bank_defaulted } remove_variable = gr_agot_bank_defaulted }
	if = { limit = { has_variable = gr_agot_bank_died_in_debt } remove_variable = gr_agot_bank_died_in_debt }
	if = { limit = { has_variable = gr_agot_bank_founder } remove_variable = gr_agot_bank_founder }
	if = { limit = { has_variable = gr_agot_bank_ib_shareholder } remove_variable = gr_agot_bank_ib_shareholder }
	if = { limit = { has_variable = gr_agot_broke_vows } remove_variable = gr_agot_broke_vows }
	if = { limit = { has_variable = gr_agot_burned } remove_variable = gr_agot_burned }
	if = { limit = { has_variable = gr_agot_crippled } remove_variable = gr_agot_crippled }
	if = { limit = { has_variable = gr_agot_deserter } remove_variable = gr_agot_deserter }
	if = { limit = { has_variable = gr_agot_dragon_dreams } remove_variable = gr_agot_dragon_dreams }
	if = { limit = { has_variable = gr_agot_dragonless } remove_variable = gr_agot_dragonless }
	if = { limit = { has_variable = gr_agot_dragonrider } remove_variable = gr_agot_dragonrider }
	if = { limit = { has_variable = gr_agot_dragonslayer } remove_variable = gr_agot_dragonslayer }
	if = { limit = { has_variable = gr_agot_dragonwidowed } remove_variable = gr_agot_dragonwidowed }
	if = { limit = { has_variable = gr_agot_faith } remove_variable = gr_agot_faith }
	if = { limit = { has_variable = gr_agot_fire_obsessed } remove_variable = gr_agot_fire_obsessed }
	if = { limit = { has_variable = gr_agot_govt_new } remove_variable = gr_agot_govt_new }
	if = { limit = { has_variable = gr_agot_govt_old } remove_variable = gr_agot_govt_old }
	if = { limit = { has_variable = gr_agot_greensight } remove_variable = gr_agot_greensight }
	if = { limit = { has_variable = gr_agot_greyscale } remove_variable = gr_agot_greyscale }
	if = { limit = { has_variable = gr_agot_half_blind } remove_variable = gr_agot_half_blind }
	if = { limit = { has_variable = gr_agot_heritage } remove_variable = gr_agot_heritage }
	if = { limit = { has_variable = gr_agot_inquisitive } remove_variable = gr_agot_inquisitive }
	if = { limit = { has_variable = gr_agot_iron_throne } remove_variable = gr_agot_iron_throne }
	if = { limit = { has_variable = gr_agot_kingsguard } remove_variable = gr_agot_kingsguard }
	if = { limit = { has_variable = gr_agot_kinslayer_accidental } remove_variable = gr_agot_kinslayer_accidental }
	if = { limit = { has_variable = gr_agot_knight } remove_variable = gr_agot_knight }
	if = { limit = { has_variable = gr_agot_maester } remove_variable = gr_agot_maester }
	if = { limit = { has_variable = gr_agot_mute } remove_variable = gr_agot_mute }
	if = { limit = { has_variable = gr_agot_nightswatch } remove_variable = gr_agot_nightswatch }
	if = { limit = { has_variable = gr_agot_nw_lifestyle } remove_variable = gr_agot_nw_lifestyle }
	if = { limit = { has_variable = gr_agot_one_handed } remove_variable = gr_agot_one_handed }
	if = { limit = { has_variable = gr_agot_paramour } remove_variable = gr_agot_paramour }
	if = { limit = { has_variable = gr_agot_religious_role } remove_variable = gr_agot_religious_role }
	if = { limit = { has_variable = gr_agot_rude } remove_variable = gr_agot_rude }
	if = { limit = { has_variable = gr_agot_scurvy } remove_variable = gr_agot_scurvy }
	if = { limit = { has_variable = gr_agot_shivers } remove_variable = gr_agot_shivers }
	if = { limit = { has_variable = gr_agot_spider } remove_variable = gr_agot_spider }
	if = { limit = { has_variable = gr_agot_squire } remove_variable = gr_agot_squire }
	if = { limit = { has_variable = gr_agot_stripped_knight } remove_variable = gr_agot_stripped_knight }
	if = { limit = { has_variable = gr_agot_sub_kingdom_count } remove_variable = gr_agot_sub_kingdom_count }
	if = { limit = { has_variable = gr_agot_the_mark } remove_variable = gr_agot_the_mark }
	if = { limit = { has_variable = gr_agot_uncouth } remove_variable = gr_agot_uncouth }
	if = { limit = { has_variable = gr_agot_war_blackfyre } remove_variable = gr_agot_war_blackfyre }
	if = { limit = { has_variable = gr_agot_war_daemon } remove_variable = gr_agot_war_daemon }
	if = { limit = { has_variable = gr_agot_war_dragon } remove_variable = gr_agot_war_dragon }
	if = { limit = { has_variable = gr_agot_war_dragon_tier } remove_variable = gr_agot_war_dragon_tier }
	if = { limit = { has_variable = gr_agot_war_duskendale } remove_variable = gr_agot_war_duskendale }
	if = { limit = { has_variable = gr_agot_war_eradicate } remove_variable = gr_agot_war_eradicate }
	if = { limit = { has_variable = gr_agot_war_faegon } remove_variable = gr_agot_war_faegon }
	if = { limit = { has_variable = gr_agot_war_independence } remove_variable = gr_agot_war_independence }
	if = { limit = { has_variable = gr_agot_war_ninepenny } remove_variable = gr_agot_war_ninepenny }
	if = { limit = { has_variable = gr_agot_war_pirate } remove_variable = gr_agot_war_pirate }
	if = { limit = { has_variable = gr_agot_war_ranging } remove_variable = gr_agot_war_ranging }
	if = { limit = { has_variable = gr_agot_war_rebellion } remove_variable = gr_agot_war_rebellion }
	if = { limit = { has_variable = gr_agot_war_reyne } remove_variable = gr_agot_war_reyne }
	if = { limit = { has_variable = gr_agot_war_slavery } remove_variable = gr_agot_war_slavery }
	if = { limit = { has_variable = gr_agot_war_succession } remove_variable = gr_agot_war_succession }
	if = { limit = { has_variable = gr_agot_war_wall_reclaim } remove_variable = gr_agot_war_wall_reclaim }
}

# ============================================================================
# BOOK WATERMARK ROTATION (AGOT)
# Overrides base's empty gr_submod_watermark_effect (filename sort: this file
# is zz_*, base's is gr_*, so this definition wins -- gotcha #18 rule).
# No heritage mapping here by design: the set rotates across all 20
# pieces, picked by (death year + text seed) modulo 20, so the choice
# is stable for a given page across opens, and successive rulers vary.
# gr_wm_seed is provided by the base selector, which calls this hook before
# cleaning up. Overwrites whatever base picked.
# ============================================================================
gr_submod_watermark_effect = {
	set_variable = { name = gr_wm_pick value = { value = var:gr_wm_seed modulo = 20 } }
	if = { limit = { var:gr_wm_pick = 0 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_01 } }
	else_if = { limit = { var:gr_wm_pick = 1 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_02 } }
	else_if = { limit = { var:gr_wm_pick = 2 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_03 } }
	else_if = { limit = { var:gr_wm_pick = 3 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_04 } }
	else_if = { limit = { var:gr_wm_pick = 4 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_05 } }
	else_if = { limit = { var:gr_wm_pick = 5 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_06 } }
	else_if = { limit = { var:gr_wm_pick = 6 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_07 } }
	else_if = { limit = { var:gr_wm_pick = 7 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_08 } }
	else_if = { limit = { var:gr_wm_pick = 8 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_09 } }
	else_if = { limit = { var:gr_wm_pick = 9 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_10 } }
	else_if = { limit = { var:gr_wm_pick = 10 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_11 } }
	else_if = { limit = { var:gr_wm_pick = 11 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_12 } }
	else_if = { limit = { var:gr_wm_pick = 12 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_13 } }
	else_if = { limit = { var:gr_wm_pick = 13 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_14 } }
	else_if = { limit = { var:gr_wm_pick = 14 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_15 } }
	else_if = { limit = { var:gr_wm_pick = 15 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_16 } }
	else_if = { limit = { var:gr_wm_pick = 16 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_17 } }
	else_if = { limit = { var:gr_wm_pick = 17 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_18 } }
	else_if = { limit = { var:gr_wm_pick = 18 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_19 } }
	else_if = { limit = { var:gr_wm_pick = 19 } set_variable = { name = gr_wm value = flag:gr_agot_watermark_20 } }
}

# ============================================================================
# BOOK YEAR CONVERSION (AGOT)
# Overrides base's empty gr_submod_book_years_effect. Westeros counts years
# from Aegon's Conquest: internal year 8000 = 1 AC. Years at or above the
# pivot become "N A.C.", below it "N B.C.". Era flags are lowercase (ac/bc);
# the loc side picks display text via Select_CString, never the flag name.
#
# Converts THREE surfaces: the folio death year, the cover TOC spans, and the
# seven absolute-year variables the obituary PROSE prints (see
# regen_submod_year_loc.py for the matching loc half). gr_reign_years is a
# duration and is deliberately NOT here.
#
# Called from: cover (frontispiece effect), book folio (watermark effect),
# and AGOT's own gr_obituary.10 immediate -- the death popup renders the same
# replaced loc, so it must convert too.
# ============================================================================
gr_submod_book_years_effect = {
	if = {
		limit = { has_variable = gr_death_year }
		if = {
			limit = { var:gr_death_year >= 8000 }
			set_variable = { name = gr_death_year_disp value = { value = var:gr_death_year subtract = 8000 } }
			set_variable = { name = gr_death_year_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_death_year_disp value = { value = 8000 subtract = var:gr_death_year } }
			set_variable = { name = gr_death_year_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_duchy_year }
		if = {
			limit = { var:gr_duchy_year >= 8000 }
			set_variable = { name = gr_duchy_year_disp value = { value = var:gr_duchy_year subtract = 8000 } }
			set_variable = { name = gr_duchy_year_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_duchy_year_disp value = { value = 8000 subtract = var:gr_duchy_year } }
			set_variable = { name = gr_duchy_year_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_kingdom_year }
		if = {
			limit = { var:gr_kingdom_year >= 8000 }
			set_variable = { name = gr_kingdom_year_disp value = { value = var:gr_kingdom_year subtract = 8000 } }
			set_variable = { name = gr_kingdom_year_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_kingdom_year_disp value = { value = 8000 subtract = var:gr_kingdom_year } }
			set_variable = { name = gr_kingdom_year_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_kingdom_2_year }
		if = {
			limit = { var:gr_kingdom_2_year >= 8000 }
			set_variable = { name = gr_kingdom_2_year_disp value = { value = var:gr_kingdom_2_year subtract = 8000 } }
			set_variable = { name = gr_kingdom_2_year_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_kingdom_2_year_disp value = { value = 8000 subtract = var:gr_kingdom_2_year } }
			set_variable = { name = gr_kingdom_2_year_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_empire_year }
		if = {
			limit = { var:gr_empire_year >= 8000 }
			set_variable = { name = gr_empire_year_disp value = { value = var:gr_empire_year subtract = 8000 } }
			set_variable = { name = gr_empire_year_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_empire_year_disp value = { value = 8000 subtract = var:gr_empire_year } }
			set_variable = { name = gr_empire_year_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_empire_2_year }
		if = {
			limit = { var:gr_empire_2_year >= 8000 }
			set_variable = { name = gr_empire_2_year_disp value = { value = var:gr_empire_2_year subtract = 8000 } }
			set_variable = { name = gr_empire_2_year_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_empire_2_year_disp value = { value = 8000 subtract = var:gr_empire_2_year } }
			set_variable = { name = gr_empire_2_year_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_hegemony_year }
		if = {
			limit = { var:gr_hegemony_year >= 8000 }
			set_variable = { name = gr_hegemony_year_disp value = { value = var:gr_hegemony_year subtract = 8000 } }
			set_variable = { name = gr_hegemony_year_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_hegemony_year_disp value = { value = 8000 subtract = var:gr_hegemony_year } }
			set_variable = { name = gr_hegemony_year_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_1 }
		if = {
			limit = { var:gr_toc_from_1 >= 8000 }
			set_variable = { name = gr_toc_from_1_disp value = { value = var:gr_toc_from_1 subtract = 8000 } }
			set_variable = { name = gr_toc_from_1_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_1_disp value = { value = 8000 subtract = var:gr_toc_from_1 } }
			set_variable = { name = gr_toc_from_1_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_1 }
		if = {
			limit = { var:gr_toc_to_1 >= 8000 }
			set_variable = { name = gr_toc_to_1_disp value = { value = var:gr_toc_to_1 subtract = 8000 } }
			set_variable = { name = gr_toc_to_1_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_1_disp value = { value = 8000 subtract = var:gr_toc_to_1 } }
			set_variable = { name = gr_toc_to_1_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_2 }
		if = {
			limit = { var:gr_toc_from_2 >= 8000 }
			set_variable = { name = gr_toc_from_2_disp value = { value = var:gr_toc_from_2 subtract = 8000 } }
			set_variable = { name = gr_toc_from_2_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_2_disp value = { value = 8000 subtract = var:gr_toc_from_2 } }
			set_variable = { name = gr_toc_from_2_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_2 }
		if = {
			limit = { var:gr_toc_to_2 >= 8000 }
			set_variable = { name = gr_toc_to_2_disp value = { value = var:gr_toc_to_2 subtract = 8000 } }
			set_variable = { name = gr_toc_to_2_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_2_disp value = { value = 8000 subtract = var:gr_toc_to_2 } }
			set_variable = { name = gr_toc_to_2_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_3 }
		if = {
			limit = { var:gr_toc_from_3 >= 8000 }
			set_variable = { name = gr_toc_from_3_disp value = { value = var:gr_toc_from_3 subtract = 8000 } }
			set_variable = { name = gr_toc_from_3_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_3_disp value = { value = 8000 subtract = var:gr_toc_from_3 } }
			set_variable = { name = gr_toc_from_3_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_3 }
		if = {
			limit = { var:gr_toc_to_3 >= 8000 }
			set_variable = { name = gr_toc_to_3_disp value = { value = var:gr_toc_to_3 subtract = 8000 } }
			set_variable = { name = gr_toc_to_3_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_3_disp value = { value = 8000 subtract = var:gr_toc_to_3 } }
			set_variable = { name = gr_toc_to_3_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_4 }
		if = {
			limit = { var:gr_toc_from_4 >= 8000 }
			set_variable = { name = gr_toc_from_4_disp value = { value = var:gr_toc_from_4 subtract = 8000 } }
			set_variable = { name = gr_toc_from_4_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_4_disp value = { value = 8000 subtract = var:gr_toc_from_4 } }
			set_variable = { name = gr_toc_from_4_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_4 }
		if = {
			limit = { var:gr_toc_to_4 >= 8000 }
			set_variable = { name = gr_toc_to_4_disp value = { value = var:gr_toc_to_4 subtract = 8000 } }
			set_variable = { name = gr_toc_to_4_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_4_disp value = { value = 8000 subtract = var:gr_toc_to_4 } }
			set_variable = { name = gr_toc_to_4_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_5 }
		if = {
			limit = { var:gr_toc_from_5 >= 8000 }
			set_variable = { name = gr_toc_from_5_disp value = { value = var:gr_toc_from_5 subtract = 8000 } }
			set_variable = { name = gr_toc_from_5_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_5_disp value = { value = 8000 subtract = var:gr_toc_from_5 } }
			set_variable = { name = gr_toc_from_5_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_5 }
		if = {
			limit = { var:gr_toc_to_5 >= 8000 }
			set_variable = { name = gr_toc_to_5_disp value = { value = var:gr_toc_to_5 subtract = 8000 } }
			set_variable = { name = gr_toc_to_5_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_5_disp value = { value = 8000 subtract = var:gr_toc_to_5 } }
			set_variable = { name = gr_toc_to_5_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_6 }
		if = {
			limit = { var:gr_toc_from_6 >= 8000 }
			set_variable = { name = gr_toc_from_6_disp value = { value = var:gr_toc_from_6 subtract = 8000 } }
			set_variable = { name = gr_toc_from_6_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_6_disp value = { value = 8000 subtract = var:gr_toc_from_6 } }
			set_variable = { name = gr_toc_from_6_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_6 }
		if = {
			limit = { var:gr_toc_to_6 >= 8000 }
			set_variable = { name = gr_toc_to_6_disp value = { value = var:gr_toc_to_6 subtract = 8000 } }
			set_variable = { name = gr_toc_to_6_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_6_disp value = { value = 8000 subtract = var:gr_toc_to_6 } }
			set_variable = { name = gr_toc_to_6_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_7 }
		if = {
			limit = { var:gr_toc_from_7 >= 8000 }
			set_variable = { name = gr_toc_from_7_disp value = { value = var:gr_toc_from_7 subtract = 8000 } }
			set_variable = { name = gr_toc_from_7_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_7_disp value = { value = 8000 subtract = var:gr_toc_from_7 } }
			set_variable = { name = gr_toc_from_7_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_7 }
		if = {
			limit = { var:gr_toc_to_7 >= 8000 }
			set_variable = { name = gr_toc_to_7_disp value = { value = var:gr_toc_to_7 subtract = 8000 } }
			set_variable = { name = gr_toc_to_7_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_7_disp value = { value = 8000 subtract = var:gr_toc_to_7 } }
			set_variable = { name = gr_toc_to_7_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_8 }
		if = {
			limit = { var:gr_toc_from_8 >= 8000 }
			set_variable = { name = gr_toc_from_8_disp value = { value = var:gr_toc_from_8 subtract = 8000 } }
			set_variable = { name = gr_toc_from_8_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_8_disp value = { value = 8000 subtract = var:gr_toc_from_8 } }
			set_variable = { name = gr_toc_from_8_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_8 }
		if = {
			limit = { var:gr_toc_to_8 >= 8000 }
			set_variable = { name = gr_toc_to_8_disp value = { value = var:gr_toc_to_8 subtract = 8000 } }
			set_variable = { name = gr_toc_to_8_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_8_disp value = { value = 8000 subtract = var:gr_toc_to_8 } }
			set_variable = { name = gr_toc_to_8_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_9 }
		if = {
			limit = { var:gr_toc_from_9 >= 8000 }
			set_variable = { name = gr_toc_from_9_disp value = { value = var:gr_toc_from_9 subtract = 8000 } }
			set_variable = { name = gr_toc_from_9_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_9_disp value = { value = 8000 subtract = var:gr_toc_from_9 } }
			set_variable = { name = gr_toc_from_9_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_9 }
		if = {
			limit = { var:gr_toc_to_9 >= 8000 }
			set_variable = { name = gr_toc_to_9_disp value = { value = var:gr_toc_to_9 subtract = 8000 } }
			set_variable = { name = gr_toc_to_9_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_9_disp value = { value = 8000 subtract = var:gr_toc_to_9 } }
			set_variable = { name = gr_toc_to_9_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_10 }
		if = {
			limit = { var:gr_toc_from_10 >= 8000 }
			set_variable = { name = gr_toc_from_10_disp value = { value = var:gr_toc_from_10 subtract = 8000 } }
			set_variable = { name = gr_toc_from_10_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_10_disp value = { value = 8000 subtract = var:gr_toc_from_10 } }
			set_variable = { name = gr_toc_from_10_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_10 }
		if = {
			limit = { var:gr_toc_to_10 >= 8000 }
			set_variable = { name = gr_toc_to_10_disp value = { value = var:gr_toc_to_10 subtract = 8000 } }
			set_variable = { name = gr_toc_to_10_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_10_disp value = { value = 8000 subtract = var:gr_toc_to_10 } }
			set_variable = { name = gr_toc_to_10_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_11 }
		if = {
			limit = { var:gr_toc_from_11 >= 8000 }
			set_variable = { name = gr_toc_from_11_disp value = { value = var:gr_toc_from_11 subtract = 8000 } }
			set_variable = { name = gr_toc_from_11_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_11_disp value = { value = 8000 subtract = var:gr_toc_from_11 } }
			set_variable = { name = gr_toc_from_11_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_11 }
		if = {
			limit = { var:gr_toc_to_11 >= 8000 }
			set_variable = { name = gr_toc_to_11_disp value = { value = var:gr_toc_to_11 subtract = 8000 } }
			set_variable = { name = gr_toc_to_11_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_11_disp value = { value = 8000 subtract = var:gr_toc_to_11 } }
			set_variable = { name = gr_toc_to_11_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_12 }
		if = {
			limit = { var:gr_toc_from_12 >= 8000 }
			set_variable = { name = gr_toc_from_12_disp value = { value = var:gr_toc_from_12 subtract = 8000 } }
			set_variable = { name = gr_toc_from_12_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_12_disp value = { value = 8000 subtract = var:gr_toc_from_12 } }
			set_variable = { name = gr_toc_from_12_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_12 }
		if = {
			limit = { var:gr_toc_to_12 >= 8000 }
			set_variable = { name = gr_toc_to_12_disp value = { value = var:gr_toc_to_12 subtract = 8000 } }
			set_variable = { name = gr_toc_to_12_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_12_disp value = { value = 8000 subtract = var:gr_toc_to_12 } }
			set_variable = { name = gr_toc_to_12_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_13 }
		if = {
			limit = { var:gr_toc_from_13 >= 8000 }
			set_variable = { name = gr_toc_from_13_disp value = { value = var:gr_toc_from_13 subtract = 8000 } }
			set_variable = { name = gr_toc_from_13_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_13_disp value = { value = 8000 subtract = var:gr_toc_from_13 } }
			set_variable = { name = gr_toc_from_13_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_13 }
		if = {
			limit = { var:gr_toc_to_13 >= 8000 }
			set_variable = { name = gr_toc_to_13_disp value = { value = var:gr_toc_to_13 subtract = 8000 } }
			set_variable = { name = gr_toc_to_13_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_13_disp value = { value = 8000 subtract = var:gr_toc_to_13 } }
			set_variable = { name = gr_toc_to_13_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_14 }
		if = {
			limit = { var:gr_toc_from_14 >= 8000 }
			set_variable = { name = gr_toc_from_14_disp value = { value = var:gr_toc_from_14 subtract = 8000 } }
			set_variable = { name = gr_toc_from_14_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_14_disp value = { value = 8000 subtract = var:gr_toc_from_14 } }
			set_variable = { name = gr_toc_from_14_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_14 }
		if = {
			limit = { var:gr_toc_to_14 >= 8000 }
			set_variable = { name = gr_toc_to_14_disp value = { value = var:gr_toc_to_14 subtract = 8000 } }
			set_variable = { name = gr_toc_to_14_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_14_disp value = { value = 8000 subtract = var:gr_toc_to_14 } }
			set_variable = { name = gr_toc_to_14_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_15 }
		if = {
			limit = { var:gr_toc_from_15 >= 8000 }
			set_variable = { name = gr_toc_from_15_disp value = { value = var:gr_toc_from_15 subtract = 8000 } }
			set_variable = { name = gr_toc_from_15_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_15_disp value = { value = 8000 subtract = var:gr_toc_from_15 } }
			set_variable = { name = gr_toc_from_15_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_15 }
		if = {
			limit = { var:gr_toc_to_15 >= 8000 }
			set_variable = { name = gr_toc_to_15_disp value = { value = var:gr_toc_to_15 subtract = 8000 } }
			set_variable = { name = gr_toc_to_15_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_15_disp value = { value = 8000 subtract = var:gr_toc_to_15 } }
			set_variable = { name = gr_toc_to_15_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_16 }
		if = {
			limit = { var:gr_toc_from_16 >= 8000 }
			set_variable = { name = gr_toc_from_16_disp value = { value = var:gr_toc_from_16 subtract = 8000 } }
			set_variable = { name = gr_toc_from_16_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_16_disp value = { value = 8000 subtract = var:gr_toc_from_16 } }
			set_variable = { name = gr_toc_from_16_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_16 }
		if = {
			limit = { var:gr_toc_to_16 >= 8000 }
			set_variable = { name = gr_toc_to_16_disp value = { value = var:gr_toc_to_16 subtract = 8000 } }
			set_variable = { name = gr_toc_to_16_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_16_disp value = { value = 8000 subtract = var:gr_toc_to_16 } }
			set_variable = { name = gr_toc_to_16_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_17 }
		if = {
			limit = { var:gr_toc_from_17 >= 8000 }
			set_variable = { name = gr_toc_from_17_disp value = { value = var:gr_toc_from_17 subtract = 8000 } }
			set_variable = { name = gr_toc_from_17_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_17_disp value = { value = 8000 subtract = var:gr_toc_from_17 } }
			set_variable = { name = gr_toc_from_17_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_17 }
		if = {
			limit = { var:gr_toc_to_17 >= 8000 }
			set_variable = { name = gr_toc_to_17_disp value = { value = var:gr_toc_to_17 subtract = 8000 } }
			set_variable = { name = gr_toc_to_17_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_17_disp value = { value = 8000 subtract = var:gr_toc_to_17 } }
			set_variable = { name = gr_toc_to_17_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_18 }
		if = {
			limit = { var:gr_toc_from_18 >= 8000 }
			set_variable = { name = gr_toc_from_18_disp value = { value = var:gr_toc_from_18 subtract = 8000 } }
			set_variable = { name = gr_toc_from_18_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_18_disp value = { value = 8000 subtract = var:gr_toc_from_18 } }
			set_variable = { name = gr_toc_from_18_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_18 }
		if = {
			limit = { var:gr_toc_to_18 >= 8000 }
			set_variable = { name = gr_toc_to_18_disp value = { value = var:gr_toc_to_18 subtract = 8000 } }
			set_variable = { name = gr_toc_to_18_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_18_disp value = { value = 8000 subtract = var:gr_toc_to_18 } }
			set_variable = { name = gr_toc_to_18_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_19 }
		if = {
			limit = { var:gr_toc_from_19 >= 8000 }
			set_variable = { name = gr_toc_from_19_disp value = { value = var:gr_toc_from_19 subtract = 8000 } }
			set_variable = { name = gr_toc_from_19_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_19_disp value = { value = 8000 subtract = var:gr_toc_from_19 } }
			set_variable = { name = gr_toc_from_19_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_19 }
		if = {
			limit = { var:gr_toc_to_19 >= 8000 }
			set_variable = { name = gr_toc_to_19_disp value = { value = var:gr_toc_to_19 subtract = 8000 } }
			set_variable = { name = gr_toc_to_19_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_19_disp value = { value = 8000 subtract = var:gr_toc_to_19 } }
			set_variable = { name = gr_toc_to_19_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_20 }
		if = {
			limit = { var:gr_toc_from_20 >= 8000 }
			set_variable = { name = gr_toc_from_20_disp value = { value = var:gr_toc_from_20 subtract = 8000 } }
			set_variable = { name = gr_toc_from_20_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_20_disp value = { value = 8000 subtract = var:gr_toc_from_20 } }
			set_variable = { name = gr_toc_from_20_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_20 }
		if = {
			limit = { var:gr_toc_to_20 >= 8000 }
			set_variable = { name = gr_toc_to_20_disp value = { value = var:gr_toc_to_20 subtract = 8000 } }
			set_variable = { name = gr_toc_to_20_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_20_disp value = { value = 8000 subtract = var:gr_toc_to_20 } }
			set_variable = { name = gr_toc_to_20_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_21 }
		if = {
			limit = { var:gr_toc_from_21 >= 8000 }
			set_variable = { name = gr_toc_from_21_disp value = { value = var:gr_toc_from_21 subtract = 8000 } }
			set_variable = { name = gr_toc_from_21_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_21_disp value = { value = 8000 subtract = var:gr_toc_from_21 } }
			set_variable = { name = gr_toc_from_21_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_21 }
		if = {
			limit = { var:gr_toc_to_21 >= 8000 }
			set_variable = { name = gr_toc_to_21_disp value = { value = var:gr_toc_to_21 subtract = 8000 } }
			set_variable = { name = gr_toc_to_21_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_21_disp value = { value = 8000 subtract = var:gr_toc_to_21 } }
			set_variable = { name = gr_toc_to_21_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_22 }
		if = {
			limit = { var:gr_toc_from_22 >= 8000 }
			set_variable = { name = gr_toc_from_22_disp value = { value = var:gr_toc_from_22 subtract = 8000 } }
			set_variable = { name = gr_toc_from_22_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_22_disp value = { value = 8000 subtract = var:gr_toc_from_22 } }
			set_variable = { name = gr_toc_from_22_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_22 }
		if = {
			limit = { var:gr_toc_to_22 >= 8000 }
			set_variable = { name = gr_toc_to_22_disp value = { value = var:gr_toc_to_22 subtract = 8000 } }
			set_variable = { name = gr_toc_to_22_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_22_disp value = { value = 8000 subtract = var:gr_toc_to_22 } }
			set_variable = { name = gr_toc_to_22_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_23 }
		if = {
			limit = { var:gr_toc_from_23 >= 8000 }
			set_variable = { name = gr_toc_from_23_disp value = { value = var:gr_toc_from_23 subtract = 8000 } }
			set_variable = { name = gr_toc_from_23_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_23_disp value = { value = 8000 subtract = var:gr_toc_from_23 } }
			set_variable = { name = gr_toc_from_23_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_23 }
		if = {
			limit = { var:gr_toc_to_23 >= 8000 }
			set_variable = { name = gr_toc_to_23_disp value = { value = var:gr_toc_to_23 subtract = 8000 } }
			set_variable = { name = gr_toc_to_23_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_23_disp value = { value = 8000 subtract = var:gr_toc_to_23 } }
			set_variable = { name = gr_toc_to_23_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_from_24 }
		if = {
			limit = { var:gr_toc_from_24 >= 8000 }
			set_variable = { name = gr_toc_from_24_disp value = { value = var:gr_toc_from_24 subtract = 8000 } }
			set_variable = { name = gr_toc_from_24_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_from_24_disp value = { value = 8000 subtract = var:gr_toc_from_24 } }
			set_variable = { name = gr_toc_from_24_era value = flag:bc }
		}
	}
	if = {
		limit = { has_variable = gr_toc_to_24 }
		if = {
			limit = { var:gr_toc_to_24 >= 8000 }
			set_variable = { name = gr_toc_to_24_disp value = { value = var:gr_toc_to_24 subtract = 8000 } }
			set_variable = { name = gr_toc_to_24_era value = flag:ac }
		}
		else = {
			set_variable = { name = gr_toc_to_24_disp value = { value = 8000 subtract = var:gr_toc_to_24 } }
			set_variable = { name = gr_toc_to_24_era value = flag:bc }
		}
	}
}
