Exemplo n.º 1
0
        private void TransferSpellToCleanses(SpellInfo spell)

        {
            if (spell == null)
            {
                return;
            }

            if (CleansesViewModel.Instance.GuiCleansesList.Any(r => r.SpellId == spell.SpellId))
            {
                return;
            }

            Logger.KefkaLog(@"Adding {0} to the Cleanse List.", spell.SpellName);

            var newSpell = new Cleanse
            {
                SpellName        = spell.SpellName,
                SpellId          = spell.SpellId,
                Leeches          = false,
                Esuna            = false,
                ExaltedDetriment = false
            };

            CleansesViewModel.Instance.GuiCleansesList.Add(newSpell);
            CleansesViewModel.Instance.Save();
        }
Exemplo n.º 2
0
        public IExecutable InterpretateCommand(string[] data)
        {
            IExecutable command = null;

            string commandName = data[0];

            string[] commandParams = data.Skip(1).ToArray();

            switch (commandName)
            {
            case "RegisterCleansingCenter":
                command = new RegisterCleansingCenter(commandParams, this.Databse);
                break;

            case "RegisterAdoptionCenter":
                command = new RegisterAdoptionCenter(commandParams, this.Databse);
                break;

            case "RegisterCastrationCenter":
                command = new RegisterCastratingCenter(commandParams, this.Databse);
                break;

            case "RegisterDog":
                command = new RegisterDog(commandParams, this.Databse, this.AnimalFactory);
                break;

            case "RegisterCat":
                command = new RegisterCat(commandParams, this.Databse, this.AnimalFactory);
                break;

            case "SendForCleansing":
                command = new SendForCleansing(commandParams, this.Databse);
                break;

            case "SendForCastration":
                command = new SendForCastrating(commandParams, this.Databse);
                break;

            case "Cleanse":
                command = new Cleanse(commandParams, this.Databse);
                break;

            case "Castrate":
                command = new Castrate(commandParams, this.Databse);
                break;

            case "Adopt":
                command = new Adopt(commandParams, this.Databse);
                break;

            case "CastrationStatistics":
                command = new CastrationStatistics(commandParams, this.Databse, this.writer);
                break;

            case "Paw Paw Pawah":
                command = new PawPawPawah(commandParams, this.Databse, this.Writer);
                break;
            }
            return(command);
        }
Exemplo n.º 3
0
        private static void Obj_AI_Base_OnBuffGain(Obj_AI_Base sender, Obj_AI_BaseBuffGainEventArgs args)
        {
            if (sender.IsEnemy)
            {
                return;
            }

            var delay = CleansersMenu.GetSliderValue("delayCleanse");

            if (PlayerHasCleanse && Player.Instance.HasCC() && CleansersMenu.GetCheckBoxValue("check" + "cleanse"))
            {
                Core.DelayAction(() => Cleanse.Cast(), delay);
            }

            var itemCleanse =
                Cleansers.CleansersItems.FirstOrDefault(
                    i => i.IsReady() && i.IsOwned() && CleansersMenu.GetCheckBoxValue("check" + (int)i.Id));

            if (itemCleanse != null)
            {
                if (itemCleanse.Id == ItemId.Mikaels_Crucible)
                {
                    var ally = EntityManager.Heroes.Allies.FirstOrDefault(a => a.HasCC());
                    if (ally != null)
                    {
                        Core.DelayAction(() => itemCleanse.Cast(ally), delay);
                    }
                }

                if (Player.Instance.HasCC())
                {
                    Core.DelayAction(() => itemCleanse.Cast(), delay);
                }
            }
        }
Exemplo n.º 4
0
        private void AddCleanse(Status spell)
        {
            if (spell == null)
            {
                return;
            }

            if (GuiCleansesList.Any(r => r.SpellId == spell.Id))
            {
                return;
            }

            Logger.KefkaLog(@"Adding {0} to the Cleanse List.", spell.Name);

            var newSpell = new Cleanse
            {
                SpellName        = spell.Name,
                SpellId          = spell.Id,
                Leeches          = false,
                Esuna            = false,
                ExaltedDetriment = false,
            };

            GuiCleansesList.Add(newSpell);
            Save();
        }
Exemplo n.º 5
0
        public void should_throw_exception_if_buffs_not_provided()
        {
            var cmd = new Cleanse {
                PlayerId = 100
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("Buffs are required!"));
        }
Exemplo n.º 6
0
        private void buttonOK_Click(object sender, EventArgs eventArgs)
        {
            ability.Name = textBoxName.Text;
            ability.SpCost = (Int32)numericUpDownSP.Value;
            ability.Effects.Clear();
            Effect e = null;
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                String _type = row.Cells[0].Value.ToString();
                int _pow = Int32.Parse(row.Cells[1].Value.ToString());
                int _acc = Int32.Parse(row.Cells[2].Value.ToString());
                int _crit = Int32.Parse(row.Cells[3].Value.ToString());
                switch (_type)
                {
                    case "pdmg":
                        e = new PhysicalDamage(_pow, _acc, _crit);
                        break;
                    case "mdmg":
                        e = new MagicalDamage(_pow, _acc, _crit);
                        break;
                    case "heal":
                        e = new Heal(_pow, _acc, _crit);
                        break;
                    case "spd":
                        e = new SPDrain(_pow, _acc, _crit);
                        break;
                    case "spr":
                        e = new SPRecovery(_pow, _acc, _crit);
                        break;
                    case "psn":
                        e = new PoisonEnemy(_acc);
                        break;
                    case "psnself":
                        e = new PoisonSelf(_acc);
                        break;
                    case "par":
                        e = new ParalyzeEnemy(_acc);
                        break;
                    case "parself":
                        e = new ParalyzeSelf(_acc);
                        break;
                    case "bli":
                        e = new BlindEnemy(_acc);
                        break;
                    case "bliself":
                        e = new BlindSelf(_acc);
                        break;
                    case "cleanse":
                        e = new Cleanse();
                        break;

                }
                ability.Effects.Add(e);
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 7
0
        public static void Init()
        {
            try
            {
                menu = Load.MenuIni.AddSubMenu("SummonerSpells", "SummonerSpells");

                if (Mark.IsVaild() || Player.Spells.Any(s => s.Name.Equals("SummonerPoroThrow")))
                {
                    balls.Init();
                }
                if (Barrier.IsVaild())
                {
                    Borrier.Init();
                }
                if (Clarity.IsVaild())
                {
                    Clarty.Init();
                }
                if (Cleanse.IsVaild())
                {
                    Clanse.Init();
                }
                if (Exhaust.IsVaild())
                {
                    Exhust.Init();
                }
                if (Flash.IsVaild())
                {
                    Flish.Init();
                }
                if (Heal.IsVaild())
                {
                    Heel.Init();
                }
                if (Ignite.IsVaild())
                {
                    Ignoite.Init();
                }
                if (Smite.IsVaild())
                {
                    Smote.Init();
                }

                if (menu.LinkedValues.Count == 0)
                {
                    menu.AddGroupLabel("Your SummonerSpells are not Supported");
                }
            }
            catch (Exception ex)
            {
                Logger.Send("Error At KappaUtility.Brain.Activator.Spells.SummonerSpells.Init", ex, Logger.LogLevel.Error);
            }
        }
Exemplo n.º 8
0
        public void should_throw_exception_if_player_not_found()
        {
            new PlayerBuilder()
            .With(p => p.Id, 100)
            .BuildAndSave();

            var cmd = new Cleanse {
                PlayerId = 3, Buffs = buffs
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("Player with ID '3' could not be found"));
        }
Exemplo n.º 9
0
        public void should_throw_exception_if_player_has_insufficient_mana()
        {
            new PlayerBuilder()
            .With(p => p.Id, 100)
            .With(p => p.Mana, PvPStatics.CleanseManaCost - 1)
            .BuildAndSave();

            var cmd = new Cleanse {
                PlayerId = 100, Buffs = buffs
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("You don't have enough mana to cleanse!"));
        }
Exemplo n.º 10
0
        public void should_throw_exception_if_player_not_animate()
        {
            new PlayerBuilder()
            .With(p => p.Id, 100)
            .With(p => p.Mobility, PvPStatics.MobilityInanimate)
            .BuildAndSave();

            var cmd = new Cleanse {
                PlayerId = 100, Buffs = buffs
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("You must be animate in order to cleanse!"));
        }
Exemplo n.º 11
0
        private static void Obj_AI_Base_OnBuffGain(Obj_AI_Base sender, Obj_AI_BaseBuffGainEventArgs args)
        {
            if (!Common.Misc.Extensions.CCbuffs.Contains(args.Buff.Type) || !Summs.menu.CheckBoxValue("Cleanse"))
            {
                return;
            }

            if (!sender.IsMe || !Cleanse.IsReady() || !Summs.menu.CheckBoxValue(args.Buff.Type.ToString()) || Player.Instance.HealthPercent > Summs.menu.SliderValue("CleanseHP"))
            {
                return;
            }

            Core.DelayAction(() => Cleanse.Cast(), new Random().Next(Summs.menu.SliderValue("CleanseMin"), Summs.menu.SliderValue("CleanseMax")));
        }
Exemplo n.º 12
0
        public void should_throw_exception_if_player_has_cleansed_or_meditated_too_much()
        {
            new PlayerBuilder()
            .With(p => p.Id, 100)
            .With(p => p.CleansesMeditatesThisRound, PvPStatics.MaxCleansesMeditatesPerUpdate)
            .BuildAndSave();

            var cmd = new Cleanse {
                PlayerId = 100, Buffs = buffs
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message
                        .EqualTo("You have cleansed and meditated the maximum number of times this update."));
        }
Exemplo n.º 13
0
        internal static void OnLoad(EventArgs args)
        {
            Config    = new Menu(Menuname, Menuname, true);
            Orbwalker = new Orbwalking.Orbwalker(Menu.root);
            ActivatorMenu.LoadActivator();
            DamagesMenu.LoadDamagesMenu();
            EnviormentMenu.LoadEnviormentMenu();
            JungleMenu.LoadJungleMenu();
            DrawingsMenu.DrawingsMenus();
            SummonersMenu.LoadSummonersMenu();
            AutoLevelMenu.OnLoad();
            Config.Item("useautolevel").SetValue(false);
            Config.AddToMainMenu();

            // Activator
            Defensive.OnLoad();
            Offensive.OnLoad();
            Consumables.OnLoad();

            // Summoners
            Ignite.OnLoad();
            Heal.OnLoad();
            Cleanse.OnLoad();
            Barrier.OnLoad();

            //Drawings //todo DtoP
            EnemyRanges.OnLoad();
            AllyRanges.OnLoad();
            Wards.OnLoad();
            TrackerSpell.OnLoad();
            //DtoT.OnLoad();s
            //  DtoP.OnLoad();

            //Jungle (yes smite contains everything in jungle) //todo Jungle timers
            Smite.OnLoad();

            //Enviormenet //todo Ult Manager, Inhibs, Turn Around, Turrets
            AntiRengar.OnLoad();
            Auto_Level_Manager.AutoLevel.OnLoad();
            //UltManager.OnLoad();
            //Inhibitors.OnLoad();
            //TurnAround.OnLoad();
            //Turrets.OnLoad();
        }
Exemplo n.º 14
0
        private void RemoveCleanse(Cleanse spell)
        {
            if (spell == null)
            {
                return;
            }

            Logger.KefkaLog(@"Removing {0} from the Cleanse List.", spell.SpellName);

            if (GuiCleansesList.All(r => r.SpellId != spell.SpellId))
            {
                return;
            }

            var cleanse = GuiCleansesList.FirstOrDefault(r => r.SpellId == spell.SpellId);

            GuiCleansesList.Remove(cleanse);
            Save();
        }
Exemplo n.º 15
0
        public static void CleanseOnTick()
        {
            var delay = CleansersMenu.GetSliderValue("delayCleanse");
            //Item
            var itemCleanse =
                Cleansers.CleansersItems.FirstOrDefault(
                    i => i.IsReady() && i.IsOwned() && CleansersMenu.GetCheckBoxValue("check" + (int)i.Id));

            if (itemCleanse == null)
            {
                return;
            }

            if (itemCleanse.Id == ItemId.Mikaels_Crucible)
            {
                var ally = EntityManager.Heroes.Allies.FirstOrDefault(a => a.HasCC());
                if (ally == null)
                {
                    return;
                }

                Core.DelayAction(() => itemCleanse.Cast(ally), delay);
                return;
            }
            if (Player.Instance.HasCC())
            {
                Core.DelayAction(() => itemCleanse.Cast(), delay);
                return;
            }

            //SummonerSpell
            if (!PlayerHasCleanse)
            {
                return;
            }

            if (Player.Instance.HasCC() && CleansersMenu.GetCheckBoxValue("check" + "cleanse"))
            {
                Core.DelayAction(() => Cleanse.Cast(), delay);
            }
        }
Exemplo n.º 16
0
    public static Effect GetEffect(string param)
    {
        if (effects.ContainsKey(param))
        {
            return(effects[param]);
        }
        string[] p = param.Split(' ');
        switch (p[0])
        {
        case "Bleed":
            effects[param] = new Bleed(int.Parse(p[1]), int.Parse(p[2]));
            break;

        case "Counter":
            effects[param] = new Counter(float.Parse(p[1]), int.Parse(p[2]));
            break;

        case "Heal":
            effects[param] = new Heal(int.Parse(p[1]));
            break;

        case "Defend":
        case "Defense":
            effects[param] = new Defend(int.Parse(p[1]));
            break;

        case "Mark":
            effects[param] = new Mark(int.Parse(p[1]));
            break;

        case "Push":
        case "Pull":
            effects[param] = new PushPull(int.Parse(p[1]));
            break;

        case "Move":
            effects[param] = new Move();
            break;

        case "MoveSelf":
            effects[param] = new MoveSelf();
            break;

        case "Dodge":
        case "Damage":
        case "Crit":
        case "Acc":
        case "Speed":
        case "StressResist":
            effects[param] = new StatBuff(p[0], float.Parse(p[1]), int.Parse(p[2]));
            break;

        case "Block":
            effects[param] = new Block(int.Parse(p[1]), int.Parse(p[2]));
            break;

        case "Stun":
            effects[param] = new Stun();
            break;

        case "Suprise":
            effects[param] = new Suprise();
            break;

        case "Stress":
        case "StressHeal":
            effects[param] = new Stress(int.Parse(p[1]));
            break;

        case "Cleanse":
            effects[param] = new Cleanse();
            break;

        case "Guard":
            return(new Guard(int.Parse(p[1])));

        case "Metal":
            return(new Metal(int.Parse(p[1])));

        default:
            Debug.Log(param);
            break;
        }
        return(effects[param]);
    }
Exemplo n.º 17
0
        public static void Execute()
        {
            #region Ignite

            if (Ignite != null && Ignite.IsReady())
            {
                var ignitableEnemies =
                    EntityManager.Heroes.Enemies.Where(
                        t =>
                        t.IsValidTarget(Ignite.Range) && !t.HasUndyingBuff() &&
                        CalculateDamage(t, false, false, false, false, true) >= t.Health);
                var igniteEnemy = TargetSelector.GetTarget(ignitableEnemies, DamageType.True);

                if (igniteEnemy != null)
                {
                    if (Ignite != null && UseIgnite)
                    {
                        if (Ignite.IsInRange(igniteEnemy))
                        {
                            Ignite.Cast(igniteEnemy);
                        }
                    }
                }
            }

            #endregion ignite

            #region heal

            if (Heal != null)
            {
                if (UseHeal && Heal.IsReady())
                {
                    if (Player.Instance.HealthPercent <= UseHealheal)
                    {
                        Heal.Cast();
                    }
                }
            }

            #endregion heal

            #region Zhonyas

            if (UseZhonyas && Zhonyas.IsReady())
            {
                if (Player.Instance.HealthPercent <= UseZhonyaheal)
                {
                    Zhonyas.Cast();
                }
            }

            #endregion Zhonyas

            #region cleanse

            if (Cleanse != null)
            {
                if (UseCleanse && Cleanse.IsReady())
                {
                    if (Player.Instance.IsDead || Player.Instance.IsInvulnerable || !Player.Instance.IsTargetable || Player.Instance.IsZombie || Player.Instance.IsInShopRange())
                    {
                        return;
                    }
                    if (Player.HasBuff("PoppyDiplomaticImmunity") || Player.HasBuff("MordekaiserChildrenOfTheGrave") || Player.HasBuff("FizzMarinerDoom") || Player.HasBuff("VladimirHemoplague") ||
                        Player.HasBuff("zedulttargetmark") || Player.HasBuff("AlZaharNetherGrasp") || Player.HasBuffOfType(BuffType.Suppression) || Player.HasBuffOfType(BuffType.Charm) || Player.HasBuffOfType(BuffType.Flee) || Player.HasBuffOfType(BuffType.Blind) ||
                        Player.HasBuffOfType(BuffType.Polymorph) || Player.HasBuffOfType(BuffType.Snare) || Player.HasBuffOfType(BuffType.Stun) || Player.HasBuffOfType(BuffType.Taunt))
                    {
                        Core.DelayAction(() => Cleanse.Cast(), 110);
                    }
                }
            }

            #endregion cleanse

            #region Qss

            if (UseQss)
            {
                if (Player.Instance.IsDead || Player.Instance.IsInvulnerable || !Player.Instance.IsTargetable || Player.Instance.IsZombie || Player.Instance.IsInShopRange())
                {
                    return;
                }
                InventorySlot[] inv = Player.Instance.InventoryItems;
                foreach (var item in inv)
                {
                    if ((item.Id == ItemId.Quicksilver_Sash || item.Id == ItemId.Mercurial_Scimitar) && item.CanUseItem() && Player.Instance.CountEnemiesInRange(700) > 0)
                    {
                        if (Player.HasBuff("PoppyDiplomaticImmunity") || Player.HasBuff("MordekaiserChildrenOfTheGrave") || Player.HasBuff("FizzMarinerDoom") || Player.HasBuff("VladimirHemoplague") ||
                            Player.HasBuff("zedulttargetmark") || Player.HasBuff("AlZaharNetherGrasp") || Player.HasBuffOfType(BuffType.Suppression) || Player.HasBuffOfType(BuffType.Charm) || Player.HasBuffOfType(BuffType.Flee) || Player.HasBuffOfType(BuffType.Blind) ||
                            Player.HasBuffOfType(BuffType.Polymorph) || Player.HasBuffOfType(BuffType.Snare) || Player.HasBuffOfType(BuffType.Stun) || Player.HasBuffOfType(BuffType.Taunt))
                        {
                            Core.DelayAction(() => item.Cast(), 110);
                        }
                    }
                }
            }

            #endregion Qss

            #region potions

            if (UsePotions && !Player.Instance.IsInShopRange() && Player.Instance.HealthPercent <= UsePotionsheal)
            {
                if (!(Player.Instance.HasBuff("RegenerationPotion") || Player.Instance.HasBuff("ItemCrystalFlaskJungle") || Player.Instance.HasBuff("ItemMiniRegenPotion") || Player.Instance.HasBuff("ItemCrystalFlask") || Player.Instance.HasBuff("ItemDarkCrystalFlask")))
                {
                    InventorySlot[] inv = Player.Instance.InventoryItems;
                    foreach (var item in inv)
                    {
                        if ((item.Id == ItemId.Health_Potion || item.Id == ItemId.Hunters_Potion || item.Id == ItemId.Corrupting_Potion || item.Id == ItemId.Refillable_Potion || item.Id == ItemId.Total_Biscuit_of_Rejuvenation) && item.CanUseItem())
                        {
                            item.Cast();
                        }
                    }
                }
            }

            #endregion potions

            #region Yomuu & Bortk

            var target = TargetSelector.GetTarget(550, DamageType.Physical); // 550 = Botrk.Range
            if (target != null)
            {
                if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) && UseYoumuu && Youmuu.IsOwned() && Youmuu.IsReady())
                {
                    Youmuu.Cast();
                }
                if (UseBotrk && Cutlass.IsOwned() && Cutlass.IsReady() &&
                    Player.Instance.HealthPercent < MinHPBotrk &&
                    target.HealthPercent < EnemyMinHPBotrk)
                {
                    Cutlass.Cast(target);
                }
                if (UseBotrk && Botrk.IsOwned() && Botrk.IsReady() &&
                    Player.Instance.HealthPercent < MinHPBotrk &&
                    target.HealthPercent < EnemyMinHPBotrk)
                {
                    Botrk.Cast(target);
                }
            }

            #endregion Yomuu & Bortk

            #region Hextech

            var targetHextech = TargetSelector.GetTarget(600, DamageType.Magical);
            if (targetHextech != null)
            {
                if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) && UseHextech && Gunblade.IsOwned() && Gunblade.IsReady())
                {
                    Gunblade.Cast(targetHextech);
                }
                if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) && UseHextech && ProtoBelt.IsOwned() && ProtoBelt.IsReady())
                {
                    ProtoBelt.Cast(targetHextech.ServerPosition);
                }
                if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) && UseHextech && GLP.IsOwned() && GLP.IsReady())
                {
                    GLP.Cast(targetHextech.ServerPosition);
                }
            }

            #endregion Hextech
        }
Exemplo n.º 18
0
        private void Cleansers()
        {
            if (!Quicksilver.IsReady && !Mikaels.IsReady && !Mercurial.IsReady && !Dervish.IsReady && !Cleanse.IsReady())
            {
                return;
            }

            if (Player.HealthPercent >= Config["activator"]["cleansers"].GetValue <MenuSlider>("cleanHP").Value || !Config["activator"]["cleansers"].GetValue <MenuBool>("Clean").Value)
            {
                return;
            }

            var bt = Config["activator"]["cleansers"]["bufftype"];

            if (Mikaels.IsReady)
            {
                var mikaels = Config["activator"]["cleansers"]["Mikaelsallys"];
                foreach (var ally in GameObjects.AllyHeroes.Where(a => a.IsValidTarget(Mikaels.Range, false)))
                {
                    var e = mikaels["MikaelsAlly" + ally.CharacterName] as MenuBool;
                    if (e != null && e.Value && ally.HealthPercent < Config["activator"]["cleansers"].GetValue <MenuSlider>("cleanHP").Value)
                    {
                        if (ally.HasBuffOfType(BuffType.Stun) && bt.GetValue <MenuBool>("Stun").Value)
                        {
                            Mikaels.Cast(ally);
                        }
                        if (ally.HasBuffOfType(BuffType.Snare) && bt.GetValue <MenuBool>("Snare").Value)
                        {
                            Mikaels.Cast(ally);
                        }
                        if (ally.HasBuffOfType(BuffType.Charm) && bt.GetValue <MenuBool>("Charm").Value)
                        {
                            Mikaels.Cast(ally);
                        }
                        if (ally.HasBuffOfType(BuffType.Flee) && bt.GetValue <MenuBool>("Flee").Value)
                        {
                            Mikaels.Cast(ally);
                        }
                        if (ally.HasBuffOfType(BuffType.Suppression) && bt.GetValue <MenuBool>("Suppression").Value)
                        {
                            Mikaels.Cast(ally);
                        }
                        if (ally.HasBuffOfType(BuffType.Taunt) && bt.GetValue <MenuBool>("Taunt").Value)
                        {
                            Mikaels.Cast(ally);
                        }
                        if (ally.HasBuffOfType(BuffType.Blind) && bt.GetValue <MenuBool>("Blind").Value)
                        {
                            Mikaels.Cast(ally);
                        }
                    }
                }
            }

            if (Player.HasBuffOfType(BuffType.Stun) && bt.GetValue <MenuBool>("Stun").Value)
            {
                Clean();
            }
            if (Player.HasBuffOfType(BuffType.Snare) && bt.GetValue <MenuBool>("Snare").Value)
            {
                Clean();
            }
            if (Player.HasBuffOfType(BuffType.Charm) && bt.GetValue <MenuBool>("Charm").Value)
            {
                Clean();
            }
            if (Player.HasBuffOfType(BuffType.Flee) && bt.GetValue <MenuBool>("Flee").Value)
            {
                Clean();
            }
            if (Player.HasBuffOfType(BuffType.Suppression) && bt.GetValue <MenuBool>("Suppression").Value)
            {
                Clean();
            }
            if (Player.HasBuffOfType(BuffType.Taunt) && bt.GetValue <MenuBool>("Taunt").Value)
            {
                Clean();
            }
            if (Player.HasBuffOfType(BuffType.Blind) && bt.GetValue <MenuBool>("Blind").Value)
            {
                Clean();
            }
        }
Exemplo n.º 19
0
        public void loadFromXML(String fileName)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(fileName);
            name = doc.SelectSingleNode("//character").Attributes["name"].Value;
            foreach (XmlNode statNode in doc.SelectNodes("//stat"))
            {
                switch (statNode.Attributes["key"].Value)
                {
                case "level":
                    level = Int32.Parse(statNode.Attributes["value"].Value);
                    break;

                case "ATK":
                    ATK = Int32.Parse(statNode.Attributes["value"].Value);
                    break;

                case "DEF":
                    DEF = Int32.Parse(statNode.Attributes["value"].Value);
                    break;

                case "VIT":
                    VIT = Int32.Parse(statNode.Attributes["value"].Value);
                    break;

                case "SKL":
                    SKL = Int32.Parse(statNode.Attributes["value"].Value);
                    break;

                case "MATK":
                    MATK = Int32.Parse(statNode.Attributes["value"].Value);
                    break;

                case "MDEF":
                    MDEF = Int32.Parse(statNode.Attributes["value"].Value);
                    break;

                case "AGI":
                    AGI = Int32.Parse(statNode.Attributes["value"].Value);
                    break;

                case "LCK":
                    LCK = Int32.Parse(statNode.Attributes["value"].Value);
                    break;
                }
            }

            abilities.Clear();
            foreach (XmlNode abilityNode in doc.SelectNodes("//ability"))
            {
                Ability a = new Ability();
                int     _pow, _acc, _crit;
                a.Name   = abilityNode.Attributes["name"].Value;
                a.SpCost = Int32.Parse(abilityNode.Attributes["sp"].Value);
                foreach (XmlNode effectNode in doc.SelectNodes("//ability[@name='" + a.Name + "']/effect"))
                {
                    Effect e     = null;
                    String _type = effectNode.Attributes["type"].Value;
                    try {
                        _pow = Int32.Parse(effectNode.Attributes["pow"].Value);
                    } catch (NullReferenceException) { _pow = 0; }
                    try
                    {
                        _acc = Int32.Parse(effectNode.Attributes["acc"].Value);
                    } catch (NullReferenceException) { _acc = 0; }
                    try
                    {
                        _crit = Int32.Parse(effectNode.Attributes["crit"].Value);
                    } catch (NullReferenceException) { _crit = 0; }
                    switch (_type)
                    {
                    case "pdmg":
                        e = new PhysicalDamage(_pow, _acc, _crit);
                        break;

                    case "mdmg":
                        e = new MagicalDamage(_pow, _acc, _crit);
                        break;

                    case "heal":
                        e = new Heal(_pow, _acc, _crit);
                        break;

                    case "spd":
                        e = new SPDrain(_pow, _acc, _crit);
                        break;

                    case "spr":
                        e = new SPRecovery(_pow, _acc, _crit);
                        break;

                    case "psn":
                        e = new PoisonEnemy(_acc);
                        break;

                    case "psnself":
                        e = new PoisonSelf(_acc);
                        break;

                    case "par":
                        e = new ParalyzeEnemy(_acc);
                        break;

                    case "parself":
                        e = new ParalyzeSelf(_acc);
                        break;

                    case "bli":
                        e = new BlindEnemy(_acc);
                        break;

                    case "bliself":
                        e = new BlindSelf(_acc);
                        break;

                    case "cleanse":
                        e = new Cleanse();
                        break;
                    }
                    a.Effects.Add(e);
                }
                abilities.Add(a);
            }
            reset();
            selectedAbility = abilities[0];
        }