Changeset 110
- Timestamp:
- 11/19/08 13:36:54 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 8 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Spell.cpp
r108 r110 1227 1227 cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); 1228 1228 } 1229 TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); 1230 cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); 1229 if(!spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_MAX_TARGETS)) 1230 { 1231 TypeContainerVisitor<Trinity::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_object_notifier(notifier); 1232 cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); 1233 } 1231 1234 } 1232 1235 … … 1352 1355 case TARGET_ALL_AROUND_CASTER: 1353 1356 { 1357 if(!unMaxTargets) 1358 unMaxTargets = spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_MAX_TARGETS); 1354 1359 m_caster->GetPosition(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ); 1355 1360 }break; … … 1414 1419 }break; 1415 1420 case TARGET_IN_FRONT_OF_CASTER: 1416 { 1417 bool inFront = m_spellInfo->SpellVisual != 3879; 1418 SearchAreaTarget(TagUnitMap, radius, inFront ? PUSH_IN_FRONT : PUSH_IN_BACK,SPELL_TARGETS_AOE_DAMAGE); 1421 case TARGET_UNIT_CONE_ENEMY_UNKNOWN: 1422 { 1423 switch(spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_CONE_TYPE)) 1424 { 1425 default: 1426 case 0: 1427 SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_AOE_DAMAGE); 1428 break; 1429 case 1: 1430 SearchAreaTarget(TagUnitMap, radius, PUSH_IN_BACK, SPELL_TARGETS_AOE_DAMAGE); 1431 break; 1432 case 2: 1433 SearchAreaTarget(TagUnitMap, radius, PUSH_IN_LINE, SPELL_TARGETS_AOE_DAMAGE); 1434 break; 1435 } 1419 1436 }break; 1437 case TARGET_UNIT_CONE_ALLY: 1438 { 1439 SearchAreaTarget(TagUnitMap, radius, PUSH_IN_FRONT, SPELL_TARGETS_FRIENDLY); 1440 }break; 1441 1420 1442 1421 1443 // nearby target -
trunk/src/game/Spell.h
r108 r110 74 74 PUSH_IN_FRONT, 75 75 PUSH_IN_BACK, 76 PUSH_IN_LINE, 76 77 PUSH_SELF_CENTER, 77 78 PUSH_DEST_CENTER, … … 603 604 { 604 605 case PUSH_IN_FRONT: 605 if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 ))606 if(i_spell.GetCaster()->isInFront((Unit*)(itr->getSource()), i_radius, M_PI/3 )) 606 607 i_data->push_back(itr->getSource()); 607 608 break; 608 609 case PUSH_IN_BACK: 609 if(i_spell.GetCaster()->isInBack((Unit*)(itr->getSource()), i_radius, 2*M_PI/3 )) 610 if(i_spell.GetCaster()->isInBack((Unit*)(itr->getSource()), i_radius, M_PI/3 )) 611 i_data->push_back(itr->getSource()); 612 break; 613 case PUSH_IN_LINE: 614 if(i_spell.GetCaster()->isInLine((Unit*)(itr->getSource()), i_radius )) 610 615 i_data->push_back(itr->getSource()); 611 616 break; -
trunk/src/game/SpellEffects.cpp
r106 r110 312 312 } 313 313 314 // Meteor like spells (divided damage to targets) 315 if(spellmgr.GetSpellExtraInfo(m_spellInfo->Id, SPELL_EXTRA_INFO_SHARE_DAMAGE)) 316 { 317 uint32 count = 0; 318 for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) 319 if(ihit->effectMask & (1<<effect_idx)) 320 ++count; 321 322 damage /= count; // divide to all targets 323 } 324 314 325 switch(m_spellInfo->Id) // better way to check unknown 315 326 { 316 // Meteor like spells (divided damage to targets)317 case 24340: case 26558: case 28884: // Meteor318 case 36837: case 38903: case 41276: // Meteor319 case 26789: // Shard of the Fallen Star320 case 31436: // Malevolent Cleave321 case 35181: // Dive Bomb322 case 40810: case 43267: case 43268: // Saber Lash323 case 42384: // Brutal Swipe324 case 45150: // Meteor Slash325 {326 uint32 count = 0;327 for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)328 if(ihit->effectMask & (1<<effect_idx))329 ++count;330 331 damage /= count; // divide to all targets332 break;333 }334 327 // percent from health with min 335 328 case 25599: // Thundercrash -
trunk/src/game/SpellMgr.cpp
r108 r110 1969 1969 } 1970 1970 1971 // set data in core for now 1972 void SpellMgr::LoadSpellExtraInfo() 1973 { 1974 SpellExtraInfo info; 1975 info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 0; 1976 info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 0; 1977 info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 0; 1978 1979 info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 1; 1980 SpellEntry const* tempSpell; 1981 for(uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) 1982 { 1983 tempSpell = GetSpellStore()->LookupEntry(i); 1984 if(tempSpell && tempSpell->SpellVisual == 3879) 1985 mSpellExtraInfoMap[tempSpell->Id] = info; 1986 } 1987 info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 2; 1988 mSpellExtraInfoMap[26029] = info; // dark glare 1989 mSpellExtraInfoMap[37433] = info; // spout 1990 mSpellExtraInfoMap[43140] = info; // flame breath 1991 mSpellExtraInfoMap[43215] = info; // flame breath 1992 info.info[SPELL_EXTRA_INFO_CONE_TYPE] = 0; 1993 1994 info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 1; 1995 for(uint32 i = 0; i < 46000; ++i) 1996 { 1997 switch(i) 1998 { 1999 case 24340: case 26558: case 28884: // Meteor 2000 case 36837: case 38903: case 41276: // Meteor 2001 case 26789: // Shard of the Fallen Star 2002 case 31436: // Malevolent Cleave 2003 case 35181: // Dive Bomb 2004 case 40810: case 43267: case 43268: // Saber Lash 2005 case 42384: // Brutal Swipe 2006 case 45150: // Meteor Slash 2007 mSpellExtraInfoMap[i] = info; 2008 break; 2009 default: 2010 break; 2011 } 2012 } 2013 info.info[SPELL_EXTRA_INFO_SHARE_DAMAGE] = 0; 2014 2015 info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 1; 2016 for(uint32 i = 0; i < 46000; ++i) 2017 { 2018 switch(i) 2019 { 2020 case 44978: case 45001: case 45002: // Wild Magic 2021 case 45004: case 45006: case 45010: // Wild Magic 2022 case 31347: // Doom 2023 case 41635: // Prayer of Mending 2024 mSpellExtraInfoMap[i] = info; 2025 break; 2026 default: 2027 break; 2028 } 2029 } 2030 info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 3; 2031 mSpellExtraInfoMap[41376] = info; //Spite 2032 info.info[SPELL_EXTRA_INFO_MAX_TARGETS] = 0; 2033 } 2034 1971 2035 /// Some checks for spells, to prevent adding depricated/broken spells for trainers, spell book, etc 1972 2036 bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) -
trunk/src/game/SpellMgr.h
r102 r110 635 635 } 636 636 637 enum SpellExtraInfoType 638 { 639 SPELL_EXTRA_INFO_MAX_TARGETS, 640 SPELL_EXTRA_INFO_CONE_TYPE, 641 SPELL_EXTRA_INFO_SHARE_DAMAGE 642 }; 643 644 struct SpellExtraInfo 645 { 646 uint32 info[3]; 647 }; 648 649 typedef std::map<uint32, SpellExtraInfo> SpellExtraInfoMap; 650 637 651 class SpellMgr 638 652 { … … 831 845 else 832 846 return NULL; 847 } 848 849 uint32 GetSpellExtraInfo(uint32 spell_id, uint32 type) const 850 { 851 SpellExtraInfoMap::const_iterator itr = mSpellExtraInfoMap.find(spell_id); 852 if(itr != mSpellExtraInfoMap.end()) 853 return itr->second.info[type]; 854 else 855 return 0; 833 856 } 834 857 … … 849 872 void LoadSkillLineAbilityMap(); 850 873 void LoadSpellPetAuras(); 874 void LoadSpellExtraInfo(); 851 875 852 876 private: … … 862 886 SkillLineAbilityMap mSkillLineAbilityMap; 863 887 SpellPetAuraMap mSpellPetAuraMap; 888 SpellExtraInfoMap mSpellExtraInfoMap; 864 889 }; 865 890 -
trunk/src/game/Unit.cpp
r102 r110 3447 3447 { 3448 3448 return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target ); 3449 } 3450 3451 bool Unit::isInLine(Unit const* target, float distance) const 3452 { 3453 if(!HasInArc(M_PI, target) || !IsWithinDistInMap(target, distance)) return false; 3454 float width = (GetObjectSize() / 2 + target->GetObjectSize()) / 2; 3455 float angle = GetAngle(target); 3456 angle -= GetOrientation(); 3457 return abs(sin(angle)) * distance < width; 3449 3458 } 3450 3459 -
trunk/src/game/Unit.h
r102 r110 1096 1096 void SetInFront(Unit const* target); 1097 1097 bool isInBack(Unit const* target, float distance, float arc = M_PI) const; 1098 bool isInLine(Unit const* target, float distance) const; 1098 1099 1099 1100 // Visibility system -
trunk/src/game/World.cpp
r102 r110 1096 1096 spellmgr.LoadSpellPetAuras(); 1097 1097 1098 sLog.outString( "Loading spell extra infos...(TODO)" ); 1099 spellmgr.LoadSpellExtraInfo(); 1100 1098 1101 sLog.outString( "Loading player Create Info & Level Stats..." ); 1099 1102 objmgr.LoadPlayerInfo();