Changeset 100 for trunk/src/game/Unit.cpp
- Timestamp:
- 11/19/08 13:35:34 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Unit.cpp
r93 r100 449 449 } 450 450 451 /* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */452 void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage)453 {454 if(!HasAuraType(auraType))455 return;456 457 // The chance to dispell an aura depends on the damage taken with respect to the casters level.458 uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;459 float chance = float(damage) / max_dmg * 100.0f;460 if (roll_chance_f(chance))461 RemoveSpellsCausingAura(auraType);462 }463 464 451 uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss) 465 452 { … … 486 473 RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); 487 474 488 if(pVictim != this)489 RemoveSpellsCausingAura(SPELL_AURA_MOD_INVISIBILITY);490 491 475 if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED)) 492 476 pVictim->SetStandState(PLAYER_STATE_NONE); … … 505 489 return 0; 506 490 } 507 508 pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage);509 // root type spells do not dispell the root effect510 if(!spellProto || spellProto->Mechanic != MECHANIC_ROOT)511 pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage);512 491 513 492 if(pVictim->GetTypeId() != TYPEID_PLAYER) … … 889 868 pVictim->RemoveAurasDueToSpell(i->second->GetId()); 890 869 // FIXME: this may cause the auras with proc chance to be rerolled several times 870 next = vAuras.begin(); 871 } 872 } 873 else if ( (se->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) && (!spellProto || se->Id != spellProto->Id) ) 874 { 875 uint32 max_dmg = pVictim->getLevel() > 8 ? 25 * pVictim->getLevel() - 150 : 50; 876 float chance = float(damage) / max_dmg * 100.0f; 877 if (roll_chance_f(chance)) 878 { 879 pVictim->RemoveAurasDueToSpell(i->second->GetId()); 891 880 next = vAuras.begin(); 892 881 }