diff --git a/src/strategy/warlock/WarlockActions.cpp b/src/strategy/warlock/WarlockActions.cpp index 69f1f335..b3b57871 100644 --- a/src/strategy/warlock/WarlockActions.cpp +++ b/src/strategy/warlock/WarlockActions.cpp @@ -171,24 +171,21 @@ bool CastCreateSoulstoneAction::isUseful() }; // Check if the bot already has any soulstone - uint32 currentSoulstones = 0; - for (uint32 id : soulstoneIds) - currentSoulstones += bot->GetItemCount(id, false); // false = only bags - - // Allow only if the bot has no soulstone AND there is space for one - ItemPosCountVec dest; - uint32 count = 1; - bool hasSpace = false; for (uint32 id : soulstoneIds) { - if (bot->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, id, count) == EQUIP_ERR_OK) - { - hasSpace = true; - break; - } + if (bot->GetItemCount(id, false) > 0) + return false; // Already has a soulstone } - return (currentSoulstones == 0) && hasSpace; + // Only need to check one soulstone type for bag space (usually the highest-tier) + ItemPosCountVec dest; + uint32 count = 1; + // Use the last in the list (highest tier) + uint32 soulstoneToCreate = soulstoneIds.back(); + + bool hasSpace = (bot->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, soulstoneToCreate, count) == EQUIP_ERR_OK); + + return hasSpace; } bool DestroySoulShardAction::Execute(Event event) diff --git a/src/strategy/warlock/WarlockAiObjectContext.cpp b/src/strategy/warlock/WarlockAiObjectContext.cpp index 155ded9f..840ee8cd 100644 --- a/src/strategy/warlock/WarlockAiObjectContext.cpp +++ b/src/strategy/warlock/WarlockAiObjectContext.cpp @@ -137,7 +137,7 @@ public: creators["no healthstone"] = &WarlockTriggerFactoryInternal::HasHealthstone; creators["no firestone"] = &WarlockTriggerFactoryInternal::HasFirestone; creators["no spellstone"] = &WarlockTriggerFactoryInternal::HasSpellstone; - creators["no soulstone"] = &WarlockTriggerFactoryInternal::HasSoulstone; + creators["no soulstone"] = &WarlockTriggerFactoryInternal::OutOfSoulstone; creators["firestone"] = &WarlockTriggerFactoryInternal::firestone; creators["spellstone"] = &WarlockTriggerFactoryInternal::spellstone; creators["soulstone"] = &WarlockTriggerFactoryInternal::soulstone; @@ -181,7 +181,7 @@ private: static Trigger* HasHealthstone(PlayerbotAI* botAI) { return new HasHealthstoneTrigger(botAI); } static Trigger* HasFirestone(PlayerbotAI* botAI) { return new HasFirestoneTrigger(botAI); } static Trigger* HasSpellstone(PlayerbotAI* botAI) { return new HasSpellstoneTrigger(botAI); } - static Trigger* HasSoulstone(PlayerbotAI* botAI) { return new HasSoulstoneTrigger(botAI); } + static Trigger* OutOfSoulstone(PlayerbotAI* botAI) { return new OutOfSoulstoneTrigger(botAI); } static Trigger* firestone(PlayerbotAI* botAI) { return new FirestoneTrigger(botAI); } static Trigger* spellstone(PlayerbotAI* botAI) { return new SpellstoneTrigger(botAI); } static Trigger* soulstone(PlayerbotAI* botAI) { return new SoulstoneTrigger(botAI); } diff --git a/src/strategy/warlock/WarlockTriggers.cpp b/src/strategy/warlock/WarlockTriggers.cpp index e0493e20..b9794935 100644 --- a/src/strategy/warlock/WarlockTriggers.cpp +++ b/src/strategy/warlock/WarlockTriggers.cpp @@ -46,7 +46,7 @@ bool OutOfSoulShardsTrigger::IsActive() { return GetSoulShardCount(botAI->GetBot bool TooManySoulShardsTrigger::IsActive() { return GetSoulShardCount(botAI->GetBot()) >= 6; } -bool HasSoulstoneTrigger::IsActive() { return GetSoulstoneCount(botAI->GetBot()) == 0; } +bool OutOfSoulstoneTrigger::IsActive() { return GetSoulstoneCount(botAI->GetBot()) == 0; } // Checks if the target marked with the moon icon can be banished bool BanishTrigger::IsActive() diff --git a/src/strategy/warlock/WarlockTriggers.h b/src/strategy/warlock/WarlockTriggers.h index 3a448973..e5ce9ad1 100644 --- a/src/strategy/warlock/WarlockTriggers.h +++ b/src/strategy/warlock/WarlockTriggers.h @@ -58,10 +58,10 @@ public: bool IsActive() override; }; -class HasSoulstoneTrigger : public Trigger +class OutOfSoulstoneTrigger : public Trigger { public: - HasSoulstoneTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no soulstone") {} + OutOfSoulstoneTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no soulstone") {} bool IsActive() override; };