Skip to content

Commit

Permalink
Can refuse demands on cities owned by vassals
Browse files Browse the repository at this point in the history
  • Loading branch information
dguenms committed Aug 14, 2022
1 parent f6eb428 commit fc944ed
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
23 changes: 22 additions & 1 deletion Assets/Python/Congresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ def applyVotes(self):
for (x, y), (iClaimant, iVotes) in dResults.items():
plot = plot_(x, y)

bCanRefuse = (plot.getOwner() == active() and active() not in self.dVotedFor[iClaimant] and not (self.bPostWar and active() in self.losers))
bCanRefuse = self.canRefuse(iClaimant, plot)

if plot.isCity():
self.lAssignments.append((plot.getPlotCity().getName(), plot.getOwner(), iClaimant))
Expand All @@ -640,6 +640,27 @@ def applyVotes(self):
else:
# without human cities affected, finish the congress immediately
self.finishCongress()

def canRefuse(self, iClaimant, plot):
if not self.isHumanOwned(plot):
return False

if active() in self.dVotedFor[iClaimant]:
return False

if self.bPostWar and active() in self.losers:
return False

return True

def isHumanOwned(self, plot):
if plot.getOwner() == active():
return True

if plot.isOwned() and team(plot.getTeam()).isVassal(player().getTeam()):
return True

return False

def assignCity(self, iPlayer, iOwner, (x, y)):
assignedCity = city(x, y)
Expand Down
4 changes: 0 additions & 4 deletions Assets/Python/EntryPoints/CvRandomEventInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2899,10 +2899,6 @@ def canTriggerCrusade(argsList):
return false

if gc.getPlayer(holyCity.getOwner()).getStateReligion() not in [iOrthodoxy, iCatholicism, iProtestantism]:
kActualTriggeredDataObject = player.getEventTriggered(kTriggeredData.iId)
kActualTriggeredDataObject.iOtherPlayerCityId = holyCity.getID()
kActualTriggeredDataObject.eOtherPlayer = holyCity.getOwner()

return true

return false
Expand Down

0 comments on commit fc944ed

Please sign in to comment.