Assert::AreEqual(player->GetRightClickAbility().GetCooldownTime(),player->GetRightClickAbility().cooldown,L"By default the player cooldowns are unaffected without the Wizard's Soul enchant.");
Assert::AreEqual(player->GetAbility1().GetCooldownTime(),player->GetAbility1().cooldown,L"By default the player cooldowns are unaffected without the Wizard's Soul enchant.");
Assert::AreEqual(player->GetAbility2().GetCooldownTime(),player->GetAbility2().cooldown,L"By default the player cooldowns are unaffected without the Wizard's Soul enchant.");
Assert::AreEqual(player->GetAbility3().GetCooldownTime(),player->GetAbility3().cooldown,L"By default the player cooldowns are unaffected without the Wizard's Soul enchant.");
Assert::AreEqual(player->GetAbility4().GetCooldownTime(),player->GetAbility4().cooldown,L"By default the player cooldowns are unaffected without the Wizard's Soul enchant.");
Assert::AreEqual(player->GetRightClickAbility().GetCooldownTime(),player->GetRightClickAbility().cooldown,L"Right-click ability goes on cooldown like normal.");
Assert::AreEqual(player->GetAbility1().GetCooldownTime(),player->GetAbility1().cooldown,L"All other abilities are unaffected by Right-click ability being used.");
Assert::AreEqual(player->GetAbility2().GetCooldownTime(),player->GetAbility2().cooldown,L"All other abilities are unaffected by Right-click ability being used.");
Assert::AreEqual(player->GetAbility3().GetCooldownTime(),player->GetAbility3().cooldown,L"All other abilities are unaffected by Right-click ability being used.");
Assert::AreEqual(player->GetAbility4().GetCooldownTime(),player->GetAbility4().cooldown,L"All other abilities are unaffected by Right-click ability being used.");
player->SetState(State::NORMAL);
player->RestoreMana(100);
player->GetAbility1().cooldown=0.f;//Reset the cooldown so it can be used.
Assert::AreEqual(player->GetRightClickAbility().GetCooldownTime(),player->GetRightClickAbility().cooldown,L"Right-click ability remains unaffected by other abilities.");
Assert::AreEqual(player->GetAbility1().GetCooldownTime(),player->GetAbility1().cooldown,L"Same ability used should not be affected.");
Assert::AreEqual(player->GetAbility2().GetCooldownTime()-1.5f,player->GetAbility2().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
Assert::AreEqual(player->GetAbility3().GetCooldownTime()-1.5f,player->GetAbility3().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
Assert::AreEqual(player->GetAbility4().GetCooldownTime()-1.5f,player->GetAbility4().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
player->SetState(State::NORMAL);
player->RestoreMana(100);
player->GetAbility2().cooldown=0.f;//Reset the cooldown so it can be used.
Assert::AreEqual(player->GetRightClickAbility().GetCooldownTime(),player->GetRightClickAbility().cooldown,L"Right-click ability remains unaffected by other abilities.");
Assert::AreEqual(player->GetAbility1().GetCooldownTime()-1.5f,player->GetAbility1().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
Assert::AreEqual(player->GetAbility2().GetCooldownTime(),player->GetAbility2().cooldown,L"Same ability used should not be affected.");
Assert::AreEqual(player->GetAbility3().GetCooldownTime()-3.f,player->GetAbility3().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
Assert::AreEqual(player->GetAbility4().GetCooldownTime()-3.f,player->GetAbility4().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
player->SetState(State::NORMAL);
player->RestoreMana(100);
player->GetAbility3().cooldown=0.f;//Reset the cooldown so it can be used.
game->OnUserUpdate(1.f);//It's a cast, so wait one second as the ability gets used. This also reduces cooldowns by a second...
Assert::AreEqual(player->GetRightClickAbility().GetCooldownTime()-1.f,player->GetRightClickAbility().cooldown,L"Right-click ability remains unaffected by other abilities.");
Assert::AreEqual(player->GetAbility1().GetCooldownTime()-4.f,player->GetAbility1().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
Assert::AreEqual(player->GetAbility2().GetCooldownTime()-2.5f,player->GetAbility2().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
Assert::AreEqual(player->GetAbility3().GetCooldownTime()-1.f,player->GetAbility3().cooldown,L"Same ability used should not be affected.");
Assert::AreEqual(player->GetAbility4().GetCooldownTime(),player->GetAbility4().cooldown,L"All other abilities have cooldowns reduced by 1.5 seconds.");
player->SetState(State::NORMAL);
player->RestoreMana(100);
player->GetAbility4().cooldown=0.f;//Reset the cooldown so it can be used.
Assert::AreEqual(player->GetRightClickAbility().GetCooldownTime()-1.f,player->GetRightClickAbility().cooldown,L"Right-click ability remains unaffected by other abilities.");
Assert::AreEqual(player->GetAbility1().GetCooldownTime()-4.f,player->GetAbility1().cooldown,L"Ability 4 isn't setup for anything and returns as unused, causing cooldowns to remain the same.");
Assert::AreEqual(player->GetAbility2().GetCooldownTime()-2.5f,player->GetAbility2().cooldown,L"Ability 4 isn't setup for anything and returns as unused, causing cooldowns to remain the same.");
Assert::AreEqual(player->GetAbility3().GetCooldownTime()-1.f,player->GetAbility3().cooldown,L"Ability 4 isn't setup for anything and returns as unused, causing cooldowns to remain the same.");
Assert::AreEqual(player->GetAbility4().GetCooldownTime(),player->GetAbility4().cooldown,L"Ability 4 isn't setup for anything and returns as unused, causing cooldowns to remain the same.");
Inventory::AddItem("Stat Up Everything Potion"s,5U);
Inventory::AddItem("Stat Up Everything Potion"s,5U);
game->SetLoadoutItem(0,"Stat Up Everything Potion");
game->SetLoadoutItem(0,"Stat Up Everything Potion");
testKey->bHeld=true;//Simulate key being pressed.
testKey->bHeld=true;//Simulate key being pressed.
Assert::ExpectException<std::exception>([&](){player->CheckAndPerformAbility(player->useItem1,testKeyboardInput);},L"If all buffs are properly applied, then some of these stat up buffs are illegal and will catch an exception.");
Assert::ExpectException<std::exception>([&](){player->CheckAndPerformAbility(player->GetItem1(),testKeyboardInput);},L"If all buffs are properly applied, then some of these stat up buffs are illegal and will catch an exception.");
if(!ItemEnchantInfo::GetEnchants().count(std::string(enchantName)))ERR(std::format("WARNING! Enchantment {} does not exist in enchantment database!",enchantName));
if(!ItemEnchantInfo::GetEnchants().count(std::string(enchantName)))ERR(std::format("WARNING! Enchantment {} does not exist in enchantment database!",enchantName));
if(ability.itemAbility)ERR(std::format("WARNING! Somehow triggered an item ability called {} in OnAbilityUse Callback function. THIS SHOULD NOT BE HAPPENING!",ability.name));