Skip to content

Commit

Permalink
Add test for OpenEnroth#1532
Browse files Browse the repository at this point in the history
  • Loading branch information
pskelton committed Mar 16, 2024
1 parent a2e1764 commit 2f8662e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/Bin/GameTest/GameTests_1500.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#include <unordered_set>
#include <ranges>

#include "Testing/Game/GameTest.h"

#include "Engine/Spells/CastSpellInfo.h"
#include "Engine/Engine.h"
#include "Engine/mm7_data.h"
#include "Engine/Party.h"
#include "Engine/Objects/SpriteObject.h"

#include "GUI/GUIWindow.h"
#include "GUI/UI/UIPartyCreation.h"
#include "GUI/UI/UIStatusBar.h"

// 1500

Expand All @@ -26,6 +31,30 @@ GAME_TEST(Issues, Issue1510) {
EXPECT_LE(actorDistTape.max(), meleeRange);
}

GAME_TEST(Issues, Issue1532) {
// Can cast too many firespikes
game.startNewGame();
engine->config->debug.AllMagic.setValue(true);
engine->config->debug.NoActors.setValue(true);
auto statusTape = tapes.statusBar();

// keep casting till the spell fails
while (engine->_statusBar->get() != "Spell failed") {
if (pParty->pCharacters[0].CanAct())
pushSpellOrRangedAttack(SPELL_FIRE_FIRE_SPIKE, 0, CombinedSkillValue(10, CHARACTER_SKILL_MASTERY_GRANDMASTER), 0, 0);
game.tick(1);
}

// count should be 9 for gm
EXPECT_EQ(9, std::ranges::count_if(pSpriteObjects, [](const SpriteObject& object) {
return object.uType != SPRITE_NULL &&
object.uObjectDescID != 0 && // exploded fire spikes have no DescID
object.uSpellID == SPELL_FIRE_FIRE_SPIKE &&
object.spell_caster_pid == Pid(OBJECT_Character, 0);
})
);
}

GAME_TEST(Issues, Issue1535) {
// Queued messages stay in the event queue and roll over between tests.
game.startNewGame();
Expand Down

0 comments on commit 2f8662e

Please sign in to comment.