Beispiel #1
0
        public List <EffectReport> Update()
        {
            List <EffectReport> reports = new List <EffectReport> ();

            this.turnsLeft--;
            if (this.isDamage)
            {
                reports.Add(this.Damage());
            }
            if (this.useModifier && this.IsEnded())
            {
                this.RemoveModifiers();
            }

            if (this.IsEnded())
            {
                EffectReport report = new EffectReport()
                {
                    type           = EffectReportType.OTHER,
                    owner          = owner,
                    isEffectRemove = true,
                    effectName     = this.name
                };
                owner.reports.Add(report);
            }

            return(reports);
        }
Beispiel #2
0
        public EffectReport Damage()
        {
            float damage = 1f * Random.Range((int)(this.damageMin * 100), (int)(this.damageMax * 100) + 1) / 100f;

            if (!this.ignoreDefence)
            {
                float defence = (this.isMagical) ? owner.magicalDefence : owner.physicalDefence;
                damage = damage * ((Character.MAX_DEFENCE - defence) / Character.MAX_DEFENCE);
            }
            damage = owner.Damage(damage);

            EffectReport report = new EffectReport()
            {
                type  = EffectReportType.DAMAGE,
                owner = owner,
                value = damage
            };

            owner.reports.Add(report);

            return(report);
        }
Beispiel #3
0
        public List <EffectReport> Update()
        {
            List <EffectReport> reports = new List <EffectReport> ();

            this.turnEnded        = false;
            this.currActionPoints = this.maxActionPoints;
            foreach (Skill skill in this.skills)
            {
                skill.Update();
            }

            foreach (Effect buff in this.buffs)
            {
                List <EffectReport> result = buff.Update();
                reports.AddRange(result);
            }
            foreach (Effect debuff in this.debuffs)
            {
                List <EffectReport> result = debuff.Update();
                reports.AddRange(result);
            }

            List <Effect> effectsToRemove = new List <Effect> ();

            foreach (Effect buff in this.buffs)
            {
                if (buff.IsEnded())
                {
                    EffectReport report = new EffectReport()
                    {
                        type  = EffectReportType.OTHER,
                        owner = this,
                        text  = "Бафф закончился: " + buff.name
                    };
                    reports.Add(report);
                    buff.End();
                    effectsToRemove.Add(buff);
                }
            }
            foreach (Effect effect in effectsToRemove)
            {
                this.buffs.Remove(effect);
            }
            effectsToRemove.Clear();
            foreach (Effect debuff in this.debuffs)
            {
                if (debuff.IsEnded())
                {
                    EffectReport report = new EffectReport()
                    {
                        type  = EffectReportType.OTHER,
                        owner = this,
                        text  = "Дебафф закончился: " + debuff.name
                    };
                    reports.Add(report);
                    debuff.End();
                    effectsToRemove.Add(debuff);
                }
            }
            foreach (Effect effect in effectsToRemove)
            {
                this.debuffs.Remove(effect);
            }
            effectsToRemove.Clear();

            return(reports);
        }