Beispiel #1
0
        public static void EffectIncreaseSpellDamage(EffectCast cast)
        {
            if (cast.Duration == 0)
            {
                return;
            }

            cast.Target = cast.Caster;

            cast.Caster.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_ATTACK_POST_JET, BuffDecrementType.TYPE_ENDTURN);
        }
Beispiel #2
0
        public static void EffectTeleport(EffectCast cast)
        {
            if (!cast.Caster.Fight.Map.IsRushableCell(cast.CellID))
            {
                return;
            }

            cast.Caster.Cell = cast.CellID;

            cast.Caster.Fight.Send("GA0;4;" + cast.Caster.ID + ';' + cast.Caster.ID + ',' + cast.CellID);
        }
Beispiel #3
0
        public static void EffectDebuff(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            cast.Target.Buffs.Debuff();

            cast.Caster.Fight.Send("GA;132;" + cast.Caster.ID + ';' + cast.Target.ID);
        }
Beispiel #4
0
        public static void EffectTranspose(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            int casterCell = cast.Caster.Cell;

            EffectTeleport(new EffectCast(EffectEnum.Teleport, cast.SpellID, casterCell, -1, -1, -1, 0, 0, false, cast.Caster, null));
            EffectTeleport(new EffectCast(EffectEnum.Teleport, cast.SpellID, casterCell, -1, -1, -1, 0, 0, false, cast.Target, null));
        }
Beispiel #5
0
        public static void PushBackDamages(EffectCast cast, int length, int currentLength)
        {
            int    damageCoef = Utilities.Basic.Rand(8, 17);
            double levelCoef  = cast.Caster.Level / 50;

            if (levelCoef < 0.1)
            {
                levelCoef = 0.1;
            }

            int damages = (int)Math.Floor(damageCoef * levelCoef) * (length - currentLength + 1);

            EffectDamage(new EffectCast(EffectEnum.DamageNeutre, cast.SpellID, damages, -1, -1, 0, 0, 0, false, cast.Caster, null, cast.Target));
        }
Beispiel #6
0
        public static void EffectChanceEcaflip(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            if (cast.Duration == 0)
            {
                return;
            }

            cast.Target.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_ATTACKED_AFTER_JET, BuffDecrementType.TYPE_ENDTURN);
        }
Beispiel #7
0
        public static void EffectStealLife(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            EffectDamage(cast);

            cast.RandomJet /= 2;
            cast.Target     = cast.Caster;

            EffectHeal(cast);
        }
Beispiel #8
0
        public static void ApplyBuffChatiment(EffectCast cast, EffectCast actualCast)
        {
            int        statsValue = actualCast.Jet / 2;
            EffectEnum statsType  = (EffectEnum)cast.Value1 == EffectEnum.Heal ? EffectEnum.AddVitalite : (EffectEnum)cast.Value1;
            int        maxValue   = cast.Value2;
            int        duration   = cast.Value3;

            if (statsValue > maxValue)
            {
                statsValue = maxValue;
            }

            EffectProcessor.ApplyEffect(new EffectCast(statsType, cast.SpellID, 0, statsValue, -1, -1, 0, duration, false, cast.Caster, null, cast.Target));
        }
Beispiel #9
0
        public static void EffectSacrifice(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            if (cast.Duration == 0)
            {
                return;
            }

            cast.Target.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_ATTACKED_POST_JET, BuffDecrementType.TYPE_ENDTURN);
        }
Beispiel #10
0
        public static void RemoveBuffArmor(EffectCast cast, EffectCast actualCast)
        {
            Fighter target = cast.Target;

            switch (cast.SpellID)
            {
            case 1: target.Stats.ModifyStatBonus(EffectEnum.SubArmorFeu, cast.Jet); break;

            case 6: target.Stats.ModifyStatBonus(EffectEnum.SubArmorTerre, cast.Jet); break;

            case 14: target.Stats.ModifyStatBonus(EffectEnum.SubArmorAir, cast.Jet); break;

            case 18: target.Stats.ModifyStatBonus(EffectEnum.SubArmorEau, cast.Jet); break;

            default: target.Stats.ModifyStatBonus(EffectEnum.SubArmor, cast.Jet); break;
            }
        }
Beispiel #11
0
        public static void ApplyBuffMissBack(EffectCast cast, EffectCast actualCast)
        {
            if (!actualCast.AtCac)
            {
                return;
            }

            int chance = cast.Value1;
            int push   = cast.Value2;

            if (Utilities.Basic.Rand(0, 99) < chance)
            {
                EffectProcessor.ApplyEffect(new EffectCast(EffectEnum.PushBack, cast.SpellID, actualCast.CellID, push, -1, -1, 0, 0, false, actualCast.Caster, null, cast.Target));

                actualCast.Jet = 0;
            }
        }
Beispiel #12
0
        public static void ApplyBuffChanceEcaflip(EffectCast cast, EffectCast actualCast)
        {
            int coefDamages = cast.Value1;
            int coefHeal    = cast.Value2;
            int chance      = cast.Value3;

            if (Utilities.Basic.Rand(0, 99) < chance)
            {
                EffectProcessor.ApplyEffect(new EffectCast(EffectEnum.Heal, cast.SpellID, actualCast.Jet * coefHeal, -1, -1, 0, 0, 0, false, cast.Caster, null, cast.Target));

                actualCast.Jet = 0;
            }
            else
            {
                actualCast.Jet *= coefDamages;
            }
        }
Beispiel #13
0
        public static void ApplyBuff(EffectCast cast, EffectCast actualCast = null)
        {
            if (!RegisteredBuffs.ContainsKey(cast.Type))
            {
                return;
            }

            if (cast.Target == null)
            {
                return;
            }

            if (RegisteredBuffs[cast.Type][0] != null)
            {
                RegisteredBuffs[cast.Type][0](cast, actualCast);
            }
        }
Beispiel #14
0
        public static void RemoveBuff(EffectCast cast)
        {
            if (!RegisteredBuffs.ContainsKey(cast.Type))
            {
                return;
            }

            if (cast.Target == null)
            {
                return;
            }

            if (RegisteredBuffs[cast.Type][1] != null)
            {
                RegisteredBuffs[cast.Type][1](cast, null);
            }
        }
Beispiel #15
0
        public static void EffectPunition(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            cast.Jet = (int)((double)cast.RandomJet / 100 * Math.Pow(Math.Cos(2 * Math.PI * ((double)cast.Caster.Life / cast.Caster.Stats.GetStat(StatEnum.MaxLife).Total - 0.5)) + 1, 2) / 4 * cast.Caster.Stats.GetStat(StatEnum.MaxLife).Total);

            if (cast.Jet > cast.Target.Life)
            {
                cast.Jet = cast.Target.Life;
            }

            cast.Target.Life -= cast.Jet;

            cast.Caster.Fight.Send("GA;100;" + cast.Caster.ID + ';' + cast.Target.ID + ",-" + cast.Jet);
        }
Beispiel #16
0
        public static void EffectHeal(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            cast.Jet = cast.RandomJet;
            cast.Jet = cast.Target.CalculHeal(cast.Jet);

            if (cast.Target.Life + cast.Jet > cast.Target.Stats.GetStat(StatEnum.MaxLife).Total)
            {
                cast.Jet = cast.Target.Stats.GetStat(StatEnum.MaxLife).Total - cast.Target.Life;
            }

            cast.Target.Life += cast.Jet;

            cast.Caster.Fight.Send("GA;100;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + cast.Jet);
        }
Beispiel #17
0
        public static void EffectDamageLife(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            if (cast.Duration > 0)
            {
                cast.Target.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_ATTACKED_POST_JET, BuffDecrementType.TYPE_ENDTURN);
            }
            else
            {
                cast.Jet          = (int)((double)cast.RandomJet / 100 * cast.Target.Life);
                cast.Target.Life -= cast.Jet;

                cast.Caster.Fight.Send("GA;100;" + cast.Caster.ID + ';' + cast.Target.ID + ",-" + cast.Jet);
            }
        }
Beispiel #18
0
        public static void EffectArnaque(EffectCast cast)
        {
            if (cast.Target == null || cast.Caster.Character == null || cast.Target.Character == null)
            {
                return;
            }

            cast.Jet = cast.RandomJet;

            if (cast.Jet > cast.Target.Character.Kamas)
            {
                cast.Jet = (int)cast.Target.Character.Kamas;
            }

            cast.Caster.Character.Kamas += cast.Jet;
            cast.Target.Character.Kamas -= cast.Jet;

            cast.Caster.Fight.Send("GA;130;" + cast.Caster.ID + ';' + cast.Jet);
        }
Beispiel #19
0
        public static void EffectChangeSkin(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            if (cast.Duration == 0)
            {
                return;
            }

            if (cast.Value3 == -1)
            {
                return;
            }

            cast.Value2      = cast.Target.Skin;
            cast.Target.Skin = cast.Value3;

            cast.Target.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_STATS, BuffDecrementType.TYPE_ENDTURN);
            cast.Caster.Fight.Send("GA;149;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + cast.Value2 + ',' + cast.Value3 + ',' + cast.Duration);
        }
Beispiel #20
0
 public static void ApplyBuffChatimentDamage(EffectCast cast, EffectCast actualCast)
 {
     actualCast.Jet = (int)((1 + (double)cast.Value1 / 100) * actualCast.Jet);
 }
Beispiel #21
0
        public static void ApplyBuffSacrifice(EffectCast cast, EffectCast actualCast)
        {
            EffectProcessor.ApplyEffect(new EffectCast(EffectEnum.Transpose, cast.SpellID, -1, -1, -1, 0, 0, 0, false, cast.Caster, null, cast.Target));

            actualCast.Target = cast.Caster;
        }
Beispiel #22
0
 public static void ApplyBuffDamage(EffectCast cast, EffectCast actualCast)
 {
     EffectProcessor.ApplyEffect(cast);
 }
Beispiel #23
0
        public static void EffectStealStats(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            if (cast.Duration == 0)
            {
                return;
            }

            EffectEnum malusEffect = EffectEnum.None;
            EffectEnum bonusEffect = EffectEnum.None;

            switch (cast.Type)
            {
            case EffectEnum.VolSagesse:
                malusEffect = EffectEnum.SubSagesse;
                bonusEffect = EffectEnum.AddSagesse;
                break;

            case EffectEnum.VolForce:
                malusEffect = EffectEnum.SubForce;
                bonusEffect = EffectEnum.AddForce;
                break;

            case EffectEnum.VolIntell:
                malusEffect = EffectEnum.SubIntelligence;
                bonusEffect = EffectEnum.AddIntelligence;
                break;

            case EffectEnum.VolChance:
                malusEffect = EffectEnum.SubChance;
                bonusEffect = EffectEnum.AddChance;
                break;

            case EffectEnum.VolAgi:
                malusEffect = EffectEnum.SubAgilite;
                bonusEffect = EffectEnum.AddAgilite;
                break;

            case EffectEnum.VolPA:
                malusEffect = EffectEnum.SubPA;
                bonusEffect = EffectEnum.AddPA;
                break;

            case EffectEnum.VolPM:
                malusEffect = EffectEnum.SubPM;
                bonusEffect = EffectEnum.AddPM;
                break;

            case EffectEnum.VolPO:
                malusEffect = EffectEnum.SubPO;
                bonusEffect = EffectEnum.AddPO;
                break;
            }

            if (malusEffect == EffectEnum.None || bonusEffect == EffectEnum.None)
            {
                return;
            }

            cast.Type = malusEffect;

            EffectStats(cast);

            cast.Type   = bonusEffect;
            cast.Target = cast.Caster;

            EffectStats(cast);
        }
Beispiel #24
0
 public static void RemoveBuffStats(EffectCast cast, EffectCast actualCast)
 {
     cast.Target.Stats.ModifyStatBonus(cast.Type, cast.Jet, true);
 }
Beispiel #25
0
 public static void EffectTurnPass(EffectCast cast)
 {
     cast.Caster.Fight.TurnEnd();
 }
Beispiel #26
0
        public static void EffectPush(EffectCast cast)
        {
            int direction = -1;

            switch (cast.Type)
            {
            case EffectEnum.PushBack:
                if (Pathfinding.InLine(cast.Caster.Fight.Map, cast.CellID, cast.Target.Cell) && cast.CellID != cast.Target.Cell)
                {
                    direction = Pathfinding.GetDirection(cast.Caster.Fight.Map, cast.CellID, cast.Target.Cell);
                }
                else if (Pathfinding.InLine(cast.Caster.Fight.Map, cast.Caster.Cell, cast.Target.Cell))
                {
                    direction = Pathfinding.GetDirection(cast.Caster.Fight.Map, cast.Caster.Cell, cast.Target.Cell);
                }
                else
                {
                    return;
                }
                break;

            case EffectEnum.PushFront:
                if (Pathfinding.InLine(cast.Caster.Fight.Map, cast.Caster.Cell, cast.Target.Cell))
                {
                    direction = Pathfinding.GetDirection(cast.Caster.Fight.Map, cast.Target.Cell, cast.Caster.Cell);
                }
                else
                {
                    return;
                }
                break;

            case EffectEnum.PushFear:
                if (Pathfinding.InLine(cast.Caster.Fight.Map, cast.Caster.Cell, cast.CellID))
                {
                    direction   = Pathfinding.GetDirection(cast.Caster.Fight.Map, cast.Caster.Cell, cast.CellID);
                    cast.Target = cast.Caster.Fight.GetAliveFighter(Pathfinding.NextCell(cast.Caster.Fight.Map, cast.Caster.Cell, direction));
                }
                else
                {
                    return;
                }
                break;
            }

            if (cast.Target == null)
            {
                return;
            }

            int lastCell = cast.Target.Cell;
            int length   = cast.Type != EffectEnum.PushFear ? cast.RandomJet : Pathfinding.GetDistanceBetween(cast.Caster.Fight.Map, cast.Target.Cell, cast.CellID);

            for (int i = 0; i < length; i++)
            {
                int nextCell = Pathfinding.NextCell(cast.Caster.Fight.Map, lastCell, direction);

                if (cast.Caster.Fight.Map.IsRushableCell(nextCell))
                {
                    if (!cast.Caster.Fight.IsFreeCell(nextCell))
                    {
                        if (i > 0)
                        {
                            cast.Target.Cell = lastCell;
                            cast.Caster.Fight.Send("GA0;5;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + lastCell);
                        }

                        if (cast.Type == EffectEnum.PushBack)
                        {
                            PushBackDamages(cast, length, i);
                        }

                        return;
                    }
                }
                else
                {
                    if (i > 0)
                    {
                        cast.Target.Cell = lastCell;
                        cast.Caster.Fight.Send("GA0;5;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + lastCell);
                    }

                    if (cast.Type == EffectEnum.PushBack)
                    {
                        PushBackDamages(cast, length, i);
                    }

                    return;
                }

                lastCell = nextCell;
            }

            cast.Target.Cell = lastCell;
            cast.Caster.Fight.Send("GA0;5;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + lastCell);
        }
Beispiel #27
0
        public static void RemoveBuffChangeSkin(EffectCast cast, EffectCast actualCast)
        {
            cast.Target.Skin = cast.Value2;

            cast.Caster.Fight.Send("GA;149;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + cast.Value3 + ',' + cast.Value2);
        }
Beispiel #28
0
        public static void EffectDamage(EffectCast cast)
        {
            if (cast.Target == null)
            {
                return;
            }

            if (cast.Duration > 0)
            {
                cast.Target.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_ENDTURN, BuffDecrementType.TYPE_ENDTURN);
            }
            else
            {
                cast.Jet = 0;

                cast.Caster.Buffs.OnAttackPostJet(cast);
                cast.Target.Buffs.OnAttackedPostJet(cast);

                cast.Jet += cast.RandomJet;
                cast.Jet  = cast.Caster.CalculDamages(cast.Type, cast.Jet);
                cast.Jet  = cast.Target.CalculReduceDamages(cast.Type, cast.Jet);

                if (cast.Jet > 0)
                {
                    int armor = cast.Target.CalculArmor(cast.Type);

                    if (armor > 0)
                    {
                        cast.Jet -= armor;

                        cast.Caster.Fight.Send("GA;105;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + armor);
                    }
                }

                cast.Caster.Buffs.OnAttackAfterJet(cast);
                cast.Target.Buffs.OnAttackedAfterJet(cast);

                if (cast.Jet > 0)
                {
                    int reflectDamages = cast.Target.Stats.GetStat(StatEnum.ReflectDamage).Total;

                    if (reflectDamages > 0)
                    {
                        if (reflectDamages > cast.Jet)
                        {
                            reflectDamages = cast.Jet;
                        }

                        cast.Jet         -= reflectDamages;
                        cast.Caster.Life -= reflectDamages;

                        cast.Caster.Fight.Send("GA;107;" + cast.Target.ID + ';' + cast.Target.ID + ',' + reflectDamages);
                        cast.Caster.Fight.Send("GA;100;" + cast.Target.ID + ';' + cast.Caster.ID + ",-" + reflectDamages);
                    }
                }

                if (cast.Jet < 0)
                {
                    cast.Jet = 0;
                }

                if (cast.Jet > cast.Target.Life)
                {
                    cast.Jet = cast.Target.Life;
                }

                cast.Target.Life -= cast.Jet;

                if (cast.Target.Life == 0)
                {
                    cast.Caster.Fight.Send("GA;103;" + cast.Caster.ID + ";" + cast.Target.ID);
                }

                cast.Caster.Fight.Send("GA;100;" + cast.Caster.ID + ';' + cast.Target.ID + ",-" + cast.Jet);
            }
        }