- Timestamp:
- 11/19/08 13:47:00 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Player.cpp
r212 r213 16606 16606 16607 16607 // prevent stealth flight 16608 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ STEALTH);16608 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LOOT); 16609 16609 16610 16610 WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); … … 18886 18886 return ( //InBattleGround() && // in battleground - not need, check in other cases 18887 18887 !IsMounted() && // not mounted 18888 !isTotalImmunity() && // not totally immuned 18888 18889 !HasStealthAura() && // not stealthed 18889 18890 !HasInvisibilityAura() && // not invisible … … 18901 18902 return false; 18902 18903 } 18904 18905 bool Player::isTotalImmunity() 18906 { 18907 AuraList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY); 18908 18909 for(AuraList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr) 18910 { 18911 if (((*itr)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_ALL) !=0) // total immunity 18912 { 18913 return true; 18914 } 18915 if (((*itr)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) !=0) // physical damage immunity 18916 { 18917 for(AuraList::const_iterator i = immune.begin(); i != immune.end(); ++i) 18918 { 18919 if (((*i)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_MAGIC) !=0) // magic immunity 18920 { 18921 return true; 18922 } 18923 } 18924 } 18925 } 18926 return false; 18927 } -
trunk/src/game/Player.h
r207 r213 1915 1915 bool GetBGAccessByLevel(uint32 bgTypeId) const; 1916 1916 bool isAllowUseBattleGroundObject(); 1917 bool isTotalImmunity(); 1917 1918 1918 1919 /*********************************************************/ -
trunk/src/game/Spell.cpp
r203 r213 957 957 unit->SetStandState(PLAYER_STATE_NONE); 958 958 959 if(!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI()) 960 ((Creature*)unit)->AI()->AttackStart(m_caster); 961 962 unit->SetInCombatWith(m_caster); 963 m_caster->SetInCombatWith(unit); 964 965 if(Player *attackedPlayer = unit->GetCharmerOrOwnerPlayerOrPlayerItself()) 966 m_caster->SetContestedPvP(attackedPlayer); 959 m_caster->CombatStart(unit); 967 960 } 968 961 } … … 1003 996 } 1004 997 1005 //if(!IsPositiveSpell(m_spellInfo->Id)) 1006 { 1007 //do not remove feign death 1008 unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE); 1009 } 998 unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL); 1010 999 } 1011 1000 else … … 2248 2237 if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) 2249 2238 { 2250 m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ STEALTH);2239 m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST); 2251 2240 } 2252 2241 -
trunk/src/game/SpellAuras.cpp
r207 r213 3072 3072 m_target->addUnitState(UNIT_STAT_DIED); 3073 3073 m_target->CombatStop(); 3074 m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_UNATTACKABLE); 3074 3075 3075 3076 // prevent interrupt message … … 3211 3212 { 3212 3213 // drop flag at stealth in bg 3213 if(((Player*)m_target)->InBattleGround()) 3214 { 3215 if(BattleGround *bg = ((Player*)m_target)->GetBattleGround()) 3216 bg->EventPlayerDroppedFlag((Player*)m_target); 3217 } 3214 m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_UNATTACKABLE); 3215 3218 3216 // remove player from the objective's active player count at stealth 3219 3217 if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) … … 3299 3297 m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue); 3300 3298 3299 m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_UNATTACKABLE); 3300 3301 3301 if(Real && m_target->GetTypeId()==TYPEID_PLAYER) 3302 3302 { … … 3306 3306 if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) 3307 3307 pvp->HandlePlayerActivityChanged((Player*)m_target); 3308 3309 // drop flag at invisible in bg3310 if(((Player*)m_target)->InBattleGround())3311 if(BattleGround *bg = ((Player*)m_target)->GetBattleGround())3312 bg->EventPlayerDroppedFlag((Player*)m_target);3313 3308 } 3314 3309 … … 3817 3812 void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) 3818 3813 { 3814 if(apply && m_modifier.m_miscvalue == SPELL_SCHOOL_MASK_NORMAL) 3815 m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_UNATTACKABLE); 3816 3819 3817 m_target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,m_modifier.m_miscvalue,apply); 3820 3818 … … 5377 5375 { 5378 5376 if(Real && Apply) 5377 { 5379 5378 m_target->CombatStop(); 5379 m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_UNATTACKABLE); 5380 } 5380 5381 5381 5382 m_target->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE,Apply); -
trunk/src/game/SpellEffects.cpp
r207 r213 3480 3480 { 3481 3481 // Reveal action + get attack 3482 m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ STEALTH);3482 m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LOOT); 3483 3483 if (((Creature*)unitTarget)->AI()) 3484 3484 ((Creature*)unitTarget)->AI()->AttackStart(m_caster); -
trunk/src/game/Unit.cpp
r186 r213 473 473 474 474 //sLog.outDetail("auraflag:%u flag:%u = %u",(*iter)->GetSpellProto()->AuraInterruptFlags,flag,(*iter)->GetSpellProto()->AuraInterruptFlags & flag); 475 if(*iter && ((*iter)->GetSpellProto()->AuraInterruptFlags & flag) == flag)475 if(*iter && ((*iter)->GetSpellProto()->AuraInterruptFlags & flag)) 476 476 { 477 477 RemoveAurasDueToSpell((*iter)->GetId()); … … 489 489 } 490 490 491 /* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */ 492 void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell) 493 { 494 // The chance to dispel an aura depends on the damage taken with respect to the casters level. 495 uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50; 496 float chance = float(damage) / max_dmg * 100.0f; 497 498 AuraList::iterator i, next; 499 for(i = m_ccAuras.begin(); i != m_ccAuras.end(); i = next) 500 { 501 next = i; 502 ++next; 503 504 if(*i && (!spell || (*i)->GetId() != spell) && roll_chance_f(chance)) 505 { 506 RemoveAurasDueToSpell((*i)->GetId()); 507 if (!m_ccAuras.empty()) 508 next = m_ccAuras.begin(); 509 else 510 return; 511 } 512 } 513 } 514 491 515 uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss) 492 516 { … … 510 534 if( damagetype != DOT) 511 535 { 512 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH);513 514 536 if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED)) 515 537 pVictim->SetStandState(PLAYER_STATE_NONE); … … 889 911 890 912 // TODO: Store auras by interrupt flag to speed this up. 891 AuraMap& vAuras = pVictim->GetAuras();913 /*AuraMap& vAuras = pVictim->GetAuras(); 892 914 for (AuraMap::iterator i = vAuras.begin(), next; i != vAuras.end(); i = next) 893 915 { … … 909 931 } 910 932 } 911 else if ( (se->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) && (!spellProto || se->Id != spellProto->Id) ) 912 { 913 uint32 max_dmg = pVictim->getLevel() > 8 ? 25 * pVictim->getLevel() - 150 : 50; 914 float chance = float(damage) / max_dmg * 100.0f; 915 if (roll_chance_f(chance)) 916 { 917 pVictim->RemoveAurasDueToSpell(i->second->GetId()); 918 next = vAuras.begin(); 919 } 920 } 921 } 933 else */ 934 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DAMAGE); 935 pVictim->RemoveSpellbyDamageTaken(damage, spellProto ? spellProto->Id : 0); 922 936 923 937 if (damagetype != NODAMAGE && damage && pVictim->GetTypeId() == TYPEID_PLAYER) … … 2193 2207 return; 2194 2208 2195 if(!pVictim->isInCombat() && pVictim->GetTypeId() != TYPEID_PLAYER && ((Creature*)pVictim)->AI()) 2196 ((Creature*)pVictim)->AI()->AttackStart(this); 2197 2198 SetInCombatWith(pVictim); 2199 pVictim->SetInCombatWith(this); 2200 2201 if(Player* attackedPlayer = pVictim->GetCharmerOrOwnerPlayerOrPlayerItself()) 2202 SetContestedPvP(attackedPlayer); 2209 CombatStart(pVictim); 2203 2210 2204 2211 uint32 hitInfo; … … 3790 3797 if(Aur->GetSpellProto()->AuraInterruptFlags) 3791 3798 m_interruptableAuras.push_back(Aur); 3799 if(Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) 3800 { 3801 m_ccAuras.push_back(Aur); 3802 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CC); 3803 } 3792 3804 } 3793 3805 … … 4153 4165 if((*i).second->GetSpellProto()->AuraInterruptFlags) 4154 4166 m_interruptableAuras.remove((*i).second); 4167 if((*i).second->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) 4168 m_ccAuras.remove((*i).second); 4155 4169 } 4156 4170 … … 8399 8413 return; 8400 8414 8401 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT ING);8415 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT); 8402 8416 8403 8417 SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, mount); … … 8467 8481 } 8468 8482 SetInCombatState(false); 8483 } 8484 8485 void Unit::CombatStart(Unit* target) 8486 { 8487 if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER && ((Creature*)target)->AI()) 8488 ((Creature*)target)->AI()->AttackStart(this); 8489 8490 SetInCombatWith(target); 8491 target->SetInCombatWith(this); 8492 8493 if(Player* attackedPlayer = target->GetCharmerOrOwnerPlayerOrPlayerItself()) 8494 SetContestedPvP(attackedPlayer); 8495 8496 if(!isInCombat()) // remove this? 8497 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ATTACK); 8469 8498 } 8470 8499 -
trunk/src/game/Unit.h
r203 r213 58 58 enum SpellAuraInterruptFlags 59 59 { 60 AURA_INTERRUPT_FLAG_ UNK0= 0x00000001, // 0 removed when getting hit by a negative spell?60 AURA_INTERRUPT_FLAG_HITBYSPELL = 0x00000001, // 0 removed when getting hit by a negative spell? 61 61 AURA_INTERRUPT_FLAG_DAMAGE = 0x00000002, // 1 removed by any damage 62 AURA_INTERRUPT_FLAG_ UNK2 = 0x00000004, // 262 AURA_INTERRUPT_FLAG_CC = 0x00000004, // 2 crowd control 63 63 AURA_INTERRUPT_FLAG_MOVE = 0x00000008, // 3 removed by any movement 64 64 AURA_INTERRUPT_FLAG_TURNING = 0x00000010, // 4 removed by any turning 65 AURA_INTERRUPT_FLAG_ ENTER_COMBAT= 0x00000020, // 5 removed by entering combat65 AURA_INTERRUPT_FLAG_JUMP = 0x00000020, // 5 removed by entering combat 66 66 AURA_INTERRUPT_FLAG_NOT_MOUNTED = 0x00000040, // 6 removed by unmounting 67 67 AURA_INTERRUPT_FLAG_NOT_ABOVEWATER = 0x00000080, // 7 removed by entering water 68 68 AURA_INTERRUPT_FLAG_NOT_UNDERWATER = 0x00000100, // 8 removed by leaving water 69 69 AURA_INTERRUPT_FLAG_NOT_SHEATHED = 0x00000200, // 9 removed by unsheathing 70 AURA_INTERRUPT_FLAG_UNK10 = 0x00000400, // 10 71 AURA_INTERRUPT_FLAG_UNK11 = 0x00000800, // 11 72 AURA_INTERRUPT_FLAG_UNK12 = 0x00001000, // 12 removed by attack? 73 AURA_INTERRUPT_FLAG_UNK13 = 0x00002000, // 13 74 AURA_INTERRUPT_FLAG_STEALTH = 0x00003C00, 70 AURA_INTERRUPT_FLAG_LOOT = 0x00000400, // 10 71 AURA_INTERRUPT_FLAG_MOUNT = 0x00000800, // 11 removed by mounting 72 AURA_INTERRUPT_FLAG_ATTACK = 0x00001000, // 12 removed by attacking 73 AURA_INTERRUPT_FLAG_CAST = 0x00002000, // 13 ??? 75 74 AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14 76 AURA_INTERRUPT_FLAG_ UNK15 = 0x00008000, // 15 removed by casting a spell?75 AURA_INTERRUPT_FLAG_TRANSFORM = 0x00008000, // 15 removed by transform? 77 76 AURA_INTERRUPT_FLAG_UNK16 = 0x00010000, // 16 78 AURA_INTERRUPT_FLAG_ MOUNTING = 0x00020000, // 17 removed by mounting77 AURA_INTERRUPT_FLAG_UNK17 = 0x00020000, // 17 misdirect, aspect, swim speed 79 78 AURA_INTERRUPT_FLAG_NOT_SEATED = 0x00040000, // 18 removed by standing up 80 79 AURA_INTERRUPT_FLAG_CHANGE_MAP = 0x00080000, // 19 leaving map/getting teleported 81 AURA_INTERRUPT_FLAG_UN K20 = 0x00100000, // 2080 AURA_INTERRUPT_FLAG_UNATTACKABLE = 0x00100000, // 20 invulnerable or stealth 82 81 AURA_INTERRUPT_FLAG_UNK21 = 0x00200000, // 21 83 AURA_INTERRUPT_FLAG_ UNK22= 0x00400000, // 2282 AURA_INTERRUPT_FLAG_TELEPORTED = 0x00400000, // 22 84 83 AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT = 0x00800000, // 23 removed by entering pvp combat 85 84 AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000 // 24 removed by any direct damage … … 845 844 846 845 uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } 846 void RemoveSpellbyDamageTaken(uint32 damage, uint32 spell); 847 847 uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss); 848 848 void DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *damage, CleanDamage *cleanDamage, bool *crit = false, bool isTriggeredSpell = false); … … 903 903 904 904 bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); } 905 void CombatStart(Unit* target); 905 906 void SetInCombatState(bool PvP); 906 907 void SetInCombatWith(Unit* enemy); … … 1335 1336 AuraList m_modAuras[TOTAL_AURAS]; 1336 1337 AuraList m_interruptableAuras; 1338 AuraList m_ccAuras; 1337 1339 float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]; 1338 1340 float m_weaponDamage[MAX_ATTACK][2];