Наследование: AbstractSpellEffect
Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            var damageJet = castInfos.RandomJet;

            castInfos.EffectType = EffectEnum.DamageBrut;

            // cannot kill the target if hes an ally
            if (castInfos.Caster.Team == castInfos.Target.Team && damageJet > castInfos.Target.Life)
            {
                damageJet = castInfos.Target.Life - 1;
            }

            if (DamageEffect.ApplyDamages(castInfos, castInfos.Target, ref damageJet) == FightActionResultEnum.RESULT_END)
            {
                return(FightActionResultEnum.RESULT_END);
            }

            var healJet = damageJet / 2;

            return(HealEffect.ApplyHeal(castInfos, castInfos.Caster, ref healJet));
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            var damageCoef = CastInfos.Value1;
            var healCoef   = CastInfos.Value2;
            var chance     = CastInfos.Value3;
            var chanceJet  = Util.Next(0, 100);

            if (chanceJet < chance)
            {
                var HealValue = damageValue * healCoef;

                if (HealEffect.ApplyHeal(CastInfos, Target, ref HealValue) == FightActionResultEnum.RESULT_END)
                {
                    return(FightActionResultEnum.RESULT_END);
                }

                damageValue = 0;
            }
            else // Multiplication des dommages
            {
                damageValue *= damageCoef;
            }

            return(base.ApplyEffect(ref damageValue, damageInfos));
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="damageValue"></param>
        /// <param name="damageInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null)
        {
            var buffValue = damageValue / 2; // Divise par deux les stats a boost car c'est un personnage.
            var statsType = (EffectEnum)CastInfos.Value1;
            var maxValue  = CastInfos.Value2;
            var duration  = CastInfos.Value3;

            if (Target.Fight.CurrentFighter.Id == CastInfos.FakeValue)
            {
                if (CastInfos.DamageValue < maxValue)
                {
                    if (CastInfos.DamageValue + buffValue > maxValue)
                    {
                        buffValue = maxValue - CastInfos.DamageValue;
                    }
                }
                else
                {
                    buffValue = 0;
                }
            }
            else
            {
                CastInfos.DamageValue = 0;
                CastInfos.FakeValue   = (int)Target.Fight.CurrentFighter.Id;

                if (CastInfos.DamageValue + buffValue > maxValue)
                {
                    buffValue = maxValue;
                }
            }

            if (buffValue != 0)
            {
                CastInfos.DamageValue += buffValue;

                switch (statsType)
                {
                case EffectEnum.Heal:
                    HealEffect.ApplyHeal(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target, ref buffValue);
                    break;

                default:
                    var BuffStats = new StatsBuff(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target);
                    BuffStats.ApplyEffect(ref buffValue);
                    Target.BuffManager.AddBuff(BuffStats);
                    break;
                }
            }

            return(base.ApplyEffect(ref damageValue, damageInfos));
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            // Si > 0 alors c'est un buff
            if (castInfos.Duration > 0)
            {
                castInfos.Target.BuffManager.AddBuff(new HealBuff(castInfos, castInfos.Target));
            }
            else // Heal direct
            {
                var healValue = castInfos.RandomJet;
                return(HealEffect.ApplyHeal(castInfos, castInfos.Target, ref healValue));
            }

            return(FightActionResultEnum.RESULT_NOTHING);
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            var damageJet = castInfos.RandomJet;

            if (DamageEffect.ApplyDamages(castInfos, castInfos.Target, ref damageJet) == FightActionResultEnum.RESULT_END)
            {
                return(FightActionResultEnum.RESULT_END);
            }

            castInfos.EffectType = Spell.EffectEnum.DamageBrut;

            // On ne se soigne que de 50% des dégats
            var healJet = damageJet / 2;

            return(HealEffect.ApplyHeal(castInfos, castInfos.Caster, ref healJet));
        }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="castInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(CastInfos castInfos)
        {
            if (castInfos.Target == null)
            {
                return(FightActionResultEnum.RESULT_NOTHING);
            }

            // damage himself
            if (castInfos.Target == castInfos.Caster)
            {
                var damageInfos = new CastInfos(EffectEnum.DamageBrut, castInfos.SpellId, castInfos.CellId, castInfos.Value1, castInfos.Value2, castInfos.Value3, castInfos.Chance, 0, castInfos.Caster, castInfos.Target);
                var damageValue = (int)(((double)castInfos.Caster.Life / 100) * castInfos.RandomJet);

                return(DamageEffect.ApplyDamages(damageInfos, castInfos.Caster, ref damageValue));
            }

            var healInfos = new CastInfos(EffectEnum.DamageBrut, -1, -1, -1, -1, -1, -1, -1, castInfos.Caster, castInfos.Target);
            var healValue = (int)(((double)castInfos.Caster.Life / 100) * castInfos.RandomJet);

            return(HealEffect.ApplyHeal(healInfos, castInfos.Target, ref healValue));
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="healValue"></param>
        /// <param name="healInfos"></param>
        /// <returns></returns>
        public override FightActionResultEnum ApplyEffect(ref int healValue, CastInfos healInfos = null)
        {
            var heal = CastInfos.RandomJet;

            return(HealEffect.ApplyHeal(CastInfos, Target, ref heal));
        }