if iFeature == iFlames:
if CyGame().getSorenRandNum(100, "Flames") <= iFlamesSpreadChance:
iX = pPlot.getX()
iY = pPlot.getY()
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
pAdjacentPlot = CyMap().plot(iiX,iiY)
if (pAdjacentPlot.getFeatureType() == iForest or pAdjacentPlot.getFeatureType() == iJungle):
pAdjacentPlot.setFeatureType(iFlames, 0)
Multiple places:
There is still the defect of conflating <= with < and > with >= in cases of percentage probability. An example:
This results in a minimum of a 6% chance, and a maximum of a 96% chance, of a unit being gifted, since the result from getSorenRandNum is 0..99. I suspect the desired numbers are 5% and 95%; this could be fixed by using:
Spoiler:
Code:
if CyGame().getSorenRandNum(100, "Gift Unit") [B]>=[/B] iChance:
iUnit = -1
More examples
Spoiler:
Code:
if iFeature == iFlames:
if CyGame().getSorenRandNum(100, "Flames") [B]<[/B] iFlamesSpreadChance:
iX = pPlot.getX()
iY = pPlot.getY()
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
pAdjacentPlot = CyMap().plot(iiX,iiY)
if (pAdjacentPlot.getFeatureType() == iForest or pAdjacentPlot.getFeatureType() == iJungle):
pAdjacentPlot.setFeatureType(iFlames, 0)
if iTerrain != iBurningSands:
if CyGame().getSorenRandNum(100, "Flames") [B]<[/B] iFlamesExpireChance:
pPlot.setFeatureType(iForestBurnt, -1)
if iTerrain == iBurningSands:
if CyGame().getSorenRandNum(100, "Flames") [B]<[/B] iFlamesSpreadChance:
pPlot.setFeatureType(iFlames, 0)
If you want iFlamesSpreadChance and iFlamesExpireChance to be percentage chances, then use:
Spoiler:
Code:
if iFeature == iFlames:
if CyGame().getSorenRandNum(100, "Flames") [B]< [/B]iFlamesSpreadChance:
iX = pPlot.getX()
iY = pPlot.getY()
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
pAdjacentPlot = CyMap().plot(iiX,iiY)
if (pAdjacentPlot.getFeatureType() == iForest or pAdjacentPlot.getFeatureType() == iJungle):
pAdjacentPlot.setFeatureType(iFlames, 0)
if iTerrain != iBurningSands:
if CyGame().getSorenRandNum(100, "Flames") [B]<[/B] iFlamesExpireChance:
pPlot.setFeatureType(iForestBurnt, -1)
if iTerrain == iBurningSands:
if CyGame().getSorenRandNum(100, "Flames") [B]<[/B] iFlamesSpreadChance:
pPlot.setFeatureType(iFlames, 0)
Otherwise, they are 1 less than the actual percentage chance. In other words, if you set them to 0 via XML, there will still be a 1% chance of occurrence; -1 would turn them off.
Here's another example:
Spoiler:
Code:
def mutate(self, pUnit):
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_MUTATED')) == False:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MUTATED'),True)
iRnd = CyGame().getSorenRandNum(100, "Mutation")
if iRnd <= 15:
pUnit.changeExtraCombatStr(-1)
if iRnd >= 60:
pUnit.changeExtraCombatStr(1)
if iRnd >= 85:
pUnit.changeExtraCombatStr(1)
if CyGame().getSorenRandNum(100, "Mutation") <= 15:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'),True)
if CyGame().getSorenRandNum(100, "Mutation") <= 15:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_CRAZED'),True)
if CyGame().getSorenRandNum(100, "Mutation") <= 10:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DISEASED'),True)
if CyGame().getSorenRandNum(100, "Mutation") <= 10:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_VULNERABLE_TO_FIRE'),True)
if CyGame().getSorenRandNum(100, "Mutation") <= 5:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MAGIC_RESISTANCE'),True)
if CyGame().getSorenRandNum(100, "Mutation") <= 5:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_REGENERATION'),True)
if CyGame().getSorenRandNum(100, "Mutation") <= 5:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_WITHERED'),True)
In the above example, assuming that the desired chances are 15%, 40%, 15%, 15% (twice), 10% (three times) and 5% (3 times), the correct code would be:
Spoiler:
Code:
def mutate(self, pUnit):
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROMOTION_MUTATED')) == False:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MUTATED'),True)
iRnd = CyGame().getSorenRandNum(100, "Mutation")
if iRnd [B]<[/B] 15:
pUnit.changeExtraCombatStr(-1)
if iRnd >= 60:
pUnit.changeExtraCombatStr(1)
if iRnd >= 85:
pUnit.changeExtraCombatStr(1)
if CyGame().getSorenRandNum(100, "Mutation") [B]<[/B] 15:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'),True)
if CyGame().getSorenRandNum(100, "Mutation") [B]<[/B] 15:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_CRAZED'),True)
if CyGame().getSorenRandNum(100, "Mutation") [B]<[/B] 10:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DISEASED'),True)
if CyGame().getSorenRandNum(100, "Mutation") [B]<[/B] 10:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_VULNERABLE_TO_FIRE'),True)
if CyGame().getSorenRandNum(100, "Mutation") [B]<[/B] 5:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MAGIC_RESISTANCE'),True)
if CyGame().getSorenRandNum(100, "Mutation") [B]<[/B] 5:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_REGENERATION'),True)
if CyGame().getSorenRandNum(100, "Mutation") [B]<[/B] 5:
pUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_WITHERED'),True)
In the following examples, just change any comparison with getSorenRandNum from <= to < or > to >=:
Spoiler:
Code:
onBuildingBuilt
.
.
.
if iBuildingType == gc.getInfoTypeForString('BUILDING_INFERNAL_GRIMOIRE'):
if CyGame().getSorenRandNum(100, "Bob") [B]<=[/B] 20:
Spoiler:
Code:
onUnitBuilt
.
.
.
if city.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_CHANCEL_OF_GUARDIANS')) > 0:
iRnd = CyGame().getSorenRandNum(100, "Bob")
if iRnd [B]<= [/B]20:
.
.
.
if (city.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_ASYLUM')) > 0 and unit.isAlive()):
if CyGame().getSorenRandNum(100, "Bob") [B]<=[/B] 25:
unit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_CRAZED'), True)
unit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_ENRAGED'), True)
onCityDoTurn
.
.
.
if (pUnit.getUnitType() == gc.getInfoTypeForString('UNIT_LOKI') and CyGame().getSorenRandNum(100, "Loki") [B]<=[/B] gc.getDefineINT('LOKI_UNREST_CHANCE')):
.
.
.
if CyGame().getSorenRandNum(10000, "Planar Gate") [B]<=[/B] gc.getDefineINT('PLANAR_GATE_CHANCE') * iMult:
Spoiler:
Code:
doArmageddonApocalypse
.
.
.
if (CyGame().getSorenRandNum(100, "Apocalypse") [B]<=[/B] iPercent):
Spoiler:
Code:
doArmageddonBlight
.
.
.
if (iRand [B]<=[/B] 25):
pPlot.setBonusType(-1)
if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_ICE'):
iRand = CyGame().getSorenRandNum(100, "Blight")
if (iRand [B]<=[/B] 50):
pPlot.setFeatureType(-1, -1)
if pPlot.getTerrainType() == gc.getInfoTypeForString('TERRAIN_PLAINS'):
iRand = CyGame().getSorenRandNum(100, "Blight")
if (iRand [B]<=[/B] 25):
Spoiler:
Code:
doArmageddonHellfire
.
.
.
if CyGame().getSorenRandNum(10000, "Hellfire") [B]<=[/B] iHellfireChance:
Spoiler:
Code:
doArmageddonWrath
.
.
.
if (CyGame().getSorenRandNum(100, "Wrath") [B]<=[/B] iWrathConvertChance and isWorldUnitClass(pUnit.getUnitClassType()) == False):
cannotTrain
This code triggers on buildings, not building classes - so for example, BUILDING_TRAINING_YARD will never trigger for the Bannor.
This code is very aggressive - it disallows the building of early units if that player can build appropriate buildings, even if no such buildings yet exist.
Spoiler:
Code:
if eUnitClass == gc.getInfoTypeForString('UNITCLASS_WARRIOR'):
if pPlayer.canConstruct(gc.getInfoTypeForString('BUILDING_TRAINING_YARD'), False, False, False):
return True
if pPlayer.canConstruct(gc.getInfoTypeForString('BUILDING_ARCHERY_RANGE'), False, False, False):
return True
if eUnitClass == gc.getInfoTypeForString('UNITCLASS_SCOUT'):
if pPlayer.canConstruct(gc.getInfoTypeForString('BUILDING_HUNTING_LODGE'), False, False, False):
return True
if pPlayer.canConstruct(gc.getInfoTypeForString('BUILDING_STABLES'), False, False, False):
return True
I would also change cannotConstruct to be based on building class.
Spoiler:
Code:
def cannotConstruct(self,argsList):
pCity = argsList[0]
eBuilding = argsList[1]
bContinue = argsList[2]
bTestVisible = argsList[3]
bIgnoreCost = argsList[4]
pPlayer = gc.getPlayer(pCity.getOwner())
if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_CULTURAL_VALUES')) == gc.getInfoTypeForString('CIVIC_CRUSADE'):
if eBuilding == gc.getInfoTypeForString('BUILDING_ELDER_COUNCIL'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_MARKET'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_OBELISK'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_MONEYCHANGER'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_THEATRE'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_AQUEDUCT'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_PUBLIC_BATHS'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_HERBALIST'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_CARNIVAL'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_COURTHOUSE'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_GAMBLING_HOUSE'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_GRANARY'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_SMOKEHOUSE'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_BREWERY'):
return True
OnBuildingBuilt appears to have the logic for getting rid of older altars of the Luonnotar. The problem is that one could also gain one through trade (trading a city for something else), or cultural acquisition. You may want to hang this code on somewhere more generic; I'd be tempted to use CvPlayer::changeBuildingClassCount.
New forests don't burn due to Acheron's being built. Perhaps this is deliberate?
Spoiler:
Code:
onUnitBuilt
.
.
.
if unit.getUnitType() == gc.getInfoTypeForString('UNIT_ACHERON'):
city.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_THE_DRAGONS_HORDE'), 1)
iX = city.getX()
iY = city.getY()
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
pPlot = CyMap().plot(iiX,iiY)
if (pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_FOREST') or pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_JUNGLE')):
pPlot.setFeatureType(gc.getInfoTypeForString('FEATURE_FLAMES'), 0)
cf.addPopup(CyTranslator().getText("TXT_KEY_POPUP_ACHERON_CREATION",()), 'art/interface/popups/Acheron the Red Dragon.dds')
[/SPOILER]
Why is def getHero(self, pPlayer) defined in two different files?
I've had two games in a row where Acheron (red dragon) sets up shop in a barb city and then just disappears randomly maybe around 50 turns later. I had units parked outside both times and there were no AI units in the area that could have killed him.
more multiplayer tests, and it seems that AI players are the real causes of OOS somehow.
haven't had any OOS in games with only humans, but games have gone OOS on the first turn if theres a single AI in (Auric in the tests), and the games with AIs invariably go OOS while those without we have no problems.
more multiplayer tests, and it seems that AI players are the real causes of OOS somehow.
haven't had any OOS in games with only humans, but games have gone OOS on the first turn if theres a single AI in (Auric in the tests), and the games with AIs invariably go OOS while those without we have no problems.
There is a bug with Hidden Nationality that I am checking right now that can cause this. If the barb units have hidden nationality then thats what you are seeing.
i dont think either where hidden nationality as it was an amurite scout with a barbarian goblin.
warriors can be Drowned for free and dont lose movement points either, and they'd look even better if they were reskinned blue heh
i was wondering about Imperalist being removed, it sounded like a perfect bannor trait.. any chance of reworking it to be better? the cheaper settlers seemed like itd be fun, and if it could help with great commanders (rather than great generals) somehow itd be great
Manes dont spawn after razing cities.
Razed 2 Kuriotates cities (6 and 8 pop). After razing 6 pop city i had to wait 5 turns to recive 1 manes. After 8 pop city i have not recived any.
Mercurians did not enter after 50 turns after Hyborem spawned (dont know if Gate wasnt build, but usually they spawn like 10 turns after Hyborem)
As Hyborem spawned i instantly switched to play as him, but he allready had 1 city built and 1 manes chenged to swordsman.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.