aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorQAston <qaston@gmail.com>2011-06-28 16:18:42 +0200
committerQAston <qaston@gmail.com>2011-06-28 16:18:42 +0200
commit348adaf791fd62c0bfb9c0a96cc5d88788b62c18 (patch)
treef73721678fb23de09be819332b2fa44531da82ef /src/server/scripts/Spells
parent11c3c80732592c8078d6b0e1003f084fcd913f65 (diff)
parent14af76672c3032467305d2e019e3b29db608749a (diff)
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp113
1 files changed, 113 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 67939a61f23..fe0ecf26c96 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1154,6 +1154,117 @@ public:
}
};
+enum Launch
+{
+ SPELL_LAUNCH_NO_FALLING_DAMAGE = 66251
+};
+
+class spell_gen_launch : public SpellScriptLoader
+{
+ public:
+ spell_gen_launch() : SpellScriptLoader("spell_gen_launch") {}
+
+ class spell_gen_launch_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_launch_SpellScript);
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+
+ SpellEntry const* const spell = GetSpellInfo();
+
+ if (Player* player = GetHitPlayer())
+ {
+ player->CastSpell(player,spell->EffectTriggerSpell[1],true); // changes the player's seat
+ player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE,player); // prevents falling damage
+ }
+ }
+
+ void Launch()
+ {
+ WorldLocation const* const position = GetTargetDest();
+
+ if (Player* player = GetHitPlayer())
+ {
+ player->ExitVehicle();
+
+ // A better research is needed
+ // There is no spell for this, the following calculation was based on void Spell::CalculateJumpSpeeds
+
+ float speedZ = 10.0f;
+ float dist = position->GetExactDist2d(player->GetPositionX(),player->GetPositionY());
+ float speedXY = dist;
+
+ player->GetMotionMaster()->MoveJump(position->GetPositionX(),position->GetPositionY(),position->GetPositionZ(),speedXY,speedZ);
+ }
+ }
+
+ void Register()
+ {
+ OnEffect += SpellEffectFn(spell_gen_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST);
+ AfterHit += SpellHitFn(spell_gen_launch_SpellScript::Launch);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_launch_SpellScript();
+ }
+};
+
+class spell_gen_vehicle_scaling : public SpellScriptLoader
+{
+ public:
+ spell_gen_vehicle_scaling() : SpellScriptLoader("spell_gen_vehicle_scaling") { }
+
+ class spell_gen_vehicle_scaling_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_vehicle_scaling_AuraScript);
+
+ void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ Unit* caster = GetCaster();
+ if (!caster || !caster->ToPlayer())
+ return;
+
+ float factor;
+ uint16 baseItemLevel;
+
+ // TODO: Reserach coeffs for different vehicles
+ switch (GetId())
+ {
+ case 66668:
+ factor = 1.0f;
+ baseItemLevel = 205;
+ break;
+ default:
+ factor = 1.0f;
+ baseItemLevel = 170;
+ break;
+ }
+
+ float avgILvl = caster->ToPlayer()->GetAverageItemLevel();
+ if (avgILvl < baseItemLevel)
+ return; // TODO: Research possibility of scaling down
+
+ amount = uint16((avgILvl - baseItemLevel) * factor);
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_HEALING_PCT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_vehicle_scaling_AuraScript::CalculateAmount, EFFECT_2, SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_vehicle_scaling_AuraScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -1181,4 +1292,6 @@ void AddSC_generic_spell_scripts()
new spell_gen_lifeblood();
new spell_gen_magic_rooster();
new spell_gen_allow_cast_from_item_only();
+ new spell_gen_launch();
+ new spell_gen_vehicle_scaling();
}