mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Merge pull request #5426 from Souler/fix_ds_pipe_knockback
Dalaran Sewers Arena: Knockback from starting pipe
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
BattlegroundDS::BattlegroundDS()
|
||||
{
|
||||
BgObjects.resize(BG_DS_OBJECT_MAX);
|
||||
BgCreatures.resize(BG_DS_NPC_MAX);
|
||||
|
||||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
@@ -49,6 +50,21 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (getPipeKnockBackCount() < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
|
||||
{
|
||||
if (getPipeKnockBackTimer() < diff)
|
||||
{
|
||||
for (uint32 i = BG_DS_NPC_PIPE_KNOCKBACK_1; i <= BG_DS_NPC_PIPE_KNOCKBACK_2; ++i)
|
||||
if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[i]))
|
||||
waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
|
||||
|
||||
setPipeKnockBackCount(getPipeKnockBackCount() + 1);
|
||||
setPipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_DELAY);
|
||||
}
|
||||
else
|
||||
setPipeKnockBackTimer(getPipeKnockBackTimer() - diff);
|
||||
}
|
||||
|
||||
if (getWaterFallTimer() < diff)
|
||||
{
|
||||
if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_OFF) // Add the water
|
||||
@@ -57,8 +73,11 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff)
|
||||
setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION);
|
||||
setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING);
|
||||
}
|
||||
else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision
|
||||
else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision and perform knockback
|
||||
{
|
||||
if (Creature* waterSpout = GetBgMap()->GetCreature(BgCreatures[BG_DS_NPC_WATERFALL_KNOCKBACK]))
|
||||
waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true);
|
||||
|
||||
if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1]))
|
||||
gob->SetGoState(GO_STATE_READY);
|
||||
|
||||
@@ -97,6 +116,9 @@ void BattlegroundDS::StartingEventOpenDoors()
|
||||
setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
|
||||
setWaterFallStatus(BG_DS_WATERFALL_STATUS_OFF);
|
||||
|
||||
setPipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_FIRST_DELAY);
|
||||
setPipeKnockBackCount(0);
|
||||
|
||||
SpawnBGObject(BG_DS_OBJECT_WATER_2, RESPAWN_IMMEDIATELY);
|
||||
DoorOpen(BG_DS_OBJECT_WATER_2);
|
||||
|
||||
@@ -151,6 +173,10 @@ void BattlegroundDS::HandleAreaTrigger(Player* Source, uint32 Trigger)
|
||||
{
|
||||
case 5347:
|
||||
case 5348:
|
||||
// Someone has get back into the pipes and the knockback has already been performed,
|
||||
// so we reset the knockback count for kicking the player again into the arena.
|
||||
if (getPipeKnockBackCount() >= BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
|
||||
setPipeKnockBackCount(0);
|
||||
break;
|
||||
default:
|
||||
sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
@@ -187,7 +213,11 @@ bool BattlegroundDS::SetupBattleground()
|
||||
|| !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, 120)
|
||||
// buffs
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7f, 813.424f, 7.11472f, 4.64562f, 0, 0, 0.730314f, -0.683111f, 120)
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120))
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f, 120)
|
||||
// knockback creatures
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_WATERFALL_KNOCKBACK, 0, 1292.587f, 790.2205f, 7.19796f, 3.054326f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 0, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 0, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY))
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundDS: Failed to spawn some object!");
|
||||
return false;
|
||||
|
||||
@@ -42,12 +42,35 @@ enum BattlegroundDSObjects
|
||||
BG_DS_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
enum BattlegroundDSCreatureTypes
|
||||
{
|
||||
BG_DS_NPC_WATERFALL_KNOCKBACK = 0,
|
||||
BG_DS_NPC_PIPE_KNOCKBACK_1 = 1,
|
||||
BG_DS_NPC_PIPE_KNOCKBACK_2 = 2,
|
||||
BG_DS_NPC_MAX = 3
|
||||
};
|
||||
|
||||
enum BattlegroundDSCreatures
|
||||
{
|
||||
BG_DS_NPC_TYPE_WATER_SPOUT = 28567,
|
||||
};
|
||||
|
||||
enum BattlegroundDSSpells
|
||||
{
|
||||
BG_DS_SPELL_FLUSH = 57405, // Visual and target selector for the starting knockback from the pipe
|
||||
BG_DS_SPELL_FLUSH_KNOCKBACK = 61698, // Knockback effect for previous spell (triggered, not need to be casted)
|
||||
BG_DS_SPELL_WATER_SPOUT = 58873, // Knockback effect of the central waterfall
|
||||
};
|
||||
|
||||
enum BattlegroundDSData
|
||||
{ // These values are NOT blizzlike... need the correct data!
|
||||
BG_DS_WATERFALL_TIMER_MIN = 30000,
|
||||
BG_DS_WATERFALL_TIMER_MAX = 60000,
|
||||
BG_DS_WATERFALL_WARNING_DURATION = 7000,
|
||||
BG_DS_WATERFALL_DURATION = 10000,
|
||||
BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000,
|
||||
BG_DS_PIPE_KNOCKBACK_DELAY = 3000,
|
||||
BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT = 2,
|
||||
|
||||
BG_DS_WATERFALL_STATUS_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking
|
||||
BG_DS_WATERFALL_STATUS_ON = 2, // LoS and Movement blocking active
|
||||
@@ -83,12 +106,18 @@ class BattlegroundDS : public Battleground
|
||||
private:
|
||||
uint32 _waterfallTimer;
|
||||
uint8 _waterfallStatus;
|
||||
uint32 _pipeKnockBackTimer;
|
||||
uint8 _pipeKnockBackCount;
|
||||
|
||||
virtual void PostUpdateImpl(uint32 diff);
|
||||
protected:
|
||||
uint32 getWaterFallStatus() { return _waterfallStatus; };
|
||||
void setWaterFallStatus(uint32 status) { _waterfallStatus = status; };
|
||||
void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; };
|
||||
void setWaterFallStatus(uint8 status) { _waterfallStatus = status; };
|
||||
uint32 getWaterFallTimer() { return _waterfallTimer; };
|
||||
void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; };
|
||||
uint8 getPipeKnockBackCount() { return _pipeKnockBackCount; };
|
||||
void setPipeKnockBackCount(uint8 count) { _pipeKnockBackCount = count; };
|
||||
uint32 getPipeKnockBackTimer() { return _pipeKnockBackTimer; };
|
||||
void setPipeKnockBackTimer(uint32 timer) { _pipeKnockBackTimer = timer; };
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -2548,6 +2548,43 @@ class spell_gen_chaos_blast : public SpellScriptLoader
|
||||
|
||||
};
|
||||
|
||||
class spell_gen_ds_flush_knockback : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_ds_flush_knockback() : SpellScriptLoader("spell_gen_ds_flush_knockback") {}
|
||||
|
||||
class spell_gen_ds_flush_knockback_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_ds_flush_knockback_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
// Here the target is the water spout and determines the position where the player is knocked from
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
{
|
||||
float horizontalSpeed = 20.0f + (40.0f - GetCaster()->GetDistance(target));
|
||||
float verticalSpeed = 8.0f;
|
||||
// This method relies on the Dalaran Sewer map disposition and Water Spout position
|
||||
// What we do is knock the player from a position exactly behind him and at the end of the pipe
|
||||
player->KnockbackFrom(target->GetPositionX(), player->GetPositionY(), horizontalSpeed, verticalSpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_ds_flush_knockback_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_ds_flush_knockback_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
new spell_gen_absorb0_hitlimit1();
|
||||
@@ -2597,4 +2634,5 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_on_tournament_mount();
|
||||
new spell_gen_tournament_pennant();
|
||||
new spell_gen_chaos_blast();
|
||||
new spell_gen_ds_flush_knockback();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user