Skip to content

Commit

Permalink
Remove .value from IntEnum (#51)
Browse files Browse the repository at this point in the history
* Remove .value

* Fix value for find fct

* Simple refacto

* Fix value for enum
  • Loading branch information
VDuchauffour authored Jun 3, 2024
1 parent 8634e96 commit fd954d1
Show file tree
Hide file tree
Showing 40 changed files with 4,095 additions and 4,097 deletions.
4 changes: 2 additions & 2 deletions Assets/Python/Civilizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def set_starting_techs_1200AD(iCiv):


def set_starting_diplomacy_1200AD():
change_attitude_extra_between_civ(Civ.BYZANTIUM.value, Civ.ARABIA.value, -2)
change_attitude_extra_between_civ(Civ.SCOTLAND.value, Civ.FRANCE.value, 4)
change_attitude_extra_between_civ(Civ.BYZANTIUM, Civ.ARABIA, -2)
change_attitude_extra_between_civ(Civ.SCOTLAND, Civ.FRANCE, 4)


def set_initial_contacts(iCiv, bMeet=True):
Expand Down
158 changes: 79 additions & 79 deletions Assets/Python/CvEventManager.py

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Assets/Python/CvGameUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def AI_unitUpdate(self, argsList):
and not AIpPlayer.isHuman()
and AIpPlayer.isAlive()
):
if pUnit.getUnitType() == Unit.PROSECUTOR.value:
if pUnit.getUnitType() == Unit.PROSECUTOR:
return self.doInquisitorCore_AI(pUnit)
return False

Expand Down Expand Up @@ -274,14 +274,14 @@ def isHasPurgeTarget(self, argsList):
if bCanPurge:
for pCity in apCityList:
if pCity.GetCy().isHasReligion(
iReligion.value
) and not pCity.GetCy().isHolyCityByType(iReligion.value):
iReligion
) and not pCity.GetCy().isHolyCityByType(iReligion):
# do not purge religions with an associated wonder in the city
bWonder = False
for iBuilding in xrange(gc.getNumBuildingInfos()): # type: ignore # type: ignore
if pCity.GetCy().getNumRealBuilding(iBuilding):
BuildingInfo = gc.getBuildingInfo(iBuilding)
if BuildingInfo.getPrereqReligion() == iReligion.value:
if BuildingInfo.getPrereqReligion() == iReligion:
if isWorldWonderClass(
BuildingInfo.getBuildingClassType()
) or isNationalWonderClass(
Expand Down Expand Up @@ -596,13 +596,13 @@ def getBuildingCostMod(self, argsList):
iDiscount = 0

# Absinthe: Borgund Stave Church start
if pPlayer.countNumBuildings(Wonder.BORGUND_STAVE_CHURCH.value) > 0:
if Building.PAGAN_SHRINE.value <= iBuilding <= Building.RELIQUARY.value:
if pPlayer.countNumBuildings(Wonder.BORGUND_STAVE_CHURCH) > 0:
if Building.PAGAN_SHRINE <= iBuilding <= Building.RELIQUARY:
iDiscount += 40
# Absinthe: Borgund Stave Church end

# Absinthe: Blue Mosque start
if pPlayer.countNumBuildings(Wonder.BLUE_MOSQUE.value) > 0:
if pPlayer.countNumBuildings(Wonder.BLUE_MOSQUE) > 0:
if pPlayer.getCapitalCity().getNumActiveBuilding(iBuilding) and not pCity.isCapital():
iDiscount += 20
# Absinthe: Blue Mosque end
Expand Down Expand Up @@ -1018,7 +1018,7 @@ def doAnarchyInstability(self, argsList):
sta.recalcEpansion(iPlayer)
iNumCities = pPlayer.getNumCities()
# anarchy instability should appear right on revolution / converting, not one turn later
if iPlayer != Civ.PRUSSIA.value: # Prussian UP
if iPlayer != Civ.PRUSSIA: # Prussian UP
if pPlayer.isHuman():
# anarchy swing instability
pPlayer.setStabilitySwing(pPlayer.getStabilitySwing() - 8)
Expand All @@ -1027,7 +1027,7 @@ def doAnarchyInstability(self, argsList):
) # the value doesn't really matter, but has to remain > 0 after the first StabSwingAnarchy check of sta.updateBaseStability
# anarchy base instability
pPlayer.changeStabilityBase(
StabilityCategory.CIVICS.value, min(0, max(-2, (-iNumCities + 4) / 7))
StabilityCategory.CIVICS, min(0, max(-2, (-iNumCities + 4) / 7))
) # 0 with 1-4 cities, -1 with 5-11 cities, -2 with at least 12 cities

else:
Expand All @@ -1038,7 +1038,7 @@ def doAnarchyInstability(self, argsList):
) # the value doesn't really matter, but has to remain > 0 after the first StabSwingAnarchy check of sta.updateBaseStability
# anarchy base instability
pPlayer.changeStabilityBase(
StabilityCategory.CIVICS.value, min(0, max(-1, (-iNumCities + 6) / 7))
StabilityCategory.CIVICS, min(0, max(-1, (-iNumCities + 6) / 7))
) # reduced for the AI: 0 with 1-6 cities, -1 with at least 7

lResult = 1
Expand Down
Loading

0 comments on commit fd954d1

Please sign in to comment.