public virtual List <EffectReport> Apply(float hitValue, float critValue, float dodgeValue, Character target)
        {
            List <EffectReport> reports = new List <EffectReport> ();

            parent.owner.currActionPoints -= parent.actionPoints;
            parent.turnsToActivate         = parent.cooldown;
            if (parent.maxUsages > 0)
            {
                parent.maxUsages--;
            }
            else
            {
                return(reports);
            }

            float heal = target.Heal(target.maxHealth * healPercent / 100f);

            EffectReport report = new EffectReport()
            {
                type  = EffectReportType.HEAL,
                owner = target,
                value = heal
            };

            target.reports.Add(report);
            reports.Add(report);

            return(reports);
        }
        public override List <EffectReport> Apply(float hitValue, float critValue, float dodgeValue, Character target)
        {
            List <EffectReport> parentReports = base.Apply(hitValue, critValue, dodgeValue, target);
            List <EffectReport> reports       = new List <EffectReport> ();

            reports.AddRange(parentReports);

            for (var i = 0; i < parentReports.Count; i++)
            {
                if (parentReports [i].isStopChild)
                {
                    return(reports);
                }
            }

            // check if effect is stackable. If not - find same effect and remove it
            if (!this.debuffTemplate.stackable)
            {
                foreach (Effect effect in target.debuffs)
                {
                    if (effect.name == this.debuffTemplate.name)
                    {
                        target.debuffs.Remove(effect);
                        break;
                    }
                }
            }

            // create debuff from template and init it
            Effect debuff = new Effect(target);

            debuff.name          = this.debuffTemplate.name;
            debuff.stackable     = this.debuffTemplate.stackable;
            debuff.allowAct      = this.debuffTemplate.allowAct;
            debuff.isDamage      = this.debuffTemplate.isDamage;
            debuff.damageMin     = this.Damage(this.debuffTemplate.damageMin, target);
            debuff.damageMax     = this.Damage(this.debuffTemplate.damageMax, target);
            debuff.ignoreDefence = this.debuffTemplate.ignoreDefence;
            debuff.permanent     = this.debuffTemplate.permanent;
            debuff.maxTurns      = this.debuffTemplate.maxTurns;
            debuff.isMagical     = this.debuffTemplate.isMagical;

            debuff.Init();

            target.debuffs.Add(debuff);

            EffectReport report = new EffectReport()
            {
                type        = EffectReportType.OTHER,
                owner       = target,
                text        = "Наложен дебафф " + debuff.name,
                isEffectAdd = true,
                effectName  = debuff.name
            };

            target.reports.Add(report);
            reports.Add(report);

            return(reports);
        }
        public virtual List <EffectReport> Apply(float hitValue, float critValue, float dodgeValue, Character target)
        {
            List <EffectReport> reports = new List <EffectReport> ();

            parent.owner.currActionPoints -= parent.actionPoints;
            parent.turnsToActivate         = parent.cooldown;
            if (parent.isMadMarksRequired)
            {
                parent.owner.madMarksCount -= parent.madMarksRequired;
            }

            if (!parent.IsHit(hitValue, target))
            {
                EffectReport report = new EffectReport()
                {
                    type        = EffectReportType.OTHER,
                    owner       = this.parent.owner,
                    isStopChild = true,
                    text        = "Промах",
                    isMiss      = true
                };
                this.parent.owner.reports.Add(report);
                reports.Add(report);

                return(reports);
            }
            if (parent.IsDodge(hitValue, target))
            {
                EffectReport report = new EffectReport()
                {
                    type        = EffectReportType.OTHER,
                    owner       = target,
                    isDodge     = true,
                    isStopChild = true,
                    text        = "Уклон"
                };
                target.reports.Add(report);
                reports.Add(report);

                return(reports);
            }

            if (!parent.isMadMarksRequired)
            {
                parent.owner.madMarksCount++;
            }

            return(reports);
        }
        public List <EffectReport> Apply(float hitValue, float critValue, float dodgeValue, Character target)
        {
            target.turnEnded = true;

            EffectReport report = new EffectReport()
            {
                type  = EffectReportType.OTHER,
                owner = target,
                text  = "Пропуск хода"
            };
            List <EffectReport> reports = new List <EffectReport> ();

            reports.Add(report);

            return(reports);
        }
Beispiel #5
0
        void GenerateSyncReport(Report report)
        {
            report.Frame        = orderManager.NetFrameNumber;
            report.SyncedRandom = orderManager.world.SharedRandom.Last;
            report.TotalCount   = orderManager.world.SharedRandom.TotalCount;
            report.Traits.Clear();
            foreach (var a in orderManager.world.ActorsWithTrait <ISync>())
            {
                var sync = Sync.CalculateSyncHash(a.Trait);
                if (sync != 0)
                {
                    var tr = new TraitReport()
                    {
                        ActorID = a.Actor.ActorID,
                        Type    = a.Actor.Info.Name,
                        Owner   = (a.Actor.Owner == null) ? "null" : a.Actor.Owner.PlayerName,
                        Trait   = a.Trait.GetType().Name,
                        Hash    = sync
                    };

                    tr.Fields = DumpSyncTrait(a.Trait);
                    report.Traits.Add(tr);
                }
            }

            foreach (var e in orderManager.world.Effects)
            {
                var sync = e as ISync;
                if (sync != null)
                {
                    var hash = Sync.CalculateSyncHash(sync);
                    if (hash != 0)
                    {
                        var er = new EffectReport()
                        {
                            Name = sync.ToString().Split('.').Last(),
                            Hash = hash
                        };

                        er.Fields = DumpSyncTrait(sync);
                        report.Effects.Add(er);
                    }
                }
            }
        }
        public override List <EffectReport> Apply(float hitValue, float critValue, float dodgeValue, Character target)
        {
            List <EffectReport> parentReports = base.Apply(hitValue, critValue, dodgeValue, target);
            List <EffectReport> reports       = new List <EffectReport> ();

            reports.AddRange(parentReports);
            if (reports.Count > 0)
            {
                return(reports);
            }

            float damage = 0f;
            bool  isCrit = parent.IsCrit(critValue, target);

            damage = 1f * Random.Range((int)(this.DamageMin(target) * 100), (int)(this.DamageMax(target) * 100) + 1) / 100f;
            if (isCrit)
            {
                damage = damage * 2.0f;
            }
            damage = target.Damage(damage);

            if (isCrit)
            {
                EffectReport critReport = new EffectReport()
                {
                    type  = EffectReportType.OTHER,
                    owner = target,
                    text  = "Критический урон"
                };
                reports.Add(critReport);
            }

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

            target.reports.Add(report);
            reports.Add(report);

            return(reports);
        }
        public override List <EffectReport> Apply(float hitValue, float critValue, float dodgeValue, Character target)
        {
            List <EffectReport> parentReports = base.Apply(hitValue, critValue, dodgeValue, target);
            List <EffectReport> reports       = new List <EffectReport> ();

            reports.AddRange(parentReports);

            if (requireDeathToHeal && !target.IsDead())
            {
                return(reports);
            }
            for (var i = 0; i < parentReports.Count; i++)
            {
                if (parentReports [i].isStopChild)
                {
                    return(reports);
                }
            }

            float damage = 0f;

            for (var i = 0; i < parentReports.Count; i++)
            {
                if (parentReports [i].type == EffectReportType.DAMAGE)
                {
                    damage += parentReports [i].value;
                }
            }

            float heal = this.parent.owner.Heal(damage * this.heal / 100f);

            if (heal > 0f)
            {
                EffectReport report = new EffectReport()
                {
                    type  = EffectReportType.HEAL,
                    owner = this.parent.owner,
                    value = heal
                };
                this.parent.owner.reports.Add(report);
                reports.Add(report);
            }

            return(reports);
        }
Beispiel #8
0
    private void drawReports(List <EffectReport> reports)
    {
        for (int i = 0; i < reports.Count; i++)
        {
            EffectReport report = reports[i];
            string       text   = report.owner.name + ": ";
            if (report.type == EffectReportType.DAMAGE)
            {
                text += "урон ";
            }
            else if (report.type == EffectReportType.HEAL)
            {
                text += "лечение ";
            }
            text += (report.value > 0f) ? report.value.ToString("F2") : report.text;

            this.battleLog.text = text + "\n" + this.battleLog.text;;
        }
    }
Beispiel #9
0
        void GenerateSyncReport(Report report)
        {
            report.Frame = orderManager.NetFrameNumber;
            report.SyncedRandom = orderManager.world.SharedRandom.Last;
            report.TotalCount = orderManager.world.SharedRandom.TotalCount;
            report.Traits.Clear();
            foreach (var a in orderManager.world.ActorsWithTrait<ISync>())
            {
                var sync = Sync.CalculateSyncHash(a.Trait);
                if (sync != 0)
                {
                    var tr = new TraitReport()
                    {
                        ActorID = a.Actor.ActorID,
                        Type = a.Actor.Info.Name,
                        Owner = (a.Actor.Owner == null) ? "null" : a.Actor.Owner.PlayerName,
                        Trait = a.Trait.GetType().Name,
                        Hash = sync
                    };

                    tr.Fields = DumpSyncTrait(a.Trait);
                    report.Traits.Add(tr);
                }
            }

            foreach (var e in orderManager.world.Effects)
            {
                var sync = e as ISync;
                if (sync != null)
                {
                    var hash = Sync.CalculateSyncHash(sync);
                    if (hash != 0)
                    {
                        var er = new EffectReport()
                        {
                            Name = sync.ToString().Split('.').Last(),
                            Hash = hash
                        };

                        er.Fields = DumpSyncTrait(sync);
                        report.Effects.Add(er);
                    }
                }
            }
        }
Beispiel #10
0
        public virtual List <EffectReport> Apply(float hitValue, float critValue, float dodgeValue, Character target)
        {
            List <EffectReport> reports = new List <EffectReport> ();

            parent.owner.currActionPoints -= parent.actionPoints;
            parent.turnsToActivate         = parent.cooldown;
            if (parent.maxUsages > 0)
            {
                parent.maxUsages--;
            }
            else
            {
                return(reports);
            }

            EffectReport report;

            // check if target has overdose debuff
            foreach (Effect debuff in target.debuffs)
            {
                if (debuff.isOverdose)
                {
                    // kill target
                    float damage = target.Damage(target.maxHealth);
                    report = new EffectReport()
                    {
                        type  = EffectReportType.DAMAGE,
                        owner = target,
                        value = damage
                    };

                    return(reports);
                }
            }

            // check if target already used drugs and using another drug
            if (target.drugUsed.Count > 0 && !target.drugUsed.Contains(this.drugName))
            {
                // create overdose debuff
                Effect overdoseEffect = new Effect(target)
                {
                    permanent  = true,
                    stackable  = false,
                    isOverdose = true,
                    name       = "Передоз"
                };
                target.debuffs.Add(overdoseEffect);

                // create stun effect
                Effect stunEffect = new Effect(target)
                {
                    permanent = false,
                    maxTurns  = 2,
                    allowAct  = false,
                    stackable = false,
                    name      = "Оглушение"
                };
                target.debuffs.Add(stunEffect);

                report = new EffectReport()
                {
                    type        = EffectReportType.OTHER,
                    owner       = target,
                    effectName  = "Передоз",
                    text        = "Передоз",
                    isEffectAdd = true
                };
                target.reports.Add(report);
                reports.Add(report);
                return(reports);
            }

            target.drugUsed.Add(drugName);

            // remove drug effect if exists
            foreach (Effect effect in target.buffs)
            {
                if (effect.name == this.drugName)
                {
                    effect.RemoveModifiers();
                    target.buffs.Remove(effect);
                    break;
                }
            }

            Effect drugEffect = new Effect(target)
            {
                maxTurns    = this.maxTurns,
                permanent   = false,
                stackable   = false,
                useModifier = true,
                name        = this.drugName
            };

            drugEffect.modifierType.AddRange(this.modifierType);
            drugEffect.modifierValue.AddRange(this.modifierValue);
            drugEffect.isMultiplier.AddRange(this.isMultiplier);

            drugEffect.Init();

            target.buffs.Add(drugEffect);

            report = new EffectReport()
            {
                type        = EffectReportType.OTHER,
                owner       = target,
                text        = "Использован наркотик " + this.drugName,
                isEffectAdd = true,
                effectName  = this.drugName
            };
            target.reports.Add(report);
            reports.Add(report);

            return(reports);
        }