Add Enchant API and EnchantItem() function that applies a random Enchant onto an item. Added HasEnchant() check to see if an equip has an enchant for future integration of enchants in the game. Fix money listeners structure not being reset between unit tests. Add unit tests to ensure items receive correct valid enchants and we can properly detect the player has enchants. Release Build 10527.
Assert::AreEqual(ITEM_DATA[slimeKingRing.lock()->ActualName()].GetMaxStats().A_Read(attr),val,L"The current stats should be equal to the maximum stats when refinement is done.");
}
}
TEST_METHOD(EnchantTestCheck){
std::weak_ptr<Item>slimeKingRing{Inventory::AddItem("Ring of the Slime King"s)};
if(ItemEnchantInfo::ENCHANT_LIST.at(slimeKingRing.lock()->GetEnchant().value().Name()).GetClass().has_value())Assert::AreEqual(int(player->GetClass()),int(ItemEnchantInfo::ENCHANT_LIST.at(slimeKingRing.lock()->GetEnchant().value().Name()).GetClass().value()));//Validate enchant is only for this class if it's a class-based ability.
}
testGame->ChangePlayerClass(WIZARD);
player=testGame->GetPlayer();//The player pointer has been reassigned...
if(ItemEnchantInfo::ENCHANT_LIST.at(slimeKingRing.lock()->GetEnchant().value().Name()).GetClass().has_value())Assert::AreEqual(int(player->GetClass()),int(ItemEnchantInfo::ENCHANT_LIST.at(slimeKingRing.lock()->GetEnchant().value().Name()).GetClass().value()));//Validate enchant is only for this class if it's a class-based ability.
for(inti=int(EquipSlot::RING2);i>=int(EquipSlot::HELMET);i>>=1){//I'm inverting the order of this equip slot check because typically the player will have enchants in the ring slots, so check those earlier to terminate the loop quicker.
Description = "Using an ability reduces the cooldown of every other ability by {ABILITY COOLDOWN AMOUNT} seconds. Mana Recovery also increases by {MANA RECOVERY MULT}x for {MANA RECOVERY DURATION} seconds."