Example #1
0
 public void SpellResult(int manacost,int id, Mobile c )
 {
     //AuraEffect ae = null;
     c.LooseMana(c,manacost);
 }
Example #2
0
        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;
        }