Changeset 100 for trunk

Show
Ignore:
Timestamp:
11/19/08 13:35:34 (17 years ago)
Author:
yumileroy
Message:

[svn] Add SPELL_ATTR_BREAKABLE_BY_DAMAGE. Remove part of the hacked breakable aura check. Patch provided by thenecromancer.

Original author: megamage
Date: 2008-10-22 14:58:50-05:00

Location:
trunk/src/game
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/SharedDefines.h

    r79 r100  
    229229#define SPELL_ATTR_CANT_USED_IN_COMBAT            0x10000000            // 28 Cannot be used in combat 
    230230#define SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY  0x20000000            // 29 unaffected by invulnerability (hmm possible not...) 
    231 #define SPELL_ATTR_UNK30                          0x40000000            // 30 breakable by damage? 
     231#define SPELL_ATTR_BREAKABLE_BY_DAMAGE            0x40000000            // 30 breakable by damage? 
    232232#define SPELL_ATTR_CANT_CANCEL                    0x80000000            // 31 positive aura can't be canceled 
    233233 
  • trunk/src/game/Unit.cpp

    r93 r100  
    449449} 
    450450 
    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  
    464451uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss) 
    465452{ 
     
    486473        RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); 
    487474 
    488         if(pVictim != this) 
    489             RemoveSpellsCausingAura(SPELL_AURA_MOD_INVISIBILITY); 
    490  
    491475        if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED)) 
    492476            pVictim->SetStandState(PLAYER_STATE_NONE); 
     
    505489        return 0; 
    506490    } 
    507  
    508     pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage); 
    509     // root type spells do not dispell the root effect 
    510     if(!spellProto || spellProto->Mechanic != MECHANIC_ROOT) 
    511         pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage); 
    512491 
    513492    if(pVictim->GetTypeId() != TYPEID_PLAYER) 
     
    889868                    pVictim->RemoveAurasDueToSpell(i->second->GetId()); 
    890869                    // 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()); 
    891880                    next = vAuras.begin(); 
    892881                } 
  • trunk/src/game/Unit.h

    r69 r100  
    914914        bool isFrozen() const; 
    915915 
    916         void RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage); 
    917  
    918916        bool isTargetableForAttack() const; 
    919917        virtual bool IsInWater() const;