fix(Core/Spell): Roll 'dem Bones (#14522)

* fix(Core/Spell): Roll 'dem Bones

* closes https://github.com/azerothcore/azerothcore-wotlk/issues/14357

* Partial cp of 029527365f

Co-Authored-By: joschiwald <736792+joschiwald@users.noreply.github.com>

* newline pleb

Co-authored-by: joschiwald <736792+joschiwald@users.noreply.github.com>
This commit is contained in:
Kitzunu
2023-01-07 20:05:42 +01:00
committed by GitHub
parent 21700f2760
commit 7b774c8141
3 changed files with 46 additions and 11 deletions

View File

@@ -23,6 +23,7 @@
#include "Battleground.h"
#include "GameTime.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
@@ -3757,6 +3758,46 @@ class spell_item_green_whelp_armor : public AuraScript
}
};
enum TrollDice
{
TEXT_WORN_TROLL_DICE = 26152
};
// 47776 - Roll 'dem Bones
class spell_item_worn_troll_dice : public SpellScript
{
PrepareSpellScript(spell_item_worn_troll_dice);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sObjectMgr->GetBroadcastText(TEXT_WORN_TROLL_DICE))
return false;
return true;
}
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetCaster()->TextEmote(TEXT_WORN_TROLL_DICE, GetHitUnit());
static uint32 const minimum = 1;
static uint32 const maximum = 6;
// roll twice
GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum);
GetCaster()->ToPlayer()->DoRandomRoll(minimum, maximum);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_worn_troll_dice::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_item_spell_scripts()
{
RegisterSpellScript(spell_item_massive_seaforium_charge);
@@ -3873,4 +3914,5 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_snowman);
RegisterSpellScript(spell_item_freeze_rookery_egg);
RegisterSpellScript(spell_item_green_whelp_armor);
RegisterSpellScript(spell_item_worn_troll_dice);
}