1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Asaf's Custom DLL version 7 2016-10-05

Asaf's Custom DLL version 7

  1. Asaf
    Current version: 7

    This custom DLL contains features requested here and here.
    It is based on BTS 3.19.

    All changed code is marked with one of the following:
    - Enhanced Python API
    - Enhanced Traits
    - Ethnic Buildings

    Change log:

    Version 7 - changes
    Add a new trait property: <bExploreRivalTerritory>. It can receive 1 or 0, or not appear at all (in which case default value is 0).
    A player with a trait with this property set to 1 can move all his units in rival territory regardless of open borders agreements.
    This is the same as bRivalTerritory in UnitInfo, only for all the player's units.

    Exposed to Python the following:
    Spoiler :

    Code:
    bool CvTraitInfo.isExploreRivalTerritory()
    
    bool CyPlayer.isExploreRivalTerritory()
    


    Version 6 - changes
    Spoiler :

    First, some minor changes:
    - Changed maximum number of civilizations to 28
    - Exposed internal method to Python: CyPlayer.AI_chooseFreeTech()
    - In getConscriptUnitType callback - added city object as another argument (2nd argument, in addition to owner).

    New feature: Enhanced Traits:
    New trait properties were added (some were already introduced here as python extensions only).
    Each of the properties may or may not appear in any trait XML, so not to force changes on all existing traits.
    The order is important and imposed by the scheme (see CIV4CivilizationsSchema.xml for details).

    - iExtraEnemyCombatModifier - Units of a player with this trait receive +X% combat strength bonus when fighting in enemy territory.

    - iExtraDomesticCombatModifier - Units of a player with this trait receive +X% combat strength bonus when fighting inside own cultural borders.

    - iExtraNonDomesticUnitHealRateChange - Units of a player with this trait heal +X damage/turn when outside of player's cultural borders.

    - ExtraTerrainYields - All tiles of the specified terrains inside the cultural borders of a player with this trait, yield extra yields (according to the yield list).

    - ExtraPlotTypeYields - All tiles of the specified plot type inside the cultural borders of a player with this trait, yield extra yields (according to the yield list).
    Spoiler :
    Plot types are numbers taken from the enum, and are as follows:
    0 - PLOT_PEAK (mountains)
    1 - PLOT_HILLS (hills)
    2 - PLOT_LAND (all flat land)
    3 - PLOT_OCEAN (all water tiles)


    - ExtraFeatureYields - All tiles with the specified feature inside the cultural borders of a player with this trait, yield extra yields (according to the yield list).

    Sample XML's (not very usable, but a good example):
    Spoiler :

    Code:
    <TraitInfo>
    	<Type>TRAIT_PHILOSOPHICAL</Type>
    	...
         <FreePromotionUnitCombats/>
    	 
    	 [B]<!-- Additions start here -->[/B]
    	<iExtraEnemyCombatModifier>100</iExtraEnemyCombatModifier>
    	<iExtraDomesticCombatModifier>80</iExtraDomesticCombatModifier>
    	<iExtraNonDomesticUnitHealRateChange>20</iExtraNonDomesticUnitHealRateChange>
    
         <ExtraTerrainYields>
            <ExtraTerrainYield>
              <Terrain>TERRAIN_DESERT</Terrain>
              <ExtraYields>
                <iExtraYield>0</iExtraYield>
                <iExtraYield>0</iExtraYield>
                <iExtraYield>2</iExtraYield>
              </ExtraYields>
            </ExtraTerrainYield>
            <ExtraTerrainYield>
              <Terrain>TERRAIN_TUNDRA</Terrain>
              <ExtraYields>
                <iExtraYield>2</iExtraYield>
                <iExtraYield>1</iExtraYield>
                <iExtraYield>0</iExtraYield>
              </ExtraYields>
            </ExtraTerrainYield>
          </ExtraTerrainYields>
          
          <ExtraPlotTypeYields>
            <ExtraPlotTypeYield>
              <iPlotType>1</iPlotType>
              <ExtraYields>
                <iExtraYield>4</iExtraYield>
                <iExtraYield>0</iExtraYield>
                <iExtraYield>0</iExtraYield>
              </ExtraYields>
            </ExtraPlotTypeYield>
            <ExtraPlotTypeYield>
              <iPlotType>3</iPlotType>
              <ExtraYields>
                <iExtraYield>0</iExtraYield>
                <iExtraYield>1</iExtraYield>
                <iExtraYield>0</iExtraYield>
              </ExtraYields>
            </ExtraPlotTypeYield>
          </ExtraPlotTypeYields>
    
          <ExtraFeatureYields>
            <ExtraFeatureYield>
              <Feature>FEATURE_JUNGLE</Feature>
              <ExtraYields>
                <iExtraYield>0</iExtraYield>
                <iExtraYield>3</iExtraYield>
                <iExtraYield>0</iExtraYield>
              </ExtraYields>
            </ExtraFeatureYield>
            <ExtraFeatureYield>
              <Feature>FEATURE_FOREST</Feature>
              <ExtraYields>
                <iExtraYield>4</iExtraYield>
                <iExtraYield>0</iExtraYield>
                <iExtraYield>4</iExtraYield>
              </ExtraYields>
            </ExtraFeatureYield>
          </ExtraFeatureYields>
    


    Exposed to Python the following:
    Spoiler :

    Code:
    int CvTraitInfo.getExtraEnemyCombatModifier()
    int CvTraitInfo.getExtraDomesticCombatModifier()
    int CvTraitInfo.getExtraNonDomesticUnitHealRateChange()
    int CvTraitInfo.getExtraTerrainYield(int iTerrain, int iYield)
    int CvTraitInfo.getExtraPlotTypeYield(int iPlotType, int iYield)
    int CvTraitInfo.getExtraFeatureYield(int iFeature, int iYield)
    
    Code:
    int CyPlayer.getExtraEnemyCombatModifier()
    int CyPlayer.getExtraDomesticCombatModifier()
    int CyPlayer.getExtraNonDomesticUnitHealRateChange()
    
    Code:
    int CyPlayer.getExtraFeatureYield(int /*FeatureTypes*/ eFeatureType, int /*YieldTypes*/ eYield)
    void CyPlayer.setExtraFeatureYield(int /*FeatureTypes*/ eFeatureType, int /*YieldTypes*/ eYield, int iValue)
    
    (In addition to the terrain / plot type methods that were already previously exposed)

    And the following members on CombatDetails, both as a result of the new trait's combat strength modifiers:
    Code:
    int CombatDetails::iTerritoryAttackModifier
    int CombatDetails::iTerritoryDefenseModifier
    



    Version 5 - changes
    Merged Ethnic Buildings Mod

    Version 4 - changes
    Spoiler :
    Well, not really a python API, but new requested functionality:
    A BuildInfo now has an optional new tag: UnitClassType (comes after ImprovementType).
    If this tag exists (and is not NONE), it contains the class type of the unit that will be created when this build completes.

    The schema was changed to reflect that and is part of this package.

    An example:
    Spoiler :
    Code:
        <BuildInfo>
          <Type>BUILD_CATAPULT</Type>
          <Description>TXT_KEY_BUILD_CATAPULT</Description>
          <Help/>
          <PrereqTech>TECH_CONSTRUCTION</PrereqTech>
          <iTime>300</iTime>
          <iCost>0</iCost>
          <bKill>0</bKill>
          <ImprovementType>NONE</ImprovementType>
         [B] <UnitClassType>UNITCLASS_CATAPULT</UnitClassType>[/B]
          <RouteType>NONE</RouteType>
          <EntityEvent>ENTITY_EVENT_BUILD</EntityEvent>
          <FeatureStructs>
            <FeatureStruct>
              <FeatureType>FEATURE_FOREST</FeatureType>
              <PrereqTech>TECH_BRONZE_WORKING</PrereqTech>
              <iTime>300</iTime>
              <iProduction>0</iProduction>
              <bRemove>1</bRemove>
            </FeatureStruct>
          </FeatureStructs>
          <HotKey>KB_C</HotKey>
          <bAltDown>0</bAltDown>
          <bShiftDown>0</bShiftDown>
          <bCtrlDown>0</bCtrlDown>
          <iHotKeyPriority>0</iHotKeyPriority>
          <Button>,Art/Interface/Buttons/Builds/BuildCatapult.dds,Art/Interface/Buttons/Actions_Builds_LeaderHeads_Specialists_Atlas.dds,3,7</Button>
        </BuildInfo>
    


    This build can be started on a forest, and when it ends - it removes the forest (without giving production to the nearest city) and a new catapult is created in this plot.

    Known issues:
    1. Unless it also creates an improvement, this build can only be made if there's a feature which will be removed (forest, in this example). This is according to the original requirements.
    2. This cannot be done inside a rival's cultural borders (same as any forest chop). (I think this is the correct behavior, I might be mistaken though).
    3. The AI has no special code to use it. It may do it as part of the 'best build', but I haven't tested it and have no idea how it will act.

    Notes:
    • As in any other build, if you want another unit besides a worker to do this, you should change this unit's iWorkRate from 0 to something else (e.g. 100).


    Version 3 - changes
    Spoiler :

    New functionality:
    1. Added option to change the city defense bonus (the cultural/building one) from Python:
    Code:
    int CyCity.getExtraDefense()
    void CyCity.changeExtraDefense(int iChange)
    
    This extra defense bonus is bombardable.
    This value is saved when saving a game. No need to update it after loading.

    2. Added option to increase/decrease a player's cultural strength for cultural wars over cities.
    There are 2 new values for each player:
    A modifier for cities owned by the player, which the player founded.
    A modifier for cities which are not owned by the player but which the player founded (Ex-Cities).

    In both cases this modifier affects the cultural owner calculation and the cultural strength when calculating city revolt probability.
    Again, these values are saved in the saved game.

    Code:
    int CyPlayer.getCitiesCultureStrengthModifier()
    void CyPlayer.setCitiesCultureStrengthModifier(int iValue)
    
    int CyPlayer.getExCitiesCultureStrengthModifier()
    void CyPlayer.setExCitiesCultureStrengthModifier(int iValue)
    

    Version 2 - changes
    Spoiler :

    New functionality:
    From python (using the following new API), you can add (and subtract) extra yield for certain types of terrains and plots to a specific player.

    Code:
    int getExtraTerrainYield(int iTerrain, int iYield);
    void setExtraTerrainYield(int iTerrain, int iYield, int iValue);
    int getExtraPlotTypeYield(int iPlotType, int iYield);
    void setExtraPlotTypeYield(int iPlotType, int iYield, int iValue);
    
    For example:

    Code:
    player.setExtraTerrainYield(gc.getInfoTypeForString('TERRAIN_DESERT'), gc.getInfoTypeForString('YIELD_COMMERCE'), 2)
    
    player.setExtraPlotTypeYield(PlotTypes.PLOT_HILLS, gc.getInfoTypeForString('YIELD_FOOD'), 1)
    


    Version 1
    Spoiler :
    This DLL has a few new exposed functions to Python:

    Code:
    CyPlayer.changeCityDefenseModifier(int iChange) 
    CyPlayer.changeWarWearinessModifier(int iChange)
    CyPlayer.changeDistanceMaintenanceModifier(int iChange)
    CyPlayer.changeNumCitiesMaintenanceModifier(int iChange)
    


    Credits:
    ========
    DannyDaemonic - the fast Makefile (1.0). Downloaded from: http://forums.civfanatics.com/showthread.php?t=370861