Skip to content

Commit

Permalink
Heavy tribute fix (#10383)
Browse files Browse the repository at this point in the history
  • Loading branch information
axatin authored Oct 22, 2023
1 parent 75b74d0 commit e2d3c81
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions CvGameCoreDLL_Expansion2/CvMinorCivAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16758,47 +16758,11 @@ void CvMinorCivAI::DoMajorBullyUnit(PlayerTypes eBully, UnitTypes eUnitType)
}
DoObsoleteQuestsForPlayer(eBully, NO_MINOR_CIV_QUEST_TYPE, false, true);

DoBulliedByMajorReaction(eBully, /*-6000*/ GD_INT_GET(MINOR_FRIENDSHIP_DROP_BULLY_WORKER_SUCCESS));
DoBulliedByMajorReaction(eBully, /*-6000*/ min(GD_INT_GET(MINOR_FRIENDSHIP_DROP_BULLY_WORKER_SUCCESS), (GetRestingPointChange(eBully) * 100) - GetEffectiveFriendshipWithMajorTimes100(eBully)));

if (MOD_EVENTS_MINORS_INTERACTION) {
GAMEEVENTINVOKE_HOOK(GAMEEVENT_PlayerBullied, eBully, GetPlayer()->GetID(), iGold, -1, -1, -1, YIELD_SCIENCE);
}

}
else
{
if(eUnitType == NO_UNIT)
{
CvAssertMsg(false, "eUnitType is not expected to be NO_UNIT. Please send Anton your save file and version.");
return;
}
// Minor must have Capital
CvCity* pMinorCapital = GetPlayer()->getCapitalCity();
if(pMinorCapital == NULL)
{
CvAssertMsg(false, "Trying to spawn a Unit for a major civ but the minor has no capital. Please send Anton your save file and version.");
return;
}
int iX = pMinorCapital->getX();
int iY = pMinorCapital->getY();

CvUnit* pNewUnit = GET_PLAYER(eBully).initUnit(eUnitType, iX, iY);
if (pNewUnit->jumpToNearestValidPlot())
{
pNewUnit->finishMoves(); // The given unit cannot move this turn

if(GetPlayer()->getCapitalCity())
GetPlayer()->getCapitalCity()->addProductionExperience(pNewUnit);

DoBulliedByMajorReaction(eBully, /*-5000 in CP, 6000 in VP*/ GD_INT_GET(MINOR_FRIENDSHIP_DROP_BULLY_WORKER_SUCCESS));
#if defined(MOD_EVENTS_MINORS_INTERACTION)
if (MOD_EVENTS_MINORS_INTERACTION) {
GAMEEVENTINVOKE_HOOK(GAMEEVENT_PlayerBullied, eBully, GetPlayer()->GetID(), -1, eUnitType, pNewUnit->getX(), pNewUnit->getY(), -1);
}
#endif
}
else
pNewUnit->kill(false); // Could not find a spot for the unit!
}
}
else
Expand Down Expand Up @@ -16829,11 +16793,9 @@ void CvMinorCivAI::DoMajorBullyUnit(PlayerTypes eBully, UnitTypes eUnitType)

DoBulliedByMajorReaction(eBully, /*-5000 in CP, 6000 in VP*/ GD_INT_GET(MINOR_FRIENDSHIP_DROP_BULLY_WORKER_SUCCESS));

#if defined(MOD_EVENTS_MINORS_INTERACTION)
if (MOD_EVENTS_MINORS_INTERACTION) {
GAMEEVENTINVOKE_HOOK(GAMEEVENT_PlayerBullied, eBully, GetPlayer()->GetID(), -1, eUnitType, pNewUnit->getX(), pNewUnit->getY(), -1);
}
#endif
}
else
pNewUnit->kill(false); // Could not find a spot for the unit!
Expand Down

0 comments on commit e2d3c81

Please sign in to comment.