Skip to content

Commit

Permalink
#336 Fix Animal \ Escaped unit XP farming
Browse files Browse the repository at this point in the history
We now cap the XP for defeating animals at 2XP and escapees at 0XP
  • Loading branch information
devolution79 committed Dec 31, 2019
1 parent 33fea6d commit aad2a22
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 11 additions & 1 deletion Assets/XML/GlobalDefinesAlt.xml
Expand Up @@ -1034,5 +1034,15 @@
<DefineName>CITY_DEFENSE_DAMAGE_HEAL_RATE</DefineName>
<iDefineIntVal>5</iDefineIntVal>
</Define>
<!-- Super Forts end -->
<!-- Super Forts end -->
<!-- XP cap begin -->
<Define>
<DefineName>ANIMAL_MAX_XP_VALUE</DefineName>
<iDefineIntVal>2</iDefineIntVal>
</Define>
<Define>
<DefineName>ESCAPE_MAX_XP_VALUE</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
<!-- XP cap end -->
</Civ4Defines>
12 changes: 7 additions & 5 deletions Project Files/DLLSources/CvUnit.cpp
Expand Up @@ -8502,11 +8502,13 @@ int CvUnit::defenseXPValue() const

int CvUnit::maxXPValue() const
{
int iMaxValue;

iMaxValue = MAX_INT;

return iMaxValue;
int iMaxValue = MAX_INT;
if (getUnitInfo().isAnimal())
iMaxValue = std::min(iMaxValue, GC.getDefineINT("ANIMAL_MAX_XP_VALUE"));
if (getUnitInfo().LbD_canEscape())
iMaxValue = std::min(iMaxValue, GC.getDefineINT("ESCAPE_MAX_XP_VALUE"));

return iMaxValue;
}

bool CvUnit::isRanged() const
Expand Down

0 comments on commit aad2a22

Please sign in to comment.