コード例 #1
0
        void DamageBuffTrigger(TriggerBuff buff, FightActor triggerrer, BuffTriggerType trigger, object token)
        {
            var triggerDmg = token as Fights.Damage;

            if (triggerDmg == null)
            {
                return;
            }

            if (triggerDmg.ReflectedDamages)
            {
                return;
            }

            var damage = new Fights.Damage(buff.Dice, GetEffectSchool(buff.Dice.EffectId), buff.Target, buff.Spell, buff.Target.Cell)
            {
                Buff              = buff,
                ReflectedDamages  = true,
                IsCritical        = Critical,
                MarkTrigger       = MarkTrigger,
                IgnoreDamageBoost = true
            };

            damage.GenerateDamages();
            damage.Amount = (int)((buff.Target.LifePoints * (buff.Dice.DiceNum / 100.0)));

            buff.Target.InflictDamage(damage);
        }
コード例 #2
0
 public override bool Apply()
 {
     foreach (FightActor current in base.GetAffectedActors())
     {
         if (this.Effect.Duration > 0)
         {
             base.AddTriggerBuff(current, true, BuffTriggerType.TURN_BEGIN, new TriggerBuffApplyHandler(DamagePercent.DamageBuffTrigger));
         }
         else
         {
             Fights.Damage damage = new Fights.Damage(base.Dice, DamagePercent.GetEffectSchool(base.Dice.EffectId), base.Caster, base.Spell);
             damage.GenerateDamages();
             damage.Amount            = (int)((double)current.MaxLifePoints * ((double)damage.Amount / 100.0));
             damage.IgnoreDamageBoost = true;
             damage.MarkTrigger       = base.MarkTrigger;
             SpellReflectionBuff bestReflectionBuff = current.GetBestReflectionBuff();
             if (bestReflectionBuff != null && bestReflectionBuff.ReflectedLevel >= (int)base.Spell.CurrentLevel && base.Spell.Template.Id != 0)
             {
                 this.NotifySpellReflected(current);
                 damage.Source           = current;
                 damage.ReflectedDamages = true;
                 base.Caster.InflictDamage(damage);
                 current.RemoveAndDispellBuff(bestReflectionBuff);
             }
             else
             {
                 current.InflictDamage(damage);
             }
         }
     }
     return(true);
 }
コード例 #3
0
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors())
            {
                var integerEffect = GenerateEffect();

                if (integerEffect == null)
                {
                    return(false);
                }

                if (Effect.Duration != 0 || Effect.Delay != 0)
                {
                    AddTriggerBuff(actor, BuffTriggerType.OnTurnBegin, OnBuffTriggered);
                }
                else
                {
                    var damages = new Fights.Damage(Dice, EffectSchoolEnum.Neutral, Caster, Spell, TargetedCell, EffectZone)
                    {
                        IsCritical            = Critical,
                        IgnoreDamageBoost     = true,
                        IgnoreDamageReduction = false
                    };

                    damages.GenerateDamages();
                    var inflictedDamages = actor.InflictDamage(damages);

                    var heal = (int)Math.Floor(inflictedDamages / 2d);
                    Caster.Heal(heal, actor, true);
                }
            }

            return(true);
        }
コード例 #4
0
ファイル: DirectDamage.cs プロジェクト: Mixi59/Stump
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors())
            {
                if (Effect.Duration != 0 || Effect.Delay != 0)
                {
                    if (BuffTriggerType == BuffTriggerType.Unknown)
                    {
                        AddTriggerBuff(actor, DamageBuffTrigger);
                    }
                    else
                    {
                        AddTriggerBuff(actor, BuffTriggerType, DamageBuffTrigger);
                    }
                }
                else
                {
                    // spell reflected
                    var buff = actor.GetBestReflectionBuff();
                    if (buff != null && buff.ReflectedLevel >= Spell.CurrentLevel &&
                        Spell.Template.Id != 0 && !Caster.IsIndirectSpellCast(Spell) && !Caster.IsPoisonSpellCast(Spell))
                    {
                        NotifySpellReflected(actor);
                        var damage = new Fights.Damage(Dice, GetEffectSchool(Dice.EffectId), Caster, Spell, Caster.Cell)
                        {
                            ReflectedDamages = true,
                            MarkTrigger      = MarkTrigger,
                            IsCritical       = Critical
                        };
                        damage.GenerateDamages();
                        damage.Amount = (short)(damage.Amount * Efficiency);

                        Caster.InflictDamage(damage);

                        if (buff.Duration <= 0)
                        {
                            actor.RemoveBuff(buff);
                        }
                    }
                    else
                    {
                        var damage = new Fights.Damage(Dice, GetEffectSchool(Dice.EffectId), Caster, Spell, TargetedCell, EffectZone)
                        {
                            MarkTrigger = MarkTrigger,
                            IsCritical  = Critical
                        };
                        damage.GenerateDamages();
                        damage.Amount = (short)(damage.Amount * Efficiency);

                        actor.InflictDamage(damage);
                    }
                }
            }

            return(true);
        }
コード例 #5
0
        static void OnBuffTriggered(TriggerBuff buff, FightActor triggerrer, BuffTriggerType trigger, object token)
        {
            var damages = new Fights.Damage(buff.Dice, EffectSchoolEnum.Unknown, buff.Caster, buff.Spell, buff.Target.Cell)
            {
                Buff       = buff,
                IsCritical = buff.Critical,
            };

            damages.GenerateDamages();
            buff.Target.InflictDirectDamage(damages.Amount);

            var heal = (int)Math.Floor(damages.Amount / 2d);

            buff.Caster.Heal(heal, buff.Target, true);
        }
コード例 #6
0
        private static void DamageBuffTrigger(TriggerBuff buff, BuffTriggerType trigger, object token)
        {
            EffectInteger left = buff.GenerateEffect();

            if (!(left == null))
            {
                Fights.Damage damage = new Fights.Damage(buff.Dice, DamagePercent.GetEffectSchool(buff.Dice.EffectId), buff.Caster, buff.Spell)
                {
                    Buff = buff
                };
                damage.GenerateDamages();
                damage.Amount            = (int)((double)buff.Target.MaxLifePoints * ((double)damage.Amount / 100.0));
                damage.IgnoreDamageBoost = true;
                buff.Target.InflictDamage(damage);
            }
        }
コード例 #7
0
ファイル: Heal.cs プロジェクト: Mixi59/Stump
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors())
            {
                var integerEffect = GenerateEffect();

                if (integerEffect == null)
                {
                    return(false);
                }

                if (Effect.Duration != 0 || Effect.Delay != 0)
                {
                    var triggerType = BuffTriggerType.Instant;

                    switch (Spell.Id)
                    {
                    case (int)SpellIdEnum.SPORE_TEILLE:
                        triggerType = BuffTriggerType.OnTackle;
                        break;
                    }

                    AddTriggerBuff(actor, triggerType, HealBuffTrigger);
                }
                else
                {
                    if (actor.IsAlive())
                    {
                        var damage = new Fights.Damage(Dice, EffectSchoolEnum.Healing, Caster, Spell, TargetedCell, EffectZone)
                        {
                            MarkTrigger = MarkTrigger,
                            IsCritical  = Critical
                        };
                        damage.GenerateDamages();
                        damage.Amount = (short)(damage.Amount * Efficiency);
                        actor.Heal(damage);
                    }
                }
            }

            return(true);
        }
コード例 #8
0
ファイル: DirectDamage.cs プロジェクト: Mixi59/Stump
        static void DamageBuffTrigger(TriggerBuff buff, FightActor triggerrer, BuffTriggerType trigger, object token)
        {
            var damages = token as Fights.Damage;

            if (damages != null && (damages.Spell == null || damages.ReflectedDamages))
            {
                return;
            }

            var damage = new Fights.Damage(buff.Dice, GetEffectSchool(buff.Dice.EffectId), buff.Caster, null, buff.Target.Cell)
            {
                IsCritical       = buff.Critical,
                ReflectedDamages = true
            };

            damage.GenerateDamages();
            damage.Amount = (short)(damage.Amount * buff.Efficiency);

            buff.Target.InflictDamage(damage);
        }
コード例 #9
0
 public override bool Apply()
 {
     foreach (FightActor current in base.GetAffectedActors())
     {
         Fights.Damage damage = new Fights.Damage(base.Dice);
         damage.MarkTrigger = base.MarkTrigger;
         damage.GenerateDamages();
         double num  = 0.0;
         double num2 = (double)base.Caster.LifePoints / (double)base.Caster.MaxLifePoints;
         if (num2 <= 0.5)
         {
             num = 2.0 * num2;
         }
         else
         {
             if (num2 > 0.5)
             {
                 num = 1.0 + (num2 - 0.5) * -2.0;
             }
         }
         damage.Amount = (int)((double)base.Caster.LifePoints * num * (double)damage.Amount / 100.0);
         SpellReflectionBuff bestReflectionBuff = current.GetBestReflectionBuff();
         if (bestReflectionBuff != null && bestReflectionBuff.ReflectedLevel >= (int)base.Spell.CurrentLevel && base.Spell.Template.Id != 0)
         {
             this.NotifySpellReflected(current);
             damage.Source            = current;
             damage.ReflectedDamages  = true;
             damage.IgnoreDamageBoost = true;
             base.Caster.InflictDamage(damage);
             current.RemoveAndDispellBuff(bestReflectionBuff);
         }
         else
         {
             current.InflictDamage(damage);
         }
     }
     return(true);
 }
コード例 #10
0
ファイル: PunishmentDamage.cs プロジェクト: Mixi59/Stump
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors().ToArray())
            {
                var damages = new Fights.Damage(Dice)
                {
                    MarkTrigger = MarkTrigger
                };
                damages.GenerateDamages();

                damages.Amount = (int)(Dice.DiceNum * Caster.Stats.Health.TotalMaxWithoutPermanentDamages * (Math.Pow(Math.Cos(2 * Math.PI * ((100 * Caster.LifePoints / Caster.MaxLifePoints) * 0.01 - 0.5)) + 1, 2) / 4) / 100);

                // spell reflected
                var buff = actor.GetBestReflectionBuff();
                if (buff != null && buff.ReflectedLevel >= Spell.CurrentLevel && Spell.Template.Id != 0)
                {
                    NotifySpellReflected(actor);
                    damages.Source            = Caster;
                    damages.ReflectedDamages  = true;
                    damages.IgnoreDamageBoost = true;
                    damages.IsCritical        = Critical;
                    Caster.InflictDamage(damages);

                    if (buff.Duration <= 0)
                    {
                        actor.RemoveBuff(buff);
                    }
                }
                else
                {
                    damages.Source            = Caster;
                    damages.IgnoreDamageBoost = true;
                    actor.InflictDamage(damages);
                }
            }

            return(true);
        }
コード例 #11
0
        protected override bool InternalApply()
        {
            foreach (var actor in GetAffectedActors().ToArray())
            {
                if (Effect.Duration != 0 || Effect.Delay != 0)
                {
                    AddTriggerBuff(actor, DamageBuffTrigger);
                }
                else
                {
                    var damage = new Fights.Damage(Dice, GetEffectSchool(Dice.EffectId), Caster, Spell, TargetedCell, EffectZone);
                    damage.GenerateDamages();
                    damage.Amount            = (int)Math.Floor((Caster.LifePoints * Dice.DiceNum) / 100d);
                    damage.IgnoreDamageBoost = true;
                    damage.MarkTrigger       = MarkTrigger;
                    damage.IsCritical        = Critical;

                    // spell reflected
                    var buff = actor.GetBestReflectionBuff();
                    if (buff != null && buff.ReflectedLevel >= Spell.CurrentLevel && Spell.Template.Id != 0)
                    {
                        NotifySpellReflected(actor);
                        damage.Source           = Caster;
                        damage.ReflectedDamages = true;
                        Caster.InflictDamage(damage);

                        actor.RemoveBuff(buff);
                    }
                    else
                    {
                        actor.InflictDamage(damage);
                    }
                }
            }

            return(true);
        }
コード例 #12
0
        void OnBuffTriggered(TriggerBuff buff, FightActor triggerrer, BuffTriggerType trigger, object token)
        {
            var usedAP = buff.Target.UsedAP;

            if (usedAP <= 0)
            {
                return;
            }

            var damages = new Fights.Damage(Dice)
            {
                Source      = buff.Caster,
                Buff        = buff,
                School      = GetEffectSchool(buff.Dice.EffectId),
                MarkTrigger = MarkTrigger,
                IsCritical  = Critical,
                Spell       = buff.Spell
            };

            damages.GenerateDamages();
            damages.Amount = usedAP * damages.BaseMaxDamages;

            buff.Target.InflictDamage(damages);
        }