Пример #1
0
        /** Applies damage to given target. */
        protected void ApplyDamage(SpellResult info)
        {
            //todo:

            /*
             * for (int monsterLoop = 0; monsterLoop < MaxTargetsPerGroup; monsterLoop++) {
             *
             *      int resisted = 0;
             *
             *      int damage = CalculateSpellDamage(info.Caster, info.Target, out resisted);
             *
             *      //stub:
             *      damage = 99;
             *
             *      bool killed = (!info.Target.IsDead && (damage >= info.Target.Hits));
             *      damage = info.Target.ReceiveDamage(new DamageInfo(damage, info.Caster, DamageType));
             *
             *      Trace.LogDebug(" -damage = {0}, killed? {1}", damage, killed);
             *
             *      if (info.Caster != null && info.Target != null && (info.Caster is MDRCharacter) && (info.Target is MDRMonsterStack))
             *              info.Caster.GainXP(GameRules.CalculateXP((MDRCharacter)info.Caster, ((MDRMonsterStack)info.Target).Monster, damage));
             *
             *      if (!killed)
             *              break;
             *
             *      info.MonstersKilled++;
             * }
             */
            info.DidCast = true;
        }
Пример #2
0
        /**
         * Applyies the effects of this spell to given target.
         * Returns the result that can be used to log information about the outcome.
         */
        public SpellResult CastTargeted(MDRActor caster, MDRActor target)
        {
            Trace.LogDebug("STUB: Casting {0} / {1}", caster, target);
            Debug.Assert(caster != null, "Invalid parameter.  Caster must not be null.");

            var info = new SpellResult(caster, target, this);

            ApplyEffect(info);
            return(info);
        }
Пример #3
0
        /** Applies the effects of the spell on a target. */
        protected void ApplyEffect(SpellResult info)
        {
            switch (Effect)
            {
            case SpellEffect.Damage:
                ApplyDamage(info);
                break;

            case SpellEffect.Heal:
                ApplyHealing(info);
                break;
            }
        }
Пример #4
0
        /** Applies healing. */
        protected void ApplyHealing(SpellResult info)
        {
            Util.Assert(HealingSpell, "Tried casting a non healing spell as a healing spell.");

            Util.Assert(info.Target != null, "Target for healing spell must not be null.");

            if (info.Target.IsDead)
            {
                CoM.PostMessage("Can not cast {0} on {1}, they are dead.", info.Spell, info.Target);
                return;
            }

            int healing = CalculateSpellHealing(info.Caster, info.Target);

            // caclulate the amount of healing done
            info.HealingDone = info.Target.ReceiveHealing(healing);
            info.DidCast     = true;
        }