コード例 #1
0
ファイル: SpellTemplate.cs プロジェクト: karliky/wowwow
 public float AbsorbCalculation(float dmg, Mobile src, Mobile target)
 {
     int realDamage = 0;
     switch( resistance )
     {
         case Resistances.Fire:
             realDamage = target.DiminishFireAbsordb( (int)dmg );
             if (dmg - realDamage > 0)
             {
                 if (target.HaveTalent(Talents.ImprovedFireWard))
                 {
                     AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedFireWard );
                     float modif = (float)ae.S1/100;
                     bool haveFWSpell = false;
                     foreach( Mobile.AuraReleaseTimer art in target.Auras )
                         if ( art.ae == (AuraEffect)Abilities.abilities[10223])haveFWSpell = true;
                     if (haveFWSpell) this.MakeDamage(target,src,(dmg - realDamage)*modif);
                 }
             }
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Frost:
             realDamage = target.DiminishFrostAbsordb( (int)dmg );
             // Improved frost ward
             if ( target.Classe == Classes.Mage )
                 if ( target.HaveTalent( Talents.ImprovedFrostWard ) &&
                     realDamage != dmg )
                 {
                     bool haveFWSpell = false;
                     foreach( Mobile.AuraReleaseTimer art in target.Auras )
                         if ( art.ae == (AuraEffect)Abilities.abilities[6143])haveFWSpell = true;
                     if (haveFWSpell) target.GainMana( target, (int)(( dmg - realDamage ) / 2) );
                 }
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Light:
             realDamage = target.DiminishHolyAbsordb( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Arcane:
             realDamage = target.DiminishArcaneAbsordb( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Shadow:
             realDamage = target.DiminishShadowAbsordb( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Nature:
             realDamage = target.DiminishNatureAbsordb( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
         case Resistances.Armor:
             realDamage = target.DiminishAbsorbPhysical( (int)dmg );
             realDamage = target.DiminishAbsordbAll( realDamage );
             break;
     }
     realDamage = target.DiminishAbsorbAllDamage(realDamage);
     return realDamage;
 }
コード例 #2
0
ファイル: SpellTemplate.cs プロジェクト: karliky/wowwow
        public int MakeManaDamage( Mobile src, Mobile target, float dmg, bool f )
        {
            if ( target.Dead )
                return 0;
            if (this.ImmuneCheck(target,this)) return 0;
            float roll2 = (float)Utility.RandomDouble();
            float avarageResistance = this.ResistCalculation(src, target);
            if (roll2 < avarageResistance)
                return 0;
            Console.WriteLine("MAGIC HIT damage: " + dmg);

            #region bovies hit chance calculation
            float dif = dif = (float)(5*src.Level - target.Level*5)/5;
            float hitChance = 0;
            if (src is Character && target is Character)
                hitChance = 95;
            else
            {
                if (dif > 0 ) hitChance = 95 + (int)dif;
                else if (target.Level > src.Level + 3) hitChance = 95 - (int)dif * 15;
                else hitChance = 95 - (int)dif * 10;
                if(hitChance >= 99) hitChance = 99;
                if(hitChance <= 1) hitChance = 1;
            }
            int roll = Utility.Random( 100 );
            Console.WriteLine("hit chance =" + hitChance + " " + roll );
            if (roll >= hitChance)
            {
                return 0;
            }
            #endregion
            float res = 0f;
            float spellMod = 1.0f;
            switch( resistance )
            {
                case Resistances.Fire:
                    res = (float)target.ResistFire / 200f;
                    spellMod = FireSpellModifier( src );
                    break;
                case Resistances.Frost:
                    res = (float)target.ResistFrost / 200f;
                    spellMod = FrostSpellModifier( src );
                    break;
                case Resistances.Light:
                    res = (float)target.ResistHoly / 200f;
                    spellMod = LightSpellModifier( src );
                    break;
                case Resistances.Arcane:
                    res = (float)target.ResistArcane / 200f;
                    spellMod = ArcaneSpellModifier( src );
                    break;
                case Resistances.Shadow:
                    res = (float)target.ResistShadow / 200f;
                    spellMod = ShadowSpellModifier( src );
                    break;
                case Resistances.Nature:
                    res = (float)target.ResistNature / 200f;
                    spellMod = NatureSpellModifier( src );
                    break;
                case Resistances.Armor:
                    res = (float)target.Armor / 3000f;
                    break;
            }
            if ( res == 0f && target is BaseCreature )
                res = ( target.Level * 3 ) / 200f;
            res = 1 - res;
            dmg *= res * spellMod;
            int realDamage = 0;
            switch( resistance )
            {
                case Resistances.Fire:
                    realDamage = target.DiminishFireAbsordb( (int)dmg );
                    realDamage = target.DiminishAbsordbAll( realDamage );
                    break;
                case Resistances.Frost:
                    realDamage = target.DiminishFrostAbsordb( (int)dmg );
                    realDamage = target.DiminishAbsordbAll( realDamage );
                    break;
                case Resistances.Light:
                    realDamage = target.DiminishHolyAbsordb( (int)dmg );
                    realDamage = target.DiminishAbsordbAll( realDamage );
                    break;
                case Resistances.Arcane:
                    realDamage = target.DiminishArcaneAbsordb( (int)dmg );
                    realDamage = target.DiminishAbsordbAll( realDamage );
                    break;
                case Resistances.Shadow:
                    realDamage = target.DiminishShadowAbsordb( (int)dmg );
                    realDamage = target.DiminishAbsordbAll( realDamage );
                    break;
                case Resistances.Nature:
                    realDamage = target.DiminishNatureAbsordb( (int)dmg );
                    realDamage = target.DiminishAbsordbAll( realDamage );
                    break;
                case Resistances.Armor:
                    break;
            }

            if ( realDamage > target.Mana )
                realDamage = target.Mana;

            target.LooseMana( src, realDamage );
            return realDamage;
        }