diff options
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r-- | src/game/SpellEffects.cpp | 464 |
1 files changed, 231 insertions, 233 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 3f90a52c7df..c3a633c5ffc 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -161,7 +161,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectSelfResurrect, // 94 SPELL_EFFECT_SELF_RESURRECT &Spell::EffectSkinning, // 95 SPELL_EFFECT_SKINNING &Spell::EffectCharge, // 96 SPELL_EFFECT_CHARGE - &Spell::EffectUnused, // 97 SPELL_EFFECT_97 + &Spell::EffectCastButtons, // 97 SPELL_EFFECT_CAST_BUTTON (totem bar since 3.2.2a) &Spell::EffectKnockBack, // 98 SPELL_EFFECT_KNOCK_BACK &Spell::EffectDisEnchant, // 99 SPELL_EFFECT_DISENCHANT &Spell::EffectInebriate, //100 SPELL_EFFECT_INEBRIATE @@ -377,7 +377,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) break; // Consumption case 28865: - damage = (m_caster->GetMap()->IsHeroic() ? 4250 : 2750); + damage = (((InstanceMap*)m_caster->GetMap())->GetDifficulty() == REGULAR_DIFFICULTY ? 2750 : 4250); break; // percent from health with min case 25599: // Thundercrash @@ -420,8 +420,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage = unitTarget->GetMaxHealth() / 10; break; } - // Gargoyle Strike - case 51963: + case 51963: // Gargoyle Strike { // about +4 base spell dmg per level damage = (m_caster->getLevel() - 60) * 4 + 60; @@ -535,7 +534,23 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) if (unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, m_caster->GetGUID())) damage += damage * aurEff->GetAmount() / 100; } - + // Improved Mind Blast (Mind Blast in shadow form bonus) + else if (m_caster->m_form == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000)) + { + Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); + for(Unit::AuraEffectList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i) + { + if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST && + ((*i)->GetSpellProto()->SpellIconID == 95)) + { + int chance = (*i)->GetSpellProto()->CalculateSimpleValue(1); + if (roll_chance_i(chance)) + // Mind Trauma + m_caster->CastSpell(unitTarget, 48301, true, 0); + break; + } + } + } break; } case SPELLFAMILY_DRUID: @@ -687,12 +702,12 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) damage += int32(0.25f*ap + 0.4f*sp); } // Judgement of Wisdom, Light, Justice - else if (m_spellInfo->SpellFamilyFlags[0] & 0x00800000 && m_spellInfo->Id != 31804 && m_spellInfo->Id != 53733) + else if(m_spellInfo->Id == 54158) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); float sp = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)); damage += int32(0.16f*ap + 0.25f*sp); - } + } break; } case SPELLFAMILY_DEATHKNIGHT: @@ -850,6 +865,22 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(unitTarget,spell_id,true,NULL); return; } + case 67019: // Flask of the North + { + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + uint32 spell_id; + switch(urand(1, 3)) + { + case 1: spell_id = 67016; break; + case 2: spell_id = 67017; break; + default:spell_id = 67018; break; + } + + m_caster->CastSpell(m_caster, spell_id, true, NULL); + return; + } case 13280: // Gnomish Death Ray { if (!unitTarget) @@ -945,10 +976,6 @@ void Spell::EffectDummy(uint32 i) creatureTarget->ForcedDespawn(); - WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << uint64(Crystal_Prison->GetGUID()); - m_caster->SendMessageToSet(&data, true); - return; } case 23074: // Arcanite Dragonling @@ -1351,16 +1378,28 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(m_caster, 54586, true); return; } + // Great Feast + case 57337: + { + if (!unitTarget) + return; + + unitTarget->CastSpell(unitTarget, 58067, true); + break; + } + //Fish Feast + case 57397: + { + if (!unitTarget) + return; + + unitTarget->CastSpell(unitTarget, 58648, true); + unitTarget->CastSpell(unitTarget, 57398, true); + break; + } case 58418: // Portal to Orgrimmar case 58420: // Portal to Stormwind return; // implemented in EffectScript[0] - case 58601: - if (Player *plr = (Player*)unitTarget) - { - plr->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED); - plr->RemoveAurasByType(SPELL_AURA_FLY); - } - break; case 59640: // Underbelly Elixir { if(m_caster->GetTypeId() != TYPEID_PLAYER) @@ -1426,29 +1465,6 @@ void Spell::EffectDummy(uint32 i) } } - //All IconID Check in there - switch(m_spellInfo->SpellIconID) - { - // Berserking (troll racial traits) - case 1661: - { - uint32 healthPerc = uint32((float(m_caster->GetHealth())/m_caster->GetMaxHealth())*100); - int32 melee_mod = 10; - if (healthPerc <= 40) - melee_mod = 30; - if (healthPerc < 100 && healthPerc > 40) - melee_mod = 10+(100-healthPerc)/3; - - int32 hasteModBasePoints0 = melee_mod; // (EffectBasePoints[0]+1)-1+(5-melee_mod) = (melee_mod-1+1)-1+5-melee_mod = 5-1 - int32 hasteModBasePoints1 = (5-melee_mod); - int32 hasteModBasePoints2 = 5; - - // FIXME: custom spell required this aura state by some unknown reason, we not need remove it anyway - m_caster->ModifyAuraState(AURA_STATE_BERSERKING,true); - m_caster->CastCustomSpell(m_caster, 26635, &hasteModBasePoints0, &hasteModBasePoints1, &hasteModBasePoints2, true, NULL); - return; - } - } break; } case SPELLFAMILY_MAGE: @@ -1501,6 +1517,10 @@ void Spell::EffectDummy(uint32 i) { int32 chargeBasePoints0 = damage; m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true); + + //Juggernaut crit bonus + if(m_caster->HasAura(64976)) + m_caster->CastSpell(m_caster, 65156, true); return; } //Slam @@ -1533,8 +1553,8 @@ void Spell::EffectDummy(uint32 i) } else { - rage += m_caster->GetPower(POWER_RAGE); - m_caster->SetPower(POWER_RAGE,0); + rage += m_powerCost; + m_caster->ModifyPower(POWER_RAGE,- m_powerCost); } bp = damage+int32(rage * m_spellInfo->DmgMultiplier[i] + @@ -1629,9 +1649,9 @@ void Spell::EffectDummy(uint32 i) if (!unitTarget || !unitTarget->isAlive()) return; - uint32 hurt = 0; - uint32 heal = 0; - switch (m_spellInfo->Id) + int hurt = 0; + int heal = 0; + switch(m_spellInfo->Id) { case 47540: hurt = 47758; heal = 47757; break; case 53005: hurt = 53001; heal = 52986; break; @@ -1653,15 +1673,15 @@ void Spell::EffectDummy(uint32 i) if (m_spellInfo->SpellFamilyFlags[2] & 0x100) { //Shapeshifting into an animal form or mounting cancels the effect. - if (m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted()) + if(m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted()) { - if (m_triggeredByAuraSpell) + if(m_triggeredByAuraSpell) m_caster->RemoveAurasDueToSpell(m_triggeredByAuraSpell->Id); return; } //Any effect which causes you to lose control of your character will supress the starfall effect. - if (m_caster->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_ROOT | UNIT_STAT_CONFUSED)) + if(m_caster->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_ROOT | UNIT_STAT_CONFUSED)) return; m_caster->CastSpell(unitTarget, damage, true); @@ -1675,35 +1695,35 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(m_caster, 63848, true); break; } - switch(m_spellInfo->Id) + switch(m_spellInfo->Id ) { case 5938: // Shiv { - if (m_caster->GetTypeId() != TYPEID_PLAYER) + if(m_caster->GetTypeId() != TYPEID_PLAYER) return; Player *pCaster = ((Player*)m_caster); Item *item = pCaster->GetWeaponForAttack(OFF_ATTACK); - if (!item) + if(!item) return; // all poison enchantments is temporary uint32 enchant_id = item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT); - if (!enchant_id) + if(!enchant_id) return; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if (!pEnchant) + if(!pEnchant) return; - for (uint8 s = 0; s < 3; ++s) + for (int s=0; s<3; s++) { - if(pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) + if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) continue; - SpellEntry const *combatEntry = sSpellStore.LookupEntry(pEnchant->spellid[s]); - if (!combatEntry || combatEntry->Dispel != DISPEL_POISON) + SpellEntry const* combatEntry = sSpellStore.LookupEntry(pEnchant->spellid[s]); + if(!combatEntry || combatEntry->Dispel != DISPEL_POISON) continue; m_caster->CastSpell(unitTarget, combatEntry, true, item); @@ -1714,7 +1734,7 @@ void Spell::EffectDummy(uint32 i) } case 14185: // Preparation { - if (m_caster->GetTypeId() != TYPEID_PLAYER) + if(m_caster->GetTypeId() != TYPEID_PLAYER) return; //immediately finishes the cooldown on certain Rogue abilities @@ -1738,14 +1758,21 @@ void Spell::EffectDummy(uint32 i) } break; case SPELLFAMILY_HUNTER: - switch (m_spellInfo->Id) + switch(m_spellInfo->Id) { case 781: // Disengage { - if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->isInCombat()) // Does not require a target, but m_caster must be in combat (3.0.3?) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - m_caster->JumpTo(15.0f, 7.0f, false); + WorldPacket data(SMSG_MOVE_KNOCK_BACK, 50); + data.append(m_caster->GetPackGUID()); + data << getMSTime(); + data << float(cosf(m_caster->GetOrientation()+M_PI)); + data << float(sinf(m_caster->GetOrientation()+M_PI)); + data << float(15); + data << float(-7.0f); + ((Player*)m_caster)->GetSession()->SendPacket(&data); return; } case 23989: // Readiness talent @@ -1759,7 +1786,7 @@ void Spell::EffectDummy(uint32 i) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && GetSpellRecoveryTime(spellInfo) > 0) + if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && spellInfo->Id != 19574 && GetSpellRecoveryTime(spellInfo) > 0 ) ((Player*)m_caster)->RemoveSpellCooldown((itr++)->first,true); else ++itr; @@ -1812,10 +1839,10 @@ void Spell::EffectDummy(uint32 i) if (!unitTarget) return; - uint32 hurt = 0; - uint32 heal = 0; + int hurt = 0; + int heal = 0; - switch (m_spellInfo->Id) + switch(m_spellInfo->Id) { case 20473: hurt = 25912; heal = 25914; break; case 20929: hurt = 25911; heal = 25913; break; @@ -1825,7 +1852,7 @@ void Spell::EffectDummy(uint32 i) case 48824: hurt = 48822; heal = 48820; break; case 48825: hurt = 48823; heal = 48821; break; default: - sLog.outError("Spell::EffectDummy: Spell %u not handled in Holy Shock",m_spellInfo->Id); + sLog.outError("Spell::EffectDummy: Spell %u not handled in HS",m_spellInfo->Id); return; } @@ -1858,13 +1885,26 @@ void Spell::EffectDummy(uint32 i) } case 31789: // Righteous Defense (step 1) { + if (m_caster->GetTypeId() != TYPEID_PLAYER) + { + SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT); + return; + } + // 31989 -> dummy effect (step 1) + dummy effect (step 2) -> 31709 (taunt like spell for each target) + Unit* friendTarget = !unitTarget || unitTarget->IsFriendlyTo(m_caster) ? unitTarget : unitTarget->getVictim(); + if (friendTarget) + { + Player* player = friendTarget->GetCharmerOrOwnerPlayerOrPlayerItself(); + if (!player || !player->IsInSameRaidWith((Player*)m_caster)) + friendTarget = NULL; + } + // non-standard cast requirement check - if (!unitTarget || unitTarget->getAttackers().empty()) + if (!friendTarget || friendTarget->getAttackers().empty()) { - if (m_caster->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true); + ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true); SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT); return; } @@ -1874,18 +1914,16 @@ void Spell::EffectDummy(uint32 i) for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) ihit->effectMask &= ~(1<<1); - // not empty (checked) - Unit::AttackerSet const& attackers = unitTarget->getAttackers(); + // not empty (checked), copy + Unit::AttackerSet attackers = friendTarget->getAttackers(); - // chance to be selected from list - float chance = 100.0f / attackers.size(); - uint32 count = 0; - for (Unit::AttackerSet::const_iterator aItr = attackers.begin(); aItr != attackers.end() && count < 3; ++aItr) + // selected from list 3 + for(int i = 0; i < std::min(size_t(3),attackers.size()); ++i) { - if (!roll_chance_f(chance)) - continue; - ++count; + Unit::AttackerSet::iterator aItr = attackers.begin(); + std::advance(aItr, rand() % attackers.size()); AddUnitTarget((*aItr), 1); + attackers.erase(aItr); } // now let next effect cast spell at each target. @@ -1912,55 +1950,6 @@ void Spell::EffectDummy(uint32 i) } break; case SPELLFAMILY_SHAMAN: - // Rockbiter Weapon - if (m_spellInfo->SpellFamilyFlags[0] & 0x400000) - { - // TODO: use expect spell for enchant (if exist talent) - // In 3.0.3 no mods present for rockbiter - uint32 spell_id = 0; - switch (m_spellInfo->Id) - { - case 8017: spell_id = 36494; break; // Rank 1 - case 8018: spell_id = 36750; break; // Rank 2 - case 8019: spell_id = 36755; break; // Rank 3 - case 10399: spell_id = 36759; break; // Rank 4 - default: - sLog.outError("Spell::EffectDummy: Spell %u not handled in RW", m_spellInfo->Id); - return; - } - - SpellEntry const *spellInfo = sSpellStore.LookupEntry( spell_id ); - - if (!spellInfo) - { - sLog.outError("WORLD: unknown spell id %i", spell_id); - return; - } - - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - for (uint8 j = BASE_ATTACK; j <= OFF_ATTACK; ++j) - { - if (Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j))) - { - if (item->IsFitToSpellRequirements(m_spellInfo)) - { - Spell *spell = new Spell(m_caster, spellInfo, true); - - // enchanting spell selected by calculated damage-per-sec in enchanting effect - // at calculation applied affect from Elemental Weapons talent - // real enchantment damage-1 - spell->m_currentBasePoints[1] = damage-1; - - SpellCastTargets targets; - targets.setItemTarget(item); - spell->prepare(&targets); - } - } - } - return; - } // Cleansing Totem Pulse if (m_spellInfo->SpellFamilyFlags[0] & 0x04000000 && m_spellInfo->SpellIconID==1673) { @@ -3377,6 +3366,7 @@ void Spell::EffectOpenLock(uint32 effIndex) return; } } + // TODO: Add script for spell 41920 - Filling, becouse server it freze when use this spell // handle outdoor pvp object opening, return true if go was registered for handling // these objects must have been spawned by outdoorpvp! else if(gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_GOOBER && sOutdoorPvPMgr.HandleOpenGo(player, gameObjTarget->GetGUID())) @@ -4111,64 +4101,61 @@ void Spell::EffectEnchantItemTmp(uint32 i) Player* p_caster = (Player*)m_caster; + // Rockbiter Weapon apply to both weapon if (!itemTarget) - return; - - uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; - - // Shaman Rockbiter Weapon - if (i == 0 && m_spellInfo->Effect[1] == SPELL_EFFECT_DUMMY) + return; + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & 0x400000) { - int32 enchnting_damage = CalculateDamage(1, NULL);//+1; + uint32 spell_id = 0; - // enchanting id selected by calculated damage-per-sec stored in Effect[1] base value - // with already applied percent bonus from Elemental Weapons talent + // enchanting spell selected by calculated damage-per-sec stored in Effect[1] base value // Note: damage calculated (correctly) with rounding int32(float(v)) but // RW enchantments applied damage int32(float(v)+0.5), this create 0..1 difference sometime - switch (enchnting_damage) + switch(damage) { // Rank 1 - case 2: enchant_id = 29; break; // 0% [ 7% == 2, 14% == 2, 20% == 2] + case 2: spell_id = 36744; break; // 0% [ 7% == 2, 14% == 2, 20% == 2] // Rank 2 - case 4: enchant_id = 6; break; // 0% [ 7% == 4, 14% == 4] - case 5: enchant_id = 3025; break; // 20% + case 4: spell_id = 36753; break; // 0% [ 7% == 4, 14% == 4] + case 5: spell_id = 36751; break; // 20% // Rank 3 - case 6: enchant_id = 1; break; // 0% [ 7% == 6, 14% == 6] - case 7: enchant_id = 3027; break; // 20% + case 6: spell_id = 36754; break; // 0% [ 7% == 6, 14% == 6] + case 7: spell_id = 36755; break; // 20% // Rank 4 - case 9: enchant_id = 3032; break; // 0% [ 7% == 6] - case 10: enchant_id = 503; break; // 14% - case 11: enchant_id = 3031; break; // 20% - // Rank 5 - case 15: enchant_id = 3035; break; // 0% - case 16: enchant_id = 1663; break; // 7% - case 17: enchant_id = 3033; break; // 14% - case 18: enchant_id = 3034; break; // 20% - // Rank 6 - case 28: enchant_id = 3038; break; // 0% - case 29: enchant_id = 683; break; // 7% - case 31: enchant_id = 3036; break; // 14% - case 33: enchant_id = 3037; break; // 20% - // Rank 7 - case 40: enchant_id = 3041; break; // 0% - case 42: enchant_id = 1664; break; // 7% - case 45: enchant_id = 3039; break; // 14% - case 48: enchant_id = 3040; break; // 20% - // Rank 8 - case 49: enchant_id = 3044; break; // 0% - case 52: enchant_id = 2632; break; // 7% - case 55: enchant_id = 3042; break; // 14% - case 58: enchant_id = 3043; break; // 20% - // Rank 9 - case 62: enchant_id = 2633; break; // 0% - case 66: enchant_id = 3018; break; // 7% - case 70: enchant_id = 3019; break; // 14% - case 74: enchant_id = 3020; break; // 20% + case 9: spell_id = 36761; break; // 0% [ 7% == 6] + case 10: spell_id = 36758; break; // 14% + case 11: spell_id = 36760; break; // 20% default: - sLog.outError("Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW",enchnting_damage); + sLog.outError("Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW",damage); return; } + + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); + if (!spellInfo) + { + sLog.outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); + return; + } + + for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j) + { + if (Item* item = p_caster->GetWeaponForAttack(WeaponAttackType(j))) + { + if (item->IsFitToSpellRequirements(m_spellInfo)) + { + Spell *spell = new Spell(m_caster, spellInfo, true); + SpellCastTargets targets; + targets.setItemTarget( item ); + spell->prepare(&targets); + } + } + } + return; } + if (!itemTarget) + return; + + uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; if (!enchant_id) { @@ -4402,6 +4389,13 @@ void Spell::EffectTaunt(uint32 /*i*/) return; } + if (m_spellInfo->Id == 62124) + { + int32 damageDone = 1 + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f; + m_caster->DealDamage(unitTarget, damageDone, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_HOLY, m_spellInfo, false); + m_caster->SendSpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damageDone, SPELL_SCHOOL_MASK_HOLY, 0, 0, false, false, false); + } + // Also use this effect to set the taunter's threat to the taunted creature's highest value if (unitTarget->getThreatManager().getCurrentVictim()) { @@ -4583,15 +4577,6 @@ void Spell::SpellDamageWeaponDmg(uint32 i) else m_caster->CastCustomSpell(m_caster, 53725, &damagePoint, NULL, NULL, true); } - // Seal of Blood/of the Martyr backlash damage (10%) - else if (m_spellInfo->SpellIconID==2293) - { - int32 damagePoint = m_damage * 10 / 100; - if(m_spellInfo->Id == 31893) - m_caster->CastCustomSpell(m_caster, 32221, &damagePoint, NULL, NULL, true); - else - m_caster->CastCustomSpell(m_caster, 53718, &damagePoint, NULL, NULL, true); - } } case SPELLFAMILY_SHAMAN: { @@ -4676,10 +4661,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i) } bool normalized = false; - float weaponDamagePercentMod = 1.0f; - for (uint8 j = 0; j < 3; ++j) + float weaponDamagePercentMod = 1.0; + for (int j = 0; j < 3; ++j) { - switch (m_spellInfo->Effect[j]) + switch(m_spellInfo->Effect[j]) { case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: @@ -4698,10 +4683,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i) } // apply to non-weapon bonus weapon total pct effect, weapon total flat effect included in weapon damage - if (fixed_bonus || spell_bonus) + if(fixed_bonus || spell_bonus) { UnitMods unitMod; - switch (m_attackType) + switch(m_attackType) { default: case BASE_ATTACK: unitMod = UNIT_MOD_DAMAGE_MAINHAND; break; @@ -4710,23 +4695,23 @@ void Spell::SpellDamageWeaponDmg(uint32 i) } float weapon_total_pct = 1.0f; - if (m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL) + if ( m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL ) weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT); - if (fixed_bonus) + if(fixed_bonus) fixed_bonus = int32(fixed_bonus * weapon_total_pct); - if (spell_bonus) + if(spell_bonus) spell_bonus = int32(spell_bonus * weapon_total_pct); } int32 weaponDamage = m_caster->CalculateDamage(m_attackType, normalized, true); // Sequence is important - for (uint8 j = 0; j < 3; ++j) + for (int j = 0; j < 3; ++j) { // We assume that a spell have at most one fixed_bonus // and at most one weaponDamagePercentMod - switch (m_spellInfo->Effect[j]) + switch(m_spellInfo->Effect[j]) { case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: @@ -4753,7 +4738,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i) // Add melee damage bonuses (also check for negative) m_caster->MeleeDamageBonus(unitTarget, &eff_damage, m_attackType, m_spellInfo); - m_damage += eff_damage; + m_damage+= eff_damage; } void Spell::EffectThreat(uint32 /*i*/) @@ -5218,11 +5203,17 @@ void Spell::EffectScriptEffect(uint32 effIndex) switch(((Player*)unitTarget)->GetBaseSkillValue(762)) { - case 75: unitTarget->CastSpell(unitTarget, 51621, true); break;; - case 150: unitTarget->CastSpell(unitTarget, 48024, true); break; - case 225: unitTarget->CastSpell(unitTarget, 51617, true); break; - case 300: unitTarget->CastSpell(unitTarget, 48023, true); break; - default: break; + case 75: unitTarget->CastSpell(unitTarget, 51621, true); break;; + case 150: unitTarget->CastSpell(unitTarget, 48024, true); break; + case 225: + if(((Player*)unitTarget)->GetMapId()==571 || ((Player*)unitTarget)->GetMapId()==530) + unitTarget->CastSpell(unitTarget, 51617, true); + break; + case 300: + if(((Player*)unitTarget)->GetMapId()==571 || ((Player*)unitTarget)->GetMapId()==530) + unitTarget->CastSpell(unitTarget, 48023, true); + break; + default: break; } break; } @@ -5492,25 +5483,6 @@ void Spell::EffectScriptEffect(uint32 effIndex) } return; } - // Great Feast - case 57337: - { - if (!unitTarget) - return; - - unitTarget->CastSpell(unitTarget, 58067, true); - break; - } - //Fish Feast - case 57397: - { - if (!unitTarget) - return; - - unitTarget->CastSpell(unitTarget, 58648, true); - unitTarget->CastSpell(unitTarget, 57398, true); - break; - } case 58418: // Portal to Orgrimmar case 58420: // Portal to Stormwind { @@ -5553,15 +5525,15 @@ void Spell::EffectScriptEffect(uint32 effIndex) m_originalCaster->CastSpell(unitTarget, 58689, true); m_originalCaster->CastSpell(unitTarget, 58692, true); } - if(m_originalCaster->GetMap()->IsHeroic()) + if(((InstanceMap*)m_originalCaster->GetMap())->GetDifficulty() == REGULAR_DIFFICULTY) { - m_originalCaster->CastSpell(unitTarget, 60883, true); - m_originalCaster->CastSpell(unitTarget, 60884, true); + m_originalCaster->CastSpell(unitTarget, 58695, true); + m_originalCaster->CastSpell(unitTarget, 58696, true); } else { - m_originalCaster->CastSpell(unitTarget, 58695, true); - m_originalCaster->CastSpell(unitTarget, 58696, true); + m_originalCaster->CastSpell(unitTarget, 60883, true); + m_originalCaster->CastSpell(unitTarget, 60884, true); } } return; @@ -5611,12 +5583,15 @@ void Spell::EffectScriptEffect(uint32 effIndex) return; } case 62428: // Load into Catapult + { if(Vehicle *seat = m_caster->GetVehicleKit()) if(Unit *passenger = seat->GetPassenger(0)) if(Unit *demolisher = m_caster->GetVehicleBase()) passenger->CastSpell(demolisher, damage, true); return; + } case 62482: // Grab Crate + { if(unitTarget) { if(Vehicle *seat = m_caster->GetVehicleKit()) @@ -5629,6 +5604,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) } } return; + } case 60123: // Lightwell { if (m_caster->GetTypeId() != TYPEID_UNIT || !((Creature*)m_caster)->isSummon()) @@ -5803,9 +5779,6 @@ void Spell::EffectScriptEffect(uint32 effIndex) AuraDivinePlea->RefreshAura(); return; } - case 45634: //Neural Needle - unitTarget->CastSpell(unitTarget, 45702, true); //Neural Needle Impact - return; } break; } @@ -6067,7 +6040,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case SPELLFAMILY_WARRIOR: { // Shattering Throw - if ( m_spellInfo->SpellFamilyFlags[1] & 0x1 ) + if (m_spellInfo->SpellFamilyFlags[1] & 0x00400000) { if(!unitTarget) return; @@ -6098,7 +6071,7 @@ void Spell::EffectSanctuary(uint32 /*i*/) if(!(*iter)->hasUnitState(UNIT_STAT_CASTING)) continue; - for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) + for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) { if((*iter)->GetCurrentSpell(i) && (*iter)->GetCurrentSpell(i)->m_targets.getUnitTargetGUID() == unitTarget->GetGUID()) @@ -6497,9 +6470,6 @@ void Spell::EffectSummonObject(uint32 i) m_caster->AddGameObject(pGameObj); map->Add(pGameObj); - WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << uint64(pGameObj->GetGUID()); - m_caster->SendMessageToSet(&data, true); m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID(); } @@ -7089,10 +7059,6 @@ void Spell::EffectTransmitted(uint32 effIndex) cMap->Add(pGameObj); - WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << uint64(pGameObj->GetGUID()); - m_caster->SendMessageToSet(&data,true); - if(uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry()) { GameObject* linkedGO = new GameObject; @@ -7399,6 +7365,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const * } else summon->SetDisplayId(1126); + summon->AI()->EnterEvadeMode(); } } @@ -7484,3 +7451,34 @@ void Spell::EffectActivateSpec(uint32 /*eff_idx*/) ((Player*)unitTarget)->ActivateSpec(damage-1); // damage is 1 or 2, spec is 0 or 1 } +void Spell::EffectCastButtons(uint32 i) +{ + if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + Player *p_caster = (Player*)m_caster; + uint32 button_id = m_spellInfo->EffectMiscValue[i] + 132; + uint32 n_buttons = m_spellInfo->EffectMiscValueB[i]; + + for (; n_buttons; n_buttons--, button_id++) + { + if (uint32 spell_id = p_caster->GetActionButtonSpell(button_id)) + { + if (!spell_id) + continue; + + if (p_caster->HasSpellCooldown(spell_id)) + continue; + + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); + uint32 cost = CalculatePowerCost(spellInfo, m_caster, GetSpellSchoolMask(spellInfo)); + + if (m_caster->GetPower(POWER_MANA) < cost) + break; + + m_caster->CastSpell(unitTarget, spell_id, true); + m_caster->ModifyPower(POWER_MANA, -(int32)cost); + p_caster->AddSpellAndCategoryCooldowns(spellInfo, 0); + } + } +} |