Skip to content

Commit

Permalink
Icecrown: Implement s.56683 and s.56684
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Oct 28, 2023
1 parent d8367cc commit 5247c28
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(56265,'spell_vortex_aura'),
(56266,'spell_vortex_aura'),
(56430,'spell_arcane_bomb'),
(56683,'spell_grab_captured_crusader'),
(56684,'spell_drop_off_captured_crusader'),
(57073,'spell_drink'),
(57082,'spell_crystal_spikes'),
(57083,'spell_crystal_spikes'),
Expand Down
51 changes: 51 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/northrend/icecrown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ EndContentData */

#include "AI/ScriptDevAI/include/sc_common.h"
#include "AI/ScriptDevAI/base/escort_ai.h"
#include "Entities/Vehicle.h"

/*######
## npc_squad_leader
Expand Down Expand Up @@ -977,6 +978,54 @@ struct spell_create_lance : public SpellScript
}
};

// 56683 - Grab Captured Crusader
struct GrabCapturedCrusader : public SpellScript
{
SpellCastResult OnCheckCast(Spell* spell, bool /*strict*/) const override
{
if (VehicleInfo* vehicle = spell->GetCaster()->GetVehicleInfo())
{
if (vehicle->GetPassenger(1) != nullptr)
{
spell->SetParam1(SPELL_FAILED_CUSTOM_ERROR_43);
return SPELL_FAILED_CUSTOM_ERROR;
}
}
return SPELL_CAST_OK;
}

void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
{
if (!spell->GetUnitTarget())
return;

spell->GetUnitTarget()->CastSpell(spell->GetCaster(), spell->GetDamage(), TRIGGERED_OLD_TRIGGERED);
}
};

// 56684 - Drop Off Captured Crusader
struct DropOffCapturedCrusader : public SpellScript
{
SpellCastResult OnCheckCast(Spell* spell, bool /*strict*/) const override
{
if (VehicleInfo* vehicle = spell->GetCaster()->GetVehicleInfo())
{
if (vehicle->GetPassenger(1) == nullptr)
{
spell->SetParam1(SPELL_FAILED_CUSTOM_ERROR_41);
return SPELL_FAILED_CUSTOM_ERROR;
}
}
return SPELL_CAST_OK;
}

void OnEffectExecute(Spell* spell, SpellEffectIndex /*effIdx*/) const override
{
if (VehicleInfo* vehicle = spell->GetCaster()->GetVehicleInfo())
vehicle->UnBoard(vehicle->GetPassenger(1), false);
}
};

void AddSC_icecrown()
{
Script* pNewScript = new Script;
Expand Down Expand Up @@ -1009,4 +1058,6 @@ void AddSC_icecrown()
pNewScript->RegisterSelf();

RegisterSpellScript<spell_create_lance>("spell_create_lance");
RegisterSpellScript<GrabCapturedCrusader>("spell_grab_captured_crusader");
RegisterSpellScript<DropOffCapturedCrusader>("spell_drop_off_captured_crusader");
}

0 comments on commit 5247c28

Please sign in to comment.