diff options
| author | Matan Shukry <matanshukry@gmail.com> | 2021-04-11 20:23:19 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-11 19:23:19 +0200 |
| commit | b92e20f6c860bd1b5f3e7ce3f614dd48fc5b49c4 (patch) | |
| tree | a64ebcfe0d953c78a54f39af457f33c3e5d52efc /src/server/game/Entities | |
| parent | 5fdd2c95ef013e6828de70e160ff091fe886451f (diff) | |
Script/Spells: shaman spell fixes (#26192)
* Flametongue Weapon
* Tremor Totem
* Healing Stream Totem
* Liquid Magma Totem
* Healing Rain
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/Item/ItemTemplate.h | 4 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 14 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 1 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/server/game/Entities/Item/ItemTemplate.h b/src/server/game/Entities/Item/ItemTemplate.h index 990ee108dc6..cdee1d0265d 100644 --- a/src/server/game/Entities/Item/ItemTemplate.h +++ b/src/server/game/Entities/Item/ItemTemplate.h @@ -817,9 +817,11 @@ struct TC_GAME_API ItemTemplate bool IsConjuredConsumable() const { return GetClass() == ITEM_CLASS_CONSUMABLE && (GetFlags() & ITEM_FLAG_CONJURED); } bool IsCraftingReagent() const { return (GetFlags2() & ITEM_FLAG2_USED_IN_A_TRADESKILL) != 0; } + bool IsWeapon() const { return GetClass() == ITEM_CLASS_WEAPON; } + bool IsRangedWeapon() const { - return GetClass() == ITEM_CLASS_WEAPON || + return IsWeapon() || GetSubClass() == ITEM_SUBCLASS_WEAPON_BOW || GetSubClass() == ITEM_SUBCLASS_WEAPON_GUN || GetSubClass() == ITEM_SUBCLASS_WEAPON_CROSSBOW; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ffa959fedc5..1e2396560da 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1130,6 +1130,20 @@ void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castI CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); } +void Unit::CastSpell(Item* target, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) +{ + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId, GetMap()->GetDifficultyID()); + if (!spellInfo) + { + TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s", spellId, GetGUID().ToString().c_str()); + return; + } + SpellCastTargets targets; + targets.SetItemTarget(target); + + CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); +} + void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType, bool crit) { if (damage < 0) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 36f5f01bc41..d950b89122a 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1335,6 +1335,7 @@ class TC_GAME_API Unit : public WorldObject void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); void CastSpell(float x, float y, float z, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); + void CastSpell(Item* target, uint32 spellId, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = nullptr, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = nullptr, AuraEffect const* triggeredByAura = nullptr, ObjectGuid originalCaster = ObjectGuid::Empty); |
