Python in air missions

1984plusplus

Chieftain
Joined
May 23, 2011
Messages
59
Is Python used in air combat at all? I'm looking to make aircraft gain experience in a more reasonable fashion, but I haven't been able to find any code that deals with air combat that I could add experience gain into.
 
Looks like it's in the DLL only. CvUnit::resolveAirCombat() deals with the combat and if one unit dies, it calls CvUnit::changeExperience(), which in turn calls CvUnit::setExperience(). None of those functions have python callbacks.

PHP:
if (isDead())
   {
       if (iTheirRoundDamage > 0)
       {
           int iExperience = attackXPValue();
           iExperience = (iExperience * iOurStrength) / std::max(1, iTheirStrength);
           iExperience = range(iExperience, GC.getDefineINT("MIN_EXPERIENCE_PER_COMBAT"), GC.getDefineINT("MAX_EXPERIENCE_PER_COMBAT"));
           pInterceptor->changeExperience(iExperience, maxXPValue(), true, pPlot->getOwnerINLINE() == pInterceptor->getOwnerINLINE(), !isBarbarian());
       }
   }
   else if (pInterceptor->isDead())
   {
       int iExperience = pInterceptor->defenseXPValue();
       iExperience = (iExperience * iTheirStrength) / std::max(1, iOurStrength);
       iExperience = range(iExperience, GC.getDefineINT("MIN_EXPERIENCE_PER_COMBAT"), GC.getDefineINT("MAX_EXPERIENCE_PER_COMBAT"));
       changeExperience(iExperience, pInterceptor->maxXPValue(), true, pPlot->getOwnerINLINE() == getOwnerINLINE(), !pInterceptor->isBarbarian());
   }
Looks like the formula is attack/defense XP Value from unit XML multiplied with strength(winner/loser) and then capped by MIN/MAX experience from globalDefines. This means it should be possible to tweak experience from XML if you really don't want to mess with the DLL.
 
Back
Top Bottom