Changeset 161 for trunk/src/game/Unit.cpp
- Timestamp:
- 11/19/08 13:41:55 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Unit.cpp
r157 r161 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 1697 1697 } 1698 1698 1699 AuraList const& vSplitDamageFlat = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_FLAT); 1700 for(AuraList::const_iterator i = vSplitDamageFlat.begin(), next; i != vSplitDamageFlat.end() && RemainingDamage >= 0; i = next) 1701 { 1702 next = i; ++next; 1703 1704 // check damage school mask 1705 if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0) 1706 continue; 1707 1708 // Damage can be splitted only if aura has an alive caster 1709 Unit *caster = (*i)->GetCaster(); 1710 if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive()) 1711 continue; 1712 1713 int32 currentAbsorb; 1714 if (RemainingDamage >= (*i)->GetModifier()->m_amount) 1715 currentAbsorb = (*i)->GetModifier()->m_amount; 1716 else 1717 currentAbsorb = RemainingDamage; 1718 1719 RemainingDamage -= currentAbsorb; 1720 1721 SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, currentAbsorb, schoolMask, 0, 0, false, 0, false); 1722 1723 CleanDamage cleanDamage = CleanDamage(currentAbsorb, BASE_ATTACK, MELEE_HIT_NORMAL); 1724 DealDamage(caster, currentAbsorb, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false); 1725 } 1726 1727 AuraList const& vSplitDamagePct = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT); 1728 for(AuraList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next) 1729 { 1730 next = i; ++next; 1731 1732 // check damage school mask 1733 if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0) 1734 continue; 1735 1736 // Damage can be splitted only if aura has an alive caster 1737 Unit *caster = (*i)->GetCaster(); 1738 if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive()) 1739 continue; 1740 1741 int32 splitted = int32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f); 1742 1743 RemainingDamage -= splitted; 1744 1745 SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, 0, 0, false, 0, false); 1746 1747 CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL); 1748 DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false); 1699 // only split damage if not damaing yourself 1700 if(pVictim != this) 1701 { 1702 AuraList const& vSplitDamageFlat = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_FLAT); 1703 for(AuraList::const_iterator i = vSplitDamageFlat.begin(), next; i != vSplitDamageFlat.end() && RemainingDamage >= 0; i = next) 1704 { 1705 next = i; ++next; 1706 1707 // check damage school mask 1708 if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0) 1709 continue; 1710 1711 // Damage can be splitted only if aura has an alive caster 1712 Unit *caster = (*i)->GetCaster(); 1713 if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive()) 1714 continue; 1715 1716 int32 currentAbsorb; 1717 if (RemainingDamage >= (*i)->GetModifier()->m_amount) 1718 currentAbsorb = (*i)->GetModifier()->m_amount; 1719 else 1720 currentAbsorb = RemainingDamage; 1721 1722 RemainingDamage -= currentAbsorb; 1723 1724 SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, currentAbsorb, schoolMask, 0, 0, false, 0, false); 1725 1726 CleanDamage cleanDamage = CleanDamage(currentAbsorb, BASE_ATTACK, MELEE_HIT_NORMAL); 1727 DealDamage(caster, currentAbsorb, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false); 1728 } 1729 1730 AuraList const& vSplitDamagePct = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT); 1731 for(AuraList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next) 1732 { 1733 next = i; ++next; 1734 1735 // check damage school mask 1736 if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0) 1737 continue; 1738 1739 // Damage can be splitted only if aura has an alive caster 1740 Unit *caster = (*i)->GetCaster(); 1741 if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive()) 1742 continue; 1743 1744 int32 splitted = int32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f); 1745 1746 RemainingDamage -= splitted; 1747 1748 SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, 0, 0, false, 0, false); 1749 1750 CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL); 1751 DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false); 1752 } 1749 1753 } 1750 1754 … … 1945 1949 1946 1950 // after parry nearest next attack time will reduced at %40 from full attack time. 1947 // The delay cannot be reduced to less than 20% of your weapon 'sbase swing delay.1951 // The delay cannot be reduced to less than 20% of your weapon base swing delay. 1948 1952 if (pVictim->haveOffhandWeapon() && offtime < basetime) 1949 1953 { … … 6490 6494 case 836: // Improved Blizzard (Rank 1) 6491 6495 { 6492 if (!procSpell || procSpell->SpellVisual!=9487)6496 if (!procSpell || procSpell->SpellVisual!=9487) 6493 6497 return false; 6494 6498 triggered_spell_id = 12484; … … 6497 6501 case 988: // Improved Blizzard (Rank 2) 6498 6502 { 6499 if (!procSpell || procSpell->SpellVisual!=9487)6503 if (!procSpell || procSpell->SpellVisual!=9487) 6500 6504 return false; 6501 6505 triggered_spell_id = 12485; … … 6504 6508 case 989: // Improved Blizzard (Rank 3) 6505 6509 { 6506 if (!procSpell || procSpell->SpellVisual!=9487)6510 if (!procSpell || procSpell->SpellVisual!=9487) 6507 6511 return false; 6508 6512 triggered_spell_id = 12486; … … 7303 7307 } 7304 7308 } 7309 7305 7310 // .. taken pct: dummy auras 7306 7311 AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY); … … 7536 7541 } 7537 7542 // Holy Nova - 14% 7538 else if ((spellProto->SpellFamilyFlags & 0x400000LL) && spellProto->SpellIconID == 1874) 7543 else if ((spellProto->SpellFamilyFlags & 0x400000LL) && spellProto->SpellIconID == 1874) 7539 7544 { 7540 7545 CastingTime = 500; … … 7776 7781 return healamount; 7777 7782 7778 7779 7783 int32 AdvertisedBenefit = SpellBaseHealingBonus(GetSpellSchoolMask(spellProto)); 7780 7784 uint32 CastingTime = GetSpellCastTime(spellProto); … … 7881 7885 case SPELLFAMILY_PRIEST: 7882 7886 // Holy Nova - 14% 7883 if ((spellProto->SpellFamilyFlags & 0x8000000LL) && spellProto->SpellIconID == 1874) 7887 if ((spellProto->SpellFamilyFlags & 0x8000000LL) && spellProto->SpellIconID == 1874) 7884 7888 CastingTime = 500; 7885 7889 break; … … 8643 8647 // raw invisibility 8644 8648 bool invisible = (m_invisibilityMask != 0 || u->m_invisibilityMask !=0); 8645 8649 8646 8650 // detectable invisibility case 8647 8651 if( invisible && ( … … 10376 10380 WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4+4); 10377 10381 data << uint64(GetGUID()); 10378 data << uint8(0x0); 10382 data << uint8(0x0); // flags (0x1, 0x2) 10379 10383 data << uint32(spellid); 10380 10384 data << uint32(cooltime); … … 10887 10891 pet->RemoveAurasDueToSpell(petSpell->GetAura(pet->GetEntry())); 10888 10892 } 10893 10894 Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) 10895 { 10896 Pet* pet = new Pet(HUNTER_PET); 10897 10898 if(!pet->CreateBaseAtCreature(creatureTarget)) 10899 { 10900 delete pet; 10901 return NULL; 10902 } 10903 10904 pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, this->GetGUID()); 10905 pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, this->GetGUID()); 10906 pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,this->getFaction()); 10907 pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); 10908 10909 if(!pet->InitStatsForLevel(creatureTarget->getLevel())) 10910 { 10911 sLog.outError("ERROR: Pet::InitStatsForLevel() failed for creature (Entry: %u)!",creatureTarget->GetEntry()); 10912 delete pet; 10913 return NULL; 10914 } 10915 10916 pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true); 10917 // this enables pet details window (Shift+P) 10918 pet->AIM_Initialize(); 10919 pet->InitPetCreateSpells(); 10920 pet->SetHealth(pet->GetMaxHealth()); 10921 10922 return pet; 10923 }