This is the current Russian UP from UniquePowers.py:
Firstly, the tiles within the defined map coordinates are checked every single turn (after the Russian spawn). This is wasteful since most of the time there will be no foreign unit in this area - and unless they are an invading force the rule won't apply anyway.
Secondly, the AI loses its capacity to carry out offensive operations because every single unit gets automatic damage on every turn - even while stationary and healing previous damage. So it would help if only moving units were affected by this - healing is already hampered outside of friendly territory.
This is why I'm proposing a mod-mod (or rather a mod-mod-component) that relies on the onUnitMove callup from the SDK. This event needs to be included in CvRFCEventHandler.py and the call to russianUP() needs to be located here instead of being connected to the onBeginGameTurn via UniquePowers.UniquePowers.checkTurn().
This is what the improved russianUP() method could look like:
Also, these assignment statements should go into the top of the module - there is no need to define these every single time:
This would also mean that the invading unit must move from one Russian tile into another Russian tile, which is somewhat less severe as the current rule. But this can easily be edited out by deleting the red marked code above. Or the amount of damage could be increased to compensate.
Thoughts? Ideas?
Code:
#------------------RUSSIAN U.P.-------------------
def russianUP(self):
pRussia = gc.getPlayer(iRussia)
teamRussia = gc.getTeam(pRussia.getTeam())
for x in range(tRussianTopLeft[0], tRussianBottomRight[0]):
for y in range(tRussianTopLeft[1], tRussianBottomRight[1]):
pCurrent = gc.getMap().plot( x, y )
if (pCurrent.getOwner() == iRussia):
iNumUnitsInAPlot = pCurrent.getNumUnits()
if (iNumUnitsInAPlot):
for i in range(iNumUnitsInAPlot):
unit = pCurrent.getUnit(i)
if (teamRussia.isAtWar(unit.getOwner())):
## print("hp", unit.currHitPoints() )
## print("damage", unit.getDamage() )
unit.setDamage(unit.getDamage()+8, iRussia)
## print("hp now", unit.currHitPoints()
## print("damage", unit.getDamage() )
Secondly, the AI loses its capacity to carry out offensive operations because every single unit gets automatic damage on every turn - even while stationary and healing previous damage. So it would help if only moving units were affected by this - healing is already hampered outside of friendly territory.
This is why I'm proposing a mod-mod (or rather a mod-mod-component) that relies on the onUnitMove callup from the SDK. This event needs to be included in CvRFCEventHandler.py and the call to russianUP() needs to be located here instead of being connected to the onBeginGameTurn via UniquePowers.UniquePowers.checkTurn().
This is what the improved russianUP() method could look like:
Code:
def russianUP(self, pUnit, pPlot, pOldPlot):
iOwner = pUnit.getOwner()
iOwnerTeam = gc.getPlayer(iOwner).getTeam()
if pRussia.isAlive() and teamRussia.isAtWar(iOwnerTeam):
if iOwner != [COLOR="Red"]pOldPlot.getOwner() == [/COLOR]pPlot.getOwner() == iRussia:
pUnit.setDamage(pUnit.getDamage() + [COLOR="Red"]8[/COLOR], iRussia)
Code:
pRussia = gc.getPlayer(iRussia)
teamRussia = gc.getTeam(pRussia.getTeam())
Thoughts? Ideas?