소스 검색

- Fixed AI crash at "gather resource" quest
- AI will now understand threat of Abandoned Mine. For sure.
- Fixed incorrect creeps quantities info

DjWarmonger 13 년 전
부모
커밋
55f321f3f3
3개의 변경된 파일16개의 추가작업 그리고 9개의 파일을 삭제
  1. 14 8
      AI/VCAI/VCAI.cpp
  2. 1 1
      lib/CObjectHandler.cpp
  3. 1 0
      lib/GameConstants.h

+ 14 - 8
AI/VCAI/VCAI.cpp

@@ -417,6 +417,7 @@ ui64 evaluateDanger(const CGObjectInstance *obj)
 			return d->getArmyStrength();
 		}
 	case Obj::MINE:
+	case Obj::ABANDONED_MINE:
 		{
 			const CArmedInstance * a = dynamic_cast<const CArmedInstance*>(obj);
 			return a->getArmyStrength();
@@ -2140,18 +2141,23 @@ void VCAI::striveToQuest (const QuestInfo &q)
 			}
 			case CQuest::MISSION_RESOURCES:
 			{
-				if (q.quest->checkQuest(NULL))
+				if (heroes.size())
 				{
-					 striveToGoal (CGoal(VISIT_TILE).settile(q.tile));
-				}
-				else
-				{
-					for (int i = 0; i < q.quest->m7resources.size(); ++i)
+					if (q.quest->checkQuest(heroes.front())) //it doesn't matter which hero it is
 					{
-						if (q.quest->m7resources[i])
-							striveToGoal (CGoal(COLLECT_RES).setresID(i).setvalue(q.quest->m7resources[i]));
+						 striveToGoal (CGoal(VISIT_TILE).settile(q.tile));
+					}
+					else
+					{
+						for (int i = 0; i < q.quest->m7resources.size(); ++i)
+						{
+							if (q.quest->m7resources[i])
+								striveToGoal (CGoal(COLLECT_RES).setresID(i).setvalue(q.quest->m7resources[i]));
+						}
 					}
 				}
+				else
+					striveToGoal (CGoal(RECRUIT_HERO)); //FIXME: checkQuest requires any hero belonging to player :(
 				break;
 			}
 			case CQuest::MISSION_KILL_HERO:

+ 1 - 1
lib/CObjectHandler.cpp

@@ -2933,7 +2933,7 @@ const std::string & CGCreature::getHoverText() const
 {
 	MetaString ms;
 	int pom = stacks.begin()->second->getQuantityID();
-	pom = 174 + 3*pom + 1;
+	pom = 172 + 3*pom;
 	ms << std::pair<ui8,ui32>(6,pom) << " " << std::pair<ui8,ui32>(7,subID);
 	ms.toString(hoverName);
 

+ 1 - 0
lib/GameConstants.h

@@ -219,6 +219,7 @@ namespace Obj
 		BORDER_GATE = 212,
 		QUEST_GUARD = 215,
 		GARRISON2 = 219,
+		ABANDONED_MINE = 220,
 		CLOVER_FIELD = 222,
 		CURSED_GROUND2 = 223,
 		EVIL_FOG = 224,