| 작성자 |
|
||
|---|---|---|---|
| 작성일 | 2013-12-31 11:02:28 KST | 조회 | 243 |
| 제목 |
문명 5 핵 AI
|
||
//
// Operation vs. Other Civs
//
// If at war, consider launching an operation
if(IsUsingStrategy(eStrategyFightAWar))
{
// check nuke launches
// Loop through each enemy
for(iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)
{
eLoopPlayer = (PlayerTypes) iPlayerLoop;
// Is this a player we have relations with?
if(eLoopPlayer != m_pPlayer->GetID() && m_pPlayer->GetDiplomacyAI()->IsPlayerValid(eLoopPlayer))
{
bool bLaunchNuke = false;
// only evaluate nukes when we have nukes and we've declared war on someone
if (m_pPlayer->getNumNukeUnits() > 0 && GET_TEAM(m_pPlayer->getTeam()).isAtWar(GET_PLAYER(eLoopPlayer).getTeam()))
{
// they nuked us, so we can nuke them.
if (m_pPlayer->GetDiplomacyAI()->GetNumTimesNuked(eLoopPlayer) > 0)
{
bLaunchNuke = true;
}
// if we already nuked them, uhhh, keep it up!
else if (GET_PLAYER(eLoopPlayer).GetDiplomacyAI()->GetNumTimesNuked(m_pPlayer->GetID()) > 0)
{
bLaunchNuke = true;
}
else
{
bool bRollForNuke = false;
WarProjectionTypes eLastWarProjection = m_pPlayer->GetDiplomacyAI()->GetLastWarProjection(eLoopPlayer);
WarProjectionTypes eCurrentWarProjection = m_pPlayer->GetDiplomacyAI()->GetWarProjection(eLoopPlayer);
if (eCurrentWarProjection == WAR_PROJECTION_DESTRUCTION)
{
// roll every turn
bRollForNuke = true;
}
else if (eCurrentWarProjection != WAR_PROJECTION_UNKNOWN && eCurrentWarProjection != NO_WAR_PROJECTION_TYPE &&
eLastWarProjection != WAR_PROJECTION_UNKNOWN && eLastWarProjection != NO_WAR_PROJECTION_TYPE &&
eCurrentWarProjection < eLastWarProjection)
{
// roll for nukes!
bRollForNuke = true;
}
if (bRollForNuke)
{
int iFlavorNuke = m_pPlayer->GetGrandStrategyAI()->GetPersonalityAndGrandStrategy((FlavorTypes)GC.getInfoTypeForString("FLAVOR_USE_NUKE"));
int iRoll = GC.getGame().getJonRandNum(10, "Roll to see if we're going to nuke!");
int iRoll2 = GC.getGame().getJonRandNum(10, "Second roll to see if we're going to nuke!");
if (iRoll < iFlavorNuke && iRoll2 < iFlavorNuke)
{
bLaunchNuke = true;
}
}
}
}
if (bLaunchNuke)
{
RequestNukeAttack(eLoopPlayer);
}
}
}CvMilitaryAI.cpp
AI 핵 조건들
1. 핵공격을 받았는가?
OR
2. 핵공격을 실시했는가?
Or
3. 적이 너무 강한가?
OR
4. 전쟁 양상이 너무 악화됬는가?
간디가 nuke_propensity 가 12 라서 게임중 가장 핵을 많이 만들고 많이 씀 ㅁㄴㅇㄹ
|
||
|
|
||
|
© PlayXP Inc. All Rights Reserved.