Code associated with Mercurians and Infernals?

LightofAbraxas

Chieftain
Joined
Sep 9, 2011
Messages
30
Alright, I have another question for you helpful folks. I wanted to play around with how the infernals and mercurians are summoned, but I can't locate the Python code. It doesn't seem to link to any files in the spellinterface file or be called directly from the tech xml file. Would anyone happen to know where the code is located?

What I'm trying to do is to do is this:

1) Bring the mercurians in controlled directly by the player summoning them (I thought maybe I could look at the Tolerant code to make this happen) or put them into a permanent alliance rather than a team.

2) Play around with how and where the infernal civ is summoned to see if I can't make them more competitive in situations where the map is (almost) fully colonized.

So, anyway, the first step is actually being able to find where this is handled. Thanks in advance!
 
In base FfH2, the code that summons the Mercurians and the Infernals is found in CvEventManager.py, with the Mercurian portion starting at line 772 under def onBuildingBuilt(self, argsList): and the Infernal portion starting at line 1754 under def onTechAcquired(self, argsList):


(In my modmod I moved the Infernal summoning code to def onProjectBuilt(self, argsList): and the Mercurian summoning code to CvSpellInterface.py. The Mercurian Gate allows 2 spells, one to summon the Mercurians to join your team and one bring them back again if they have already been defeated. The Infernal Pact ritual can be completed 7 times, once for each demon lord, although each team may use it no more than 3 times. If your rivals have a good AV city other than their capitals, the Infenals start by stealing it instead of spawning on a random tile.)



I don't know what you mean by "put them into a permanent alliance rather than a team," as those two terms are synonymous.

I give Basium (a renamed version of) the Tolerant trait in my modmod.

It would be very easy to make Basium and his angels appear under the control of the player who built the Mercurian Gate instead of being a separate player, but gifting future angels to that player would require significant changes to def giftUnit(self, iUnit, iCivilization, iXP, pFromPlot, iFromPlayer): and/or the various places where cf.giftUnit(gc.getInfoTypeForString('UNIT_ANGEL'), gc.getInfoTypeForString('CIVILIZATION_MERCURIANS'), unit.getExperience(), unit.plot(), unit.getOwner()) is called so that it treats whoever owns Basium and/or the Mercurian Gate as Mercurians.

(The giftUnit code was not well written in the first place, as it gives the free unit to every player of a civ type.
 
Thanks, Magister! Jesus Christ that code is hairy, though. I think I'm going to revise my ambitions downward a bit, because coding aside, I would imagine that upkeep costs would get kind of ridiculous if you had angels just thrown at you in addition to your normal units.

I'll be taking a look at the code in your modmod as a reference for the infernals. I think what I'll end up doing is creating a temptation event that results in their early summoning, with subsequent events/pact researches spawning hellfire and unique demons to the barbarians.

So, anyway, thanks again.
 
Back
Top Bottom