diff --git a/sql/migrations/2017040712473.sql b/sql/migrations/2017040712473.sql new file mode 100644 index 000000000..ddaf75d8f --- /dev/null +++ b/sql/migrations/2017040712473.sql @@ -0,0 +1 @@ +UPDATE creature_template SET mindmg = 60 , maxdmg = 70, ScriptName = 'npc_arcanite_dragonling' WHERE entry = 12473; \ No newline at end of file diff --git a/sql/migrations/20170409170435_world.sql b/sql/migrations/20170409170435_world.sql new file mode 100644 index 000000000..9924a22c5 --- /dev/null +++ b/sql/migrations/20170409170435_world.sql @@ -0,0 +1,8 @@ +INSERT INTO `migrations` VALUES ('20170409170435'); + +-- Add the passive attribute to weapon enchants +DELETE FROM spell_mod WHERE Id IN (22755,9784,9782,16624); +INSERT INTO spell_mod (Id, Attributes, `Comment`) VALUES (22755, 327888, 'Elemental Sharpening Stone - Passive'); +INSERT INTO spell_mod (Id, Attributes, `Comment`) VALUES (9784, 268435520, 'Iron Shield Spike - Passive'); +INSERT INTO spell_mod (Id, Attributes, `Comment`) VALUES (9782, 268435520, 'Mithril Shield Spike - Passive'); +INSERT INTO spell_mod (Id, Attributes, `Comment`) VALUES (16624, 268435520, 'Thorium Shield Spike - Passive'); diff --git a/sql/migrations/20170409202223_world.sql b/sql/migrations/20170409202223_world.sql new file mode 100644 index 000000000..1df15a13c --- /dev/null +++ b/sql/migrations/20170409202223_world.sql @@ -0,0 +1,5 @@ +INSERT INTO `migrations` VALUES ('20170409202223'); + +-- Set MrSmite yelling at deadmines iron clad door event as CHAT_TYPE_ZONE_YELL +UPDATE `script_texts` SET `type`='6' WHERE `entry`='-1036001'; +UPDATE `script_texts` SET `type`='6' WHERE `entry`='-1036000'; \ No newline at end of file diff --git a/sql/migrations/20170410044436_world.sql b/sql/migrations/20170410044436_world.sql new file mode 100644 index 000000000..a04e2b306 --- /dev/null +++ b/sql/migrations/20170410044436_world.sql @@ -0,0 +1,9 @@ +INSERT INTO `migrations` VALUES ('20170410044436'); + +-- Fix Thundering Charm, Burning Charm and Cresting Charm +UPDATE `spell_effect_mod` SET `Effect`=1 WHERE `Id`=4131; +INSERT INTO `spell_effect_mod` (`Id`, `EffectIndex`, `Effect`, `EffectDieSides`, `EffectBaseDice`, `EffectDicePerLevel`, `EffectRealPointsPerLevel`, `EffectBasePoints`, `EffectAmplitude`, `EffectPointsPerComboPoint`, `EffectChainTarget`, `EffectMultipleValue`, `EffectMechanic`, `EffectImplicitTargetA`, `EffectImplicitTargetB`, `EffectRadiusIndex`, `EffectApplyAuraName`, `EffectItemType`, `EffectMiscValue`, `EffectTriggerSpell`, `Comment`) VALUES (4130, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 0, -1, -1, -1, 0, -1, 'Arathi Cresting Charm'); +INSERT INTO `spell_effect_mod` (`Id`, `EffectIndex`, `Effect`, `EffectDieSides`, `EffectBaseDice`, `EffectDicePerLevel`, `EffectRealPointsPerLevel`, `EffectBasePoints`, `EffectAmplitude`, `EffectPointsPerComboPoint`, `EffectChainTarget`, `EffectMultipleValue`, `EffectMechanic`, `EffectImplicitTargetA`, `EffectImplicitTargetB`, `EffectRadiusIndex`, `EffectApplyAuraName`, `EffectItemType`, `EffectMiscValue`, `EffectTriggerSpell`, `Comment`) VALUES (4132, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, 0, -1, -1, -1, 0, -1, 'Arathi Burning Charm'); + +-- Fix db errors. Targets are already defined in `spell_script_target`. +DELETE FROM `item_required_target` WHERE `entry` IN (4479, 4480, 4481); \ No newline at end of file diff --git a/sql/migrations/20170410155823_world.sql b/sql/migrations/20170410155823_world.sql new file mode 100644 index 000000000..5edb6d774 --- /dev/null +++ b/sql/migrations/20170410155823_world.sql @@ -0,0 +1,4 @@ +INSERT INTO `migrations` VALUES ('20170410155823'); + +-- Fix Mottled Screecher emote +update creature_ai_texts set content_default = '%s lets out a high pitched screech, calling for help!' where entry = -100; diff --git a/sql/migrations/20170410212002_world.sql b/sql/migrations/20170410212002_world.sql new file mode 100644 index 000000000..455b1c0d2 --- /dev/null +++ b/sql/migrations/20170410212002_world.sql @@ -0,0 +1,4 @@ +INSERT INTO `migrations` VALUES ('20170410212002'); + +-- Make Touch of Zanzil prevent Stealth and fix debuff not being applied when opening the chest. +INSERT INTO `spell_effect_mod` (`Id`, `EffectIndex`, `Effect`, `EffectDieSides`, `EffectBaseDice`, `EffectDicePerLevel`, `EffectRealPointsPerLevel`, `EffectBasePoints`, `EffectAmplitude`, `EffectPointsPerComboPoint`, `EffectChainTarget`, `EffectMultipleValue`, `EffectMechanic`, `EffectImplicitTargetA`, `EffectImplicitTargetB`, `EffectRadiusIndex`, `EffectApplyAuraName`, `EffectItemType`, `EffectMiscValue`, `EffectTriggerSpell`, `Comment`) VALUES (9991, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 41, -1, 5, -1, 'Touch of Zanzil - Prevent Stealth'); diff --git a/sql/migrations/20170411223505_world.sql b/sql/migrations/20170411223505_world.sql new file mode 100644 index 000000000..9588ef6b3 --- /dev/null +++ b/sql/migrations/20170411223505_world.sql @@ -0,0 +1,4 @@ +INSERT INTO `migrations` VALUES ('20170411223505'); + +-- Add dummy effect to Summon Screecher Spirit so we can despawn corpse. +INSERT INTO `spell_effect_mod` (`Id`, `EffectIndex`, `Effect`, `EffectDieSides`, `EffectBaseDice`, `EffectDicePerLevel`, `EffectRealPointsPerLevel`, `EffectBasePoints`, `EffectAmplitude`, `EffectPointsPerComboPoint`, `EffectChainTarget`, `EffectMultipleValue`, `EffectMechanic`, `EffectImplicitTargetA`, `EffectImplicitTargetB`, `EffectRadiusIndex`, `EffectApplyAuraName`, `EffectItemType`, `EffectMiscValue`, `EffectTriggerSpell`, `Comment`) VALUES (12699, 1, 3, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 'Summon Screecher Spirit - Dummy Effect'); diff --git a/sql/migrations/20170413170000_world.sql b/sql/migrations/20170413170000_world.sql new file mode 100644 index 000000000..4f5f88448 --- /dev/null +++ b/sql/migrations/20170413170000_world.sql @@ -0,0 +1,22 @@ +INSERT INTO `migrations` VALUES ('20170413170000'); + +-- Darnassus Sentinel sends you to Tirisfal Glades herbalism trainer +UPDATE `gossip_menu_option` SET `action_poi_id` = 268 WHERE `menu_id` = 2351 AND `action_poi_id` = 440 LIMIT 1; + +-- Undercity Guardian sends you to Tailoring trainer instead of Skinning trainer +UPDATE `gossip_menu_option` SET `action_poi_id` = 346 WHERE `action_menu_id` = 2844 AND `action_poi_id` = 348 LIMIT 1; + +-- Undercity Guardian sends you to Mining trainer instead of Leatherworking trainer +UPDATE `gossip_menu_option` SET `action_poi_id` = 345 WHERE `action_menu_id` = 2842 AND `action_poi_id` = 347 LIMIT 1; + +-- Undercity Guardian sends you to Skinning trainer instead of Mining trainer +UPDATE `gossip_menu_option` SET `action_poi_id` = 347 WHERE `action_menu_id` = 2843 AND `action_poi_id` = 346 LIMIT 1; + +-- Ironforge Mountaineer sends you to Undercity Enchanting trainer instead of Dun Morogh Mining trainer (Yarr Hammerstone) +UPDATE `gossip_menu_option` SET `action_poi_id` = 402 WHERE `action_menu_id` = 3555 AND `action_poi_id` = 339 LIMIT 1; + +-- Stormwind City Guard/Patroller sends you to Enchanting trainer instead of Cooking trainer +UPDATE `gossip_menu_option` SET `action_poi_id` = 42 WHERE `action_menu_id` = 424 AND `action_poi_id` = 43 LIMIT 1; + +-- Stormwind Guard sends you to Silvermoon City Mage Trainer instead of Elwynn Forest Herbalism trainer +UPDATE `gossip_menu_option` SET `action_poi_id` = 269 WHERE `action_menu_id` = 3527 AND `action_poi_id` = 363 LIMIT 1; diff --git a/src/game/AI/CreatureEventAI.cpp b/src/game/AI/CreatureEventAI.cpp index 157e1e7ac..5c34965b9 100644 --- a/src/game/AI/CreatureEventAI.cpp +++ b/src/game/AI/CreatureEventAI.cpp @@ -1332,7 +1332,15 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* if ((*i).second.SoundId) { if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) - pSource->PlayDirectSound((*i).second.SoundId); + { + if((*i).second.Type == CHAT_TYPE_ZONE_YELL) + { + if(Map* pZone = pSource->GetMap()) + pZone->PlayDirectSoundToMap((*i).second.SoundId); + } + else + pSource->PlayDirectSound((*i).second.SoundId); + } else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId); } diff --git a/src/game/Maps/GridNotifiersImpl.h b/src/game/Maps/GridNotifiersImpl.h index 2b6ecaba8..d14460346 100644 --- a/src/game/Maps/GridNotifiersImpl.h +++ b/src/game/Maps/GridNotifiersImpl.h @@ -184,6 +184,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) { PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, holder, target, i_dynobject.GetCaster()); holder->AddAura(Aur, eff_index); + target->AddAuraToModList(Aur); Aur->ApplyModifier(true,true); } @@ -199,6 +200,7 @@ inline void MaNGOS::DynamicObjectUpdater::VisitHelper(Unit* target) holder = CreateSpellAuraHolder(spellInfo, target, i_dynobject.GetCaster()); PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, holder, target, i_dynobject.GetCaster()); holder->AddAura(Aur, eff_index); + target->AddSpellAuraHolder(holder); } diff --git a/src/game/Objects/Object.h b/src/game/Objects/Object.h index 07d8d301e..5e98a8a8d 100644 --- a/src/game/Objects/Object.h +++ b/src/game/Objects/Object.h @@ -779,7 +779,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object // Transports / Movement Transport* GetTransport() const { return m_transport; } - void SetTransport(Transport * t) { m_transport = t; } + virtual void SetTransport(Transport * t) { m_transport = t; } float GetTransOffsetX() const { return m_movementInfo.GetTransportPos()->x; } float GetTransOffsetY() const { return m_movementInfo.GetTransportPos()->y; } diff --git a/src/game/Objects/Player.cpp b/src/game/Objects/Player.cpp index c4e126ef6..5153a8ddf 100644 --- a/src/game/Objects/Player.cpp +++ b/src/game/Objects/Player.cpp @@ -435,6 +435,7 @@ Player::Player(WorldSession *session) : Unit(), m_modManaRegen = 0; m_modManaRegenInterrupt = 0; + m_carryHealthRegen = 0; for (int s = 0; s < MAX_SPELL_SCHOOL; s++) m_SpellCritPercentage[s] = 0.0f; m_regenTimer = 0; @@ -908,7 +909,8 @@ uint32 Player::EnvironmentalDamage(EnvironmentalDamageType type, uint32 damage) // Absorb, resist some environmental damage type uint32 absorb = 0; uint32 resist = 0; - if (type == DAMAGE_LAVA) + + if ((type == DAMAGE_LAVA) || (type == DAMAGE_FIRE)) CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist, NULL); else if (type == DAMAGE_SLIME) CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist, NULL); @@ -2281,6 +2283,10 @@ void Player::RegenerateHealth() // This function is called every 2 seconds. addvalue += HealthIncreaseRate * 2.0f * (GetTotalAuraModifier(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) / 5.0f); + // Health fractions get carried to the next tick + addvalue += m_carryHealthRegen; + m_carryHealthRegen = addvalue - int32(addvalue); + if (addvalue < 0) addvalue = 0; @@ -6131,10 +6137,41 @@ uint32 Player::GetLevelFromDB(ObjectGuid guid) return level; } +void Player::DismountCheck() +{ + if (IsMounted()) + { + auto auras = this->GetAurasByType(SPELL_AURA_MOUNTED); + + for (auto& aura : auras) + { + Spell mountSpell(this, aura->GetSpellProto(), true); + + if (mountSpell.CheckCast(true) != SPELL_CAST_OK) + { + RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); + Unmount(true); + } + } + } +} + +void Player::SetTransport(Transport* t) +{ + if (t) // don't bother checking when exiting a transport + { + DismountCheck(); + } + + WorldObject::SetTransport(t); +} + void Player::UpdateArea(uint32 newArea) { m_areaUpdateId = newArea; + DismountCheck(); + const auto *areaEntry = AreaEntry::GetById(newArea); // FFA_PVP flags are area and not zone id dependent diff --git a/src/game/Objects/Player.h b/src/game/Objects/Player.h index e650eb038..fddf8c926 100644 --- a/src/game/Objects/Player.h +++ b/src/game/Objects/Player.h @@ -875,6 +875,8 @@ class MANGOS_DLL_SPEC Player final: public Unit bool Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ); void Update(uint32 update_diff, uint32 time) override; + void SetTransport(Transport * t) override; + void DismountCheck(); static bool BuildEnumData( QueryResult * result, WorldPacket * p_data ); @@ -1914,6 +1916,7 @@ class MANGOS_DLL_SPEC Player final: public Unit float m_modManaRegen; float m_modManaRegenInterrupt; float m_SpellCritPercentage[MAX_SPELL_SCHOOL]; + float m_carryHealthRegen; bool HasMovementFlag(MovementFlags f) const; // for script access to m_movementInfo.HasMovementFlag void UpdateFallInformationIfNeed(MovementInfo const& minfo,uint16 opcode); diff --git a/src/game/Objects/Unit.cpp b/src/game/Objects/Unit.cpp index cd3e78032..48878ee3e 100644 --- a/src/game/Objects/Unit.cpp +++ b/src/game/Objects/Unit.cpp @@ -1546,15 +1546,20 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da } bool immune = true; + bool feral = IsInFeralForm(); - for (uint8 i = 0; i < m_weaponDamageCount[damageInfo->attackType]; i++) + // Only get one damage type for feral druids so they don't receive incorrect benefits + // from weapons with multiple types of damage + uint8 actualDamageCount = feral ? 1 : m_weaponDamageCount[damageInfo->attackType]; + for (uint8 i = 0; i < actualDamageCount; i++) { SubDamageInfo *subDamage = &damageInfo->subDamage[i]; - - subDamage->damageSchoolMask = GetTypeId() == TYPEID_PLAYER + + // feral only allowed melee school + subDamage->damageSchoolMask = GetTypeId() == TYPEID_PLAYER && !feral ? GetSchoolMask(GetWeaponDamageSchool(damageInfo->attackType, i)) : GetMeleeDamageSchoolMask(); - + if (damageInfo->target->IsImmuneToDamage(subDamage->damageSchoolMask)) { subDamage->damage = 0; @@ -2986,7 +2991,7 @@ int32 Unit::MagicSpellHitChance(Unit *pVictim, SpellEntry const *spell, Spell* s // Parry // For spells // Resist -SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool CanReflect, Spell* spellPtr) +SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, SpellEffectIndex effIndex, bool CanReflect, Spell* spellPtr) { // Return evade for units in evade mode if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) @@ -2998,7 +3003,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool // All positive spells can`t miss // TODO: client not show miss log for this spells - so need find info for this in dbc and use it! - if (IsPositiveSpell(spell->Id, this, pVictim)) + if (IsPositiveSpell(spell->Id, this, pVictim) || IsPositiveEffect(spell, effIndex)) return SPELL_MISS_NONE; // Check for immune (use charges) @@ -3974,6 +3979,7 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder) holder->HandleSpellSpecificBoosts(true); // Check debuff limit + //DEBUG_LOG("AddSpellAuraHolder: Adding spell %d, debuff limit affected: %d", holder->GetId(), holder->IsAffectedByDebuffLimit()); if (holder->IsAffectedByDebuffLimit()) { uint32 negativeAuras = GetNegativeAurasCount(); @@ -5087,7 +5093,8 @@ void Unit::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVic // Now go on with a victim's events'n'auras // Not much to do if no flags are set or there is no victim - if (pVictim && pVictim->isAlive() && procVictim) + // Don't proc victim auras if its a miss / resist + if (pVictim && pVictim->isAlive() && procVictim && !(PROC_EX_RESIST & procExtra) && !(PROC_EX_MISS & procExtra)) pVictim->ProcDamageAndSpellFor(true, this, procVictim, procExtra, attType, procSpell, amount, procTriggered, spell); HandleTriggers(pVictim, procExtra, amount, procSpell, procTriggered); @@ -5621,6 +5628,12 @@ void Unit::AttackedBy(Unit* attacker) // trigger AI reaction if (((Creature*)this)->AI()) ((Creature*)this)->AI()->AttackedBy(attacker); + + // trigger owner AI reaction + if(Unit* owner = GetCharmerOrOwner()) + if (owner->IsCreature() && ((Creature*)owner)->AI()){ + ((Creature*)owner)->AI()->AttackedBy(attacker); + } } bool Unit::AttackStop(bool targetSwitch /*=false*/) diff --git a/src/game/Objects/Unit.h b/src/game/Objects/Unit.h index db62e8307..a074546ab 100644 --- a/src/game/Objects/Unit.h +++ b/src/game/Objects/Unit.h @@ -1203,7 +1203,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject SpellMissInfo MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell, Spell* spellPtr = nullptr); SpellMissInfo MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell, Spell* spellPtr = nullptr); int32 MagicSpellHitChance(Unit *pVictim, SpellEntry const *spell, Spell* spellPtr = nullptr); - SpellMissInfo SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool canReflect = false, Spell* spellPtr = nullptr); + SpellMissInfo SpellHitResult(Unit *pVictim, SpellEntry const *spell, SpellEffectIndex effIndex, bool canReflect = false, Spell* spellPtr = nullptr); // Nostalrius : SPELL_AURA_MOD_MECHANIC_RESISTANCE bool IsAuraResist(SpellEntry const *spell); diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index f7d495e82..409dddd9f 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -1579,7 +1579,15 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) if (pData->SoundId) { if (GetSoundEntriesStore()->LookupEntry(pData->SoundId)) - pSource->PlayDirectSound(pData->SoundId); + { + if(pData->Type == CHAT_TYPE_ZONE_YELL) + { + if(Map* pZone = pSource->GetMap()) + pZone->PlayDirectSoundToMap(pData->SoundId); + } + else + pSource->PlayDirectSound(pData->SoundId); + } else sLog.outError("DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->SoundId); } diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 555646388..dddcfae49 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -806,7 +806,7 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex) target.damage = 0; // Calculate hit result - target.missCondition = m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect, this); + target.missCondition = m_caster->SpellHitResult(pVictim, m_spellInfo, effIndex, m_canReflect, this); // spell fly from visual cast object WorldObject* affectiveObject = GetAffectiveCasterObject(); @@ -833,7 +833,7 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex) if (target.missCondition == SPELL_MISS_REFLECT) { // Calculate reflected spell result on caster - target.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect, this); + target.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, effIndex, m_canReflect, this); if (target.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell target.reflectResult = SPELL_MISS_PARRY; @@ -1280,11 +1280,15 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) if (!unit) return; - if (!effectMask) - return; - Unit* realCaster = GetAffectiveCaster(); + if (!effectMask) + { + if (realCaster && !unit->isInCombat()) + unit->AttackedBy(realCaster); + return; + } + // Nostalrius: IsAuraResist pour les ModMechanicResistance des effets. if (IsSpellAppliesAura(m_spellInfo, effectMask) && unit->IsAuraResist(m_spellInfo)) for (int eff = 0; eff < MAX_EFFECT_INDEX; ++eff) diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index 950b8960a..030fc5777 100644 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -4912,7 +4912,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data return; if (spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) + pCaster->SpellHitResult(target, spellProto, GetEffIndex(), false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) @@ -5021,7 +5021,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data return; if (spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) + pCaster->SpellHitResult(target, spellProto, GetEffIndex(), false) != SPELL_MISS_NONE) return; // Check for immune @@ -5211,7 +5211,7 @@ void Aura::PeriodicTick(SpellEntry const* sProto, AuraType auraType, uint32 data return; if (GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) + pCaster->SpellHitResult(target, spellProto, GetEffIndex(), false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) @@ -5940,11 +5940,19 @@ bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const { bool totemAura = caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->IsTotem(); + // Check for persistent area auras that only do damage. If it has a secondary effect, it takes + // up a slot + bool persistent = m_spellProto->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_PERSISTENT_AREA_AURA; + bool persistentWithSecondaryEffect = false; + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { - if (!m_auras[i]) + // Check for persistent aura here since the effect aura is applied to the holder + // by a dynamic object as the target passes through the object field, meaning + // m_auras will be unset when this method is called (initialization) + if (!m_auras[i] && !persistent) continue; - + // special area auras cases switch (m_spellProto->Effect[i]) { @@ -5952,12 +5960,36 @@ bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: // passive auras (except totem auras) do not get placed in caster slot return (m_target != caster || totemAura || !m_isPassive) && m_auras[i]->GetModifier()->m_auraname != SPELL_AURA_NONE; + + break; + case SPELL_EFFECT_PERSISTENT_AREA_AURA: + // If spell aura applies something other than plain damage, it takes + // up a debuff slot. + if (m_spellProto->EffectApplyAuraName[i] != SPELL_AURA_PERIODIC_DAMAGE) + persistentWithSecondaryEffect = true; + + break; default: break; } } - + /* Persistent area auras such as Blizzard/RoF/Volley do not get require debuff slots + since they just do area damage with no additional effects. However, spells like + Hurricane do since they have a secondary effect attached to them. There are enough + persistent area spells in-game that making a switch for all of them is a bit + unreasonable. Any spell with a secondary affect should take up a slot. Note + that most (usable) persistent spells only deal damage. + + It was considered whether spells with secondary effects should still deal damage, + even if there is no room for the other effect, however the debuff tooltip states + that the spell causes damage AND slows, therefore it must take a debuff slot. + */ + if (persistent && !persistentWithSecondaryEffect) + { + return false; + } + // necessary for some spells, e.g. Immolate visual passive 28330 if (m_spellProto->SpellVisual) return true; @@ -6322,6 +6354,10 @@ void SpellAuraHolder::UpdateAuraDuration() const } } +void SpellAuraHolder::SetAffectedByDebuffLimit(bool isAffectedByDebuffLimit) +{ + m_debuffLimitAffected = isAffectedByDebuffLimit; +} /** NOSTALRIUS Debuff limitation diff --git a/src/game/Spells/SpellAuras.h b/src/game/Spells/SpellAuras.h index d80ac1973..34af5f773 100644 --- a/src/game/Spells/SpellAuras.h +++ b/src/game/Spells/SpellAuras.h @@ -92,6 +92,7 @@ class MANGOS_DLL_SPEC SpellAuraHolder // Debuff limit void CalculateForDebuffLimit(); bool IsAffectedByDebuffLimit() const { return m_debuffLimitAffected; } + void SetAffectedByDebuffLimit(bool isAffectedByDebuffLimit); bool IsMoreImportantDebuffThan(SpellAuraHolder *other) const; bool m_debuffLimitAffected; uint32 m_debuffLimitScore; // + haut => + important diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 88ae1e704..8172853b5 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -471,6 +471,17 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { switch (m_spellInfo->Id) { + case 11885: // Capture Treant + case 11886: // Capture Wildkin + case 11887: // Capture Hippogryph + case 11888: // Capture Faerie Dragon + case 11889: // Capture Mountain Giant + case 12699: // Summon Screecher Spirit + { + if (unitTarget->isDead() && unitTarget->GetTypeId() == TYPEID_UNIT) + ((Creature*)unitTarget)->ForcedDespawn(1000); + break; + } case 25716 : // Force Self - Bow { m_caster->HandleEmote(EMOTE_ONESHOT_BOW); diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 72d90b3aa..e871ac1d9 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -704,7 +704,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex, U // Hellfire. Damages the caster, but is still positive ! // (Has same SpellFamilyFlags as Soul Fire oO) - if (spellproto->IsFitToFamily() && spellproto->SpellIconID == 937) + if (spellproto->IsFitToFamily() && spellproto->SpellIconID == 937 && spellproto->SpellVisual == 5423) return true; switch (spellproto->Effect[effIndex]) @@ -729,6 +729,9 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex, U return true; // Negative Effects case SPELL_EFFECT_INSTAKILL: + // Suicide is a positive spell - ex. Garr Massive Eruption + if (spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF && spellproto->EffectImplicitTargetB[effIndex] == TARGET_NONE) + return true; // Sacrifice is a positive spell - for the warlock :) if (spellproto->IsFitToFamily()) return true; diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 7f3907931..74781823c 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -395,12 +395,25 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, fl if (IsInFeralForm()) // check if player is druid and in cat or bear forms, non main hand attacks not allowed for this mode so not check attack type { - uint32 lvl = getLevel(); - if (lvl > 60) - lvl = 60; + /* Druids don't use weapons so a weapon damage index > 0 + should not affect their damage. Fixes crazy druid scaling + when using melee weapons with two or more damage types on it */ + if (index > 0) + { + // Note that CalculateDamage will pull max_damage up to 5.0f, + // so they'll still get some extra damage... + weapon_mindamage = 0.0f; + weapon_maxdamage = 0.0f; + } + else + { + uint32 lvl = getLevel(); + if (lvl > 60) + lvl = 60; - weapon_mindamage = lvl * 0.85f * att_speed; - weapon_maxdamage = lvl * 1.25f * att_speed; + weapon_mindamage = lvl * 0.85f * att_speed; + weapon_maxdamage = lvl * 1.25f * att_speed; + } } else if (!CanUseEquippedWeapon(attType)) // check if player not in form but still can't use weapon (broken/etc) { diff --git a/src/scripts/eastern_kingdoms/westfall/deadmines/instance_deadmines.cpp b/src/scripts/eastern_kingdoms/westfall/deadmines/instance_deadmines.cpp index a1cb0c666..dd9b0e9a6 100644 --- a/src/scripts/eastern_kingdoms/westfall/deadmines/instance_deadmines.cpp +++ b/src/scripts/eastern_kingdoms/westfall/deadmines/instance_deadmines.cpp @@ -73,7 +73,6 @@ struct instance_deadmines : public ScriptedInstance void OnCreatureCreate(Creature* pCreature) { - if (pCreature->GetEntry() == NPC_RHAHKZOR) m_uiRhahkGUID = pCreature->GetGUID(); @@ -96,13 +95,6 @@ struct instance_deadmines : public ScriptedInstance pCreature->SetVisibility(VISIBILITY_OFF); pCreature->setFaction(35); } - - /** Initialize Canon detroying door Patrol */ - if (pCreature->GetRespawnDelay() == 43202) - { - pCreature->SetVisibility(VISIBILITY_OFF); - pCreature->setFaction(35); - } } void OnCreatureDeath(Creature *who) @@ -158,7 +150,9 @@ struct instance_deadmines : public ScriptedInstance { if (GameObject* pGo = instance->GetGameObject(m_uiIronCladGUID)) { - pGo->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + // no breaking the door if it's open + if (!(pGo->GetGoState() == GO_STATE_ACTIVE)) + pGo->UseDoorOrButton(0, true); m_uiIronDoor_Timer = 3000; } } @@ -263,29 +257,15 @@ struct instance_deadmines : public ScriptedInstance { case 0: DoScriptText(INST_SAY_ALARM1, pMrSmite); - m_uiIronDoor_Timer = 2000; - ++m_uiDoor_Step; - GetCreatureListWithEntryInGrid(m_EscortList, pMrSmite, 657, 400.0f); for (std::list::iterator it = m_EscortList.begin(); it != m_EscortList.end(); ++it) if ((*it)->GetRespawnDelay() == 43202) - { - (*it)->SetVisibility(VISIBILITY_ON); - (*it)->setFaction(17); (*it)->GetMotionMaster()->MovePoint(0, -99.6611f, -671.071655f, 7.42241f, MOVE_PATHFINDING | MOVE_RUN_MODE); - } m_EscortList.clear(); - + ++m_uiDoor_Step; + m_uiIronDoor_Timer = 15000; break; case 1: - if (Creature* pi1 = pMrSmite->SummonCreature(NPC_PIRATE, 93.68f, -678.63f, 7.71f, 2.09f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000)) - pi1->GetMotionMaster()->MovePoint(0, 100.11f, -670.65f, 7.42f); - if (Creature* pi2 = pMrSmite->SummonCreature(NPC_PIRATE, 102.63f, -685.07f, 7.42f, 1.28f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000)) - pi2->GetMotionMaster()->MovePoint(0, 100.11f, -670.65f, 7.42f); - ++m_uiDoor_Step; - m_uiIronDoor_Timer = 10000; - break; - case 2: DoScriptText(INST_SAY_ALARM2, pMrSmite); m_uiDoor_Step = 0; m_uiIronDoor_Timer = 0; diff --git a/src/scripts/kalimdor/ashenvale/ashenvale.cpp b/src/scripts/kalimdor/ashenvale/ashenvale.cpp index e3378aea6..ddae26978 100644 --- a/src/scripts/kalimdor/ashenvale/ashenvale.cpp +++ b/src/scripts/kalimdor/ashenvale/ashenvale.cpp @@ -140,6 +140,7 @@ struct npc_muglashAI : public npc_escortAI if (GameObject* pGo = GetClosestGameObjectWithEntry(m_creature, GO_NAGA_BRAZIER, INTERACTION_DISTANCE * 2)) { //some kind of event flag? Update to player/group only? + pGo->SetGoState(GO_STATE_READY); pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT); SetEscortPaused(true); } @@ -274,7 +275,10 @@ bool QuestAccept_npc_muglash(Player* pPlayer, Creature* pCreature, const Quest* // Ensure Brazier can be extinguished if (GameObject* go_naga_brazier = GetClosestGameObjectWithEntry(pCreature, GO_NAGA_BRAZIER, 1000)) + { go_naga_brazier->ResetDoorOrButton(); + go_naga_brazier->SetGoState(GO_STATE_READY); + } } diff --git a/src/scripts/kalimdor/orgrimmar/orgrimmar.cpp b/src/scripts/kalimdor/orgrimmar/orgrimmar.cpp index 57c966db7..426012049 100644 --- a/src/scripts/kalimdor/orgrimmar/orgrimmar.cpp +++ b/src/scripts/kalimdor/orgrimmar/orgrimmar.cpp @@ -571,12 +571,15 @@ struct npc_thrall_warchiefAI : public ScriptedAI npc_thrall_warchiefAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); + m_uiTick = 0; + m_uiBlessingEventTimer = 0; + m_bBlessingEvent = false; } uint32 m_uiTick; uint32 ChainLightning_Timer; uint32 Shock_Timer; - uint32 m_uiBlessingEventTimer; + int32 m_uiBlessingEventTimer; bool m_bBlessingEvent; Creature* m_pHerald; @@ -584,9 +587,6 @@ struct npc_thrall_warchiefAI : public ScriptedAI { ChainLightning_Timer = 2000; Shock_Timer = 8000; - m_uiTick = 0; - m_uiBlessingEventTimer = 0; - m_bBlessingEvent = false; } void StartBlessingEvent() @@ -654,7 +654,9 @@ struct npc_thrall_warchiefAI : public ScriptedAI m_uiTick++; break; case 4: - Reset(); + m_uiTick = 0; + m_uiBlessingEventTimer = 0; + m_bBlessingEvent = false; return; } } diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index 9fa5a7a70..479ec020e 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -1407,16 +1407,86 @@ CreatureAI* GetAI_npc_gnomish_battle_chicken(Creature* pCreature) return new npc_gnomish_battle_chickenAI(pCreature); } + +/*###### +## arcanite dragonling +######*/ +enum +{ + SPELL_Flame_Buffet = 9574, + SPELL_Flame_Breath = 20712 +}; + +struct npc_arcanite_dragonling_dragonlingAI : ScriptedPetAI +{ + explicit npc_arcanite_dragonling_dragonlingAI(Creature* pCreature) : ScriptedPetAI(pCreature) + { + m_creature->SetCanModifyStats(true); + + if (m_creature->GetCharmInfo()) + m_creature->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE); + + + m_firebuffetTimer = urand(0, 10000); + m_flamebreathTimer = urand(0, 20000); + + npc_arcanite_dragonling_dragonlingAI::Reset(); + } + + uint32 m_firebuffetTimer; + uint32 m_flamebreathTimer; + + + void Reset() override + { + + } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) override + { + + ScriptedPetAI::DamageTaken(pDoneBy, uiDamage); + } + + void UpdatePetAI(const uint32 uiDiff) override + { + + if (m_firebuffetTimer < uiDiff) + { + if (DoCastSpellIfCan(m_creature, SPELL_Flame_Buffet, CAST_TRIGGERED) == CAST_OK) + m_firebuffetTimer = urand(0, 10000); + } + else + m_firebuffetTimer -= uiDiff; + + if (m_flamebreathTimer < uiDiff) + { + int32 damage = 300; + m_creature->CastCustomSpell(m_creature, SPELL_Flame_Breath, &damage, nullptr, nullptr, true); + m_flamebreathTimer = urand(0, 20000); + } + else + m_flamebreathTimer -= uiDiff; + + + + ScriptedPetAI::UpdatePetAI(uiDiff); + } +}; + +CreatureAI* GetAI_npc_arcanite_dragonling_dragonling(Creature* pCreature) +{ + return new npc_arcanite_dragonling_dragonlingAI(pCreature); +} +/*###### +## npc_the_cleaner +######*/ enum { SPELL_IMMUNITY = 29230, SAY_CLEANER_AGGRO = -1289010 }; -/*###### -## npc_the_cleaner -######*/ - struct npc_the_cleanerAI : public ScriptedAI { npc_the_cleanerAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } @@ -2067,7 +2137,7 @@ struct npc_shahramAI : ScriptedPetAI case 0: shahramSpell = SPELL_CURSE_OF_SHAHRAM; - break; + break; case 1: shahramSpell = SPELL_FLAMES_OF_SHAHRAM; @@ -2634,6 +2704,11 @@ void AddSC_npcs_special() newscript->GetAI = &GetAI_npc_gnomish_battle_chicken; newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "npc_arcanite_dragonling"; + newscript->GetAI = &GetAI_npc_arcanite_dragonling_dragonling; + newscript->RegisterSelf(); + newscript = new Script; newscript->Name = "npc_the_cleaner"; newscript->GetAI = &GetAI_npc_the_cleaner;