diff --git a/Assets/Python/AIWars.py b/Assets/Python/AIWars.py
index 7fe009e6b..426f77f53 100644
--- a/Assets/Python/AIWars.py
+++ b/Assets/Python/AIWars.py
@@ -3,11 +3,13 @@
from Core import (
civilization,
civilizations,
+ every,
get_data_from_upside_down_map,
get_scenario_start_turn,
is_independent_civ,
is_major_civ,
turn,
+ turns,
year,
plots,
)
@@ -44,7 +46,7 @@ def setup():
@handler("BeginGameTurn")
def checkTurn(iGameTurn):
- if iGameTurn > 20:
+ if iGameTurn > turns(20):
# Absinthe: automatically turn peace on between independent cities and all the major civs
turn_peace_human_mapper = {
Civ.INDEPENDENT: 9,
@@ -53,7 +55,7 @@ def checkTurn(iGameTurn):
Civ.INDEPENDENT_4: 19,
}
for civ, value in turn_peace_human_mapper.items():
- if iGameTurn % 20 == value:
+ if every(20, shift=value):
restorePeaceHuman(civ)
turn_peace_ai_mapper = {
@@ -63,7 +65,7 @@ def checkTurn(iGameTurn):
Civ.INDEPENDENT_4: 27,
}
for civ, value in turn_peace_ai_mapper.items():
- if iGameTurn % 36 == value:
+ if every(36, shift=value):
restorePeaceAI(civ, False)
# Absinthe: automatically turn war on between independent cities and some AI major civs
@@ -75,7 +77,7 @@ def checkTurn(iGameTurn):
Civ.INDEPENDENT_4: 29,
}
for civ, value in turn_minor_wars_mapper.items():
- if iGameTurn % 36 == value:
+ if every(36, shift=value):
minorWars(civ, iGameTurn)
# Absinthe: declare war sooner / more frequently if there is an Indy city inside the core area
@@ -87,11 +89,11 @@ def checkTurn(iGameTurn):
Civ.INDEPENDENT_4: 1,
}
for civ, value in turn_minor_core_wars_mapper.items():
- if iGameTurn % 12 == value:
+ if every(12, shift=value):
minorCoreWars(civ, iGameTurn)
# Absinthe: Venice always seeks war with an Independent Ragusa - should help AI Venice significantly
- if iGameTurn % 9 == 2:
+ if every(9):
pVenice = gc.getPlayer(Civ.VENECIA)
if pVenice.isAlive() and not pVenice.isHuman():
pRagusaPlot = gc.getMap().plot(64, 28)
@@ -104,7 +106,7 @@ def checkTurn(iGameTurn):
teamVenice.declareWar(iOwner, False, WarPlanTypes.WARPLAN_LIMITED)
# Absinthe: Kingdom of Hungary should try to dominate Sisak/Zagreb if it's independent
- if iGameTurn > year(1000) and iGameTurn % 7 == 3:
+ if iGameTurn > year(1000) and every(7):
pHungary = gc.getPlayer(Civ.HUNGARY)
if pHungary.isAlive() and not pHungary.isHuman():
pZagrebPlot = gc.getMap().plot(62, 34)
@@ -252,7 +254,7 @@ def checkGrid(iCiv):
if (
getPlagueCountdown(iLoopCiv) > 0
or getPlagueCountdown(iLoopCiv) < -10
- and not turn() <= civilization(iLoopCiv).date.birth + 20
+ and not turn() <= year(civilization(iLoopCiv).date.birth) + turns(20)
):
lTargetCivs[iLoopCiv] *= 3
lTargetCivs[iLoopCiv] /= 2
diff --git a/Assets/Python/Barbs.py b/Assets/Python/Barbs.py
index db63dc1cd..a9c10803a 100644
--- a/Assets/Python/Barbs.py
+++ b/Assets/Python/Barbs.py
@@ -12,6 +12,8 @@
make_units,
text,
turn,
+ turns,
+ year,
cities,
plots,
)
@@ -30,7 +32,6 @@
getTempFlippingCity,
setTempFlippingCity,
)
-from TimelineData import DateTurn
from StoredData import data
@@ -601,8 +602,8 @@
0,
)
-dIndependentCities = {
- DateTurn.i500AD: [
+independent_cities = {
+ 500: [
tTangier,
tBordeaux,
tAlger,
@@ -623,34 +624,34 @@
tSeville,
tPalermo,
],
- DateTurn.i504AD: [tNapoli],
- DateTurn.i552AD: [tInverness],
- DateTurn.i600AD: [tRhodes],
- DateTurn.i640AD: [tNorwich],
- DateTurn.i670AD: [tKairouan],
- DateTurn.i680AD: [tToledo, tLeicester],
- DateTurn.i700AD: [tValencia, tPamplona, tLubeck, tPorto, tDublin, tDownpatrick],
- DateTurn.i760AD: [tTonsberg],
- DateTurn.i768AD: [tRaska],
- DateTurn.i780AD: [tFez],
- DateTurn.i800AD: [tMilanR, tPrague, tKursk, tCalais, tNidaros, tUppsala, tBeloozero, tZagreb],
- DateTurn.i850AD: [tBrennabor],
- DateTurn.i880AD: [tApulum],
- DateTurn.i900AD: [tTvanksta, tKrakow, tRiga, tWales, tVisby],
- DateTurn.i911AD: [tCaenR],
- DateTurn.i960AD: [tMinsk, tSmolensk],
- DateTurn.i988AD: [tDublinR],
- DateTurn.i1010AD: [tYaroslavl],
- DateTurn.i1050AD: [tGroningen, tKalmar],
- DateTurn.i1110AD: [tGraz],
- DateTurn.i1124AD: [tHalych],
- DateTurn.i1200AD: [tRigaR],
- DateTurn.i1227AD: [tTripoliR],
- DateTurn.i1250AD: [tAbo, tPerekop],
- DateTurn.i1320AD: [tNizhnyNovgorod],
- DateTurn.i1393AD: [tTanais],
- DateTurn.i1410AD: [tReykjavik],
- DateTurn.i1530AD: [tValletta],
+ 504: [tNapoli],
+ 552: [tInverness],
+ 600: [tRhodes],
+ 640: [tNorwich],
+ 670: [tKairouan],
+ 680: [tToledo, tLeicester],
+ 700: [tValencia, tPamplona, tLubeck, tPorto, tDublin, tDownpatrick],
+ 760: [tTonsberg],
+ 768: [tRaska],
+ 780: [tFez],
+ 800: [tMilanR, tPrague, tKursk, tCalais, tNidaros, tUppsala, tBeloozero, tZagreb],
+ 850: [tBrennabor],
+ 880: [tApulum],
+ 900: [tTvanksta, tKrakow, tRiga, tWales, tVisby],
+ 911: [tCaenR],
+ 960: [tMinsk, tSmolensk],
+ 988: [tDublinR],
+ 1010: [tYaroslavl],
+ 1050: [tGroningen, tKalmar],
+ 1110: [tGraz],
+ 1124: [tHalych],
+ 1200: [tRigaR],
+ 1227: [tTripoliR],
+ 1250: [tAbo, tPerekop],
+ 1320: [tNizhnyNovgorod],
+ 1393: [tTanais],
+ 1410: [tReykjavik],
+ 1530: [tValletta],
}
@@ -664,119 +665,122 @@
# list text keys: text keys for "The Nation" and "Nation Adjective"
# Note: lists 3, 4, 5, 6 should have the same size
# Note: you should increase the size of 'lNextMinorRevolt' in StoredData to be at least the number of minor nations
-lMinorNations = [
- [
- Province.SERBIA,
- [],
- [],
- [DateTurn.i508AD, DateTurn.i852AD, DateTurn.i1346AD],
- [20, 20, 20],
- [Unit.AXEMAN, Unit.AXEMAN, Unit.LONG_SWORDSMAN],
- [2, 1, 2],
- ["TXT_KEY_THE_SERBS", "TXT_KEY_SERBIAN"],
- ],
- [
- Province.SCOTLAND,
- [Civ.SCOTLAND],
- [],
- [DateTurn.i1297AD, DateTurn.i1569AD, DateTurn.i1715AD],
- [20, 10, 20],
- [Unit.HIGHLANDER, Unit.MUSKETMAN, Unit.GRENADIER],
- [2, 2, 2],
- ["TXT_KEY_THE_SCOTS", "TXT_KEY_SCOTTISH"],
- ],
- [
- Province.CATALONIA,
- [Civ.ARAGON],
- [],
- [DateTurn.i1164AD + 10, DateTurn.i1640AD],
- [20, 10],
- [Unit.LONG_SWORDSMAN, Unit.MUSKETMAN],
- [2, 2],
- ["TXT_KEY_THE_CATALANS", "TXT_KEY_CATALAN"],
- ],
- [
- Province.JERUSALEM,
- [Civ.ARABIA, Civ.OTTOMAN, Civ.BYZANTIUM],
- [Religion.ISLAM],
+def get_minor_nations():
+ return [
[
- DateTurn.i1099AD + 8,
- DateTurn.i1099AD + 16,
- DateTurn.i1099AD + 25,
- DateTurn.i1099AD + 33,
- DateTurn.i1099AD + 40,
- DateTurn.i1099AD + 47,
- DateTurn.i1099AD + 55,
- DateTurn.i1099AD + 65,
+ Province.SERBIA,
+ [],
+ [],
+ [year(508), year(852), year(1346)],
+ [20, 20, 20],
+ [Unit.AXEMAN, Unit.AXEMAN, Unit.LONG_SWORDSMAN],
+ [2, 1, 2],
+ ["TXT_KEY_THE_SERBS", "TXT_KEY_SERBIAN"],
],
- [30, 30, 40, 40, 30, 30, 30, 30],
[
- Unit.MACEMAN,
- Unit.MACEMAN,
- Unit.MACEMAN,
- Unit.KNIGHT,
- Unit.KNIGHT,
- Unit.KNIGHT,
- Unit.KNIGHT,
- Unit.KNIGHT,
+ Province.SCOTLAND,
+ [Civ.SCOTLAND],
+ [],
+ [year(1297), year(1569), year(1715)],
+ [20, 10, 20],
+ [Unit.HIGHLANDER, Unit.MUSKETMAN, Unit.GRENADIER],
+ [2, 2, 2],
+ ["TXT_KEY_THE_SCOTS", "TXT_KEY_SCOTTISH"],
],
- [3, 3, 4, 3, 3, 3, 3, 3],
- ["TXT_KEY_THE_MUSLIMS", "TXT_KEY_MUSLIM"],
- ],
- [
- Province.SYRIA,
- [Civ.ARABIA, Civ.OTTOMAN, Civ.BYZANTIUM],
- [Religion.ISLAM],
[
- DateTurn.i1099AD + 8,
- DateTurn.i1099AD + 16,
- DateTurn.i1099AD + 25,
- DateTurn.i1099AD + 33,
- DateTurn.i1099AD + 40,
- DateTurn.i1099AD + 47,
- DateTurn.i1099AD + 55,
- DateTurn.i1099AD + 65,
+ Province.CATALONIA,
+ [Civ.ARAGON],
+ [],
+ [year(1164) + 10, year(1640)],
+ [20, 10],
+ [Unit.LONG_SWORDSMAN, Unit.MUSKETMAN],
+ [2, 2],
+ ["TXT_KEY_THE_CATALANS", "TXT_KEY_CATALAN"],
],
- [30, 30, 40, 40, 30, 30, 30, 30],
[
- Unit.MACEMAN,
- Unit.MACEMAN,
- Unit.MACEMAN,
- Unit.KNIGHT,
- Unit.KNIGHT,
- Unit.KNIGHT,
- Unit.KNIGHT,
- Unit.KNIGHT,
+ Province.JERUSALEM,
+ [Civ.ARABIA, Civ.OTTOMAN, Civ.BYZANTIUM],
+ [Religion.ISLAM],
+ [
+ year(1099) + turns(8),
+ year(1099) + turns(16),
+ year(1099) + turns(25),
+ year(1099) + turns(33),
+ year(1099) + turns(40),
+ year(1099) + turns(47),
+ year(1099) + turns(55),
+ year(1099) + turns(65),
+ ],
+ [30, 30, 40, 40, 30, 30, 30, 30],
+ [
+ Unit.MACEMAN,
+ Unit.MACEMAN,
+ Unit.MACEMAN,
+ Unit.KNIGHT,
+ Unit.KNIGHT,
+ Unit.KNIGHT,
+ Unit.KNIGHT,
+ Unit.KNIGHT,
+ ],
+ [3, 3, 4, 3, 3, 3, 3, 3],
+ ["TXT_KEY_THE_MUSLIMS", "TXT_KEY_MUSLIM"],
],
- [3, 3, 4, 3, 3, 3, 3, 3],
- ["TXT_KEY_THE_MUSLIMS", "TXT_KEY_MUSLIM"],
- ],
- [
- Province.ORAN,
- [],
- [],
- [DateTurn.i1236AD, DateTurn.i1346AD, DateTurn.i1359AD, DateTurn.i1542AD],
- [40, 10, 10, 20],
[
- Unit.KNIGHT,
- Unit.HEAVY_LANCER,
- Unit.HEAVY_LANCER,
- Unit.MUSKETMAN,
+ Province.SYRIA,
+ [Civ.ARABIA, Civ.OTTOMAN, Civ.BYZANTIUM],
+ [Religion.ISLAM],
+ [
+ year(1099) + turns(8),
+ year(1099) + turns(16),
+ year(1099) + turns(25),
+ year(1099) + turns(33),
+ year(1099) + turns(40),
+ year(1099) + turns(47),
+ year(1099) + turns(55),
+ year(1099) + turns(65),
+ ],
+ [30, 30, 40, 40, 30, 30, 30, 30],
+ [
+ Unit.MACEMAN,
+ Unit.MACEMAN,
+ Unit.MACEMAN,
+ Unit.KNIGHT,
+ Unit.KNIGHT,
+ Unit.KNIGHT,
+ Unit.KNIGHT,
+ Unit.KNIGHT,
+ ],
+ [3, 3, 4, 3, 3, 3, 3, 3],
+ ["TXT_KEY_THE_MUSLIMS", "TXT_KEY_MUSLIM"],
],
- [2, 2, 2, 2],
- ["TXT_KEY_THE_ZIYYANIDS", "TXT_KEY_ZIYYANID"],
- ],
- [
- Province.FEZ,
- [Civ.MOROCCO],
- [],
- [DateTurn.i1473AD],
- [30],
- [Unit.ARQUEBUSIER],
- [4],
- ["TXT_KEY_THE_WATTASIDS", "TXT_KEY_WATTASID"],
- ],
-]
+ [
+ Province.ORAN,
+ [],
+ [],
+ [year(1236), year(1346), year(1359), year(1542)],
+ [40, 10, 10, 20],
+ [
+ Unit.KNIGHT,
+ Unit.HEAVY_LANCER,
+ Unit.HEAVY_LANCER,
+ Unit.MUSKETMAN,
+ ],
+ [2, 2, 2, 2],
+ ["TXT_KEY_THE_ZIYYANIDS", "TXT_KEY_ZIYYANID"],
+ ],
+ [
+ Province.FEZ,
+ [Civ.MOROCCO],
+ [],
+ [year(1473)],
+ [30],
+ [Unit.ARQUEBUSIER],
+ [4],
+ ["TXT_KEY_THE_WATTASIDS", "TXT_KEY_WATTASID"],
+ ],
+ ]
+
+
# 3Miro: Jerusalem and Syria were added here, so the Crusaders will not be able to control it for too long
@@ -791,7 +795,7 @@ def checkTurn(iGameTurn):
iHuman = human()
# Mediterranean Pirates (Light before 1500, then heavy for rest of game)
- if DateTurn.i960AD <= iGameTurn < DateTurn.i1401AD:
+ if year(960) <= iGameTurn < year(1401):
spawnPirate(
Civ.BARBARIAN,
(9, 15),
@@ -805,7 +809,7 @@ def checkTurn(iGameTurn):
3,
outerSeaSpawn,
)
- elif iGameTurn >= DateTurn.i1401AD:
+ elif iGameTurn >= year(1401):
spawnPirate(
Civ.BARBARIAN,
(9, 15),
@@ -835,7 +839,7 @@ def checkTurn(iGameTurn):
outerSeaSpawn,
text("TXT_KEY_BARBARIAN_NAMES_BARBARY_PIRATES"),
)
- if DateTurn.i1200AD <= iGameTurn < DateTurn.i1500AD:
+ if year(1200) <= iGameTurn < year(1500):
spawnPirate(
Civ.BARBARIAN,
(9, 15),
@@ -849,7 +853,7 @@ def checkTurn(iGameTurn):
5,
outerSeaSpawn,
)
- elif iGameTurn >= DateTurn.i1500AD:
+ elif iGameTurn >= year(1500):
spawnPirate(
Civ.BARBARIAN,
(9, 15),
@@ -865,7 +869,7 @@ def checkTurn(iGameTurn):
)
# Germanic Barbarians throughout Western Europe (France, Germany)
- if iGameTurn < DateTurn.i600AD:
+ if iGameTurn < year(600):
spawnUnits(
Civ.BARBARIAN,
(43, 42),
@@ -906,7 +910,7 @@ def checkTurn(iGameTurn):
UnitAITypes.UNITAI_ATTACK,
text("TXT_KEY_BARBARIAN_NAMES_GERMANIC_TRIBES"),
)
- elif DateTurn.i600AD <= iGameTurn < DateTurn.i800AD:
+ elif year(600) <= iGameTurn < year(800):
spawnUnits(
Civ.BARBARIAN,
(43, 42),
@@ -975,7 +979,7 @@ def checkTurn(iGameTurn):
)
# Longobards in Italy
- if DateTurn.i632AD <= iGameTurn <= DateTurn.i800AD:
+ if year(632) <= iGameTurn <= year(800):
spawnUnits(
Civ.BARBARIAN,
(49, 33),
@@ -1004,7 +1008,7 @@ def checkTurn(iGameTurn):
)
# Visigoths in Iberia
- if DateTurn.i712AD <= iGameTurn <= DateTurn.i892AD:
+ if year(712) <= iGameTurn <= year(892):
spawnUnits(
Civ.BARBARIAN,
(22, 21),
@@ -1073,7 +1077,7 @@ def checkTurn(iGameTurn):
)
# Berbers in North Africa
- if DateTurn.i700AD <= iGameTurn < DateTurn.i1020AD:
+ if year(700) <= iGameTurn < year(1020):
# Tunesia
spawnUnits(
Civ.BARBARIAN,
@@ -1158,7 +1162,7 @@ def checkTurn(iGameTurn):
)
# Avars in the Carpathian Basin
- if DateTurn.i632AD <= iGameTurn < DateTurn.i800AD:
+ if year(632) <= iGameTurn < year(800):
spawnUnits(
Civ.BARBARIAN,
(60, 30),
@@ -1188,7 +1192,7 @@ def checkTurn(iGameTurn):
)
# Early barbs for Byzantium:
- if iGameTurn < DateTurn.i640AD:
+ if iGameTurn < year(640):
# Pre-Bulgarian Slavs in the Balkans
spawnUnits(
Civ.BARBARIAN,
@@ -1285,7 +1289,7 @@ def checkTurn(iGameTurn):
text("TXT_KEY_BARBARIAN_NAMES_SASSANIDS"),
)
# Barbs in NW Greece
- if iGameTurn < DateTurn.i720AD:
+ if iGameTurn < year(720):
spawnUnits(
Civ.BARBARIAN,
(66, 21),
@@ -1313,7 +1317,7 @@ def checkTurn(iGameTurn):
)
# Serbs in the Southern Balkans
- if DateTurn.i1025AD <= iGameTurn < DateTurn.i1282AD:
+ if year(1025) <= iGameTurn < year(1282):
if Civ.BYZANTIUM == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -1370,7 +1374,7 @@ def checkTurn(iGameTurn):
)
# Khazars
- if DateTurn.i660AD <= iGameTurn < DateTurn.i864AD:
+ if year(660) <= iGameTurn < year(864):
spawnUnits(
Civ.BARBARIAN,
(88, 31),
@@ -1384,7 +1388,7 @@ def checkTurn(iGameTurn):
UnitAITypes.UNITAI_ATTACK,
text("TXT_KEY_BARBARIAN_NAMES_KHAZARS"),
)
- elif DateTurn.i864AD <= iGameTurn < DateTurn.i920AD:
+ elif year(864) <= iGameTurn < year(920):
if Civ.KIEV == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -1428,7 +1432,7 @@ def checkTurn(iGameTurn):
)
# Pechenegs
- if DateTurn.i920AD <= iGameTurn < DateTurn.i1040AD:
+ if year(920) <= iGameTurn < year(1040):
# in the Rus
spawnUnits(
Civ.BARBARIAN,
@@ -1502,7 +1506,7 @@ def checkTurn(iGameTurn):
)
# Cumans and Kipchaks
- elif DateTurn.i1040AD <= iGameTurn < DateTurn.i1200AD:
+ elif year(1040) <= iGameTurn < year(1200):
# in the Rus
if Civ.KIEV == iHuman:
spawnUnits(
@@ -1631,7 +1635,7 @@ def checkTurn(iGameTurn):
# Vikings on ships
if Civ.NORWAY == iHuman: # Humans can properly go viking without help
pass
- elif DateTurn.i780AD <= iGameTurn < DateTurn.i1000AD:
+ elif year(780) <= iGameTurn < year(1000):
if Civ.FRANCE == iHuman:
spawnVikings(
Civ.BARBARIAN,
@@ -1660,7 +1664,7 @@ def checkTurn(iGameTurn):
)
# Swedish Crusades
- elif DateTurn.i1150AD <= iGameTurn < DateTurn.i1210AD:
+ elif year(1150) <= iGameTurn < year(1210):
spawnVikings(
Civ.BARBARIAN,
(71, 62),
@@ -1675,7 +1679,7 @@ def checkTurn(iGameTurn):
)
# Chudes in Finland and Estonia
- if DateTurn.i864AD <= iGameTurn < DateTurn.i1150AD:
+ if year(864) <= iGameTurn < year(1150):
spawnUnits(
Civ.BARBARIAN,
(72, 67),
@@ -1706,7 +1710,7 @@ def checkTurn(iGameTurn):
# Livonian Order as barbs in the area before the Prussian spawn, but only if Prussia is AI (no need for potentially gained extra units for the human player)
# Also pre-Lithanian barbs for human Prussia a couple turns before the Lithuanian spawn
if Civ.PRUSSIA == iHuman:
- if DateTurn.i1224AD <= iGameTurn < DateTurn.i1236AD:
+ if year(1224) <= iGameTurn < year(1236):
spawnUnits(
Civ.BARBARIAN,
(73, 56),
@@ -1746,7 +1750,7 @@ def checkTurn(iGameTurn):
UnitAITypes.UNITAI_ATTACK,
text("TXT_KEY_BARBARIAN_NAMES_BALTICS"),
)
- elif DateTurn.i1200AD <= iGameTurn < DateTurn.i1224AD:
+ elif year(1200) <= iGameTurn < year(1224):
spawnUnits(
Civ.BARBARIAN,
(73, 57),
@@ -1775,7 +1779,7 @@ def checkTurn(iGameTurn):
)
# Couple melee barb units in Ireland:
- if DateTurn.i800AD <= iGameTurn < DateTurn.i900AD:
+ if year(800) <= iGameTurn < year(900):
spawnUnits(
Civ.BARBARIAN,
(28, 56),
@@ -1791,7 +1795,7 @@ def checkTurn(iGameTurn):
)
# Anglo-Saxons before the Danish 1st UHV (Conquer England)
- elif DateTurn.i970AD <= iGameTurn < DateTurn.i1050AD:
+ elif year(970) <= iGameTurn < year(1050):
if Civ.DENMARK == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -1849,7 +1853,7 @@ def checkTurn(iGameTurn):
# Scots to keep England busy, but only if Scotland is dead
if not gc.getPlayer(Civ.SCOTLAND).isAlive():
- if DateTurn.i1060AD <= iGameTurn < DateTurn.i1320AD:
+ if year(1060) <= iGameTurn < year(1320):
if Civ.ENGLAND == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -1878,7 +1882,7 @@ def checkTurn(iGameTurn):
UnitAITypes.UNITAI_ATTACK,
text("TXT_KEY_BARBARIAN_NAMES_SCOTS"),
)
- elif DateTurn.i1320AD <= iGameTurn < DateTurn.i1500AD:
+ elif year(1320) <= iGameTurn < year(1500):
if Civ.ENGLAND == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -1922,7 +1926,7 @@ def checkTurn(iGameTurn):
)
# Welsh in Britain
- if DateTurn.i1060AD <= iGameTurn < DateTurn.i1160AD:
+ if year(1060) <= iGameTurn < year(1160):
if Civ.ENGLAND == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -1951,7 +1955,7 @@ def checkTurn(iGameTurn):
UnitAITypes.UNITAI_ATTACK,
text("TXT_KEY_BARBARIAN_NAMES_WELSH"),
)
- elif DateTurn.i1160AD <= iGameTurn < DateTurn.i1452AD:
+ elif year(1160) <= iGameTurn < year(1452):
if Civ.ENGLAND == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -1982,7 +1986,7 @@ def checkTurn(iGameTurn):
)
# Magyars (preceeding Hungary)
- if DateTurn.i840AD <= iGameTurn < DateTurn.i892AD:
+ if year(840) <= iGameTurn < year(892):
spawnUnits(
Civ.BARBARIAN,
(54, 38),
@@ -2039,7 +2043,7 @@ def checkTurn(iGameTurn):
)
# Wends in NE Germany
- if DateTurn.i860AD <= iGameTurn < DateTurn.i1053AD:
+ if year(860) <= iGameTurn < year(1053):
if Civ.GERMANY == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -2070,7 +2074,7 @@ def checkTurn(iGameTurn):
)
# Great Slav Rising in 983AD
- if (DateTurn.i983AD - 1) <= iGameTurn < (DateTurn.i983AD + 1):
+ if (year(983) - 1) <= iGameTurn < (year(983) + 1):
if Civ.GERMANY == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -2140,7 +2144,7 @@ def checkTurn(iGameTurn):
)
# Barbs in the middle east
- if DateTurn.i700AD <= iGameTurn <= DateTurn.i1300AD:
+ if year(700) <= iGameTurn <= year(1300):
if not gc.getTeam(gc.getPlayer(Civ.ARABIA).getTeam()).isHasTech(Technology.FARRIERS):
spawnUnits(
Civ.BARBARIAN,
@@ -2225,7 +2229,7 @@ def checkTurn(iGameTurn):
)
# Banu Hilal and Bani Hassan, in Morocco and Tunesia
- if DateTurn.i1040AD <= iGameTurn < DateTurn.i1229AD:
+ if year(1040) <= iGameTurn < year(1229):
if Civ.MOROCCO == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -2280,7 +2284,7 @@ def checkTurn(iGameTurn):
UnitAITypes.UNITAI_ATTACK,
text("TXT_KEY_BARBARIAN_NAMES_BANU_HILAL"),
)
- if DateTurn.i1640AD <= iGameTurn < DateTurn.i1680AD:
+ if year(1640) <= iGameTurn < year(1680):
spawnUnits(
Civ.BARBARIAN,
(18, 1),
@@ -2296,7 +2300,7 @@ def checkTurn(iGameTurn):
)
# Pre Mongols to keep Kiev busy
- if DateTurn.i900AD <= iGameTurn < DateTurn.i1020AD:
+ if year(900) <= iGameTurn < year(1020):
spawnUnits(
Civ.BARBARIAN,
(93, 35),
@@ -2309,7 +2313,7 @@ def checkTurn(iGameTurn):
outerInvasion,
UnitAITypes.UNITAI_ATTACK,
)
- elif DateTurn.i1020AD <= iGameTurn < DateTurn.i1236AD:
+ elif year(1020) <= iGameTurn < year(1236):
spawnUnits(
Civ.BARBARIAN,
(93, 35),
@@ -2337,7 +2341,7 @@ def checkTurn(iGameTurn):
)
# Barbs in Anatolia pre Seljuks (but after Sassanids)
- if DateTurn.i700AD <= iGameTurn < DateTurn.i1050AD:
+ if year(700) <= iGameTurn < year(1050):
spawnUnits(
Civ.BARBARIAN,
(97, 20),
@@ -2437,7 +2441,7 @@ def checkTurn(iGameTurn):
)
# Seljuks
- if DateTurn.i1064AD <= iGameTurn < DateTurn.i1094AD:
+ if year(1064) <= iGameTurn < year(1094):
spawnUnits(
Civ.BARBARIAN,
(90, 21),
@@ -2741,7 +2745,7 @@ def checkTurn(iGameTurn):
)
# Danishmends
- if DateTurn.i1077AD <= iGameTurn < DateTurn.i1147AD:
+ if year(1077) <= iGameTurn < year(1147):
if Civ.BYZANTIUM == iHuman:
spawnUnits(
Civ.BARBARIAN,
@@ -2772,7 +2776,7 @@ def checkTurn(iGameTurn):
)
# Mongols
- if DateTurn.i1236AD <= iGameTurn < DateTurn.i1288AD:
+ if year(1236) <= iGameTurn < year(1288):
# Kiev
if Civ.KIEV == iHuman:
spawnUnits(
@@ -2998,7 +3002,7 @@ def checkTurn(iGameTurn):
# Timurids, Tamerlane's conquests (aka Mongols, the return!)
if (
- DateTurn.i1380AD <= iGameTurn <= DateTurn.i1431AD
+ year(1380) <= iGameTurn <= year(1431)
): # Timur started his first western campaigns in 1380AD
# Eastern Europe
spawnUnits(
@@ -3113,7 +3117,7 @@ def checkTurn(iGameTurn):
)
# Nogais
- if DateTurn.i1500AD <= iGameTurn <= DateTurn.i1600AD:
+ if year(1500) <= iGameTurn <= year(1600):
spawnUnits(
Civ.BARBARIAN,
(93, 38),
@@ -3143,7 +3147,7 @@ def checkTurn(iGameTurn):
)
# Kalmyks
- elif DateTurn.i1600AD <= iGameTurn <= DateTurn.i1715AD:
+ elif year(1600) <= iGameTurn <= year(1715):
spawnUnits(
Civ.BARBARIAN,
(93, 38),
@@ -3181,8 +3185,10 @@ def checkTurn(iGameTurn):
def doIndependentCities(iGameTurn):
- if iGameTurn in dIndependentCities.keys():
- for tCity in dIndependentCities[iGameTurn]:
+ keys = [year(k) for k in independent_cities.keys()]
+ if iGameTurn in keys:
+ index = keys.index(iGameTurn)
+ for tCity in independent_cities[independent_cities.keys()[index]]:
lVariations, iCiv, iPop, iUnit, iNumUnits, iReligion, iWorkers = tCity
iChosenCity = -1
iRand = percentage()
@@ -3310,11 +3316,11 @@ def onImprovementDestroyed(iX, iY):
# getHandicapType: Viceroy=0, Monarch=1, Emperor=2)
iHandicap = gc.getGame().getHandicapType()
iTurn = turn()
- if iTurn > DateTurn.i1500AD:
+ if iTurn > year(1500):
iBarbUnit = Unit.MUSKETMAN
- elif iTurn > DateTurn.i1284AD:
+ elif iTurn > year(1284):
iBarbUnit = Unit.ARQUEBUSIER
- elif iTurn > DateTurn.i840AD:
+ elif iTurn > year(840):
iBarbUnit = Unit.HORSE_ARCHER
else:
iBarbUnit = Unit.SPEARMAN
@@ -3333,20 +3339,20 @@ def onImprovementDestroyed(iX, iY):
def setupMinorNation():
- for lNation in lMinorNations:
+ for lNation in get_minor_nations():
iNextRevolt = lNation[3][0]
while iNextRevolt in data.minor_revolt_dates:
- iNextRevolt = lNation[3][0] - 3 + rand(6)
- iNationIndex = lMinorNations.index(lNation)
+ iNextRevolt = lNation[3][0] - turns(3) + turns(rand(6))
+ iNationIndex = get_minor_nations().index(lNation)
data.minor_revolt_dates[iNationIndex] = iNextRevolt
def doMinorNations(iGameTurn):
if iGameTurn in data.minor_revolt_dates:
- lNation = lMinorNations[data.minor_revolt_dates.index(iGameTurn)]
+ lNation = get_minor_nations()[data.minor_revolt_dates.index(iGameTurn)]
lRevolts = lNation[3]
for iRevoltDate in lRevolts:
- if (iRevoltDate - 3 <= iGameTurn) and (iRevoltDate + 3 >= iGameTurn):
+ if (iRevoltDate - turns(3) <= iGameTurn) and (iRevoltDate + turns(3) >= iGameTurn):
iRevoltIndex = lRevolts.index(iRevoltDate)
break
# loop over all the province tiles to find the cities revolting
@@ -3373,9 +3379,9 @@ def doMinorNations(iGameTurn):
# setup next revolt
iRevoltIndex += 1
if iRevoltIndex < len(lNation[3]):
- iNextRevolt = lNation[3][iRevoltIndex] - 3 + rand(6)
+ iNextRevolt = lNation[3][iRevoltIndex] - turns(3) + turns(rand(6))
while iNextRevolt in data.minor_revolt_dates:
- iNextRevolt = lNation[3][iRevoltIndex] - 3 + rand(6)
+ iNextRevolt = lNation[3][iRevoltIndex] - turns(3) + turns(rand(6))
data.minor_revolt_dates[data.minor_revolt_dates.index(iGameTurn)] = iNextRevolt
@@ -3429,7 +3435,7 @@ def doRevoltAI(iPlayer, iGameTurn, lNation, iRevoltIndex):
def CounterReformationEvent(playerID, netUserData, popupReturn):
iDecision = popupReturn.getButtonClicked()
iNationIndex, iRevoltIndex = data.revolut_nation_index
- lNation = lMinorNations[iNationIndex]
+ lNation = get_minor_nations()[iNationIndex]
iPlayer = human()
cityList = cities.owner(iPlayer).province(lNation[0]).entities()
@@ -3520,7 +3526,7 @@ def CounterReformationEvent(playerID, netUserData, popupReturn):
# suppress with force: + base chance + military strength in the city. revolt +1 turn, unhappy +1 for 10 turns
# bribe the lords: + financial chance: costs 10 gold per population, suppression depends on the government Divine Monarchy (30%), Feudal or Limited (25%), Merchant (20%), Decentral (15%)
def doRevoltHuman(iPlayer, iGameTurn, lNation, iRevoltIndex):
- data.revolut_nation_index = [lMinorNations.index(lNation), iRevoltIndex]
+ data.revolut_nation_index = [get_minor_nations().index(lNation), iRevoltIndex]
cityList = cities.owner(iPlayer).province(lNation[0]).entities()
diff --git a/Assets/Python/Civilizations.py b/Assets/Python/Civilizations.py
index 8ece3f7f6..7e3fbaa1e 100644
--- a/Assets/Python/Civilizations.py
+++ b/Assets/Python/Civilizations.py
@@ -21,7 +21,7 @@
def set_starting_turns():
for civ in civilizations().drop(Civ.BARBARIAN):
- civ.player.setInitialBirthTurn(civ.date.birth)
+ civ.player.setInitialBirthTurn(year(civ.date.birth))
def set_starting_gold():
@@ -51,7 +51,7 @@ def create_starting_units_500AD():
make_units(Civ.FRANCE, Unit.CATHOLIC_MISSIONARY, CIV_CAPITAL_LOCATIONS[Civ.FRANCE], 2)
iHuman = human()
- if civilization(iHuman).date.birth > year(500):
+ if year(civilization(iHuman).date.birth) > year(500):
# so everyone apart from Byzantium and France
tStart = CIV_CAPITAL_LOCATIONS[iHuman]
@@ -75,7 +75,7 @@ def create_starting_units_500AD():
def create_starting_units_1200AD():
iHuman = human()
- if civilization(iHuman).date.birth > year(1200):
+ if year(civilization(iHuman).date.birth) > year(1200):
# so iSweden, iPrussia, iLithuania, iAustria, iTurkey, iMoscow, iDutch
tStart = civilization(iHuman).location.capital
diff --git a/Assets/Python/Collapse.py b/Assets/Python/Collapse.py
index 14563da14..64d693ae7 100644
--- a/Assets/Python/Collapse.py
+++ b/Assets/Python/Collapse.py
@@ -1,7 +1,6 @@
from CvPythonExtensions import CyGlobalContext
-
from Consts import MessageData
-from Core import civilization, civilizations, message, human, text
+from Core import civilization, civilizations, message, human, text, turns, year
from CoreTypes import Civ
from RFCUtils import collapseImmune, killAndFragmentCiv
from StoredData import data
@@ -16,8 +15,8 @@ def collapseByBarbs(iGameTurn):
if pCiv.isAlive():
# Absinthe: no barb collapse for 20 turns after spawn, for 10 turns after respawn, or with the Emperor UP
if (
- iGameTurn >= civilization(iCiv).date.birth + 20
- and iGameTurn >= data.players[iCiv].last_respawn_turn + 10
+ iGameTurn >= year(civilization(iCiv).date.birth) + turns(20)
+ and iGameTurn >= data.players[iCiv].last_respawn_turn + turns(10)
and not collapseImmune(iCiv)
):
iNumCities = pCiv.getNumCities()
@@ -60,8 +59,8 @@ def collapseGeneric(iGameTurn):
data.players[iCiv].num_cities = iNumCitiesCurrently
# Absinthe: no generic collapse for 20 turns after spawn, for 10 turns after respawn, or with the Emperor UP
if (
- iGameTurn >= civilization(iCiv).date.birth + 20
- and iGameTurn >= data.players[iCiv].last_respawn_turn + 10
+ iGameTurn >= year(civilization(iCiv).date.birth) + turns(20)
+ and iGameTurn >= data.players[iCiv].last_respawn_turn + turns(10)
and not collapseImmune(iCiv)
):
# Absinthe: pass for small civs, we have bad stability collapses and collapseMotherland anyway, which is better suited for the collapse of those
@@ -98,8 +97,8 @@ def collapseMotherland(iGameTurn):
if pCiv.isAlive():
# Absinthe: no motherland collapse for 20 turns after spawn, for 10 turns after respawn, or with the Emperor UP
if (
- iGameTurn >= civilization(iCiv).date.birth + 20
- and iGameTurn >= data.players[iCiv].last_respawn_turn + 10
+ iGameTurn >= year(civilization(iCiv).date.birth) + turns(20)
+ and iGameTurn >= data.players[iCiv].last_respawn_turn + turns(10)
and not collapseImmune(iCiv)
):
# Absinthe: respawned Cordoba or Aragon shouldn't collapse because not holding the original core area
diff --git a/Assets/Python/Companies.py b/Assets/Python/Companies.py
index 22c7f4764..7d65072d9 100644
--- a/Assets/Python/Companies.py
+++ b/Assets/Python/Companies.py
@@ -1,6 +1,3 @@
-# RFC Europe - Companies
-# Implemented by AbsintheRed, based on the wonderful idea of embryodead
-
from CvPythonExtensions import *
from Consts import MessageData
from Core import (
@@ -11,6 +8,7 @@
player,
text,
turn,
+ turns,
year,
cities,
companies,
@@ -599,7 +597,7 @@ def checkTurn(iGameTurn):
return
# check if it's not too late
- elif iGameTurn > year(companies[iCompany].deathdate) + rand(companies.len()):
+ elif iGameTurn > year(companies[iCompany].deathdate) + turns(rand(companies.len())):
iMaxCompanies = 0
# do not dissolve the Templars while Jerusalem is under Catholic control
if iCompany == Company.TEMPLARS:
diff --git a/Assets/Python/Core.py b/Assets/Python/Core.py
index 5cbcca0a0..1bebfec27 100644
--- a/Assets/Python/Core.py
+++ b/Assets/Python/Core.py
@@ -982,8 +982,8 @@ def since(iTurn):
return turn() - iTurn
-def every(interval):
- return turn() % turns(interval) == 0
+def every(interval, shift=0):
+ return turn() % turns(interval) == shift
class InfoCollection(EntitiesCollection):
diff --git a/Assets/Python/Crusades.py b/Assets/Python/Crusades.py
index 638824a2f..b9d4519c5 100644
--- a/Assets/Python/Crusades.py
+++ b/Assets/Python/Crusades.py
@@ -5,6 +5,7 @@
civilization,
civilizations,
event_popup,
+ every,
human,
location,
make_crusade_unit,
@@ -16,6 +17,7 @@
message,
text,
turn,
+ turns,
year,
cities,
plots,
@@ -388,27 +390,36 @@ def checkTurn(iGameTurn):
freeCrusaders(data.crusade_to_return)
data.crusade_to_return = -1
- # Absinthe: crusade date - 5 means the exact time for the arrival
- if iGameTurn == year(1096) - 5: # First Crusade arrives in 1096AD
+ if iGameTurn == year(1096) - turns(5):
data.crusade_status[0] = -1
elif (
- iGameTurn >= year(1147) - 7 and data.crusade_status[0] > 0 and data.crusade_status[1] == -2
+ iGameTurn >= year(1147) - turns(7)
+ and data.crusade_status[0] > 0
+ and data.crusade_status[1] == -2
): # Crusade of 1147AD, little earlier (need to be more than 9 turns between crusades)
data.crusade_status[1] = -1 # turn 176
elif (
- iGameTurn >= year(1187) - 8 and data.crusade_status[1] > 0 and data.crusade_status[2] == -2
+ iGameTurn >= year(1187) - turns(8)
+ and data.crusade_status[1] > 0
+ and data.crusade_status[2] == -2
): # Crusade of 1187AD, little earlier (need to be more than 9 turns between crusades)
data.crusade_status[2] = -1 # turn 187
elif (
- iGameTurn >= year(1202) - 4 and data.crusade_status[2] > 0 and data.crusade_status[3] == -2
+ iGameTurn >= year(1202) - turns(4)
+ and data.crusade_status[2] > 0
+ and data.crusade_status[3] == -2
): # Crusade of 1202AD, little later (need to be more than 9 turns between crusades)
data.crusade_status[3] = -1 # turn 197
elif (
- iGameTurn >= year(1229) - 3 and data.crusade_status[3] > 0 and data.crusade_status[4] == -2
+ iGameTurn >= year(1229) - turns(3)
+ and data.crusade_status[3] > 0
+ and data.crusade_status[4] == -2
): # Crusade of 1229AD, little later (need to be more than 9 turns between crusades)
data.crusade_status[4] = -1 # turn 207
elif (
- iGameTurn >= year(1271) - 5 and data.crusade_status[4] > 0 and data.crusade_status[5] == -2
+ iGameTurn >= year(1271) - turns(5)
+ and data.crusade_status[4] > 0
+ and data.crusade_status[5] == -2
): # Crusade of 1270AD
data.crusade_status[5] = -1 # turn 219
@@ -573,7 +584,7 @@ def CrusadeInitVoteEvent(playerID, netUserData, popupReturn):
def doParticipation(iGameTurn):
iHuman = human()
- if civilization(iHuman).date.birth < iGameTurn:
+ if year(civilization(iHuman).date.birth) < iGameTurn:
pHuman = player(iHuman)
if pHuman.getStateReligion() != Religion.CATHOLICISM:
data.is_participate_to_crusade = False
@@ -624,7 +635,7 @@ def computeVotingPower(iGameTurn):
for iPlayer in civilizations().majors().ids():
pPlayer = player(iPlayer)
if (
- civilization(iPlayer).date.birth > iGameTurn
+ year(civilization(iPlayer).date.birth) > iGameTurn
or not pPlayer.isAlive()
or pPlayer.getStateReligion() != Religion.CATHOLICISM
or gc.getTeam(pPlayer.getTeam()).isVassal(iTmJerusalem)
@@ -659,12 +670,12 @@ def setCrusaders():
def sendUnits(iPlayer):
pPlayer = player(iPlayer)
iNumUnits = pPlayer.getNumUnits()
- if civilization(iPlayer).date.birth + 10 > turn(): # in the first 10 turns
+ if year(civilization(iPlayer).date.birth) + turns(10) > turn(): # in the first 10 turns
if iNumUnits < 10:
iMaxToSend = 0
else:
iMaxToSend = 1
- elif civilization(iPlayer).date.birth + 25 > turn(): # between turn 11-25
+ elif year(civilization(iPlayer).date.birth) + turns(25) > turn(): # between turn 11-25
iMaxToSend = min(10, max(1, (5 * iNumUnits) / 50))
else:
iMaxToSend = min(10, max(1, (5 * iNumUnits) / 35)) # after turn 25
@@ -1416,7 +1427,7 @@ def freeCrusaders(iPlayer):
@handler("BeginPlayerTurn")
def checkPlayerTurn(iGameTurn, iPlayer):
# Absinthe: pilgrims in Jerusalem if it's held by a Catholic civ
- if iGameTurn % 3 == 1: # checked every 3rd turn
+ if every(3):
pCity = gc.getMap().plot(*CITIES[City.JERUSALEM]).getPlotCity()
if pCity.getOwner() == iPlayer:
pPlayer = player(iPlayer)
@@ -1477,7 +1488,7 @@ def canDefensiveCrusade(iPlayer, iGameTurn):
teamPlayer = gc.getTeam(pPlayer.getTeam())
# only born, flipped and living Catholics can defensive crusade
if (
- (iGameTurn < civilization(iPlayer).date.birth + 5)
+ iGameTurn < year(civilization(iPlayer).date.birth) + turns(5)
or not pPlayer.isAlive()
or pPlayer.getStateReligion() != Religion.CATHOLICISM
):
@@ -1493,7 +1504,7 @@ def canDefensiveCrusade(iPlayer, iGameTurn):
pEnemy = player(iEnemy)
if (
teamPlayer.isAtWar(pEnemy.getTeam())
- and civilization(iEnemy).date.birth + 10 < iGameTurn
+ and year(civilization(iEnemy).date.birth) + turns(10) < iGameTurn
):
if isOrMasterChristian(iEnemy):
continue
diff --git a/Assets/Python/History.py b/Assets/Python/History.py
index 38fabc04b..505145e54 100644
--- a/Assets/Python/History.py
+++ b/Assets/Python/History.py
@@ -11,6 +11,7 @@
show,
show_if_human,
text,
+ turns,
year,
)
from CoreTypes import Building, Civ, RandomEvent, Religion, StabilityCategory, Unit
@@ -61,12 +62,13 @@ def move_ottoman_capital(owner, iPlayer, city, bConquest, bTrade):
@handler("BeginGameTurn")
def viking_attack_on_constantinople(iGameTurn):
- # Absinthe: 868AD Viking attack on Constantinople
- if iGameTurn == year(860) + data.random_events[RandomEvent.BYZANTIUM_VIKING_ATTACK] - 2:
+ if iGameTurn == year(860) + turns(
+ data.random_events[RandomEvent.BYZANTIUM_VIKING_ATTACK]
+ ) - turns(2):
if human() == Civ.BYZANTIUM:
show(text("TXT_KEY_EVENT_VIKING_CONQUERERS_RUMOURS"))
- if iGameTurn == year(860) + data.random_events[RandomEvent.BYZANTIUM_VIKING_ATTACK]:
+ if iGameTurn == year(860) + turns(data.random_events[RandomEvent.BYZANTIUM_VIKING_ATTACK]):
if human() == Civ.BYZANTIUM:
for unit, number in zip((Unit.DENMARK_HUSKARL, Unit.VIKING_BERSERKER), (3, 4)):
Barbs.spawnUnits(
diff --git a/Assets/Python/Messages.py b/Assets/Python/Messages.py
index e19072e99..052931f38 100644
--- a/Assets/Python/Messages.py
+++ b/Assets/Python/Messages.py
@@ -1,6 +1,6 @@
from CvPythonExtensions import CyArtFileMgr, CyGlobalContext, InterfaceMessageTypes
from Consts import MessageData
-from Core import human, message, player, show, team, text, year
+from Core import human, message, player, show, team, text, turns, year
from CoreTypes import Building, Civ, Wonder
from Events import handler
import Mercenaries
@@ -172,7 +172,7 @@ def announce_schism(iGameTurn):
def announce_invaders(iGameTurn, iPlayer):
if iPlayer == human():
# Seljuks
- if iGameTurn == year(1064) - 7:
+ if iGameTurn == year(1064) - turns(7):
if iPlayer == Civ.BYZANTIUM:
show(("TXT_KEY_EVENT_BARBARIAN_INVASION_START"))
elif iGameTurn == year(1094) + 1:
@@ -180,7 +180,7 @@ def announce_invaders(iGameTurn, iPlayer):
sText = "Seljuk"
show(text("TXT_KEY_EVENT_BARBARIAN_INVASION_END", sText))
# Mongols
- elif iGameTurn == year(1236) - 7:
+ elif iGameTurn == year(1236) - turns(7):
if iPlayer in [
Civ.KIEV,
Civ.HUNGARY,
@@ -188,7 +188,7 @@ def announce_invaders(iGameTurn, iPlayer):
Civ.BULGARIA,
]:
show(text("TXT_KEY_EVENT_BARBARIAN_INVASION_START"))
- elif iGameTurn == year(1288) + 1:
+ elif iGameTurn == year(1288) + turns(1):
if iPlayer in [
Civ.KIEV,
Civ.HUNGARY,
@@ -198,10 +198,10 @@ def announce_invaders(iGameTurn, iPlayer):
sText = "Tatar"
show(text("TXT_KEY_EVENT_BARBARIAN_INVASION_END", sText))
# Timurids
- elif iGameTurn == year(1380) - 7:
+ elif iGameTurn == year(1380) - turns(7):
if iPlayer in [Civ.ARABIA, Civ.OTTOMAN, Civ.BYZANTIUM]:
show(text("TXT_KEY_EVENT_TIMURID_INVASION_START"))
- elif iGameTurn == year(1431) + 1:
+ elif iGameTurn == year(1431) + turns(1):
if iPlayer in [Civ.ARABIA, Civ.OTTOMAN, Civ.BYZANTIUM]:
sText = "Timurid"
show(text("TXT_KEY_EVENT_BARBARIAN_INVASION_END", sText))
diff --git a/Assets/Python/Modifiers.py b/Assets/Python/Modifiers.py
index f678612eb..1a99e9caf 100644
--- a/Assets/Python/Modifiers.py
+++ b/Assets/Python/Modifiers.py
@@ -25,7 +25,7 @@
GREAT_PROPHET_FAITH_POINT_BONUS,
PROSECUTOR_UNITCLASS,
)
-from TimelineData import TIMELINE_TECH_MODIFIER, DateTurn
+from TimelineData import TIMELINE_TECH_MODIFIER
from LocationsData import CITIES
from Events import handler
@@ -424,7 +424,7 @@ def set_other_parameters():
gc.setFastTerrain(Terrain.OCEAN)
# set the religions and year of the great schism
- gc.setSchism(Religion.CATHOLICISM, Religion.ORTHODOXY, DateTurn.i1053AD)
+ gc.setSchism(Religion.CATHOLICISM, Religion.ORTHODOXY, year(1053))
gc.setHoliestCity(*CITIES[City.JERUSALEM])
# 3Miro: set the Jews as the minor Religion
diff --git a/Assets/Python/Plague.py b/Assets/Python/Plague.py
index b81a137ec..d8c8a5066 100644
--- a/Assets/Python/Plague.py
+++ b/Assets/Python/Plague.py
@@ -12,6 +12,7 @@
human,
player,
turn,
+ turns,
year,
city as _city,
plot as _plot,
@@ -564,7 +565,7 @@ def onCityAcquired(iOldOwner, iNewOwner, city):
return
# only if it's not a recently born civ
- if turn() > civilization(iNewOwner).date.birth + PLAGUE_IMMUNITY:
+ if turn() > year(civilization(iNewOwner).date.birth) + turns(PLAGUE_IMMUNITY):
# reinfect the human player if conquering plagued cities
if iNewOwner == human():
# if > 0 do nothing, if < 0 skip immunity and restart the plague, if == 0 start the plague
diff --git a/Assets/Python/Provinces.py b/Assets/Python/Provinces.py
index d5a728cdd..cb4a8f976 100644
--- a/Assets/Python/Provinces.py
+++ b/Assets/Python/Provinces.py
@@ -15,7 +15,7 @@ def setup():
# update provinces for the 1200 AD Scenario
if get_scenario() == Scenario.i1200AD:
for civ in civilizations().main():
- if civ.date.birth < year(1200):
+ if year(civ.date.birth) < year(1200):
onSpawn(civ.id)
diff --git a/Assets/Python/RFCUtils.py b/Assets/Python/RFCUtils.py
index e8acef2b2..7df66977f 100644
--- a/Assets/Python/RFCUtils.py
+++ b/Assets/Python/RFCUtils.py
@@ -1,5 +1,3 @@
-# Rhye's and Fall of Civilization: Europe - Utilities
-
from CvPythonExtensions import *
from Core import (
event_popup,
@@ -20,10 +18,12 @@
text,
text_if_exists,
turn,
+ turns,
units,
cities,
plots,
get_data_from_upside_down_map,
+ year,
)
from CoreTypes import (
City,
@@ -184,7 +184,7 @@ def minorWars(iMinorCiv, iGameTurn):
and not iActiveCiv == Civ.POPE
):
if not teamMinor.isAtWar(iActiveCiv):
- if iGameTurn > civilization(iActiveCiv).date.birth + 20:
+ if iGameTurn > year(civilization(iActiveCiv).date.birth) + turns(20):
# Absinthe: probably better to use war maps instead of settler maps, but let the AI concentrate on it's core area first
# maybe we should use both settler and war maps? distance calculations would be great, but use too much iterations
random_value = percentage()
@@ -213,7 +213,7 @@ def minorCoreWars(iMinorCiv, iGameTurn):
and not iActiveCiv == Civ.POPE
):
# Absinthe: do not want to force the AI into these wars with WARPLAN_TOTAL too early
- if iGameTurn > civilization(iActiveCiv).date.birth + 40:
+ if iGameTurn > year(civilization(iActiveCiv).date.birth) + turns(40):
if not teamMinor.isAtWar(iActiveCiv):
if gc.getPlayer(iActiveCiv).getWarsMaps(WORLD_HEIGHT - y - 1, x) == 16:
teamActive = gc.getTeam(gc.getPlayer(iActiveCiv).getTeam())
diff --git a/Assets/Python/Religions.py b/Assets/Python/Religions.py
index 2c54933a1..d302a602a 100644
--- a/Assets/Python/Religions.py
+++ b/Assets/Python/Religions.py
@@ -6,12 +6,14 @@
civilization,
civilizations,
event_popup,
+ every,
human,
location,
message,
player,
text,
turn,
+ turns,
units,
year,
)
@@ -257,14 +259,14 @@ def onReligionFounded(iReligion, iFounder):
@handler("BeginGameTurn")
def checkTurn(iGameTurn):
# Absinthe: Spreading religion in a couple preset dates
- if iGameTurn == year(700) - 2:
+ if iGameTurn == year(700) - turns(2):
# Spread Judaism to Toledo
spreadReligion(CITIES[City.TOLEDO], Religion.JUDAISM)
# Spread Islam to a random city in Africa
tCity = selectRandomCityRegion(tNorthAfrica, Religion.ISLAM)
if tCity:
spreadReligion(tCity, Religion.ISLAM)
- elif iGameTurn == year(700) + 2:
+ elif iGameTurn == year(700) + turns(2):
# Spread Judaism and Islam to a random city in Africa
tCity = selectRandomCityRegion(tWestAfrica, Religion.ISLAM)
if tCity:
@@ -296,7 +298,7 @@ def checkTurn(iGameTurn):
tCity = selectRandomCityRegion(tPoland, Religion.JUDAISM)
if tCity:
spreadReligion(tCity, Religion.JUDAISM)
- elif year(1299) < iGameTurn < year(1350) and iGameTurn % 3 == 0:
+ elif year().between(1299, 1350) and every(3):
# Spread Islam to a couple cities in Anatolia before the Ottoman spawn
tCity = selectRandomCityRegion(tBalkansAndAnatolia, Religion.ISLAM)
if tCity:
@@ -309,14 +311,14 @@ def checkTurn(iGameTurn):
# Absinthe: Spreading Judaism in random dates
# General 6% chance to spread Jews to a random city in every third turn
- if year(800) < iGameTurn < year(1700) and iGameTurn % 3 == 0:
+ if year().between(800, 1700) and every(3):
if percentage_chance(6, strict=True):
tCity = cities.all().random_entry()
if tCity is not None:
spreadReligion(tCity, Religion.JUDAISM)
# Additional 11% chance to spread Jews to a random Central European city in every third turn
- if year(1000) < iGameTurn < year(1500) and iGameTurn % 3 == 1:
+ if year().between(1000, 1500) and every(3, shift=1):
if percentage_chance(11, strict=True):
tCity = selectRandomCityRegion(tCentralEurope, Religion.JUDAISM)
if tCity:
@@ -324,37 +326,37 @@ def checkTurn(iGameTurn):
# Absinthe: Encouraging desired religion spread in a couple areas (mostly for Islam and Orthodoxy)
# Maghreb and Cordoba:
- if year(700) < iGameTurn < year(800) and iGameTurn % 2 == 1:
+ if year().between(700, 800) and every(2):
if percentage_chance(32, strict=True):
tCity = selectRandomCityRegion(tMaghrebAndalusia, Religion.ISLAM, True)
if tCity:
spreadReligion(tCity, Religion.ISLAM)
- if year(800) < iGameTurn < year(1200) and iGameTurn % 3 == 2:
+ if year().between(800, 1200) and every(3):
if percentage_chance(28, strict=True):
tCity = selectRandomCityRegion(tMaghrebAndalusia, Religion.ISLAM, True)
if tCity:
spreadReligion(tCity, Religion.ISLAM)
# Bulgaria and Balkans:
- if year(700) < iGameTurn < year(800) and iGameTurn % 3 == 1:
+ if year().between(700, 800) and every(3):
if percentage_chance(25, strict=True):
tCity = selectRandomCityRegion(tBulgariaBalkans, Religion.ORTHODOXY, True)
if tCity:
spreadReligion(tCity, Religion.ORTHODOXY)
- if year(800) < iGameTurn < year(1000) and iGameTurn % 4 == 1:
+ if year().between(800, 1000) and every(4):
if percentage_chance(15, strict=True):
tCity = selectRandomCityRegion(tBulgariaBalkans, Religion.ORTHODOXY, True)
if tCity:
spreadReligion(tCity, Religion.ORTHODOXY)
# Old Rus territories:
- if year(852) < iGameTurn < year(1300) and iGameTurn % 4 == 3:
+ if year().between(852, 1300) and every(4):
if percentage_chance(25, strict=True):
tCity = selectRandomCityRegion(tOldRus, Religion.ORTHODOXY, True)
if tCity:
spreadReligion(tCity, Religion.ORTHODOXY)
# Extra chance for early Orthodoxy spread in Novgorod:
- if year(852) < iGameTurn < year(960) and iGameTurn % 5 == 2:
+ if year().between(852, 960) and every(5):
if percentage_chance(34, strict=True):
tCity = selectRandomCityRegion(
[Province.NOVGOROD, Province.POLOTSK, Province.SMOLENSK],
@@ -364,14 +366,14 @@ def checkTurn(iGameTurn):
if tCity:
spreadReligion(tCity, Religion.ORTHODOXY)
# Hungary:
- if year(960) < iGameTurn < year(1200) and iGameTurn % 4 == 2:
+ if year().between(960, 1200) and every(4):
if percentage_chance(21, strict=True):
tCity = selectRandomCityRegion(tHungary, Religion.CATHOLICISM, True)
if tCity:
spreadReligion(tCity, Religion.CATHOLICISM)
# Scandinavia:
- if year(1000) < iGameTurn < year(1300) and iGameTurn % 4 == 0:
+ if year().between(1000, 1300) and every(4):
if percentage_chance(24, strict=True):
tCity = selectRandomCityRegion(tSouthScandinavia, Religion.CATHOLICISM, True)
if tCity:
@@ -465,9 +467,7 @@ def checkTurn(iGameTurn):
buildInRandomCity(iChosenPlayer.id, iCatholicBuilding, Religion.CATHOLICISM)
# Free technology
if iGameTurn > year(843): # Treaty of Verdun, the Carolingian Empire divided into 3 parts
- if (
- iGameTurn % 13 == 4
- ): # checked every 13th turn - won't change it as the game progresses, as the number of available techs will already change with the number of Catholic civs
+ if every(13):
weights = []
for civ in catholic_civs:
iCatholicFaith = 0
@@ -500,7 +500,7 @@ def checkTurn(iGameTurn):
# don't continue if a tech was already given - this also means that there is bigger chance for getting a tech if the chosen civ is multiple techs behind
break
- if iGameTurn % 6 == 3:
+ if every(6):
update_pope_techs(catholic_civs)
# Absinthe: Reformation
@@ -756,7 +756,7 @@ def ReformationEvent(playerID, netUserData, popupReturn):
def onTechAcquired(iTech, iTeam, iPlayer):
if (
gc.getPlayer(iPlayer).isAlive()
- and turn() > civilization(iPlayer).date.birth
+ and turn() > year(civilization(iPlayer).date.birth)
and iPlayer < civilizations().majors().len()
):
if iTech == Technology.PRINTING_PRESS:
diff --git a/Assets/Python/Resources.py b/Assets/Python/Resources.py
index 9345e95c4..a43d7621a 100644
--- a/Assets/Python/Resources.py
+++ b/Assets/Python/Resources.py
@@ -1,6 +1,6 @@
from CvPythonExtensions import *
from Consts import MessageData
-from Core import get_scenario, text, message, year
+from Core import get_scenario, text, message, turns, year
from CoreTypes import Feature, Improvement, Bonus, Scenario
from Events import handler
@@ -95,7 +95,7 @@ def checkTurn(iGameTurn):
elif iGameTurn == year(1000):
createResource(36, 24, Bonus.RICE) # Rice in Iberia
createResource(86, 2, Bonus.RICE) # Rice in the Middle East
- elif iGameTurn == (year(1066) + 1):
+ elif iGameTurn == year(1066) + turns(1):
removeResource(2, 69) # Remove the NAA from Iceland
elif iGameTurn == year(1452): # Coffee spawns instead of being preplaced
createResource(93, 0, Bonus.COFFEE) # near Sinai
diff --git a/Assets/Python/Resurrection.py b/Assets/Python/Resurrection.py
index efc24a70a..f771bede1 100644
--- a/Assets/Python/Resurrection.py
+++ b/Assets/Python/Resurrection.py
@@ -15,8 +15,10 @@
text,
message,
turn,
+ turns,
plots,
cities,
+ year,
)
from CoreTypes import (
Area,
@@ -73,9 +75,9 @@ def findCivToResurect(iGameTurn, bSpecialRespawn, iDeadCiv):
cityList = []
if (
not gc.getPlayer(iDeadCiv).isAlive()
- and iGameTurn > civilization(iDeadCiv).date.birth + 25
- and iGameTurn > data.players[iDeadCiv].last_turn_alive + 10
- ): # Sedna17: Allow re-spawns only 10 turns after death and 25 turns after birth
+ and iGameTurn > year(civilization(iDeadCiv).date.birth) + turns(25)
+ and iGameTurn > data.players[iDeadCiv].last_turn_alive + turns(10)
+ ):
tile_min = civilization(iDeadCiv).location.area[AreaType.NORMAL][Area.TILE_MIN]
tile_max = civilization(iDeadCiv).location.area[AreaType.NORMAL][Area.TILE_MAX]
diff --git a/Assets/Python/RiseAndFall.py b/Assets/Python/RiseAndFall.py
index c3a438ad2..4bc0a3369 100644
--- a/Assets/Python/RiseAndFall.py
+++ b/Assets/Python/RiseAndFall.py
@@ -17,6 +17,7 @@
civilization,
civilizations,
event_popup,
+ every,
get_scenario,
get_scenario_start_turn,
human,
@@ -29,6 +30,7 @@
player,
text,
turn,
+ turns,
year,
cities,
plots,
@@ -100,7 +102,9 @@ def setup():
if get_scenario() == Scenario.i500AD:
create_starting_units_500AD()
- for civ in civilizations().majors().filter(lambda c: c.date.birth == year(500)).ids():
+ for civ in (
+ civilizations().majors().filter(lambda c: year(c.date.birth) == year(500)).ids()
+ ):
reveal_areas(civ)
set_initial_contacts(civ)
@@ -109,7 +113,7 @@ def setup():
for civ in (
civilizations()
.main()
- .filter(lambda c: c.date.birth < get_scenario_start_turn(Scenario.i1200AD))
+ .filter(lambda c: year(c.date.birth) < get_scenario_start_turn(Scenario.i1200AD))
.ids()
):
reveal_areas(civ)
@@ -338,7 +342,6 @@ def onCityBuilt(pCity):
@handler("BeginGameTurn")
def checkTurn(iGameTurn):
- # Trigger betrayal mode
if data.betrayal_turns > 0:
initBetrayal()
@@ -351,25 +354,25 @@ def checkTurn(iGameTurn):
else:
data.cheaters_check[0] -= 1
- if iGameTurn % 20 == 0:
+ if every(20):
for civ in civilizations().independents().alive():
updateMinorTechs(civ.id, Civ.BARBARIAN)
# Absinthe: checking the spawn dates
for iLoopCiv in civilizations().majors().ids():
if (
- civilization(iLoopCiv).date.birth != 0
- and iGameTurn >= civilization(iLoopCiv).date.birth - 2
- and iGameTurn <= civilization(iLoopCiv).date.birth + 4
+ year(civilization(iLoopCiv).date.birth) != 0
+ and iGameTurn >= year(civilization(iLoopCiv).date.birth) - turns(2)
+ and iGameTurn <= year(civilization(iLoopCiv).date.birth) + turns(4)
):
- initBirth(iGameTurn, civilization(iLoopCiv).date.birth, iLoopCiv)
+ initBirth(iGameTurn, year(civilization(iLoopCiv).date.birth), iLoopCiv)
# Fragment minor civs:
# 3Miro: Shuffle cities between Indies and Barbs to make sure there is no big Independent nation
- if iGameTurn >= 20:
- if iGameTurn % 15 == 6:
+ if iGameTurn >= turns(20):
+ if every(15):
fragmentIndependents()
- if iGameTurn % 30 == 12:
+ if every(30):
fragmentBarbarians(iGameTurn)
# Fall of civs:
@@ -377,15 +380,15 @@ def checkTurn(iGameTurn):
# Generic collapse: if 1/2 of the empire is lost in only a few turns (16 ATM) = collapse
# Motherland collapse: if no city is in the core area and the number of cities in the normal area is less than the number of foreign cities = collapse
# Secession: if stability is negative there is a chance (bigger chance with worse stability) for a random city to declare it's independence
- if iGameTurn >= 64 and iGameTurn % 7 == 0: # mainly for Seljuks, Mongols, Timurids
+ if iGameTurn >= turns(64) and every(7): # mainly for Seljuks, Mongols, Timurids
collapseByBarbs(iGameTurn)
- if iGameTurn >= 34 and iGameTurn % 16 == 0:
+ if iGameTurn >= turns(34) and every(16):
collapseGeneric(iGameTurn)
- if iGameTurn >= 34 and iGameTurn % 9 == 7:
+ if iGameTurn >= turns(34) and every(9):
collapseMotherland(iGameTurn)
- if iGameTurn > 20 and iGameTurn % 3 == 1:
+ if iGameTurn > turns(20) and every(3):
secession(iGameTurn)
- if iGameTurn > 20 and iGameTurn % 7 == 3:
+ if iGameTurn > turns(20) and every(7):
secessionCloseCollapse(iGameTurn)
# Resurrection of civs:
@@ -412,15 +415,15 @@ def checkTurn(iGameTurn):
resurrection(iGameTurn, -1)
# Absinthe: Reduce cities to towns, in order to make room for new civs
- if iGameTurn == civilization(Civ.SCOTLAND).date.birth - 3:
+ if iGameTurn == year(civilization(Civ.SCOTLAND).date.birth) - turns(3):
# Reduce Inverness and Scone, so more freedom in where to found cities in Scotland
reduceCity((37, 65))
reduceCity((37, 67))
- elif iGameTurn == civilization(Civ.ENGLAND).date.birth - 3:
+ elif iGameTurn == year(civilization(Civ.ENGLAND).date.birth) - turns(3):
# Reduce Norwich and Nottingham, so more freedom in where to found cities in England
reduceCity((43, 55))
reduceCity((39, 56))
- elif iGameTurn == civilization(Civ.SWEDEN).date.birth - 2:
+ elif iGameTurn == year(civilization(Civ.SWEDEN).date.birth) - turns(2):
# Reduce Uppsala
reduceCity((65, 66))
# Absinthe: Reduce cities to town, if not owned by the human player
@@ -489,7 +492,7 @@ def checkPlayerTurn(iGameTurn, iPlayer):
# Absinthe: Another English AI cheat, extra defenders and defensive buildings in Normandy some turns after spawn - from RFCE++
if (
- iGameTurn == year(1066) + 3
+ iGameTurn == year(1066) + turns(3)
and human() != Civ.ENGLAND
and iPlayer == Civ.ENGLAND
and player(Civ.ENGLAND).isAlive()
@@ -573,10 +576,9 @@ def fragmentBarbarians(iGameTurn):
iRndnum = rand(civilizations().majors().len())
for j in civilizations().majors().ids():
iDeadCiv = (j + iRndnum) % civilizations().majors().len()
- if (
- not gc.getPlayer(iDeadCiv).isAlive()
- and iGameTurn > civilization(iDeadCiv).date.birth + 50
- ):
+ if not gc.getPlayer(iDeadCiv).isAlive() and iGameTurn > year(
+ civilization(iDeadCiv).date.birth
+ ) + turns(50):
lCities = [
location(city)
for city in (
@@ -676,7 +678,7 @@ def initBirth(iCurrentTurn, iBirthYear, iCiv):
if (
gc.getPlayer(iCiv).isAlive()
and not data.already_switched
- and iCurrentTurn > civilization(iHuman).date.birth + 40
+ and iCurrentTurn > year(civilization(iHuman).date.birth) + turns(40)
and not gc.getPlayer(iHuman).getIsCrusader()
):
newCivPopup(iCiv)
@@ -949,7 +951,7 @@ def convertSurroundingCities(iCiv, tTopLeft, tBottomRight):
elif not city.isCapital(): # 3Miro: this keeps crashing in the C++, makes no sense
if iConvertedCitiesCount < 6: # there won't be more than 5 flips in the area
iCultureChange = 50
- if turn() <= civilization(iCiv).date.birth + 5: # if we're during a birth
+ if turn() <= year(civilization(iCiv).date.birth) + turns(5):
rndNum = percentage()
# 3Miro: I don't know why the iOwner check is needed below, but the module crashes sometimes
if is_major_civ(city) and rndNum >= civilization(city).ai.stop_birth_threshold:
@@ -1008,90 +1010,88 @@ def findSeaPlots(tCoords, iRange):
return None
-def getSpecialRespawn(
- iGameTurn,
-): # Absinthe: only the first civ for which it is True is returned, so the order of the civs is very important here
+def getSpecialRespawn(iGameTurn):
+ # Absinthe: only the first civ for which it is True is returned, so the order of the civs is very important here
if canSpecialRespawn(Civ.FRANCE, iGameTurn, 12):
# France united in it's modern borders, start of the Bourbon royal line
- if year(1588) < iGameTurn < year(1700) and iGameTurn % 5 == 3:
+ if year().between(1588, 1700) and every(5):
return Civ.FRANCE
if canSpecialRespawn(Civ.ARABIA, iGameTurn):
# Saladin, Ayyubid Dynasty
- if year(1080) < iGameTurn < year(1291) and iGameTurn % 7 == 3:
+ if year().between(1080, 1291) and every(7):
return Civ.ARABIA
if canSpecialRespawn(Civ.BULGARIA, iGameTurn):
# second Bulgarian Empire
- if year(1080) < iGameTurn < year(1299) and iGameTurn % 5 == 1:
+ if year().between(1080, 1299) and every(5):
return Civ.BULGARIA
if canSpecialRespawn(Civ.CORDOBA, iGameTurn):
# special respawn as the Hafsid dynasty in North Africa
- if year(1229) < iGameTurn < year(1540) and iGameTurn % 5 == 3:
+ if year().between(1229, 1540) and every(5):
return Civ.CORDOBA
if canSpecialRespawn(Civ.BURGUNDY, iGameTurn, 20):
# Burgundy in the 100 years war
- if year(1336) < iGameTurn < year(1453) and iGameTurn % 8 == 1:
+ if year().between(1336, 1453) and every(8):
return Civ.BURGUNDY
if canSpecialRespawn(Civ.PRUSSIA, iGameTurn):
# respawn as the unified Prussia
- if iGameTurn > year(1618) and iGameTurn % 3 == 1:
+ if iGameTurn > year(1618) and every(3):
return Civ.PRUSSIA
if canSpecialRespawn(Civ.HUNGARY, iGameTurn):
# reconquest of Buda from the Ottomans
- if iGameTurn > year(1680) and iGameTurn % 6 == 2:
+ if iGameTurn > year(1680) and every(6):
return Civ.HUNGARY
if canSpecialRespawn(Civ.CASTILE, iGameTurn, 25):
# respawn as the Castile/Aragon Union
- if year(1470) < iGameTurn < year(1580) and iGameTurn % 5 == 0:
+ if year().between(1470, 1580) and every(5):
return Civ.CASTILE
if canSpecialRespawn(Civ.ENGLAND, iGameTurn, 12):
# restoration of monarchy
- if iGameTurn > year(1660) and iGameTurn % 6 == 2:
+ if iGameTurn > year(1660) and every(6):
return Civ.ENGLAND
if canSpecialRespawn(Civ.SCOTLAND, iGameTurn, 30):
- if iGameTurn <= year(1600) and iGameTurn % 6 == 3:
+ if iGameTurn <= year(1600) and every(6):
return Civ.SCOTLAND
if canSpecialRespawn(Civ.PORTUGAL, iGameTurn):
# respawn to be around for colonies
- if year(1431) < iGameTurn < year(1580) and iGameTurn % 5 == 3:
+ if year().between(1431, 1580) and every(5):
return Civ.PORTUGAL
if canSpecialRespawn(Civ.AUSTRIA, iGameTurn):
# increasing Habsburg influence in Hungary
- if year(1526) < iGameTurn < year(1690) and iGameTurn % 8 == 3:
+ if year().between(1526, 1690) and every(8):
return Civ.AUSTRIA
if canSpecialRespawn(Civ.KIEV, iGameTurn):
# Cossack Hetmanate
- if year(1620) < iGameTurn < year(1750) and iGameTurn % 5 == 3:
+ if year().between(1620, 1750) and every(5):
return Civ.KIEV
if canSpecialRespawn(Civ.MOROCCO, iGameTurn):
# Alaouite Dynasty
- if iGameTurn > year(1631) and iGameTurn % 8 == 7:
+ if iGameTurn > year(1631) and every(8):
return Civ.MOROCCO
if canSpecialRespawn(Civ.ARAGON, iGameTurn):
# Kingdom of Sicily
- if iGameTurn > year(1700) and iGameTurn % 8 == 7:
+ if iGameTurn > year(1700) and every(8):
return Civ.ARAGON
if canSpecialRespawn(Civ.VENECIA, iGameTurn):
- if year(1401) < iGameTurn < year(1571) and iGameTurn % 8 == 7:
+ if year().between(1401, 1571) and every(8):
return Civ.VENECIA
if canSpecialRespawn(Civ.POLAND, iGameTurn):
- if year(1410) < iGameTurn < year(1570) and iGameTurn % 8 == 7:
+ if year().between(1410, 1570) and every(8):
return Civ.POLAND
if canSpecialRespawn(Civ.OTTOMAN, iGameTurn):
# Mehmed II's conquests
- if year(1453) < iGameTurn < year(1514) and iGameTurn % 6 == 3:
+ if year().between(1453, 1514) and every(6):
return Civ.OTTOMAN
return -1
def canSpecialRespawn(iPlayer, iGameTurn, iLastAliveInterval=10):
- pPlayer = gc.getPlayer(iPlayer)
- if pPlayer.isAlive():
+ if player(iPlayer).isAlive():
return False
- if pPlayer.getEverRespawned():
+ if player(iPlayer).getEverRespawned():
return False
- if iGameTurn <= civilization(iPlayer).date.birth + 25:
+ if iGameTurn <= year(civilization(iPlayer).date.birth) + turns(25):
return False
- if iGameTurn <= data.players[iPlayer].last_turn_alive + iLastAliveInterval:
+ if iGameTurn <= data.players[iPlayer].last_turn_alive + turns(iLastAliveInterval):
return False
return True
diff --git a/Assets/Python/Secession.py b/Assets/Python/Secession.py
index 900b73f3b..c7c28d4e8 100644
--- a/Assets/Python/Secession.py
+++ b/Assets/Python/Secession.py
@@ -1,7 +1,7 @@
from CvPythonExtensions import CyGlobalContext, WarPlanTypes
from Consts import MessageData
-from Core import civilization, civilizations, cities, message, text
+from Core import civilization, civilizations, cities, message, text, turns, year
from CoreTypes import ProvinceType, StabilityCategory, UniquePower
from PyUtils import chance, rand, choice
from RFCUtils import (
@@ -28,8 +28,8 @@ def secession(iGameTurn):
# Absinthe: no city secession for 15 turns after spawn, for 10 turns after respawn
if (
pPlayer.isAlive()
- and iGameTurn >= civilization(iPlayer).date.birth + 15
- and iGameTurn >= data.players[iPlayer].last_respawn_turn + 10
+ and iGameTurn >= year(civilization(iPlayer).date.birth) + turns(15)
+ and iGameTurn >= data.players[iPlayer].last_respawn_turn + turns(10)
):
if chance(10, -2 - pPlayer.getStability(), strict=True):
# 10% at -3, increasing by 10% with each point (100% with -12 or less)
@@ -49,8 +49,8 @@ def secessionCloseCollapse(iGameTurn):
pPlayer = gc.getPlayer(iPlayer)
if (
pPlayer.isAlive()
- and iGameTurn >= civilization(iPlayer).date.birth + 20
- and iGameTurn >= data.players[iPlayer].last_respawn_turn + 10
+ and iGameTurn >= year(civilization(iPlayer).date.birth) + turns(20)
+ and iGameTurn >= data.players[iPlayer].last_respawn_turn + turns(10)
):
iStability = pPlayer.getStability()
if (
diff --git a/Assets/Python/Stability.py b/Assets/Python/Stability.py
index dee5b99ec..e975820ce 100644
--- a/Assets/Python/Stability.py
+++ b/Assets/Python/Stability.py
@@ -1,7 +1,19 @@
# Rhye's and Fall of Civilization: Europe - Stability
from CvPythonExtensions import *
-from Core import get_scenario, civilization, civilizations, message, human, cities, text, turn
+from Core import (
+ every,
+ get_scenario,
+ civilization,
+ civilizations,
+ message,
+ human,
+ cities,
+ text,
+ turn,
+ turns,
+ year,
+)
from Consts import MessageData
from CoreTypes import (
Building,
@@ -266,12 +278,12 @@ def updateBaseStability(iGameTurn, iPlayer):
# Absinthe: Collapse dates for AI nations
if (
- iGameTurn > civilization(iPlayer).date.collapse
+ iGameTurn > year(civilization(iPlayer).date.collapse)
and iPlayer != human()
and pPlayer.isAlive()
):
# Absinthe: -1 stability every 4 turns up to a total of -15 stability
- if iGameTurn % 4 == 0 and iGameTurn <= civilization(iPlayer).date.collapse + 60:
+ if every(4) and iGameTurn <= year(civilization(iPlayer).date.collapse) + turns(60):
pPlayer.changeStabilityBase(StabilityCategory.CITIES, -1)
@@ -431,7 +443,7 @@ def onCityRazed(city, iPlayer):
def onTechAcquired(iTech, iTeam, iPlayer):
if (
gc.getPlayer(iPlayer).isAlive()
- and turn() > civilization(iPlayer).date.birth
+ and turn() > year(civilization(iPlayer).date.birth)
and iPlayer < civilizations().majors().len()
):
if iTech in [
@@ -509,8 +521,8 @@ def checkImplosion(iGameTurn):
# Absinthe: no city secession for 15 turns after spawn, for 10 turns after respawn
if (
pPlayer.isAlive()
- and iGameTurn >= civilization(iPlayer).date.birth + 15
- and iGameTurn >= data.players[iPlayer].last_respawn_turn + 10
+ and iGameTurn >= year(civilization(iPlayer).date.birth) + turns(15)
+ and iGameTurn >= data.players[iPlayer].last_respawn_turn + turns(10)
):
iStability = pPlayer.getStability()
# Absinthe: human player with very bad stability should have a much bigger chance for collapse
@@ -538,7 +550,7 @@ def checkImplosion(iGameTurn):
revoltCity(iPlayer, False)
elif (
iRand3 < 1
- and iGameTurn >= civilization(iPlayer).date.birth + 20
+ and iGameTurn >= year(civilization(iPlayer).date.birth) + turns(20)
and not collapseImmune(iPlayer)
): # 10 chance for collapse start
if iRand2 < (
@@ -553,7 +565,7 @@ def checkImplosion(iGameTurn):
revoltCity(iPlayer, False)
elif (
iRand3 < 4
- and iGameTurn >= civilization(iPlayer).date.birth + 20
+ and iGameTurn >= year(civilization(iPlayer).date.birth) + turns(20)
and not collapseImmune(iPlayer)
): # 40 chance for collapse start
if iRand2 < (
@@ -562,7 +574,7 @@ def checkImplosion(iGameTurn):
collapseCivilWar(iPlayer, iStability)
elif (
iRand1 < 7
- and iGameTurn >= civilization(iPlayer).date.birth + 20
+ and iGameTurn >= year(civilization(iPlayer).date.birth) + turns(20)
and not collapseImmune(iPlayer)
): # 70 chance for collapse start
if iRand2 < (
diff --git a/Assets/Python/UniquePowers.py b/Assets/Python/UniquePowers.py
index 8fce0828a..a107879e3 100644
--- a/Assets/Python/UniquePowers.py
+++ b/Assets/Python/UniquePowers.py
@@ -5,6 +5,7 @@
player,
human,
turn,
+ turns,
year,
message,
text,
@@ -145,7 +146,7 @@ def portugal_up_on_city_built(city):
@handler("combatResult")
def norway_up(winning_unit, losing_unit):
- if winning_unit.getOwner() == Civ.NORWAY and turn() < year(1066) + 2:
+ if winning_unit.getOwner() == Civ.NORWAY and turn() < year(1066) + turns(2):
if infos.unit(losing_unit).getDomainType() == DomainTypes.DOMAIN_SEA:
if losing_unit.getUnitType() != Unit.WORKBOAT:
player(Civ.NORWAY).setUHVCounter(0, player(Civ.NORWAY).getUHVCounter(0) + 2)
diff --git a/Assets/Python/Victory.py b/Assets/Python/Victory.py
index 2dd07a89f..64f08aa34 100644
--- a/Assets/Python/Victory.py
+++ b/Assets/Python/Victory.py
@@ -11,6 +11,7 @@
team,
text,
turn,
+ turns,
year,
plots,
cities,
@@ -560,7 +561,7 @@ def onCityAcquired(owner, iNewOwner, city, bConquest, bTrade):
lostUHV(Civ.PORTUGAL, 1)
# Norway UHV 1: Going Viking
- elif iNewOwner == Civ.NORWAY and iGameTurn < year(1066) + 2:
+ elif iNewOwner == Civ.NORWAY and iGameTurn < year(1066) + turns(2):
# Absinthe: city is already reduced by 1 on city conquest, so city.getPopulation() is one less than the original size (unless it was already 1)
if bConquest:
if city.getPopulation() > 1:
@@ -631,7 +632,7 @@ def onCityRazed(city, iPlayer):
@handler("unitPillage")
def onPillageImprovement(pUnit, iImprovement, iRoute, iOwner):
# Norway UHV 1: Going Viking
- if pUnit.getOwner() == Civ.NORWAY and iRoute == -1 and turn() < year(1066) + 2:
+ if pUnit.getOwner() == Civ.NORWAY and iRoute == -1 and turn() < year(1066) + turns(2):
if plot(pUnit).getOwner() != Civ.NORWAY:
player(Civ.NORWAY).setUHVCounter(0, player(Civ.NORWAY).getUHVCounter(0) + 1)
@@ -1022,14 +1023,6 @@ def checkCordoba(iGameTurn):
def checkNorway(iGameTurn):
-
- # Old UHV1: explore all water tiles
- # if ( iGameTurn == year(1009) and pNorway.getUHV( 0 ) == -1 ):
- # if ( gc.canSeeAllTerrain( iNorway, Terrain.OCEAN ) ):
- # wonUHV( iNorway, 0 )
- # else:
- # lostUHV( iNorway, 0 )
-
# UHV 1: Gain 100 Viking Points and build Vinland by 1066
# Viking points counted in the onCityAcquired, onPillageImprovement and onCombatResult functions
if isPossibleUHV(Civ.NORWAY, 0, True):
@@ -1115,7 +1108,7 @@ def checkBurgundy(iGameTurn):
# UHV 1: Produce 12,000 culture points in your cities by 1336
# The counter should be updated until the deadline for the challenge UHVs, even after UHV completion
- if iGameTurn < year(1336) + 2:
+ if iGameTurn < year(1336) + turns(2):
iCulture = (
player(Civ.BURGUNDY).getUHVCounter(0) + player(Civ.BURGUNDY).countCultureProduced()
)
@@ -1211,7 +1204,7 @@ def checkKiev(iGameTurn):
# UHV 1: Build 2 Orthodox cathedrals and 8 Orthodox monasteries by 1250
# Controlled in the onBuildingBuilt function
- if iGameTurn == year(1250) + 1:
+ if iGameTurn == year(1250) + turns(1):
expireUHV(Civ.KIEV, 0)
# UHV 2: Control 10 provinces out of Kiev, Podolia, Pereyaslavl, Sloboda, Chernigov, Volhynia, Minsk, Polotsk, Smolensk, Moscow, Murom, Rostov, Novgorod and Vologda in 1288
@@ -1228,7 +1221,7 @@ def checkKiev(iGameTurn):
# UHV 3: Produce 25000 food by 1300
# The counter should be updated until the deadline for the challenge UHVs, even after UHV completion
- if iGameTurn < year(1300) + 2:
+ if iGameTurn < year(1300) + turns(2):
iFood = player(Civ.KIEV).getUHVCounter(2) + player(Civ.KIEV).calculateTotalYield(
YieldTypes.YIELD_FOOD
)
@@ -1452,7 +1445,7 @@ def checkPoland(iGameTurn):
break
if bFood:
wonUHV(Civ.POLAND, 0)
- if iGameTurn == year(1520) + 1:
+ if iGameTurn == year(1520) + turns(1):
expireUHV(Civ.POLAND, 0)
# UHV 2: Own at least 12 cities in the given provinces in 1569
@@ -1565,7 +1558,7 @@ def checkMorocco(iGameTurn):
if bConq:
wonUHV(Civ.MOROCCO, 2)
- if iGameTurn == year(1578) + 1:
+ if iGameTurn == year(1578) + turns(1):
expireUHV(Civ.MOROCCO, 2)
@@ -1643,7 +1636,7 @@ def checkPrussia(iGameTurn):
# UHV 2: Conquer two cities from each of Austria, Muscovy, Germany, Sweden, France and Spain between 1650 and 1763, if they are still alive
# Controlled in the onCityAcquired function
- if iGameTurn == year(1763) + 1:
+ if iGameTurn == year(1763) + turns(1):
expireUHV(Civ.PRUSSIA, 1)
# UHV 3: Settle a total of 15 Great People in your capital
@@ -1663,7 +1656,7 @@ def checkLithuania(iGameTurn):
# UHV 1: Accumulate 2500 Culture points without declaring a state religion before 1386
# The counter should be updated until the deadline for the challenge UHVs, even after UHV completion
- if iGameTurn < year(1386) + 2:
+ if iGameTurn < year(1386) + turns(2):
iCulture = (
player(Civ.LITHUANIA).getUHVCounter(0) + player(Civ.LITHUANIA).countCultureProduced()
)
@@ -1716,7 +1709,7 @@ def checkLithuania(iGameTurn):
if bConq:
wonUHV(Civ.LITHUANIA, 2)
- if iGameTurn == year(1795) + 1:
+ if iGameTurn == year(1795) + turns(1):
expireUHV(Civ.LITHUANIA, 2)
diff --git a/Assets/Python/Wonders.py b/Assets/Python/Wonders.py
index 94e1f438a..de9fa2a2c 100644
--- a/Assets/Python/Wonders.py
+++ b/Assets/Python/Wonders.py
@@ -8,6 +8,7 @@
message,
player,
text,
+ turns,
year,
cities,
)
@@ -55,7 +56,9 @@ def krak_des_chevaliers_acquired(owner, player, city, bConquest, bTrade):
@handler("BeginGameTurn")
def remove_lighthouse(iGameTurn):
# Absinthe: Remove the Great Lighthouse, message for the human player if the city is visible
- if iGameTurn == year(1323) - 40 + data.random_events[RandomEvent.LIGHTHOUSE_EARTHQUAKE]:
+ if iGameTurn == year(1323) + turns(
+ data.random_events[RandomEvent.LIGHTHOUSE_EARTHQUAKE]
+ ) - turns(40):
for iPlayer in civilizations().drop(Civ.BARBARIAN).ids():
bFound = 0
for city in cities.owner(iPlayer).entities():
diff --git a/Assets/Python/data/TimelineData.py b/Assets/Python/data/TimelineData.py
index 4634fec02..662411fbc 100644
--- a/Assets/Python/data/TimelineData.py
+++ b/Assets/Python/data/TimelineData.py
@@ -1,315 +1,84 @@
-# -*- coding: utf-8 -*-
-
from DataStructures import CompanyDataMapper, CivDataMapper
from CoreTypes import Civ, Company, Technology
-# TODO switch to years with convert from trun
# TODO change behavior in order to replace default values like 999 with None
-# Timeline of the mod, all important years to be references by year as opposed to hard-to-follow turn numbers
-# Important event Spawn UHV
-class DateTurn:
- i500AD = 0
- i504AD = 1
- i508AD = 2
- i520AD = 5
- i540AD = 10 # Gothic wars: Ravenna reconquered
- i552AD = 13
- i568AD = 17
- i600AD = 25 # Stirrup in the beginning of the 7th century
- i632AD = 33 # Spawn of Arabia / Byzantium UHV 1
- i635AD = 34
- i640AD = 35
- i660AD = 40
- i670AD = 43
- i680AD = 45 # Spawn of Bulgaria
- i700AD = 50
- i711AD = 53 # Spawn of Cordoba
- i712AD = 53
- i720AD = 55
- i752AD = 63
- i760AD = 65
- i768AD = 67
- i770AD = 68
- i778AD = 69
- i780AD = 70
- i800AD = 75
- i810AD = 78 # Spawn of Venice
- i840AD = 85 # France UHV 1
- i843AD = 86 # Treaty of Verdun / Spawn of Burgundy
- i844AD = 86
- i850AD = 88 # Greatest extent of the Abbasid Caliphate / Arabia UHV 1
- i852AD = 88
- i856AD = 89 # Spawn of Germany
- i860AD = 90
- i864AD = 91 # Rus' capital moved to Novgorod / Spawn of Novgorod
- i867AD = 92
- i872AD = 93 # Spawn of Norway
- i880AD = 95
- i882AD = 95 # Spawn of Kiev
- i892AD = 98
- i895AD = 99 # Honfoglalas / Spawn of Hungary
- i900AD = 100
- i910AD = 103 # Kingdom of Leon / Spawn of Spain
- i911AD = 104 # Establishment of the Duchy of Normandy
- i917AD = 106 # Bulgaria UHV 1
- i920AD = 107 # Kievan Rus - Pecheneg Wars
- i925AD = 108
- i936AD = 112 # Spawn of Denmark
- i940AD = 113
- i955AD = 118 # Basil defeats the Arabs
- i960AD = 120 # Spawn of Scotland
- i961AD = 120 # Cordoba UHV 1
- i962AD = 121 # HRE founded
- i966AD = 122 # Spawn of Poland
- i970AD = 123
- i972AD = 124
- i983AD = 128
- i987AD = 129
- i988AD = 129
- i1000AD = 133 # Start of the Defensive Crusades
- i1003AD = 134
- i1004AD = 135 # Venice UHV 1
- i1009AD = 136
- i1010AD = 137
- i1016AD = 139 # Muslims are defeated in Sardinia / Spawn of Genoa
- i1020AD = 140
- i1025AD = 142 # Death of Basil II
- i1032AD = 144
- i1040AD = 147 # Spawn of Morocco
- i1050AD = 150 # Denmark UHV 1
- i1053AD = 151
- i1057AD = 152
- i1060AD = 153 # First Crusade gets called
- i1061AD = 154
- i1064AD = 155 # Seljuk invasions begin
- i1066AD = 155 # Battle of Hastings / Spawn of England / Norway UHV 1
- i1067AD = 156
- i1077AD = 159
- i1080AD = 160
- i1085AD = 162
- i1089AD = 163
- i1094AD = 165
- i1096AD = 165 # First Crusade 1096-1099
- i1097AD = 166
- i1099AD = 166 # Conquest of Jerusalem
- i1101AD = 167
- i1107AD = 169 # Norwegian Crusade (1107-1110)
- i1110AD = 170
- i1120AD = 173
- i1124AD = 175
- i1136AD = 179 # Traditional beginning of the Novgorod Republic
- i1139AD = 180 # Spawn of Portugal
- i1144AD = 181 # Alchemy introduced in Europe
- i1147AD = 182 # Second Crusade 1147-1149
- i1150AD = 183 # First Swedish "Crusade"
- i1160AD = 187
- i1164AD = 188 # Spawn of Aragon
- i1167AD = 189 # Barbarossa wins against Rome / Germany UHV 1
- i1171AD = 190
- i1180AD = 193
- i1185AD = 195 # Rise of the 2nd Bulgarian Empire
- i1187AD = 196 # Third Crusade 1187-1192
- i1194AD = 198 # End of Norman rule in Sicily / Norway UHV 2
- i1198AD = 199 # German Crusade (1195–1198)
- i1200AD = 200
- i1202AD = 201 # Fourth Crusade 1202-1204
- i1204AD = 201 # Venice UHV 2
- i1210AD = 203 # Spawn of Sweden
- i1212AD = 204
- i1217AD = 206 # Fifth Crusade 1217-1221
- i1219AD = 206
- i1224AD = 208 # Spawn of Prussia
- i1227AD = 209
- i1229AD = 210 # Sixth Crusade 1228-1229
- i1230AD = 210
- i1236AD = 212 # Mongol invasions / Spawn of Lithuania
- i1240AD = 213 # Second Swedish "Crusade"
- i1242AD = 214 # Battle on the Ice
- i1248AD = 216 # Seventh Crusade 1248-1254, Fall of Cordoban Seville / Morocco UHV 1
- i1250AD = 217 # Kiev UHV 1
- i1259AD = 220 # Bulgaria UHV 2
- i1263AD = 221
- i1269AD = 223
- i1271AD = 224 # Eighth and Ninth Crusade 1270-1272
- i1281AD = 227
- i1282AD = 227 # Rise of the Habsburgs / Spawn of Austria / Byzantium UHV 2, Aragon UHV 1
- i1284AD = 228 # Aragonese Crusade (1284-1285) / Novgorod UHV 1
- i1288AD = 230 # End of the fist wave of Mongols / Kiev UHV 2
- i1291AD = 230 # Arabia UHV 2, France UHV 2
- i1293AD = 231 # Third Swedish "Crusade"
- i1296AD = 232 # Scotland UHV 1
- i1297AD = 232
- i1299AD = 233
- i1300AD = 233 # Kiev UHV 3
- i1309AD = 236 # Cordoba UHV 2
- i1320AD = 240 # Norway UHV 3
- i1323AD = 241 # Sweden UHV 1
- i1328AD = 243
- i1336AD = 245 # Burgundy UHV 1
- i1346AD = 248
- i1348AD = 249
- i1350AD = 250
- i1354AD = 251 # Earthquake of Gallipoli
- i1356AD = 252 # Spawn of the Ottomans
- i1359AD = 253
- i1362AD = 254 # Conquest of Adrianopolis
- i1371AD = 257
- i1376AD = 259 # Burgundy UHV 2
- i1377AD = 259
- i1380AD = 260 # Spawn of Moscow
- i1386AD = 262 # Lithuania UHV 1
- i1393AD = 264
- i1396AD = 265 # Battle of Nicopolis / Bulgaria UHV 3
- i1397AD = 266 # Kalmar Union / Novgorod UHV 2
- i1400AD = 267 # Genoa UHV 1
- i1401AD = 267
- i1410AD = 270 # Battle of Grunwald / Prussia UHV 1
- i1419AD = 273
- i1430AD = 277 # Death of Vytatutas (Lithuania greatest extent) / Lithuania UHV 2
- i1431AD = 277
- i1441AD = 280
- i1444AD = 281 # Battle of Varna, Hunyadi's Balkan Campaign / Aragon UHV 2
- i1449AD = 283
- i1452AD = 284 # End of the Hundred Years war / English UHV 1
- i1453AD = 284 # Conquest of Constantinople / Byzantium UHV 3
- i1461AD = 287
- i1465AD = 288 # Morocco UHV 2
- i1470AD = 290
- i1473AD = 291 # Burgundy UHV 3
- i1474AD = 291 # Aragon UHV 3
- i1478AD = 293 # Annexation of Novgorod / Novgorod UHV 3
- i1482AD = 294 # Moscow UHV 1
- i1490AD = 297 # Hungary UHV 1
- i1491AD = 297
- i1492AD = 297 # Cordoba UHV 3, Spain UHV 1
- i1494AD = 298
- i1500AD = 300 # Poland UHV 1 (start)
- i1514AD = 307 # Copernicus
- i1517AD = 308 # Printing Press / Ottoman UHV 1
- i1520AD = 310 # Poland UHV 1 (end)
- i1523AD = 311 # Denmark UHV 2
- i1525AD = 312
- i1526AD = 313 # Battle of Mohács, Ottoman invasion of Hungary
- i1530AD = 315
- i1540AD = 320
- i1541AD = 321 # Buda is lost to the Ottomans / Hungary UHV 2
- i1542AD = 321
- i1544AD = 322
- i1560AD = 330 # Scotland UHV 2
- i1566AD = 333 # Loss of Chios and the Genoese trade routes / Genoa UHV 3
- i1569AD = 334 # Union of Lublin / Poland UHV 2
- i1570AD = 335
- i1571AD = 336
- i1578AD = 339 # Morocco UHV 3
- i1580AD = 340
- i1581AD = 340 # Spawn of the Dutch
- i1588AD = 344 # Spain UHV 2
- i1600AD = 350
- i1616AD = 358 # Ottoman UHV 2
- i1617AD = 358 # Austria UHV 1
- i1618AD = 359 # Brandenburg-Prussia, Start of Thirty Years War
- i1620AD = 360
- i1623AD = 361 # Galileo
- i1625AD = 362
- i1631AD = 365
- i1640AD = 370 # Portugal UHV 2
- i1648AD = 374 # End of Thirty Years War / Germany UHV 3, Spain UHV 3
- i1650AD = 375 # Prussia UHV 2 (start)
- i1660AD = 380 # Sweden UHV 2
- i1670AD = 385
- i1680AD = 390
- i1683AD = 391 # Ottoman UHV 3
- i1687AD = 393
- i1690AD = 395 # Steam Engine
- i1699AD = 399
- i1700AD = 400 # Austria UHV 2, Scotland UHV 3
- i1707AD = 407 # Act of Union
- i1715AD = 415
- i1730AD = 430
- i1750AD = 450 # Dutch UHV 1, Sweden UHV 3
- i1763AD = 463 # Prussia UHV 2 (end)
- i1780AD = 480 # Austria UHV 3
- i1795AD = 495 # Partition of Poland / Lithuania UHV 3
- i1800AD = 500 # Industrial Era
-
-
CIV_BIRTHDATE = CivDataMapper(
{
- Civ.BYZANTIUM: DateTurn.i500AD,
- Civ.FRANCE: DateTurn.i500AD,
- Civ.ARABIA: DateTurn.i632AD,
- Civ.BULGARIA: DateTurn.i680AD,
- Civ.CORDOBA: DateTurn.i711AD,
- Civ.VENECIA: DateTurn.i810AD,
- Civ.BURGUNDY: DateTurn.i843AD,
- Civ.GERMANY: DateTurn.i856AD,
- Civ.NOVGOROD: DateTurn.i864AD,
- Civ.NORWAY: DateTurn.i872AD,
- Civ.KIEV: DateTurn.i882AD,
- Civ.HUNGARY: DateTurn.i895AD,
- Civ.CASTILE: DateTurn.i910AD,
- Civ.DENMARK: DateTurn.i936AD,
- Civ.SCOTLAND: DateTurn.i960AD,
- Civ.POLAND: DateTurn.i966AD,
- Civ.GENOA: DateTurn.i1016AD,
- Civ.MOROCCO: DateTurn.i1040AD,
- Civ.ENGLAND: DateTurn.i1066AD,
- Civ.PORTUGAL: DateTurn.i1139AD,
- Civ.ARAGON: DateTurn.i1164AD,
- Civ.SWEDEN: DateTurn.i1210AD,
- Civ.PRUSSIA: DateTurn.i1224AD,
- Civ.LITHUANIA: DateTurn.i1236AD,
- Civ.AUSTRIA: DateTurn.i1282AD,
- Civ.OTTOMAN: DateTurn.i1356AD,
- Civ.MOSCOW: DateTurn.i1380AD,
- Civ.DUTCH: DateTurn.i1581AD,
+ Civ.BYZANTIUM: 500,
+ Civ.FRANCE: 500,
+ Civ.ARABIA: 632,
+ Civ.BULGARIA: 680,
+ Civ.CORDOBA: 711,
+ Civ.VENECIA: 810,
+ Civ.BURGUNDY: 843,
+ Civ.GERMANY: 856,
+ Civ.NOVGOROD: 864,
+ Civ.NORWAY: 872,
+ Civ.KIEV: 882,
+ Civ.HUNGARY: 895,
+ Civ.CASTILE: 910,
+ Civ.DENMARK: 936,
+ Civ.SCOTLAND: 960,
+ Civ.POLAND: 966,
+ Civ.GENOA: 1016,
+ Civ.MOROCCO: 1040,
+ Civ.ENGLAND: 1066,
+ Civ.PORTUGAL: 1139,
+ Civ.ARAGON: 1164,
+ Civ.SWEDEN: 1210,
+ Civ.PRUSSIA: 1224,
+ Civ.LITHUANIA: 1236,
+ Civ.AUSTRIA: 1282,
+ Civ.OTTOMAN: 1356,
+ Civ.MOSCOW: 1380,
+ Civ.DUTCH: 1581,
}
-).fill_missing_members(DateTurn.i500AD)
+).fill_missing_members(500)
# Gives a stability penalty to AI civs past this date
CIV_COLLAPSE_DATE = CivDataMapper(
{
- Civ.BYZANTIUM: DateTurn.i1453AD,
- Civ.ARABIA: DateTurn.i1517AD,
- Civ.BULGARIA: DateTurn.i1396AD,
- Civ.CORDOBA: DateTurn.i1492AD,
- Civ.BURGUNDY: DateTurn.i1473AD,
- Civ.GERMANY: DateTurn.i1648AD,
- Civ.NOVGOROD: DateTurn.i1478AD,
- Civ.NORWAY: DateTurn.i1523AD,
- Civ.KIEV: DateTurn.i1300AD,
- Civ.HUNGARY: DateTurn.i1542AD,
- Civ.SCOTLAND: DateTurn.i1650AD,
- Civ.POLAND: DateTurn.i1780AD,
- Civ.GENOA: DateTurn.i1500AD,
- Civ.ARAGON: DateTurn.i1474AD,
- Civ.LITHUANIA: DateTurn.i1569AD,
+ Civ.BYZANTIUM: 1453,
+ Civ.ARABIA: 1517,
+ Civ.BULGARIA: 1396,
+ Civ.CORDOBA: 1492,
+ Civ.BURGUNDY: 1473,
+ Civ.GERMANY: 1648,
+ Civ.NOVGOROD: 1478,
+ Civ.NORWAY: 1523,
+ Civ.KIEV: 1300,
+ Civ.HUNGARY: 1542,
+ Civ.SCOTLAND: 1650,
+ Civ.POLAND: 1780,
+ Civ.GENOA: 1500,
+ Civ.ARAGON: 1474,
+ Civ.LITHUANIA: 1569,
}
).fill_missing_members(999)
# TODO unused
CIV_RESPAWNING_DATE = CivDataMapper(
{
- Civ.FRANCE: DateTurn.i1600AD,
- Civ.ARABIA: DateTurn.i1107AD,
- Civ.BULGARIA: DateTurn.i1185AD,
- Civ.CORDOBA: DateTurn.i1229AD,
- Civ.BURGUNDY: DateTurn.i1336AD,
- Civ.KIEV: DateTurn.i1648AD,
- Civ.HUNGARY: DateTurn.i1687AD,
- Civ.CASTILE: DateTurn.i1470AD,
- Civ.DENMARK: DateTurn.i1359AD,
- Civ.SCOTLAND: DateTurn.i1296AD,
- Civ.POLAND: DateTurn.i1410AD,
- Civ.MOROCCO: DateTurn.i1631AD,
- Civ.ENGLAND: DateTurn.i1660AD,
- Civ.PORTUGAL: DateTurn.i1400AD,
- Civ.ARAGON: DateTurn.i1500AD,
- Civ.SWEDEN: DateTurn.i1523AD,
- Civ.PRUSSIA: DateTurn.i1618AD,
- Civ.AUSTRIA: DateTurn.i1526AD,
- Civ.OTTOMAN: DateTurn.i1482AD,
+ Civ.FRANCE: 1600,
+ Civ.ARABIA: 1107,
+ Civ.BULGARIA: 1185,
+ Civ.CORDOBA: 1229,
+ Civ.BURGUNDY: 1336,
+ Civ.KIEV: 1648,
+ Civ.HUNGARY: 1687,
+ Civ.CASTILE: 1470,
+ Civ.DENMARK: 1359,
+ Civ.SCOTLAND: 1296,
+ Civ.POLAND: 1410,
+ Civ.MOROCCO: 1631,
+ Civ.ENGLAND: 1660,
+ Civ.PORTUGAL: 1400,
+ Civ.ARAGON: 1500,
+ Civ.SWEDEN: 1523,
+ Civ.PRUSSIA: 1618,
+ Civ.AUSTRIA: 1526,
+ Civ.OTTOMAN: 1482,
}
).fill_missing_members(999)
diff --git a/Assets/Python/screens/CvDawnOfMan.py b/Assets/Python/screens/CvDawnOfMan.py
index 01231c5fe..c68ad8b93 100644
--- a/Assets/Python/screens/CvDawnOfMan.py
+++ b/Assets/Python/screens/CvDawnOfMan.py
@@ -2,7 +2,7 @@
## Copyright Firaxis Games 2005
import math
-from Core import civilization, human, text, get_scenario_start_turn, turns, game
+from Core import civilization, human, text, get_scenario_start_turn, turns, game, year
import CvUtil
from CvPythonExtensions import *
@@ -215,7 +215,7 @@ def update(self, fDelta):
self.iLastTurn = iGameTurn
- iTotalAutoplay = civilization().date.birth - get_scenario_start_turn()
+ iTotalAutoplay = year(civilization().date.birth) - get_scenario_start_turn()
iAutoplayRemaining = game.getAIAutoPlay()
iAutoplayElapsed = iTotalAutoplay - iAutoplayRemaining
diff --git a/Assets/Python/screens/CvVictoryScreen.py b/Assets/Python/screens/CvVictoryScreen.py
index c64175865..dcf36f6f2 100644
--- a/Assets/Python/screens/CvVictoryScreen.py
+++ b/Assets/Python/screens/CvVictoryScreen.py
@@ -3658,7 +3658,7 @@ def checkScores(self, tCompetitors):
pTestPlayer = gc.getPlayer(iLoopPlayer)
sCivShortName = str(pTestPlayer.getCivilizationShortDescriptionKey())
# unknown: if not yet born, or alive but no contact
- if iGameTurn <= civilization(iLoopPlayer).date.birth or (
+ if iGameTurn <= year(civilization(iLoopPlayer).date.birth) or (
not gc.getPlayer(self.iActivePlayer).canContact(iLoopPlayer)
and pTestPlayer.isAlive()
):
@@ -3679,9 +3679,9 @@ def CollapseOrVassal(self, lEnemies):
pEnemy = gc.getPlayer(iEnemy)
teamEnemy = gc.getTeam(iEnemy)
sCivShortName = str(pEnemy.getCivilizationShortDescriptionKey())
- if (
- pEnemy.isAlive() and not teamEnemy.isVassal(teamOwn.getID())
- ) or iGameTurn <= civilization(iEnemy).date.birth:
+ if (pEnemy.isAlive() and not teamEnemy.isVassal(teamOwn.getID())) or iGameTurn <= year(
+ civilization(iEnemy).date.birth
+ ):
sStringMiss += " " + u"%s" % (text(sCivShortName))
else:
sStringConq += " " + u"%s" % (text(sCivShortName))
@@ -3700,7 +3700,7 @@ def ConquerOrVassal(self, lEnemies):
pEnemy = gc.getPlayer(iEnemyCiv)
teamEnemy = gc.getTeam(iEnemyCiv)
sCivShortName = str(pEnemy.getCivilizationShortDescriptionKey())
- if iGameTurn <= civilization(iEnemyCiv).date.birth:
+ if iGameTurn <= year(civilization(iEnemyCiv).date.birth):
sStringMiss += " " + u"%s" % (text(sCivShortName))
elif (
not pEnemy.isAlive()
diff --git a/Assets/Python/screens/ScreensHandler.py b/Assets/Python/screens/ScreensHandler.py
index 5e10780f0..a501e5729 100644
--- a/Assets/Python/screens/ScreensHandler.py
+++ b/Assets/Python/screens/ScreensHandler.py
@@ -17,6 +17,7 @@
human,
player,
text,
+ year,
)
from MiscData import MODNET_EVENTS
from CityMapData import CITIES_MAP
@@ -169,7 +170,7 @@ def onGameStart():
if gc.getGame().getStartEra() == gc.getDefineINT("STANDARD_ERA") or gc.getGame().isOption(
GameOptionTypes.GAMEOPTION_ADVANCED_START
):
- if civilization().date.birth <= get_scenario_start_turn():
+ if year(civilization().date.birth) <= get_scenario_start_turn():
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setText(u"showDawnOfMan")
diff --git a/Assets/XML/GlobalDefinesVersion.xml b/Assets/XML/GlobalDefinesVersion.xml
index 879357c86..924120b7e 100644
--- a/Assets/XML/GlobalDefinesVersion.xml
+++ b/Assets/XML/GlobalDefinesVersion.xml
@@ -2,6 +2,6 @@
RFCE_MOD_VERSION
- 1.6.5-4
+ 1.6.5-5