예제 #1
0
        public void AddBuff(EffectCast buff, BuffActiveType active, BuffDecrementType decrement)
        {
            buff = buff.CopyToBuff();

            if (buff.Target == buff.Target.Fight.CurrentFighter)
                buff.Duration += 1;

            myBuffActives[active].Add(buff);
            myBuffDecrements[decrement].Add(buff);

            switch (buff.Type)
            {
                case EffectEnum.ChanceEcaflip:
                    buff.Target.Fight.Send("GIE" + (int)buff.Type + ';' + buff.Target.ID + ';' + buff.Value1 + ';' + buff.Value2 + ';' + buff.Value3 + ';' + buff.Chance + ';' + buff.Duration + ';' + buff.SpellID);
                    break;

                default:
                    buff.Target.Fight.Send("GIE" + (int)buff.Type + ';' + buff.Target.ID + ';' + buff.Value1 + ';' + (buff.Value2 == -1 ? "" : buff.Value2.ToString()) + ";;" + buff.Chance + ';' + buff.Duration + ';' + buff.SpellID);
                    break;
            }
        }
예제 #2
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);
        }
예제 #3
0
 public static void RemoveBuffStats(EffectCast cast, EffectCast actualCast)
 {
     cast.Target.Stats.ModifyStatBonus(cast.Type, cast.Jet, true);
 }
예제 #4
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;
            }
        }
예제 #5
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;
        }
예제 #6
0
 public static void ApplyBuffIncreaseSpellDamage(EffectCast cast, EffectCast actualCast)
 {
     if (cast.SpellID == actualCast.SpellID)
         actualCast.Jet += cast.Value3;
 }
예제 #7
0
 public static void ApplyBuffChatimentDamage(EffectCast cast, EffectCast actualCast)
 {
     actualCast.Jet = (int)((1 + (double)cast.Value1 / 100) * actualCast.Jet);
 }
예제 #8
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;
            }
        }
예제 #9
0
        public static void EffectSubMPEsquive(EffectCast cast)
        {
            if (cast.Target == null)
                return;

            if (cast.Duration == 0)
                return;

            cast.Jet = cast.RandomJet;

            if (cast.Jet > cast.Target.Stats.GetStat(StatEnum.MaxPM).Total)
                cast.Jet = cast.Target.Stats.GetStat(StatEnum.MaxPM).Total;

            cast.Jet = cast.Target.CalculDodgeAPMP(cast.Caster, cast.Jet, true);

            if (cast.Jet < cast.RandomJet)
                cast.Caster.Fight.Send("GA;309;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + (cast.RandomJet - cast.Jet));

            if (cast.Jet > 0)
            {
                cast.RandomJet = cast.Jet;
                EffectStats(cast);
            }
        }
예제 #10
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);
        }
예제 #11
0
        public static void EffectStealLifeFix(EffectCast cast)
        {
            if (cast.Target == null)
                return;

            cast.Jet = cast.RandomJet;

            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);

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

            cast.Caster.Life += cast.Jet;

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

            EffectDamage(cast);

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

            EffectHeal(cast);
        }
예제 #13
0
        public static void EffectStats(EffectCast cast)
        {
            if (cast.Target == null)
                return;

            if (cast.Duration == 0)
                return;

            cast.Jet = cast.RandomJet;

            cast.Target.Stats.ModifyStatBonus(cast.Type, cast.Jet);

            bool negative = false;

            if (cast.Type == EffectEnum.SubPA || cast.Type == EffectEnum.SubPM || cast.Type == EffectEnum.SubPAEsquive || cast.Type == EffectEnum.SubPMEsquive)
                negative = true;

            cast.Caster.Fight.Send("GA;" + (int)cast.Type + ';' + cast.Caster.ID + ';' + cast.Target.ID + ',' + (negative ? "-" : string.Empty) + cast.Jet + ',' + cast.Duration);

            cast.Target.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_STATS, BuffDecrementType.TYPE_ENDTURN);
        }
예제 #14
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);
        }
예제 #15
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);
        }
예제 #16
0
 public void OnAttackAfterJet(EffectCast cast)
 {
     foreach (EffectCast buff in myBuffActives[BuffActiveType.ACTIVE_ATTACK_AFTER_JET])
         BuffProcessor.ApplyBuff(buff, cast);
 }
예제 #17
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);
        }
예제 #18
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);
        }
예제 #19
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));
        }
예제 #20
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));
        }
예제 #21
0
 public static void ApplyBuffDamage(EffectCast cast, EffectCast actualCast)
 {
     EffectProcessor.ApplyEffect(cast);
 }
예제 #22
0
 public static void EffectTurnPass(EffectCast cast)
 {
     cast.Caster.Fight.TurnEnd();
 }
예제 #23
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;
            }
        }
예제 #24
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));
        }
예제 #25
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);
        }
예제 #26
0
 public void OnAttackedPostJet(EffectCast cast)
 {
     foreach (EffectCast buff in myBuffActives[BuffActiveType.ACTIVE_ATTACKED_POST_JET])
         BuffProcessor.ApplyBuff(buff, cast);
 }
예제 #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);
        }
예제 #28
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;
        }
예제 #29
0
        public EffectCast CopyToBuff()
        {
            EffectCast cast = new EffectCast(Type, SpellID, CellID, Value1, Value2, Value3, Chance, Duration, false, Caster, null, Target);
            cast.Jet = Jet;

            return cast;
        }
예제 #30
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);
        }