From f717abfa547fb5b1d8038228e499630186203738 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Wed, 14 Aug 2024 18:35:18 -0700 Subject: [PATCH] Lingering Scent enchant implemented. --- Adventures in Lestoria Tests/EnchantTests.cpp | 30 ++++++++++++++++++- Adventures in Lestoria/BearTrap.cpp | 4 ++- Adventures in Lestoria/Version.h | 2 +- .../assets/config/items/ItemEnchants.txt | 2 +- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Adventures in Lestoria Tests/EnchantTests.cpp b/Adventures in Lestoria Tests/EnchantTests.cpp index 64c38838..f8286482 100644 --- a/Adventures in Lestoria Tests/EnchantTests.cpp +++ b/Adventures in Lestoria Tests/EnchantTests.cpp @@ -43,6 +43,7 @@ All rights reserved. #include "ItemDrop.h" #include "DamageNumber.h" #include +#include "BulletTypes.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace olc::utils; @@ -921,5 +922,32 @@ namespace EnchantTests Assert::AreEqual(uint8_t(2),Trapper::ability2.MAX_CHARGES,L"Trap Collector enchant increases Bear Trap charges to two."); Assert::AreEqual(uint8_t(2),Trapper::ability3.MAX_CHARGES,L"Trap Collector enchant increases Explosive Trap charges to two."); } + TEST_METHOD(LingeringScentNoEnchantCheck){ + testKey->bHeld=true; //Force the key to be held down for testing purposes. + game->ChangePlayerClass(TRAPPER); + player=game->GetPlayer(); + Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])}; + player->CheckAndPerformAbility(player->GetAbility2(),testKeyboardInput); + game->SetElapsedTime(0.5f); + game->OnUserUpdate(0.5f); + BearTrap trap{*(BearTrap*)BULLET_LIST.back().get()}; + trap.MonsterHit(newMonster,1); //Simulate 1 mark stack on the monster to trigger the bleed. + Assert::AreEqual("Trapper.Ability 2.Marked Target Bleed"_f[1],newMonster.GetBuffs(BuffType::OVER_TIME)[0].duration,L"Bleed duration should be 10 seconds by default."); + } + TEST_METHOD(LingeringScentEnchantCheck){ + testKey->bHeld=true; //Force the key to be held down for testing purposes. + game->ChangePlayerClass(TRAPPER); + player=game->GetPlayer(); + std::weak_ptrnullRing{Inventory::AddItem("Null Ring"s)}; + Inventory::EquipItem(nullRing,EquipSlot::RING1); + nullRing.lock()->EnchantItem("Lingering Scent"); + Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])}; + player->CheckAndPerformAbility(player->GetAbility2(),testKeyboardInput); + game->SetElapsedTime(0.5f); + game->OnUserUpdate(0.5f); + BearTrap trap{*(BearTrap*)BULLET_LIST.back().get()}; + trap.MonsterHit(newMonster,1); //Simulate 1 mark stack on the monster to trigger the bleed. + Assert::AreEqual("Trapper.Ability 2.Marked Target Bleed"_f[1]+"Lingering Scent"_ENC["BLEED EXTRA DURATION"],newMonster.GetBuffs(BuffType::OVER_TIME)[0].duration,L"Bleed duration should be 10 seconds by default."); + } }; -} \ No newline at end of file +} diff --git a/Adventures in Lestoria/BearTrap.cpp b/Adventures in Lestoria/BearTrap.cpp index 9c6e829e..3dd926c4 100644 --- a/Adventures in Lestoria/BearTrap.cpp +++ b/Adventures in Lestoria/BearTrap.cpp @@ -63,9 +63,11 @@ BulletDestroyState BearTrap::MonsterHit(Monster&monster,const uint8_t markStacks animation.ChangeState(internal_animState,"bear_trap.png"); const float bleedDamage{"Trapper.Ability 2.Marked Target Bleed"_f[0]/100.f*game->GetPlayer()->GetAttack()}; - const float bleedDuration{"Trapper.Ability 2.Marked Target Bleed"_f[1]}; + float bleedDuration{"Trapper.Ability 2.Marked Target Bleed"_f[1]}; const float timeBetweenTicks{"Trapper.Ability 2.Marked Target Bleed"_f[2]}; + if(game->GetPlayer()->HasEnchant("Lingering Scent"))bleedDuration+="Lingering Scent"_ENC["BLEED EXTRA DURATION"]; + if(markStacksBeforeHit>0){ const uint8_t resetStackCount{uint8_t("Trapper.Ability 2.Marked Target Stack Count Reset"_I+1U)}; //Add an additional stack because we know the target hit is about to lose one stack. const uint8_t numberOfStacksToReplenish{uint8_t(resetStackCount-monster.GetMarkStacks())}; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 65412b01..9a547e6e 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 11021 +#define VERSION_BUILD 11022 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/items/ItemEnchants.txt b/Adventures in Lestoria/assets/config/items/ItemEnchants.txt index 5c786666..1c82438d 100644 --- a/Adventures in Lestoria/assets/config/items/ItemEnchants.txt +++ b/Adventures in Lestoria/assets/config/items/ItemEnchants.txt @@ -276,7 +276,7 @@ Item Enchants } Lingering Scent { - Description = "Bleed lasts for {BLEED EXTRA DURATION} seconds longer." + Description = "Bear Trap's bleed effect lasts for {BLEED EXTRA DURATION} seconds longer." Affects = Ability 2 BLEED EXTRA DURATION = 10s