[sanguoforciv4] r346 committed - update 3.17 dll to latest version

4 views
Skip to first unread message

codesite...@google.com

unread,
Sep 27, 2009, 1:58:21 AM9/27/09
to sanguom...@googlegroups.com
Revision: 346
Author: TongShen.Martin
Date: Sat Sep 26 22:57:14 2009
Log: update 3.17 dll to latest version
http://code.google.com/p/sanguoforciv4/source/detail?r=346

Modified:
/trunk/317DLL/CvGameCoreDLL/CvEnums.h
/trunk/317DLL/CvGameCoreDLL/CvGame.cpp
/trunk/317DLL/CvGameCoreDLL/CvInfos.cpp
/trunk/317DLL/CvGameCoreDLL/CvInfos.h
/trunk/317DLL/CvGameCoreDLL/CvPlayer.cpp
/trunk/317DLL/CvGameCoreDLL/CvPlayer.h
/trunk/317DLL/CvGameCoreDLL/CvPlayerAI.cpp
/trunk/317DLL/CvGameCoreDLL/CvSelectionGroupAI.cpp
/trunk/317DLL/CvGameCoreDLL/CvUnit.cpp
/trunk/317DLL/CvGameCoreDLL/CyEnumsInterface.cpp

=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvEnums.h Sat Sep 19 06:38:49 2009
+++ /trunk/317DLL/CvGameCoreDLL/CvEnums.h Sat Sep 26 22:57:14 2009
@@ -742,6 +742,7 @@
GAMEOPTION_NO_ESPIONAGE,
// Sanguo Mod Hero, start, added by poyuzhe 02.08.09
GAMEOPTION_NO_HERO_DEATH_FROM_COMBAT,
+ //GAMEOPTION_NO_HERO_DEATH_FROM_AGE,
GAMEOPTION_NO_SETTLER,
// Sanguo Mod Hero, end

=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvGame.cpp Tue Sep 22 03:53:27 2009
+++ /trunk/317DLL/CvGameCoreDLL/CvGame.cpp Sat Sep 26 22:57:14 2009
@@ -5786,10 +5786,18 @@
{
for (int iJ = 0; iJ < MAX_CIV_PLAYERS; iJ++)
{
- if (GET_PLAYER((PlayerTypes)iJ).isAlive() &&
GET_PLAYER((PlayerTypes)iI).getStateReligion() == eIndex)
- {
-
GET_PLAYER(pNewValue->getOwnerINLINE()).AI_invalidateAttitudeCache((PlayerTypes)iJ);
-
GET_PLAYER((PlayerTypes)iJ).AI_invalidateAttitudeCache(pNewValue->getOwnerINLINE());
+ if (GET_PLAYER((PlayerTypes)iJ).isAlive() &&
GET_PLAYER((PlayerTypes)iJ).getStateReligion() == eIndex)
+ {
+ if (pOldValue != NULL)
+ {
+
GET_PLAYER(pOldValue->getOwnerINLINE()).AI_invalidateAttitudeCache((PlayerTypes)iJ);
+
GET_PLAYER((PlayerTypes)iJ).AI_invalidateAttitudeCache(pOldValue->getOwnerINLINE());
+ }
+ if (pNewValue != NULL)
+ {
+
GET_PLAYER(pNewValue->getOwnerINLINE()).AI_invalidateAttitudeCache((PlayerTypes)iJ);
+
GET_PLAYER((PlayerTypes)iJ).AI_invalidateAttitudeCache(pNewValue->getOwnerINLINE());
+ }
}
}
}
@@ -9929,6 +9937,7 @@
// Sanguo Mod Hero, start, added by poyuzhe 01.04.09
int CvGame::getHeroDebutStatus(HeroTypes eHero) const
{
+ // a value >= 0 represent employer player id, -1 means undebuted, -2
means debuted but unemployed, -3 means dead
FAssert (eHero > -1 && eHero < GC.getNumHeroInfos());
CvHeroMap::const_iterator iter = m_mapHeroes.find(eHero);
FAssert (iter != m_mapHeroes.end());
@@ -10412,8 +10421,11 @@
{
if (getHeroUnitCombatLevel(eHero, eUnitCombat) <
GC.getHeroInfo(eHero).getPotentialUnitCombatLevel(eUnitCombat))
{
- bAllReached = false;
- }
+ if (GC.getHeroInfo(eHero).getPotentialUnitCombatLevel(eUnitCombat) >
0)
+ {
+ bAllReached = false;
+ }
+ }
}
}
if (bAllReached)
@@ -10513,6 +10525,18 @@
FAssert (eHero > -1 && eHero < GC.getNumHeroInfos());
CvHeroMap::const_iterator iter = m_mapHeroes.find(eHero);
FAssert (iter != m_mapHeroes.end());
+ PlayerTypes ePlayer = (PlayerTypes)getHeroDebutStatus(eHero);
+ if (ePlayer > -1)
+ {
+ CvUnit* pHero = GET_PLAYER(ePlayer).getUnit(getHeroUnitID(eHero));
+ if (pHero != NULL && pHero->getHeroType() != eHero)
+ {
+ if (isHeroPromotionReady(pHero->getHeroType()))
+ {
+ return false;
+ }
+ }
+ }
return (iter->second).m_bPromotionReady;
}

@@ -11747,7 +11771,7 @@
return true;
}

- int iBaseChance = 100 -
GC.getHeroInfo(eHero).getCivilizationLoyalty(getHeroDebutStatus(eHero));
+ int iBaseChance = 100 -
GC.getHeroInfo(eHero).getCivilizationLoyalty(GET_PLAYER((PlayerTypes)getHeroDebutStatus(eHero)).getCivilizationType());
if (iBaseChance == 0)
{
return false;
@@ -11822,12 +11846,12 @@
{
float fActualXP = getHeroExperience(eHero);
double dEffectiveXP = fActualXP * 10.0 / (10.0 -
((float)(getHeroLeadership(eHero, bOverwrite, eOverwriteHero) - 80.0) /
10.0));
- return ((int)floor(sqrt(dEffectiveXP / 5)) + 1);
+ return (int)(floor(sqrt(dEffectiveXP / 5)) + 1);
}

int CvGame::getHeroExperienceNeededForNextCapacity(HeroTypes eHero) const
{
- return ((int)(pow(getHeroCapacity(eHero), 2)) * 5) * (10 -
(getHeroLeadership(eHero) - 80) / 10) / 10;
+ return (int)ceil(((pow(getHeroCapacity(eHero), 2)) * 5) * (10 -
(getHeroLeadership(eHero) - 80) / 10) / 10);
}

void CvGame::swapHeroLegionList(HeroTypes eHero)
@@ -11847,7 +11871,7 @@
{
PROFILE_FUNC();

- CvLeaderHeadInfo* pNewLeaderHeadInfo = new CvLeaderHeadInfo;
+ CvLeaderHeadInfo *pNewLeaderHeadInfo = new CvLeaderHeadInfo;
FAssert (pNewLeaderHeadInfo != NULL);
FAssert (GET_PLAYER(ePlayer).isAlive());
FAssert (eHero > -1 && eHero < GC.getNumHeroInfos());
@@ -11856,8 +11880,7 @@

// find the random portrait
// set portrait, button, civilopedia, strategy, help
- CvString szBuffer, szTempBuffer;
- CvWString szBuffer1;
+ CvString szBuffer;
szBuffer.Format("LEADERHEAD_RANDOM_%d", (int)m_paNewLeaders.size() + 1);
pNewLeaderHeadInfo->setType(szBuffer);

@@ -11866,9 +11889,15 @@
pNewLeaderHeadInfo->setStrategy(GC.getHeroInfo(eHero).getStrategy());

pNewLeaderHeadInfo->setButton(GC.getHeroInfo(eHero).getButton());
- pNewLeaderHeadInfo->setLeaderHead(GC.getHeroInfo(eHero).getPortrait());
+
+ szBuffer.clear();
+ szBuffer = GC.getHeroInfo(eHero).getPortrait();
+ szBuffer.insert(szBuffer.end() - 4, '_');
+ szBuffer.insert(szBuffer.end() - 4, '1');
+ pNewLeaderHeadInfo->setLeaderHead(szBuffer);


pNewLeaderHeadInfo->setFavoriteReligion(GC.getHeroInfo(eHero).getBelief());
+
pNewLeaderHeadInfo->setFavoriteCivic(getSorenRandNum(GC.getNumCivicInfos(),"random
civic"));

pNewLeaderHeadInfo->setHasTrait(getSorenRandNum(GC.getNumTraitInfos(), "pick
random trait"), true); // HoTK ToDo

pNewLeaderHeadInfo->setHasTrait(getSorenRandNum(GC.getNumTraitInfos(), "pick
random trait"), true);

@@ -11966,7 +11995,7 @@
if (GC.getHeroInfo((HeroTypes)iI).getLeaderType()
== NO_LEADER)
{
iValue = getHeroLevel((HeroTypes)iI) * 10;
- iValue *= 100 +
GC.getHeroInfo((HeroTypes)iI).getCivilizationLoyalty(ePlayer);
+ iValue *= 100 +
GC.getHeroInfo((HeroTypes)iI).getCivilizationLoyalty(GET_PLAYER(ePlayer).getCivilizationType());
iValue /= 100;
if (iValue > iBestValue)
{
@@ -12123,6 +12152,7 @@
if (getHeroUnitID(eHero) != -1)
{
CvUnit* pHeroUnit =
GET_PLAYER(ePlayer).getUnit(getHeroUnitID(eHero));
+ GC.getGameINLINE().setHeroVitality(eHero, 0);
if (pHeroUnit->isCoreTroop())
{
pHeroUnit = pHeroUnit->dismissLegion();
=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvInfos.cpp Tue Sep 22 03:53:27 2009
+++ /trunk/317DLL/CvGameCoreDLL/CvInfos.cpp Sat Sep 26 22:57:14 2009
@@ -15427,6 +15427,11 @@
{
m_iFavoriteReligion = i;
}
+
+void CvLeaderHeadInfo::setFavoriteCivic(int i)
+{
+ m_iFavoriteCivic = i;
+}

void CvLeaderHeadInfo::setHasTrait(int i, bool bNewValue)
{
=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvInfos.h Tue Sep 22 03:53:27 2009
+++ /trunk/317DLL/CvGameCoreDLL/CvInfos.h Sat Sep 26 22:57:14 2009
@@ -3862,6 +3862,7 @@
void setStrategy(const wchar* szStrategy);
void setLeaderHead(const TCHAR* szLeaderHead);
void setFavoriteReligion(int i);
+ void setFavoriteCivic(int i);
void setHasTrait(int i, bool bNewValue);
// Sanguo Mod random leader, end

=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvPlayer.cpp Tue Sep 22 03:53:27 2009
+++ /trunk/317DLL/CvGameCoreDLL/CvPlayer.cpp Sat Sep 26 22:57:14 2009
@@ -1840,7 +1840,7 @@
// Sanguo Mod Hero, start, added by poyuzhe 01.04.09
for (iI = 0; iI < GC.getNumHeroInfos(); iI++)
{
- if (GC.getHeroInfo((HeroTypes)iI).getLeaderType() ==
getLeaderType())
+ if (GC.getHeroInfo((HeroTypes)iI).getLeaderType() ==
getLeaderType() && GC.getGameINLINE().getHeroDebutStatus((HeroTypes)iI) < 0)
{
CvUnit* pHero =
initUnit((UnitTypes)GC.getHeroInfo((HeroTypes)iI).getUnitType(),
m_iStartingX, m_iStartingY);
pHero->setHeroType((HeroTypes)iI);
@@ -1852,6 +1852,7 @@
GC.getGameINLINE().setHeroUnitID((HeroTypes)iI,
pHero->getID());
}
}
+ recalculateGreatGeneralThreshold();
// Sanguo Mod Hero, end
}
}
@@ -2443,6 +2444,25 @@
iDamage = pOldCity->getDefenseDamage();
int iOldCityId = pOldCity->getID();

+ // Sanguo Mod hero, free own heroes, start, by poyuzhe 09.25.09
+ if (bConquest)
+ {
+ if (pOldCity->isCapital())
+ {
+ for (iI = 0; iI < GC.getNumHeroInfos(); iI++)
+ {
+ if (GC.getGameINLINE().getHeroCapturePlayer((HeroTypes)iI) ==
eOldOwner)
+ {
+ if (GC.getGameINLINE().getHeroDebutStatus((HeroTypes)iI) == getID())
+ {
+ GET_PLAYER(eOldOwner).freePlayerHeroes(getID(), (HeroTypes)iI);
+ }
+ }
+ }
+ }
+ }
+ // Sanguo Mod Hero, end
+
for (iI = 0; iI < GC.getNumSpecialistInfos(); ++iI)
{
// Sanguo Mod Emperor, start, by poyuzhe 12.04.08
@@ -4085,6 +4105,45 @@
return;
}

+void CvPlayer::freePlayerHeroes(PlayerTypes ePlayer, HeroTypes eHero)
+{
+ FAssert (GC.getGameINLINE().getHeroCapturePlayer(eHero) == getID())
+ FAssert (GC.getGameINLINE().getHeroDebutStatus(eHero) == ePlayer)
+
+ if (GET_PLAYER(ePlayer).isAlive())
+ {
+ int iX, iY;
+ CvCity* pCapital = GET_PLAYER(ePlayer).getCapitalCity();
+ if (pCapital != NULL)
+ {
+ iX = pCapital->getX_INLINE();
+ iY = pCapital->getY_INLINE();
+ }
+ else
+ {
+ int iLoop;
+ CvUnit* pLoopUnit = GET_PLAYER(ePlayer).firstUnit(&iLoop);
+ FAssert(pLoopUnit!= NULL);
+ iX = pLoopUnit->getX_INLINE();
+ iY = pLoopUnit->getY_INLINE();
+ }
+ CvUnit* pHero =
GET_PLAYER(ePlayer).initUnit((UnitTypes)GC.getHeroInfo(eHero).getUnitType(),
iX, iY);
+ pHero->setHeroType(eHero);
+ GC.getGameINLINE().setHeroUnitID(eHero, pHero->getID());
+ GC.getGameINLINE().setHeroCapturePlayer(eHero, NO_PLAYER);
+ CvWString szBuffer = gDLL->getText("TXT_KEY_HERO_FREED",
GC.getHeroInfo(eHero).getDescription());
+ gDLL->getInterfaceIFace()->addMessage(ePlayer, false,
GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK",
MESSAGE_TYPE_INFO, pHero->getButton(),
(ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), iX, iY, true, true);
+ if (isAlive())
+ {
+ gDLL->getInterfaceIFace()->addMessage(getID(), false,
GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_NEGATIVE_DINK",
MESSAGE_TYPE_INFO, pHero->getButton(),
(ColorTypes)GC.getInfoTypeForString("COLOR_RED"), iX, iY, true, true);
+ }
+ }
+ else
+ {
+ GC.getGameINLINE().setHeroDebutStatus(eHero, -2);
+ GC.getGameINLINE().setHeroCapturePlayer(eHero, NO_PLAYER);
+ }
+}
// Sanguo Mod Hero, end

// Sanguo Mod Hero, join legion, start, by poyuzhe 09.14.08
@@ -11691,10 +11750,14 @@
}
else
{
- setCombatExperience(getCombatExperience() - iExperienceThreshold);
- CyArgsList argsList;
- argsList.add(getID());
-
gDLL->getPythonIFace()->callFunction(PYScreensModule, "showCreateChampionScreen",
argsList.makeFunctionArgs());
+ // If the human player is not currently active, do not show create
champion screen, it would be out of sync
+ //if (GC.getGameINLINE().getActivePlayer() == getID())
+ //{
+ setCombatExperience(getCombatExperience() - iExperienceThreshold);
+ CyArgsList argsList;
+ argsList.add(getID());
+
gDLL->getPythonIFace()->callFunction(PYScreensModule, "showCreateChampionScreen",
argsList.makeFunctionArgs());
+ //}
}
// Sanguo Mod Hero, end
}
@@ -11857,6 +11920,24 @@
killCities();
killAllDeals();

+ // Sanguo Mod hero, trade prisoners, start, by poyuzhe 09.25.09
+ for (iI = 0; iI < GC.getNumHeroInfos(); iI++)
+ {
+ if (GC.getGameINLINE().getHeroCapturePlayer((HeroTypes)iI) == getID())
+ {
+ if (GC.getGameINLINE().getHeroDebutStatus((HeroTypes)iI) >= 0)
+ {
+
freePlayerHeroes((PlayerTypes)GC.getGameINLINE().getHeroDebutStatus((HeroTypes)iI),
(HeroTypes)iI);
+ }
+ else
+ {
+ GC.getGameINLINE().setHeroDebutStatus((HeroTypes)iI, -2);
+ GC.getGameINLINE().setHeroCapturePlayer((HeroTypes)iI, NO_PLAYER);
+ }
+ }
+ }
+ // Sanguo Mod Hero, end
+
setTurnActive(false);

gDLL->endMPDiplomacy();
=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvPlayer.h Tue Sep 22 03:53:27 2009
+++ /trunk/317DLL/CvGameCoreDLL/CvPlayer.h Sat Sep 26 22:57:14 2009
@@ -1068,6 +1068,7 @@
void persuadeHero(HeroTypes eHero); // Exposed to Python
void executeHero(HeroTypes eHero); // Exposed to Python
void releaseHero(HeroTypes eHero); // Exposed to Python
+ void freePlayerHeroes(PlayerTypes ePlayer, HeroTypes eHero);
// Sanguo Mod Hero, end

// Sanguo Mod Hero, join legion, start, by poyuzhe 09.14.08
=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvPlayerAI.cpp Tue Sep 22 03:53:27 2009
+++ /trunk/317DLL/CvGameCoreDLL/CvPlayerAI.cpp Sat Sep 26 22:57:14 2009
@@ -20019,11 +20019,6 @@
{
if (GC.getGameINLINE().getHeroDebutStatus((HeroTypes)iI) ==
getID() && GC.getGameINLINE().getHeroCapturePlayer((HeroTypes)iI) ==
NO_PLAYER)
{
- if (GC.getGameINLINE().isHeroPromotionReady((HeroTypes)iI))
- {
- GC.getGameINLINE().AI_promoteHero((HeroTypes)iI);
- }
-
GC.getGameINLINE().testHeroPromotionReady((HeroTypes)iI);

if (!isHuman() &&
GC.getGameINLINE().isHeroPromotionReady((HeroTypes)iI))
=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvSelectionGroupAI.cpp Tue Sep 22 03:53:27
2009
+++ /trunk/317DLL/CvGameCoreDLL/CvSelectionGroupAI.cpp Sat Sep 26 22:57:14
2009
@@ -846,7 +846,10 @@
}

iValue *= 100;
- iValue /= (100 + pLoopUnit->cityAttackModifier() +
pLoopUnit->getExtraCityAttackPercent());
+ // Sanguo Mod Bug Fix, start, by poyuzhe 09.25.09
+ // iValue /= (100 + pLoopUnit->cityAttackModifier() +
pLoopUnit->getExtraCityAttackPercent());
+ iValue /= (100 + pLoopUnit->cityAttackModifier());
+ // Sanguo Mod Bug Fix, end

iValue /= 2 + pLoopUnit->getLevel();

=======================================
--- /trunk/317DLL/CvGameCoreDLL/CvUnit.cpp Tue Sep 22 03:53:27 2009
+++ /trunk/317DLL/CvGameCoreDLL/CvUnit.cpp Sat Sep 26 22:57:14 2009
@@ -524,6 +524,7 @@
setTempStrengthModifier(pUnit->getTempStrengthModifier());
setHeroType(pUnit->getHeroType());
setLegionHero(pUnit->getLegionHero());
+ setLeaderHero(pUnit->getLeaderHero());
m_iLegionTurn = pUnit->getLegionTurn();
if (pUnit->getLegionHero() != NO_HERO)
{
@@ -538,6 +539,24 @@
GC.getGameINLINE().setHeroUnitID(getLegionHero(), getID());
GC.getGameINLINE().tempRemoveHeroCoreTroop(getLegionHero());
GC.getGameINLINE().addHeroCoreTroop(getLegionHero(), getID());
+
+ // if this unit is in the Army
+ if (pUnit->getLeaderHero() != NO_HERO)
+ {
+ if (pUnit->isLeaderTroop())
+ {
+ GC.getGameINLINE().setHeroUnitID(getLeaderHero(), getID());
+ GC.getGameINLINE().tempRemoveHeroCoreTroop(getLeaderHero());
+ GC.getGameINLINE().addHeroCoreTroop(getLeaderHero(), getID());
+ }
+ else
+ {
+ GC.getGameINLINE().deleteHeroLegionMember(getLeaderHero(),
pUnit->getID());
+ GC.getGameINLINE().addHeroLegionMember(getLeaderHero(), getID());
+ }
+ pUnit->setLeaderHero(NO_HERO);
+ }
+
// Set the old unit's hero type and leader unit to none
pUnit->setHeroType(NO_HERO);
pUnit->setLeaderUnitType(NO_UNIT);
@@ -547,6 +566,7 @@
// If the unit is just a plain member
GC.getGameINLINE().deleteHeroLegionMember(getLegionHero(),
pUnit->getID());
GC.getGameINLINE().addHeroLegionMember(getLegionHero(), getID());
+ pUnit->setLeaderHero(NO_HERO);
}
// Set the old unit's legion hero to none
pUnit->setLegionHero(NO_HERO);
@@ -799,7 +819,7 @@
CvCity* pNearestCity =
GC.getMapINLINE().findCity(getX_INLINE(), getY_INLINE(), getOwnerINLINE(),
NO_TEAM, !(plot()->isWater()), false, NO_TEAM, NO_DIRECTION,
(plot()->isCity() ? plot()->getPlotCity() : NULL));
if (pNearestCity == NULL)
{
- CvCity* pNearestCity =
GC.getMapINLINE().findCity(plot()->getX_INLINE(), plot()->getY_INLINE(),
getOwnerINLINE(), NO_TEAM, false, false, NO_TEAM, NO_DIRECTION,
(plot()->isCity() ? plot()->getPlotCity() : NULL));
+ pNearestCity = GC.getMapINLINE().findCity(plot()->getX_INLINE(),
plot()->getY_INLINE(), getOwnerINLINE(), NO_TEAM, false, false, NO_TEAM,
NO_DIRECTION, (plot()->isCity() ? plot()->getPlotCity() : NULL));
}
FAssert (pNearestCity != NULL);
setXY(pNearestCity->getX_INLINE(), pNearestCity->getY_INLINE());
@@ -1203,7 +1223,8 @@
GC.getGameINLINE().doHeroDeath(getHeroType());
return;
}
- if (GC.getGameINLINE().getGameTurnYear() >
GC.getHeroInfo(getHeroType()).getHistoricalDieYear())
+ if (//!GC.getGameINLINE().isOption(GAMEOPTION_NO_HERO_DEATH_FROM_AGE) &&
+ GC.getGameINLINE().getGameTurnYear() >
GC.getHeroInfo(getHeroType()).getHistoricalDieYear())
{
if (GC.getHeroInfo(getHeroType()).getMurdererCiv() == NO_CIVILIZATION |
| GC.getGameINLINE().getGameTurnYear() >
GC.getHeroInfo(getHeroType()).getStartingYear() + 45)
{
@@ -1631,8 +1652,11 @@
}

iAttackNullifyChance +=
GC.getPromotionInfo((PromotionTypes)iI).getEnemyAttackNullifyChance();
- iDefenderTotalWinStrThreshold =
(iDefenderTotalWinStrThreshold == 0) ? std::max(0,
GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold()) :
(std::min(iDefenderTotalWinStrThreshold,
GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold()));
- iDefenderNoDeathThreshold =
std::min(iDefenderNoDeathThreshold, 100 -
(GC.getPromotionInfo((PromotionTypes)iI).getNoDeathCombatOddsThreshold()));
+ if
(GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold() > 0)
+ {
+ iDefenderTotalWinStrThreshold = (iDefenderTotalWinStrThreshold ==
0) ?
GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold() :
(std::min(iDefenderTotalWinStrThreshold,
GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold()));
+ }
+ iDefenderNoDeathThreshold = std::min(iDefenderNoDeathThreshold, 100 -
(GC.getPromotionInfo((PromotionTypes)iI).getNoDeathCombatOddsThreshold()));
}
}

@@ -1645,8 +1669,11 @@
bNoAttackerWithdrawal = true;
}
iDefendNullifyChance +=
GC.getPromotionInfo((PromotionTypes)iI).getEnemyAttackNullifyChance();
- iAttackerTotalWinStrThreshold =
(iAttackerTotalWinStrThreshold == 0) ? std::max(0,
GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold()) :
(std::min(iAttackerTotalWinStrThreshold,
GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold()));
- iAttackerNoDeathThreshold =
std::min(iAttackerNoDeathThreshold, 100 -
(GC.getPromotionInfo((PromotionTypes)iI).getNoDeathCombatOddsThreshold()));
+ if
(GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold() > 0)
+ {
+ iAttackerTotalWinStrThreshold = (iAttackerTotalWinStrThreshold ==
0) ?
GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold() :
(std::min(iAttackerTotalWinStrThreshold,
GC.getPromotionInfo((PromotionTypes)iI).getTotalWinStrengthThreshold()));
+ }
+ iAttackerNoDeathThreshold = std::min(iAttackerNoDeathThreshold, 100 -
(GC.getPromotionInfo((PromotionTypes)iI).getNoDeathCombatOddsThreshold()));
}
}
}
@@ -3342,7 +3369,16 @@

// Sanguo Mod Hero, start, added by poyuzhe 01.17.09
case COMMAND_PROMOTION_HERO:
- GC.getGameINLINE().promoteHero(getHeroType(), (PromotionTypes)iData1);
+ if (getLeaderHero() == NO_HERO ||
GC.getGameINLINE().canPromoteHero(getHeroType(), (PromotionTypes)iData1))
+ {
+ GC.getGameINLINE().promoteHero(getHeroType(), (PromotionTypes)iData1);
+ }
+ else
+ {
+ FAssert (getLeaderHero() != NO_HERO);
+ FAssert (GC.getGameINLINE().canPromoteHero(getLeaderHero(),
(PromotionTypes)iData1));
+ GC.getGameINLINE().promoteHero(getLeaderHero(),
(PromotionTypes)iData1);
+ }
break;
// Sanguo Mod Hero, end

@@ -16146,7 +16182,7 @@
pCoreTroop->joinAdvancedLegion(iUnitID, true);
}
}
- else
+ else if (pCoreTroop != NULL)
{
GC.getGame().swapHeroLegionList(eLeaderHero);
pLeaderHero->formAdvancedLegion(false, true);
@@ -17410,6 +17446,10 @@
{
if(pTargetPlot->getNumVisibleEnemyDefenders(this) == 0)
{
+ if (pTargetPlot->getOwnerINLINE() == getOwnerINLINE())
+ {
+ return false;
+ }
if (pTargetPlot->getImprovementType() == NO_IMPROVEMENT)
{
return false;
@@ -17604,10 +17644,10 @@
return false;
}

-// if (plotDistance(pPlot->getX_INLINE(), pPlot->getY_INLINE(),
pTargetPlot->getX_INLINE(), pTargetPlot->getY_INLINE()) > 1)
-// {
-// return false;
-// }
+ if (plotDistance(pPlot->getX_INLINE(), pPlot->getY_INLINE(),
pTargetPlot->getX_INLINE(), pTargetPlot->getY_INLINE()) > getDCMBombRange())
+ {
+ return false;
+ }

if(pTargetPlot->getNumVisibleEnemyDefenders(this) == 0)
{
@@ -19344,6 +19384,10 @@
{
return false;
}
+ if (pMember->isHurt())
+ {
+ return false;
+ }
}

return true;
@@ -19359,6 +19403,10 @@

CvUnit* pHero = processAdvancedLegion(true, false);

+ GC.getGameINLINE().setLegionUnitMoved(pHero->getHeroType(), true);
+
+ gDLL->getInterfaceIFace()->setDirty(PlotListButtons_DIRTY_BIT, true);
+
return pHero;
}

@@ -19545,10 +19593,11 @@
{
if (!GC.getGameINLINE().isHeroHasBackUpMember(eLeaderHero,
GC.getGameINLINE().getHeroLegionMemberAt(eLeaderHero, iI)))
{
- // Check unit combat level
- pLoopHero =
GET_PLAYER(getOwnerINLINE()).getUnit(GC.getGameINLINE().getHeroLegionMemberAt(eLeaderHero,
iI));
- FAssert (pLoopHero != NULL);
- eLoopHero = pLoopHero->getHeroType();
+ pLoopHero =
GET_PLAYER(getOwnerINLINE()).getUnit(GC.getGameINLINE().getHeroLegionMemberAt(eLeaderHero,
iI));
+ FAssert (pLoopHero != NULL);
+ eLoopHero = pLoopHero->getHeroType();
+
+ // Check unit combat level
eLoopUnitCombat = pLoopHero->getUnitCombatType();
eUnitCombatPromotionHigh = NO_PROMOTION;
eUnitCombatPromotionLow = NO_PROMOTION;
@@ -19569,6 +19618,13 @@
eUnitCombatPromotionMiddle = (PromotionTypes)iJ;
}
}
+ else if (!bRegroup &&
GC.getGameINLINE().getHeroPromotionStatus(eLeaderHero, (PromotionTypes)iJ)
== 1)
+ {
+ if
(GC.getGameINLINE().getHeroCurrentNineTransformationPromotion(eLeaderHero) !=
(PromotionTypes)iJ)
+ {
+ pLoopHero->setHasPromotion((PromotionTypes)iJ, true);
+ }
+ }
}

if (eUnitCombatPromotionHigh <= eUnitCombatPromotionLow)
=======================================
--- /trunk/317DLL/CvGameCoreDLL/CyEnumsInterface.cpp Sat Sep 19 06:38:49
2009
+++ /trunk/317DLL/CvGameCoreDLL/CyEnumsInterface.cpp Sat Sep 26 22:57:14
2009
@@ -537,6 +537,7 @@
.value("GAMEOPTION_NO_ESPIONAGE", GAMEOPTION_NO_ESPIONAGE)
// Sanguo Mod Hero, start, added by poyuzhe 02.08.09
.value("GAMEOPTION_NO_HERO_DEATH_FROM_COMBAT",
GAMEOPTION_NO_HERO_DEATH_FROM_COMBAT)
+ //.value("GAMEOPTION_NO_HERO_DEATH_FROM_AGE",
GAMEOPTION_NO_HERO_DEATH_FROM_AGE)
.value("GAMEOPTION_NO_SETTLER", GAMEOPTION_NO_SETTLER)
// Sanguo Mod Hero, end
.value("NUM_GAMEOPTION_TYPES", NUM_GAMEOPTION_TYPES)

Reply all
Reply to author
Forward
0 new messages