Scripts/Item: Fix Nitro Boosts to only fail in flyable areas.

Port From (https://github.com/TrinityCore/TrinityCore/commit/ba7d8e9ace2de730034cd8b2b901f19f04129ef9)
This commit is contained in:
hondacrx
2020-08-22 15:03:06 -04:00
parent 9314d5a9bc
commit f90597a156
3 changed files with 21 additions and 7 deletions
+9 -6
View File
@@ -273,8 +273,8 @@ namespace Scripts.Spells.Items
public const uint BrewfestMountTransformReverse = 52845;
//Nitroboots
public const uint NitroBootsSuccess = 54861;
public const uint NitroBootsBackfire = 46014;
public const uint NitroBoostsSuccess = 54861;
public const uint NitroBoostsBackfire = 46014;
//Teachlanguage
public const uint LearnGnomishBinary = 50242;
@@ -2491,7 +2491,7 @@ namespace Scripts.Spells.Items
}
[Script]
class spell_item_nitro_boots : SpellScript
class spell_item_nitro_boosts : SpellScript
{
public override bool Load()
{
@@ -2502,14 +2502,17 @@ namespace Scripts.Spells.Items
public override bool Validate(SpellInfo spell)
{
return ValidateSpellInfo(SpellIds.NitroBootsSuccess, SpellIds.NitroBootsBackfire);
return ValidateSpellInfo(SpellIds.NitroBoostsSuccess, SpellIds.NitroBoostsBackfire);
}
void HandleDummy(uint effIndex)
{
Unit caster = GetCaster();
bool success = caster.GetMap().IsDungeon() || RandomHelper.randChance(95);
caster.CastSpell(caster, success ? SpellIds.NitroBootsSuccess : SpellIds.NitroBootsBackfire, true, GetCastItem());
AreaTableRecord areaEntry = CliDB.AreaTableStorage.LookupByKey(caster.GetAreaId());
bool success = true;
if (areaEntry != null && areaEntry.IsFlyable() && !caster.GetMap().IsDungeon())
success = RandomHelper.randChance(95);
caster.CastSpell(caster, success ? SpellIds.NitroBoostsSuccess : SpellIds.NitroBoostsBackfire, true, GetCastItem());
}
public override void Register()