From 0e5d427dc99bd4da5ad3048d392ece2da092536f Mon Sep 17 00:00:00 2001
From: Dmitry Orlov <shubus.corporation@gmail.com>
Date: Thu, 29 Apr 2021 00:04:22 +0300
Subject: [PATCH] Fix: VCAI should not attempt to move Spellbook

---
 AI/VCAI/VCAI.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp
index f7fb1f7ed..f7c1875a8 100644
--- a/AI/VCAI/VCAI.cpp
+++ b/AI/VCAI/VCAI.cpp
@@ -1165,12 +1165,12 @@ void VCAI::pickBestArtifacts(const CGHeroInstance * h, const CGHeroInstance * ot
 
 			for(auto location : allArtifacts)
 			{
+				if(location.slot == ArtifactPosition::MACH4 || location.slot == ArtifactPosition::SPELLBOOK)
+					continue; // don't attempt to move catapult and spellbook
+
 				if(location.relatedObj() == target && location.slot < ArtifactPosition::AFTER_LAST)
 					continue; //don't reequip artifact we already wear
 
-				if(location.slot == ArtifactPosition::MACH4) // don't attempt to move catapult
-					continue;
-
 				auto s = location.getSlot();
 				if(!s || s->locked) //we can't move locks
 					continue;