I'm working on a scenario and trying to make an exception to the 32 tile outside of your core area (or whatever, its on the stability maps anyway) rule. This is done in Stabilty.py and my code looks like this:
With the limited knowledge of Python I have, I'm trying to get the Mongols to receive a greater penalty than the standard one. If I'm reading the original code correctly, then the value of 32 is subtracted from the number of plots outside of the core area. After this the result is firstly multiplied with 2 and thereafter divided by 7.
So if one has 40 "OwnedPlotsLastTurn" tiles this gives a value of 8 for iNumPlotsAbroad. This is then multiplied by 2 and divided by 7, giving you a NewBaseStability of ~2.28, which is then - if I'm reading the code correctly - rounded down to an even (negative) 2. The base stability penalty for 40 abroad tiles is therefore -2.
As for my own additions to the code, the Mongols would be getting the full iNumPlotsAbroad as their penalty, which amounts to -8. That's would be four times the penalty.
Why aren't I testing it out for myself to see what the results are? Well, I am as a matter of fact. But it will take a considerable time to figure out if it really works as intended, and I still wouldn't know if I have done it right. (I could just be misinterpreting an unforeseen result as something else.) Can anyone conform this?
Also, I'm kinda curios about all these variants of the equal sign used in Python:
Does anyone have a good link to a source on all these signs? It would help if I knew which one to use...
Code:
iTempExpansionThreshold = iNewBaseStability
iNumPlotsAbroad = max(0,self.getOwnedPlotsLastTurn(iPlayer)-32)
[COLOR="Red"]if (not iPlayer == con.iMongolia):[/COLOR]
iNewBaseStability -= iNumPlotsAbroad*2/7
[COLOR="Red"]else:
iNewBaseStability -= iNumPlotsAbroad[/COLOR]
So if one has 40 "OwnedPlotsLastTurn" tiles this gives a value of 8 for iNumPlotsAbroad. This is then multiplied by 2 and divided by 7, giving you a NewBaseStability of ~2.28, which is then - if I'm reading the code correctly - rounded down to an even (negative) 2. The base stability penalty for 40 abroad tiles is therefore -2.
As for my own additions to the code, the Mongols would be getting the full iNumPlotsAbroad as their penalty, which amounts to -8. That's would be four times the penalty.
Why aren't I testing it out for myself to see what the results are? Well, I am as a matter of fact. But it will take a considerable time to figure out if it really works as intended, and I still wouldn't know if I have done it right. (I could just be misinterpreting an unforeseen result as something else.) Can anyone conform this?
Also, I'm kinda curios about all these variants of the equal sign used in Python:
=
>=
=<
!=
==
+=
-=
Does anyone have a good link to a source on all these signs? It would help if I knew which one to use...