Scripts/Misc: Adjustments to previous fixes (#27821)

(cherry picked from commit 9ee6f4fb11)
This commit is contained in:
offl
2022-02-22 23:53:37 +02:00
committed by Shauren
parent 1bb63f69ef
commit d86bc562cb
10 changed files with 31 additions and 47 deletions

View File

@@ -789,23 +789,9 @@ class spell_volazj_whisper : public SpellScript
{
PrepareSpellScript(spell_volazj_whisper);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
SPELL_WHISPER_AGGRO,
SPELL_WHISPER_INSANITY,
SPELL_WHISPER_SLAY_1,
SPELL_WHISPER_SLAY_2,
SPELL_WHISPER_SLAY_3,
SPELL_WHISPER_DEATH_1,
SPELL_WHISPER_DEATH_2
});
}
void HandleScriptEffect(SpellEffIndex /* effIndex */)
{
Unit* target = GetHitPlayer();
Player* target = GetHitPlayer();
Creature* caster = GetCaster()->ToCreature();
if (!target || !caster)
return;

View File

@@ -38,12 +38,12 @@ class spell_summon_random_drakkari : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetCaster()->CastSpell(GetCaster(), RAND(SPELL_SUMMON_DRAKKARI_SHAMAN, SPELL_SUMMON_DRAKKARI_GUARDIAN), true);
GetCaster()->CastSpell(GetCaster(), RAND(SPELL_SUMMON_DRAKKARI_SHAMAN, SPELL_SUMMON_DRAKKARI_GUARDIAN));
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_summon_random_drakkari::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHit += SpellEffectFn(spell_summon_random_drakkari::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};

View File

@@ -1921,8 +1921,8 @@ class spell_deliver_kodo : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_KODO_DELIVERED, true);
Unit* caster = GetCaster();
caster->CastSpell(caster, SPELL_KODO_DELIVERED, true);
}
void Register() override
@@ -1947,8 +1947,8 @@ class spell_kodo_delivered : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
caster->Unit::Say(RAND(TEXT_DELIVERED_1, TEXT_DELIVERED_2, TEXT_DELIVERED_3, TEXT_DELIVERED_4, TEXT_DELIVERED_5), caster);
Unit* caster = GetCaster();
caster->Unit::Say(RAND(TEXT_DELIVERED_1, TEXT_DELIVERED_2, TEXT_DELIVERED_3, TEXT_DELIVERED_4, TEXT_DELIVERED_5), caster);
}
void Register() override

View File

@@ -611,8 +611,8 @@ class spell_warsong_battle_standard : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
caster->Unit::Say(RAND(TEXT_TAUNT_1, TEXT_TAUNT_2, TEXT_TAUNT_3, TEXT_TAUNT_4, TEXT_TAUNT_5, TEXT_TAUNT_6, TEXT_TAUNT_7), caster);
Unit* caster = GetCaster();
caster->Unit::Say(RAND(TEXT_TAUNT_1, TEXT_TAUNT_2, TEXT_TAUNT_3, TEXT_TAUNT_4, TEXT_TAUNT_5, TEXT_TAUNT_6, TEXT_TAUNT_7), caster);
}
void Register() override
@@ -663,10 +663,9 @@ class spell_moti_hourglass_cast_see_invis_on_master : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
if (TempSummon* casterSummon = caster->ToTempSummon())
if (Unit* summoner = casterSummon->GetSummonerUnit())
summoner->CastSpell(summoner, uint32(GetEffectValue()));
if (TempSummon* casterSummon = GetCaster()->ToTempSummon())
if (Unit* summoner = casterSummon->GetSummonerUnit())
summoner->CastSpell(summoner, uint32(GetEffectValue()));
}
void Register() override

View File

@@ -459,7 +459,7 @@ class spell_the_cleansing_mirror_image_script_effect : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_MIRROR_IMAGE_AURA, true);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_MIRROR_IMAGE_AURA);
}
void Register() override
@@ -480,10 +480,9 @@ class spell_the_cleansing_on_death_cast_on_master : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
if (TempSummon* casterSummon = caster->ToTempSummon())
if (Unit* summoner = casterSummon->GetSummonerUnit())
summoner->CastSpell(summoner, GetEffectInfo().CalcValue(), true);
if (TempSummon* casterSummon = GetCaster()->ToTempSummon())
if (Unit* summoner = casterSummon->GetSummonerUnit())
summoner->CastSpell(summoner, uint32(GetEffectValue()));
}
void Register() override

View File

@@ -797,7 +797,7 @@ class spell_the_ocular_on_death : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Player* target = GetHitPlayer())
target->CastSpell(target, GetEffectInfo().CalcValue(), true);
target->CastSpell(target, uint32(GetEffectValue()));
}
void Register() override

View File

@@ -1365,8 +1365,8 @@ class spell_kaelthas_flame_strike : public AuraScript
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* target = GetTarget())
target->CastSpell(target, SPELL_FLAME_STRIKE_DAMAGE);
Unit* target = GetTarget();
target->CastSpell(target, SPELL_FLAME_STRIKE_DAMAGE);
}
void Register() override
@@ -1387,14 +1387,14 @@ class spell_kaelthas_summon_weapons : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
for (uint32 spells : SummonWeaponsSpells)
caster->CastSpell(caster, spells, true);
Unit* caster = GetCaster();
for (uint32 spells : SummonWeaponsSpells)
caster->CastSpell(caster, spells, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_kaelthas_summon_weapons::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnEffectHit += SpellEffectFn(spell_kaelthas_summon_weapons::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};

View File

@@ -74,7 +74,8 @@ struct boss_laj : public BossAI
void JustSummoned(Creature* summon) override
{
// Not entirely correct, they aggro on their own in a weird way and in general behave weirdly
summon->AI()->AttackStart(SelectTarget(SelectTargetMethod::Random, 0));
if (me->IsEngaged())
DoZoneInCombat(summon);
}
void UpdateAI(uint32 diff) override

View File

@@ -495,7 +495,7 @@ class spell_detonate_teleporter : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* creature = GetHitCreature())
if (Creature* creature = GetHitCreature())
{
if (Unit* charmer = GetCaster()->GetCharmerOrOwner())
{

View File

@@ -982,8 +982,8 @@ class spell_gen_consumption : public SpellScript
void HandleDamageCalc(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (!caster || caster->GetTypeId() != TYPEID_UNIT)
Creature* caster = GetCaster()->ToCreature();
if (!caster)
return;
int32 damage = 0;
@@ -3684,10 +3684,9 @@ class spell_gen_whisper_to_controller : public SpellScript
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetCaster())
if (TempSummon* casterSummon = caster->ToTempSummon())
if (Player* target = casterSummon->GetSummonerUnit()->ToPlayer())
casterSummon->Unit::Whisper(uint32(GetEffectValue()), target, false);
if (TempSummon* casterSummon = GetCaster()->ToTempSummon())
if (Player* target = casterSummon->GetSummonerUnit()->ToPlayer())
casterSummon->Unit::Whisper(uint32(GetEffectValue()), target, false);
}
void Register() override