1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-05 13:04:54 +02:00

Merge pull request #692 from ShubusCorporation/do/fix/attempt_equip_spellbook

Fix: VCAI should not attempt to move Spell Book
This commit is contained in:
Alexander Shishkin 2021-04-29 15:52:06 +03:00 committed by GitHub
commit ef363ba4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;