From a1eb109e702d3d603d23f86f03f35d97445e238d Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 22 Jul 2024 08:23:13 -0500 Subject: [PATCH] Added TriggerMark convenience function and appropriate unit test for it. --- Adventures in Lestoria Tests/MonsterTests.cpp | 7 +++++++ Adventures in Lestoria/Monster.cpp | 4 ++++ Adventures in Lestoria/Monster.h | 1 + Adventures in Lestoria/Version.h | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Adventures in Lestoria Tests/MonsterTests.cpp b/Adventures in Lestoria Tests/MonsterTests.cpp index 0bd7b60f..183b6476 100644 --- a/Adventures in Lestoria Tests/MonsterTests.cpp +++ b/Adventures in Lestoria Tests/MonsterTests.cpp @@ -431,6 +431,13 @@ namespace MonsterTests testMonster._DealTrueDamage(10,HurtFlag::DOT|HurtFlag::PLAYER_ABILITY); Assert::AreEqual(2,testMonster.GetMarkStacks(),L"Monster should have 2 marks remaining after taking true damage, even though it's classified as a DOT. This is an edge case, but it's really meaningless here..."); + + testMonster.Heal(testMonster.GetMaxHealth()); + + testMonster.TriggerMark(); + + Assert::AreEqual(1,testMonster.GetMarkStacks(),L"Monster should have 1 mark remaining after using TriggerMark function"); + Assert::AreEqual(24,testMonster.GetHealth(),L"Monster should not take damage from the TriggerMark function (Mark deals 6 damage though)."); } }; } \ No newline at end of file diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 4e855364..7c307931 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -1218,4 +1218,8 @@ void Monster::RemoveMarkStack(){ break; } } +} + +void Monster::TriggerMark(){ + Hurt(0,OnUpperLevel(),GetZ(),HurtFlag::PLAYER_ABILITY); } \ No newline at end of file diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index af8b9ab4..55b44fe1 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -200,6 +200,7 @@ public: //The collision rectangle is only used currently for determining the safe spots for the stone golem boss fight. const std::optional>&GetRectangleCollision()const; const int GetMarkStacks()const; //Number of Trapper marks on this target. + void TriggerMark(); //Deals no damage, but causes a mark proc to occur. private: //NOTE: Marking a monster for deletion does not trigger any death events. It just simply removes the monster from the field!! // The way this works is that monsters marked for deletion will cause the monster update loop to detect there's at least one or more monsters that must be deleted and will call erase_if on the list at the end of the iteration loop. diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 3b9557af..e85f6a84 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 10261 +#define VERSION_BUILD 10262 #define stringify(a) stringify_(a) #define stringify_(a) #a