I'm playtesting it now to see what happens. I can just see somebody attaching a Great General to a tank and letting all hell break lose on a weaker Civ to get this awesome unit...
I didn't check that. I have made some adjustments (increased the survival and heal chances to 20%, for example).
I do have a recommendation for the Marauder promotion. Is there any way to add an announcement at the top of the screen that tells you how much gold your troops stole? For some reason, I think I am exceeding your 20 gold per unit theft cap.
if playerY.getGold( ) >= 500:
playerY.changeGold( -20 )
elif playerY.getGold( ) >= 25:
playerY.changeGold( -iGoldStolen )
elif (playerY.getGold( ) >= 1) and (playerY.getGold( ) < 25):
playerY.changeGold( -1 )
iGold2 = playerX.getGold( )
if playerY.getGold( ) >= 500:
playerX.changeGold( +20 )
elif playerY.getGold( ) >= 25:
playerX.changeGold( +iGoldStolen )
else:
playerX.changeGold( +1 )
You would think, with several semesters of programming and I don't know how many hours of MATLAB debugging, I would have caught that. That's definitely the reason why I got 44 gold out of a single battle.
I know the programming frustrations, though...currently, I'm struggling with getting events to trigger properly. I've done 23 and they work perfectly, but for some reason my last 3 are just utter failures. And don't get me started on my hackneyed attempts at Python.
To my understanding, if your unit was "destroyed", the combat ends with your unit at 10% strength in the same tile, and the victorious unit stays put, with any experience gained from the combat.
EDIT: I should warn you this function operates on the defense, not offense.
If I was just updating my current (read: already merged) promotion so that I receive the message, what all do I have to do? I figure there is an XML entry and then something in python pointing to the message to be displayed...
EDIT: Never mind, it's pretty obvious when you look at the Python code what has changed. Thanks for the good commenting on the code!
pPlayer = gc.getPlayer(pWinner.getOwner())
if pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_MARAUDER')):
pPlayer = gc.getPlayer(pWinner.getOwner())
iGold = playerY.getGold( )
[B] message = 0[/B]
iGoldStolen = ( iGold//25 )
if playerY.getGold( ) >= 500:
playerY.changeGold( -20 )
elif playerY.getGold( ) >= 25:
playerY.changeGold( -iGoldStolen )
elif (playerY.getGold( ) >= 1) and (playerY.getGold( ) < 25):
playerY.changeGold( -1 )
iGold2 = playerX.getGold( )
if playerY.getGold( ) >= 500:
playerX.changeGold( +20 )
[B] message = 1[/B]
elif playerY.getGold( ) >= 25:
playerX.changeGold( +iGoldStolen )
[B] message = 2[/B]
else:
playerX.changeGold( +1 )
[B] message = 3[/B]
[B] pPID = pPlayer.getID()
iX = pWinner.getX()
iY = pWinner.getY()
szName = pPlayer.getName()
## This only controls the text, all actual gold amounts are done above:
iGoldStolenMax = ( 500//25 )
iGoldStolenMin = ( 25//25 )
if ( message == 1 ):
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_MARAUDER_GOLD1",(szName,iGoldStolenMax)),'',0,',Art/Interface/Buttons/TechTree/Banking.dds,Art/Interface/Buttons/TechTree_Atlas.dds,8,1',ColorTypes(44), iX, iY, True,True)
### message: %s1 has plundered %d2 [ICON_GOLD]!###
if ( message == 2 ):
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_MARAUDER_GOLD2",(szName,iGoldStolen)),'',0,',Art/Interface/Buttons/TechTree/Banking.dds,Art/Interface/Buttons/TechTree_Atlas.dds,8,1',ColorTypes(44), iX, iY, True,True)
### message: %s1 has plundered %d2 [ICON_GOLD]!###
if ( message == 3 ):
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_MARAUDER_GOLD3",(szName,iGoldStolenMin)),'',0,',Art/Interface/Buttons/TechTree/Banking.dds,Art/Interface/Buttons/TechTree_Atlas.dds,8,1',ColorTypes(44), iX, iY, True,True)
### message: %s1 has plundered %d2 [ICON_GOLD]!###[/B]
I'm not sure I've really understood how the code works. So if:
"self.iResistance = self.getRandomNumber( 9 )
Sets the chance of survival. 9 is a 10% chance since the game includes 0 in the random number. So making it call 4 instead of 9 would raise it to a 20% chance, calling 1 would be a 50% chance, etc."
Why 4 set a 20% chance? How these accounts works?
And what value should be set to determine a 25% chance of survival, or a 35%, or a 70% chance, for example?
Why 4 set a 20% chance? How these accounts works?
And what value should be set to determine a 25% chance of survival, or a 35%, or a 70% chance, for example?