Exemplo n.º 1
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                Target.Buffs.AddBuff(new BuffChatiment(CastInfos, Target));
            }

            return(-1);
        }
Exemplo n.º 2
0
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            // On change le skin
            this.CastInfos.Value2 = this.Target.Skin;
            this.Target.Skin      = this.CastInfos.Value3 == -1 ? this.Target.Skin : this.CastInfos.Value3;

            this.Target.Fight.SendToFight(new GameActionMessage((int)EffectEnum.ChangeSkin, this.Caster.ActorId, this.Target.ActorId + "," + this.CastInfos.Value2 + "," + this.Target.Skin + "," + this.Duration));

            return(base.ApplyEffect(ref DamageValue, DamageInfos));
        }
Exemplo n.º 3
0
 public override int ApplyEffect(EffectCast CastInfos)
 {
     foreach (var Target in CastInfos.Targets)
     {
         if (Target.States.HasState(FighterStateEnum.STATE_INVISIBLE))
         {
             Target.States.RemoveState(FighterStateEnum.STATE_INVISIBLE);
         }
     }
     return(-1);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Subit des dommages, activation des buffs de reduction, renvois, anihilation des dommages apres le calcul du jet
 /// </summary>
 /// <param name="CastInfos"></param>
 /// <param name="DamageValue"></param>
 public int OnAttackedAfterJet(EffectCast CastInfos, ref int DamageValue)
 {
     foreach (var Buff in BuffsAct[BuffActiveType.ACTIVE_ATTACKED_AFTER_JET])
     {
         if (Buff.ApplyEffect(ref DamageValue, CastInfos) == -3)
         {
             return(-3);
         }
     }
     return(-1);
 }
Exemplo n.º 5
0
 public EffectInfos(EffectCast cast)
 {
     this.Spell      = null;
     this.EffectType = cast.EffectType;
     this.Value1     = cast.Value1;
     this.Value2     = cast.Value2;
     this.Value3     = cast.Value3;
     this.Duration   = cast.Duration;
     this.Chance     = cast.Chance;
     this.RangeType  = "Pa";
 }
Exemplo n.º 6
0
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            if (EffectHeal.ApplyHeal(CastInfos, Target, CastInfos.GenerateJet(Target)) == -3)
            {
                return(-3);
            }
            return(-1);
            //var Damage = this.CastInfos.RandomJet;

            //return EffectDamage.ApplyDamages(this.CastInfos, this.Target, ref Damage);
        }
Exemplo n.º 7
0
        protected override void onTouchAtBeginTurn(Fighter target)
        {
            this.Triggered(target);
            if (Duration == -1)
            {
                Dispose();
            }
            CastSpell.Initialize();
            var            Effects    = CastSpell.Effects;
            List <Fighter> listTarget = new List <Fighter>()
            {
                target
            };
            var Targets = new Dictionary <EffectInfos, List <Fighter> >();

            Effects.ForEach(x => Targets.Add(x, listTarget));

            var ActualChance = 0;

            foreach (var Effect in Effects)
            {
                if (Effect.Chance > 0)
                {
                    if (Fight.RANDOM.Next(1, 100) > (Effect.Chance + ActualChance))
                    {
                        ActualChance += Effect.Chance;
                        continue;
                    }
                    ActualChance -= 100;
                }

                // Actualisation des morts
                if (Targets[Effect][0].Dead)
                {
                    continue;
                }

                /* if (this.fight is MonsterFight && Caster is CharacterFighter)
                 *   this.fight.Challanges.ForEach(x => x.CheckSpell(Caster, Effect, new List<Fighter> { target }, target.CellId));*/

                List <Fighter> item = new List <Fighter>();
                item.Add(Targets[Effect][0]);
                var CastInfos = new EffectCast(Effect.EffectType, CastSpell.SpellCache.ID, CellId, Effect.Value1, Effect.Value2, Effect.Value3, Effect.Chance, Effect.Duration, Caster, Targets[Effect], false, EffectEnum.None, 0, Effect.Spell);
                if (EffectBase.TryApplyEffect(CastInfos) == -3)
                {
                    break;
                }
            }
            if (!this.Fight.TryEndFight())
            {
                this.Fight.onApplyGroundLayer(this, Caster, CastSpell, target.CellId, target, Targets);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="DamageValue"></param>
        /// <param name="DamageInfos"></param>
        /// <returns></returns>
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            // Si effet finis
            if (!this.Target.States.HasState(FighterStateEnum.STATE_PORTE))
            {
                this.Duration = 0;
                return(-1);
            }

            // On affecte la meme cell pour la cible porté
            return(this.Target.SetCell(this.Caster.Cell));
        }
Exemplo n.º 9
0
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            //var Damage = this.CastInfos.RandomJet;

            // return EffectDamage.ApplyDamages(this.CastInfos, this.Target, ref Damage);

            int effectBase   = CastInfos.GenerateJet(Target);
            var DamageValuea = (Target.CurrentLife / 100) * effectBase;

            //DamageValuea = (-DamageValuea);
            return(EffectDamage.ApplyDamages(this.CastInfos, this.Target, ref DamageValuea));
        }
Exemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="DamageValue"></param>
        /// <param name="DamageInfos"></param>
        /// <returns></returns>
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            if (this.Caster.CellId != this.Target.CellId)
            {
                this.Caster.States.RemoveState(FighterStateEnum.STATE_PORTEUR);
                this.Target.States.RemoveState(FighterStateEnum.STATE_PORTE);

                this.Duration = 0;
            }

            return(-1);
        }
Exemplo n.º 11
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            if (CastInfos.Duration > 0)
            {
                foreach (var Target in CastInfos.Targets)
                {
                    Target.Buffs.AddBuff(new BuffReflectSpell(CastInfos, Target));
                }
            }

            return(-1);
        }
Exemplo n.º 12
0
        private bool IsDebuffable(EffectCast cast)
        {
            switch (cast.Type)
            {
            case EffectEnum.AddPA:
            case EffectEnum.AddPABis:
            case EffectEnum.AddPM:
            case EffectEnum.SubPA:
            case EffectEnum.SubPAEsquive:
                return(false);
            }

            return(true);
        }
Exemplo n.º 13
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                if (Target.Team != CastInfos.Caster.Team || Target == CastInfos.Caster)
                {
                    continue;
                }

                Target.Buffs.AddBuff(new BuffSacrifice(CastInfos, Target));
            }

            return(-1);
        }
Exemplo n.º 14
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                if (Target.Buffs.Debuff() == -3)
                {
                    return(-3);
                }

                Target.Fight.SendToFight(new GameActionMessage((int)EffectEnum.DeleteAllBonus, Target.ActorId, Target.ActorId.ToString()));
            }

            return(-1);
        }
Exemplo n.º 15
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            if (CastInfos.Duration > 0)
            {
                foreach (var Target in CastInfos.Targets)
                {
                    Target.States.RemoveState(FighterStateEnum.STATE_MINIMIZE_EFFECTS);
                    Target.States.RemoveState(FighterStateEnum.STATE_MAXIMIZE_EFFECTS);
                    Target.Buffs.AddBuff(new BuffState(CastInfos, Target));
                }
            }

            return(-1);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Application de l'effet
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override int ApplyEffect(EffectCast CastInfos)
        {
            var Caster = CastInfos.Caster;
            var Cell   = Caster.Fight.GetCell(CastInfos.CellId);

            if (Cell != null)
            {
                Caster.Fight.SendToFight(new GameActionMessage((int)GameActionTypeEnum.MAP_TELEPORT, Caster.ActorId, Caster.ActorId + "," + CastInfos.CellId));

                return(Caster.SetCell(Cell));
            }

            return(-1);
        }
Exemplo n.º 17
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                switch (CastInfos.SpellId)
                {
                case 1:
                    if (Target.Team != CastInfos.Caster.Team)
                    {
                        continue;
                    }
                    Target.Stats.AddBoost(EffectEnum.AddArmorFeu, CastInfos.Value1);
                    break;

                case 6:
                    if (Target.Team != CastInfos.Caster.Team)
                    {
                        continue;
                    }
                    Target.Stats.AddBoost(EffectEnum.AddArmorTerre, CastInfos.Value1);
                    break;

                case 14:
                    if (Target.Team != CastInfos.Caster.Team)
                    {
                        continue;
                    }
                    Target.Stats.AddBoost(EffectEnum.AddArmorAir, CastInfos.Value1);
                    break;

                case 18:
                    if (Target.Team != CastInfos.Caster.Team)
                    {
                        continue;
                    }
                    Target.Stats.AddBoost(EffectEnum.AddArmorEau, CastInfos.Value1);
                    break;

                default:
                    Target.Stats.AddBoost(EffectEnum.AddArmor, CastInfos.Value1);
                    break;
                }

                // Ajout du buff
                Target.Buffs.AddBuff(new BuffArmor(CastInfos, Target));
            }

            return(-1);
        }
Exemplo n.º 18
0
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            if (!DamageInfos.IsCAC)
            {
                return(-1);
            }

            DamageValue = 0; // Annihilation des dommages;

            var SubInfos  = new EffectCast(EffectEnum.PushBack, 0, 0, 0, 0, 0, 0, 0, DamageInfos.Caster, null);
            var Direction = Pathfinder.GetDirection(Target.Fight.Map, DamageInfos.Caster.CellId, Target.CellId);

            // Application du push
            return(EffectPush.ApplyPush(SubInfos, this.Target, Direction, 1, true));
        }
Exemplo n.º 19
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            if (!CastInfos.Caster.Fight.GetCell(CastInfos.CellId).IsWalkable())
            {
                return(-1);
            }
            int    spellID  = CastInfos.Value1;
            int    level    = CastInfos.Value2;
            short  duration = (short)CastInfos.Value3;
            String po       = CastInfos.SpellLevel.Range;
            var    spell    = SpellTable.Cache[spellID].GetLevel(level);

            spell.Initialize();
            new FightBlypheLayer(CastInfos.Caster, spell, CastInfos.Caster.Fight.GetCell(CastInfos.CellId), CastInfos.SpellId, duration, po);
            return(-1);
        }
Exemplo n.º 20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                if (Target.ObjectType == FightObjectType.OBJECT_STATIC)
                {
                    continue;
                }
                var PorteurInfos = new EffectCast(CastInfos.EffectType, CastInfos.SpellId, 0, 0, 0, (int)FighterStateEnum.STATE_PORTEUR, 0, 0, CastInfos.Caster, null);
                var PorterInfos  = new EffectCast(CastInfos.EffectType, CastInfos.SpellId, 0, 0, 0, (int)FighterStateEnum.STATE_PORTE, 0, 0, CastInfos.Caster, null);

                CastInfos.Caster.Buffs.AddBuff(new BuffPorteur(PorteurInfos, Target));
                Target.Buffs.AddBuff(new BuffPorter(PorterInfos, Target));
            }

            return(-1);
        }
Exemplo n.º 21
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                var SubInfos    = new EffectCast(CastInfos.EffectType, CastInfos.SpellId, CastInfos.CellId, CastInfos.GenerateJet(Target), CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Targets);
                var BuffStats   = new BuffStats(SubInfos, Target);
                var DamageValue = 0;
                if (BuffStats.ApplyEffect(ref DamageValue) == -3)
                {
                    return(-3);
                }

                Target.Buffs.AddBuff(BuffStats);
            }

            return(-1);
        }
Exemplo n.º 22
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            // Si > 0 alors c'est un buff
            if (CastInfos.Duration > 0)
            {
                // L'effet est un poison
                CastInfos.IsPoison = true;

                // Ajout du buff
                foreach (var Target in CastInfos.Targets)
                {
                    Target.Buffs.AddBuff(new BuffDamageDropLife(CastInfos, Target));
                }
            }
            else // Dommage direct
            {
                int effectBase  = CastInfos.GenerateJet(CastInfos.Caster);
                var DamageValue = (CastInfos.Caster.CurrentLife / 100) * effectBase;
                if (EffectDamage.ApplyDamages(CastInfos, CastInfos.Caster, ref DamageValue) == -3)
                {
                    foreach (var Target in CastInfos.Targets)
                    {
                        if (EffectHeal.ApplyHeal(CastInfos, Target, DamageValue) == -3)
                        {
                            return(-3);
                        }
                    }
                    return(-3);
                }
                else
                {
                    foreach (var Target in CastInfos.Targets)
                    {
                        if (EffectHeal.ApplyHeal(CastInfos, Target, DamageValue) == -3)
                        {
                            return(-3);
                        }
                    }
                }
                //DamageValue = (-DamageValue);
            }

            return(-1);
        }
Exemplo n.º 23
0
        public int BeginTurn()
        {
            int result = this.Buffs.BeginTurn();

            if (firstTurn && Grade.Monster.StaticFighterBeginEffects != null)
            {
                try
                {
                    var ActualChance = 0;
                    foreach (var Effect in Grade.Monster.StaticFighterBeginEffects)
                    {
                        if (Effect.Chance > 0)
                        {
                            if (Fight.RANDOM.Next(1, 100) > (Effect.Chance + ActualChance))
                            {
                                ActualChance += Effect.Chance;
                                continue;
                            }
                            ActualChance -= 100;
                        }
                        List <Fighter> target = new List <Fighter>()
                        {
                            this
                        };
                        var CastInfos = new EffectCast(Effect.EffectType, -1, CellId, Effect.Value1, Effect.Value2, Effect.Value3, Effect.Chance, Effect.Duration, this, target, false, EffectEnum.None, 0, Effect.Spell);

                        if (EffectBase.TryApplyEffect(CastInfos) == -3)
                        {
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                }
                finally
                {
                    firstTurn = false;
                }
            }

            return(result);
        }
Exemplo n.º 24
0
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            var BuffValue = DamageValue / 2; // Divise par deux les stats a boost car c'est un personnage.
            var StatsType = (EffectEnum)this.CastInfos.Value1 == EffectEnum.Heal ? EffectEnum.AddVitalite : (EffectEnum)this.CastInfos.Value1;
            var MaxValue  = this.CastInfos.Value2;
            var Duration  = this.CastInfos.Value3;

            if (this.Target.Fight.CurrentFighter.ActorId == this.CastInfos.FakeValue)
            {
                if (this.CastInfos.DamageValue < MaxValue)
                {
                    if (this.CastInfos.DamageValue + BuffValue > MaxValue)
                    {
                        BuffValue = MaxValue - this.CastInfos.DamageValue;
                    }
                }
                else
                {
                    BuffValue = 0;
                }
            }
            else
            {
                this.CastInfos.DamageValue = 0;
                this.CastInfos.FakeValue   = (int)this.Target.Fight.CurrentFighter.ActorId;

                if (this.CastInfos.DamageValue + BuffValue > MaxValue)
                {
                    BuffValue = MaxValue;
                }
            }

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

                var BuffStats = new BuffStats(new EffectCast(StatsType, this.CastInfos.SpellId, this.CastInfos.SpellId, BuffValue, 0, 0, 0, Duration, this.CastInfos.Caster, null), this.Target);
                BuffStats.ApplyEffect(ref BuffValue);
                this.Target.Buffs.AddBuff(BuffStats);
            }

            return(base.ApplyEffect(ref DamageValue, DamageInfos));
        }
Exemplo n.º 25
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                if (Target.ObjectType == FightObjectType.OBJECT_STATIC)
                {
                    continue;
                }
                if (CastInfos.SpellId == 445)
                {
                    if (Target.Team == CastInfos.Caster.Team)
                    {
                        continue;
                    }
                }
                else if (CastInfos.SpellId == 438)
                {
                    if (Target.Team != CastInfos.Caster.Team)
                    {
                        continue;
                    }
                }

                var TargetTeleport = new EffectCast(EffectEnum.Teleport, CastInfos.SpellId, CastInfos.Caster.CellId, 0, 0, 0, 0, 0, Target, null);
                var CasterTeleport = new EffectCast(EffectEnum.Teleport, CastInfos.SpellId, Target.CellId, 0, 0, 0, 0, 0, CastInfos.Caster, null);

                CastInfos.Caster.SetCell(null);
                Target.SetCell(null);

                if (BuffSacrifice.Teleport.ApplyEffect(TargetTeleport) == -3)
                {
                    return(-3);
                }

                if (BuffSacrifice.Teleport.ApplyEffect(CasterTeleport) == -3)
                {
                    return(-3);
                }
            }

            return(-1);
        }
Exemplo n.º 26
0
        public override int ApplyEffect(ref int DamageValue, EffectCast DamageInfos = null)
        {
            var LostAP = CastInfos.Value1 > Target.AP ? Target.AP : CastInfos.Value1;

            CastInfos.Value1 = Target.CalculDodgeAPMP(CastInfos.Caster, LostAP);

            if (CastInfos.Value1 != LostAP)
            {
                Target.Fight.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_DODGE_SUBPA, Target.ActorId, Target.ActorId + "," + (LostAP - CastInfos.Value1)));
            }

            if (CastInfos.Value1 > 0)
            {
                var BuffStats = new BuffStats(new EffectCast(this.CastInfos.EffectType, this.CastInfos.SpellId, this.CastInfos.SpellId, CastInfos.Value1, 0, 0, 0, Duration, this.CastInfos.Caster, null), this.Target);
                BuffStats.ApplyEffect(ref LostAP);
                this.Target.Buffs.AddBuff(BuffStats);
            }

            return(base.ApplyEffect(ref DamageValue, DamageInfos));
        }
Exemplo n.º 27
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                if (Target.ObjectType == FightObjectType.OBJECT_STATIC)
                {
                    continue;
                }

                int Direction = 0;

                switch (CastInfos.EffectType)
                {
                case EffectEnum.PushBack:
                    if (Pathfinder.InLine(Target.Fight.Map, CastInfos.CellId, Target.CellId) && CastInfos.CellId != Target.CellId)
                    {
                        Direction = Pathfinder.GetDirection(Target.Fight.Map, CastInfos.CellId, Target.CellId);
                    }
                    else if (Pathfinder.InLine(Target.Fight.Map, CastInfos.Caster.CellId, Target.CellId))
                    {
                        Direction = Pathfinder.GetDirection(Target.Fight.Map, CastInfos.Caster.CellId, Target.CellId);
                    }
                    else
                    {
                        continue;
                    }
                    break;

                case EffectEnum.PushFront:
                    Direction = Pathfinder.GetDirection(Target.Fight.Map, Target.CellId, CastInfos.Caster.CellId);
                    break;
                }

                if (EffectPush.ApplyPush(CastInfos, Target, Direction, CastInfos.Value1) == -3)
                {
                    return(-3);
                }
            }

            return(-1);
        }
Exemplo n.º 28
0
        public override int ApplyEffect(EffectCast CastInfos)
        {
            foreach (var Target in CastInfos.Targets)
            {
                var DamageJet = CastInfos.GenerateJet(Target);

                if (EffectDamage.ApplyDamages(CastInfos, Target, ref DamageJet) == -3)
                {
                    return(-3);
                }

                var HealJet = DamageJet / 2;

                if (EffectHeal.ApplyHeal(CastInfos, CastInfos.Caster, HealJet) == -3)
                {
                    return(-3);
                }
            }

            return(-1);
        }
Exemplo n.º 29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <returns></returns>
        public override int ApplyEffect(EffectCast CastInfos)
        {
            var Infos = CastInfos.Caster.States.FindState(FighterStateEnum.STATE_PORTEUR);

            if (Infos != null)
            {
                var Target = Infos.Target;

                if (Target.States.HasState(FighterStateEnum.STATE_PORTE))
                {
                    var SleepTime = 1 + (200 * Pathfinder.GoalDistance(Target.Fight.Map, Target.CellId, CastInfos.CellId));

                    Target.Fight.SendToFight(new GameActionMessage((int)EffectEnum.Lancer, CastInfos.Caster.ActorId, CastInfos.CellId.ToString()));

                    System.Threading.Thread.Sleep(SleepTime);

                    return(Target.SetCell(Target.Fight.GetCell(CastInfos.CellId)));
                }
            }

            return(-1);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Application du heal
        /// </summary>
        /// <param name="CastInfos"></param>
        /// <param name="Heal"></param>
        /// <returns></returns>
        public static int ApplyHeal(EffectCast CastInfos, Fighter Target, int Heal)
        {
            var Caster = CastInfos.Caster;

            // Boost soin etc
            Caster.CalculHeal(ref Heal);

            // Si le soin est superieur a sa vie actuelle
            if (Target.Life + Heal > Target.MaxLife)
            {
                Heal = Target.MaxLife - Target.Life;
            }

            // Affectation
            Target.Life += Heal;

            // Envoi du Packet
            Target.Fight.SendToFight(new GameActionMessage((int)GameActionTypeEnum.FIGHT_HEAL, Caster.ActorId, Target.ActorId + "," + Heal));

            // Le soin entraine la fin du combat ?
            return(Target.TryDie(Caster.ActorId));
        }