Ejemplo n.º 1
0
        public void Add(int id, string name = null)
        {
            SpellEntry se = new SpellEntry(id, name);

            Spells.Add(se);
            SpellIds.Add(id);
        }
Ejemplo n.º 2
0
        public Character(string name, BeginClasses className, Weapon weapon) : base(name, weapon)
        {
            Potions           = 2;
            NeededExperiences = 14;
            ClassName         = (Classes)className;
            LevelingManager   = new LevelingManager(this);
            InitStats initStats = Json.GetInitStats(className.ToString());

            Inventory = new Inventory(16);

            initStats.Init();
            EntityStats = initStats;

            switch (className)
            {
            case BeginClasses.Mage:
            case BeginClasses.Priest:
            case BeginClasses.Thief:
                HasSpells = true;
                Spells.Add(new Spell("Fireball", 3, 6, "attack"));
                break;

            default:
                HasSpells = false;
                break;
            }
        }
        public async Task LoadData(bool forceReload)
        {
            if (Detail != null && !forceReload)
            {
                return;
            }

            this.Loading = true;
            this.Detail  = await Task.Run(() => dataDragonClient.GetChampionDetailAsync(id));

            this.Loading = false;

            if (Detail == null)
            {
                return;
            }

            this.Spells = new List <ISpellViewModel>();
            Spells.Add(new ChampionPassiveViewModel(Detail.Passive));
            foreach (ChampionSpell championSpell in Detail.Spells)
            {
                Spells.Add(new ChampionSpellViewModel(championSpell, Detail.ResourceType));
            }

            this.Stats = new ChampionStatsViewModel(Detail.Stats, Detail.ResourceType);

            if (Skins.Count > 0)
            {
                // Replace "default" skin name with champion name
                Skins[0].Name = Name;
            }

            RaiseAllPropertiesChanged();
        }
Ejemplo n.º 4
0
        public void AddSpells(int id, int level, int pos)
        {
            if (Spells.Any(x => x.ID == id))
            {
                return;
            }

            if (level < 1)
            {
                level = 1;
            }
            if (level > 6)
            {
                level = 6;
            }

            if (pos > 25)
            {
                pos = 25;
            }
            if (pos < 1)
            {
                pos = 25;
            }

            lock (Spells)
                Spells.Add(new CharacterSpell(id, level, pos));
        }
Ejemplo n.º 5
0
        private static void CreateSpells()
        {
            List <Effect> effects      = new List <Effect>();
            EffectDamage  effectDamage = new EffectDamage(3000, "Effect Damage", EffectType.Damage, TargetType.Direct, 0.5f, null);

            effects.Add(effectDamage);
            Bite bite = new Bite(2000, "Bite", 1.5f, 0, TargetType.Direct, DispelType.None, effects);

            Spells.Add(bite.Id, bite);

            effects      = new List <Effect>();
            effectDamage = new EffectDamage(3001, "Effect Damage", EffectType.Damage, TargetType.Direct, 0.5f, null);
            effects.Add(effectDamage);
            bite = new Bite(2001, "Scratch", 0f, 0, TargetType.Direct, DispelType.None, effects);
            Spells.Add(bite.Id, bite);

            effects = new List <Effect>();
            effects.Add(new EffectDamage(3000, "Effect Damage", EffectType.Damage, TargetType.Direct, 0.25f, null));
            effects.Add(new EffectDamage(3001, "Effect Damage", EffectType.Damage, TargetType.Direct, 0.50f, null));
            effects.Add(new EffectDamage(3002, "Effect Damage", EffectType.Damage, TargetType.Direct, 0.75f, null));
            var test = effects.FindAll(x => { if (x.Id < 3002)
                                              {
                                                  return(true);
                                              }
                                              else
                                              {
                                                  return(false);
                                              } });
        }
Ejemplo n.º 6
0
        private bool HandleDeadPartymembers()
        {
            if (!Spells.ContainsKey(resurrectionSpell))
            {
                Spells.Add(resurrectionSpell, CharacterManager.SpellBook.GetSpellByName(resurrectionSpell));
            }

            if (Spells[resurrectionSpell] != null &&
                !CooldownManager.IsSpellOnCooldown(resurrectionSpell) &&
                Spells[resurrectionSpell].Costs < ObjectManager.Player.Mana)
            {
                IEnumerable <WowPlayer> players      = ObjectManager.WowObjects.OfType <WowPlayer>();
                List <WowPlayer>        groupPlayers = players.Where(e => e.IsDead && e.Health == 0 && ObjectManager.PartymemberGuids.Contains(e.Guid)).ToList();

                if (groupPlayers.Count > 0)
                {
                    HookManager.TargetGuid(groupPlayers.First().Guid);
                    HookManager.CastSpell(resurrectionSpell);
                    CooldownManager.SetSpellCooldown(resurrectionSpell, (int)HookManager.GetSpellCooldown(resurrectionSpell));
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 7
0
        public void InventoryUpdate()
        {
            Weapons.Clear();
            Artifacts.Clear();
            Spells.Clear();
            Treasure.Clear();


            foreach (var gameItem in _inventory)
            {
                if (gameItem is Weapon)
                {
                    Weapons.Add(gameItem);                     //1000
                }
                if (gameItem is Artifact)
                {
                    Artifacts.Add(gameItem);                       //2000
                }
                if (gameItem is Spell)
                {
                    Spells.Add(gameItem);                    //3000
                }
                if (gameItem is Treasure)
                {
                    Treasure.Add(gameItem);                       //4000
                }
            }
        }
Ejemplo n.º 8
0
        void OnCastSpell(SpellCastEventData e)
        {
            //TODO: this should be refactored. I am tired.
            switch (e.Type)
            {
            case SpellTypes.ManMega_RocketRampage: PlaySound(Sounds.ManMega_1, e.Position); break;

            case SpellTypes.ManMega_Slash: PlaySound(Sounds.ManMega_2, e.Position); break;

            case SpellTypes.ManMega_HintOfASpark: PlaySound(Sounds.ManMega_3, e.Position); break;

            case SpellTypes.ManMega_Shotgun: PlaySound(Sounds.ManMega_4, e.Position); break;

            case SpellTypes.Zoro_Tooth: PlaySound(Sounds.Zero_1, e.Position); break;

            case SpellTypes.Zoro_Slash: PlaySound(Sounds.Zero_2, e.Position); break;

            case SpellTypes.Zoro_Double: PlaySound(Sounds.Zero_3, e.Position); break;

            case SpellTypes.Zoro_Wall: PlaySound(Sounds.Zero_4, e.Position); break;
            }

            var s = GetSpellFromType(new ClientLinearSpell(e.ID, e.Type, e.Position, e.Time, e.Velocity, e.Range, e.Width));

            Spells.Add(e.ID, s);
            GameWorld.AddChild(s);

            if (OurChampion != null && OurChampion.Champion.ID == e.OwnerID)
            {
                ChampionState.SetSpellCooldown(e.Type, e.Cooldown);
            }
        }
Ejemplo n.º 9
0
 public void AddSpell(Spell spell)
 {
     if (Owner.Condition == Character.ConditionType.dead)
     {
         throw new System.ArgumentException("The initiator cannot be dead");
     }
     Spells.Add(spell);
 }
Ejemplo n.º 10
0
 public void LearnSpell(LearnSpell Spell)
 {
     if (!Spells.Contains(Spell))
     {
         Spells.Add(Spell);
         Send(&Spell, Spell.Size);
     }
 }
Ejemplo n.º 11
0
        public void AddSpell(string spellName, string spellDescription, int spellLevel)
        {
            Spell spell = new Spell();

            spell.SpellName        = spellName;
            spell.SpellDescription = spellDescription;
            spell.SpellLevel       = spellLevel;
            Spells.Add(spell);
        }
Ejemplo n.º 12
0
        public WarriorViewModel(IWarrior warrior)
        {
            if (warrior == null)
            {
                throw new ArgumentNullException("Warrior is null");
            }
            Warrior = warrior;
            Warrior.PropertiesChanged      += Warrior_PropertiesChanged;
            ShowWeaponsPickerCommand        = new ShowWeaponsPicker(this);
            BuyWarriorCommand               = new BuyWarrior(this);
            RemoveWarriorCommand            = new RemoveWarrior(this);
            IncreaseWarriorBuyAmountCommand = new IncreaseBuyAmount(this);
            DecreaseWarriorBuyAmountCommand = new DecreaseBuyAmount(this);
            ShowSkillSelectorCommand        = new ShowSkillSelector(this);

            foreach (IEquipment item in warrior.Equipment)
            {
                EquippedWeapons.Add(new EquipmentSummaryViewModel(item));
            }

            foreach (var item in warrior.AllowedSkills)
            {
                //if (!warrior.Skills.Contains(item))
                //{
                AllowedSkills.Add(new SkillViewModel(item));
                //}
            }

            IWizard wizard = warrior as IWizard;

            if (wizard != null)
            {
                foreach (var item in wizard.DrawnSpells)
                {
                    Spells.Add(new SpellViewModel(item));
                }
            }

            IHero hero = warrior as IHero;

            if (hero != null)
            {
                foreach (var item in hero.Injuries)
                {
                    InjuryViewModel injuryModel = new InjuryViewModel(item);

                    Injuries.Add(injuryModel);
                    InjuriesSimple.Add(injuryModel);
                }

                foreach (var item in hero.Skills)
                {
                    Skills.Add(new SkillViewModel(item));
                    SkillsSimple.Add(new SkillViewModelSimple(item));
                }
            }
        }
Ejemplo n.º 13
0
 void Start()
 {
     Health = PREFS.I.PlayerHealth;
     for (int i = 0; i < SpellList.Length; i++)
     {
         Spells.Add((INPUT.Button)i, SpellList[i]);
     }
     IdleCastSlots = GetComponentsInChildren <CastSlot>().ToList();
 }
Ejemplo n.º 14
0
        protected override void InitializeSpells()
        {
            Spell Q = new Spell(SpellSlot.Q, 625);
            Spell W = new Spell(SpellSlot.W, 600);
            Spell E = new Spell(SpellSlot.E, 600);
            Spell R = new Spell(SpellSlot.R, 625);

            Spells.Add("Q", Q);
            Spells.Add("W", W);
            Spells.Add("E", E);
            Spells.Add("R", R);
        }
Ejemplo n.º 15
0
        private void ParseActions()
        {
            var numberOfActions = int.Parse(Io.ReadLine());

            for (var i = 0; i < numberOfActions; i++)
            {
                var inputs = Io.ReadLine().Split(' ');

                var actionType = ActionTypeExtension.FromString(inputs[1]);
                if (actionType == ActionType.Brew)
                {
                    Potions.Add(new Potion(int.Parse(inputs[0]),
                                           int.Parse(inputs[2]),
                                           int.Parse(inputs[3]),
                                           int.Parse(inputs[4]),
                                           int.Parse(inputs[5]),
                                           int.Parse(inputs[6])));
                }
                else if (actionType == ActionType.Cast)
                {
                    Spells.Add(new Spell(int.Parse(inputs[0]),
                                         int.Parse(inputs[2]),
                                         int.Parse(inputs[3]),
                                         int.Parse(inputs[4]),
                                         int.Parse(inputs[5]),
                                         int.Parse(inputs[9]) != 0,
                                         int.Parse(inputs[10]) != 0));
                }
                else if (actionType == ActionType.OpponentCast)
                {
                    OpponentSpells.Add(new Spell(int.Parse(inputs[0]),
                                                 int.Parse(inputs[2]),
                                                 int.Parse(inputs[3]),
                                                 int.Parse(inputs[4]),
                                                 int.Parse(inputs[5]),
                                                 int.Parse(inputs[9]) != 0,
                                                 int.Parse(inputs[10]) != 0));
                }
                else if (actionType == ActionType.Learn)
                {
                    Scrolls.Add(new Scroll(int.Parse(inputs[0]),
                                           int.Parse(inputs[2]),
                                           int.Parse(inputs[3]),
                                           int.Parse(inputs[4]),
                                           int.Parse(inputs[5]),
                                           int.Parse(inputs[7]),
                                           int.Parse(inputs[10]) != 0));
                }
            }
        }
Ejemplo n.º 16
0
        private FightSpell AddSpell(string name, string type)
        {
            var spell = Spells.FirstOrDefault(x => x.Name == name && x.Type == type);

            if (spell == null)
            {
                spell = new FightSpell()
                {
                    Name = name, Type = type
                };
                Spells.Add(spell);
            }
            return(spell);
        }
Ejemplo n.º 17
0
        public Npc([NotNull] NpcBase myBase, bool despawnable = false) : base()
        {
            Name        = myBase.Name;
            Sprite      = myBase.Sprite;
            Level       = myBase.Level;
            Base        = myBase;
            Despawnable = despawnable;

            for (var i = 0; i < (int)Stats.StatCount; i++)
            {
                BaseStats[i] = myBase.Stats[i];
                Stat[i]      = new Stat((Stats)i, this);
            }

            var spellSlot = 0;

            for (var I = 0; I < Base.Spells.Count; I++)
            {
                var slot = new SpellSlot(spellSlot);
                slot.Set(new Spell(Base.Spells[I]));
                Spells.Add(slot);
                spellSlot++;
            }

            //Give NPC Drops
            var itemSlot = 0;

            foreach (var drop in myBase.Drops)
            {
                //if (Globals.Rand.Next(1, 10001) <= drop.Chance * 100 && ItemBase.Get(drop.ItemId) != null)
                //{
                var slot = new InventorySlot(itemSlot);
                slot.Set(new Item(drop.ItemId, drop.Quantity, true));
                slot.DropChance = drop.Chance;
                Items.Add(slot);
                itemSlot++;

                //}
            }

            for (var i = 0; i < (int)Vitals.VitalCount; i++)
            {
                SetMaxVital(i, myBase.MaxVital[i]);
                SetVital(i, myBase.MaxVital[i]);
            }

            Range       = (byte)myBase.SightRange;
            mPathFinder = new Pathfinder(this);
        }
Ejemplo n.º 18
0
        void AddSpellFromJSON(JToken spell)
        {
            Spell s = new Spell();

            s.LoadFromJSON(spell);

            if (spell.SelectToken("flavorText") != null)
            {
                s.Flavor = spell.SelectToken("flavorText").ToObject <string>();
            }

            s.Description = ExtractAbilitiesAndConditions(s.Description, ref s.DescriptionAbilities, ref s.DescriptionConditions);

            Spells.Add(s.ID, s);
        }
Ejemplo n.º 19
0
 public void AddSpell(string spell)
 {
     if (Spells.Count == 0)
     {
         Spells.Add(new Spell(spell, SpellIcons[spell + " Spell Icon"]));
         Spells[0].IconXpos = 1130;
         Spells[0].IconYpos = 20;
     }
     else
     {
         Spells.Add(new Spell(spell, SpellIcons[spell + " Spell Icon"]));
         Spells[1].IconXpos = 1180;
         Spells[1].IconYpos = 20;
     }
 }
Ejemplo n.º 20
0
        public Default()
        {
            //initializing spells
            Q = new Spell(SpellSlot.Q);
            W = new Spell(SpellSlot.W);
            E = new Spell(SpellSlot.E);
            R = new Spell(SpellSlot.R);

            //add them to a list to process them later on for voodoo magic
            Spells.Add(Q);
            Spells.Add(W);
            Spells.Add(E);
            Spells.Add(R);

            //find skillshots in evade spelldb
            List <Data.SpellData> MySkillShots =
                Data.SpellDatabase.Spells.FindAll(s => s.ChampionName == ObjectHandler.Player.ChampionName);

            //set skillshots
            foreach (var ss in MySkillShots)
            {
                var theSpell = Spells.First(s => s.Slot == ss.Slot);
                if (theSpell != null)
                {
                    theSpell.Range = ss.Range;
                    theSpell.SetSkillshot(ss.Delay, ss.RawRadius, ss.MissileSpeed, true, ss.Type);
                }
            }

            //spell is not a skillshot? make it targettable.
            foreach (var spell in Spells)
            {
                var sd = SpellData.GetSpellData(ObjectManager.Player.GetSpell(spell.Slot).Name);
                if (!spell.IsSkillshot && sd != null)
                {
                    spell.Range = sd.CastRange;
                    spell.SetTargetted(sd.DelayTotalTimePercent, sd.SpellCastTime);
                }
            }

            //initialize combo menu
            ComboConfig.AddBool("ComboQ", "Use Q", true);
            ComboConfig.AddBool("ComboW", "Use W", true);
            ComboConfig.AddBool("ComboE", "Use E", true);
            ComboConfig.AddBool("ComboR", "Use R", true);
        }
Ejemplo n.º 21
0
        private bool CastSpellIfPossible(string spellName, bool needsMana = false)
        {
            if (!Spells.ContainsKey(spellName))
            {
                Spells.Add(spellName, CharacterManager.SpellBook.GetSpellByName(spellName));
            }

            if (Spells[spellName] != null &&
                !CooldownManager.IsSpellOnCooldown(spellName) &&
                (!needsMana || Spells[spellName].Costs < ObjectManager.Player.Mana))
            {
                HookManager.CastSpell(spellName);
                CooldownManager.SetSpellCooldown(spellName, (int)HookManager.GetSpellCooldown(spellName));
                return(true);
            }

            return(false);
        }
Ejemplo n.º 22
0
        private bool PrepareCast(string spellName)
        {
            if (!Spells.ContainsKey(spellName))
            {
                Spell spell = WowInterface.CharacterManager.SpellBook.GetSpellByName(spellName);

                if (spell != null)
                {
                    Spells.Add(spellName, spell);
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 23
0
 public void DeserializeSelf(Helper _helper)
 {
     foreach (string spellDef in KnownSpellsS)
     {
         SpellDefinition sd = _helper.GetSpell(spellDef);
         if (sd != null)
         {
             KnownSpells.Add(sd);
         }
     }
     foreach (SpellS spell in SpellsS)
     {
         SpellDefinition sd = _helper.GetSpell(spell.Name);
         Spells.Add(new Spell()
         {
             Definition = sd, IsCasted = spell.IsCasted
         });
     }
 }
Ejemplo n.º 24
0
        protected override void InitializeSpells()
        {
            Spell Q = new Spell(SpellSlot.Q, 900f);

            Q.SetSkillshot(0.25f, 100f, 1200f, false, SkillshotType.SkillshotLine);

            Spell W = new Spell(SpellSlot.W, 800);

            Spell E = new Spell(SpellSlot.E, 975);

            E.SetSkillshot(0.25f, 60f, 1200f, true, SkillshotType.SkillshotLine);

            Spell R = new Spell(SpellSlot.R, 450f);

            Spells.Add("Q", Q);
            Spells.Add("W", W);
            Spells.Add("E", E);
            Spells.Add("R", R);
        }
Ejemplo n.º 25
0
 public void LevelUp()
 {
     if (Level != 200)
     {
         Level++;
         Health        = MaxHealth;
         StatsPoints  += 5;
         SpellsPoints += 1;
         Experience    = ExperienceLevelFloor;
         if (GetNextSpell(Level) != 0)
         {
             Spells.Add(new CharacterSpellRecord(Id, (byte)(Spells.LastOrDefault().Position + 1), GetNextSpell(Level), 1));
         }
         CharacterHandler.SendCharacterLevelUpMessage(Client, Level);
         CurrentMap.SendCharacterLevelUpInformation(Client);
         CharacterHandler.SendCharacterStatsListMessage(Client);
         InventoryHandler.SendSpellListMessage(Client);
     }
 }
Ejemplo n.º 26
0
 public Supervisor(List <Pair <Container, Info> > soliders, List <Pair <Container, Info> > spells,
                   SimpleDatabase.Database database, int startSolidersCount, int startSpellsCount)
 {
     if ((this.database = database) == null)
     {
         throw new ArgumentNullException(nameof(database));
     }
     foreach (var f in soliders)
     {
         Soliders.Add(new Pair <Container, Pair <InterpretedObject, Info> >(f.Obj1, new Pair <InterpretedObject, Info>(Interpretor.Interpretate(f.Obj1), f.Obj2)));
     }
     foreach (var f in spells)
     {
         Spells.Add(new Pair <Container, Pair <InterpretedObject, Info> >(f.Obj1, new Pair <InterpretedObject, Info>(Interpretor.Interpretate(f.Obj1), f.Obj2)));
     }
     (sessionFounder = new Task(new Action(SessionFounder))).Start();
     StartSolidersCount = startSolidersCount;
     StartSpellsCount   = startSpellsCount;
 }
Ejemplo n.º 27
0
        public void OnLearnSpellFromSpellbook(Item_Spellbook book, int slotSelected)
        {
            if (slotSelected > NumOfSpellSlots)
            {
                slotSelected = NumOfSpellSlots;
            }

            if (Spells.Count >= slotSelected)
            {
                OnForgetSpell(Spells[slotSelected - 1]);
                Spells[slotSelected - 1] = _scene.CreateSpell(book.spellID, InstanceID);
            }
            else
            {
                slotSelected = Spells.Count + 1;
                Spells.Add(_scene.CreateSpell(book.spellID, InstanceID));
            }

            RemoveItem(book);
        }
Ejemplo n.º 28
0
        protected override void InitializeSpells()
        {
            Spell Q = new Spell(SpellSlot.Q, 950);

            Q.SetSkillshot(0.25f, 70f, 1650f, true, SkillshotType.SkillshotLine);

            Spell W = new Spell(SpellSlot.W, 130);

            Spell E = new Spell(SpellSlot.E, 1200);

            E.SetSkillshot(0.25f, 120f, 1400f, false, SkillshotType.SkillshotLine);

            Spell R = new Spell(SpellSlot.R, 1100);

            R.SetSkillshot(1.5f, 225f, float.MaxValue, false, SkillshotType.SkillshotCircle);

            Spells.Add("Q", Q);
            Spells.Add("W", W);
            Spells.Add("E", E);
            Spells.Add("R", R);
        }
Ejemplo n.º 29
0
        public void AddSpell(String spellname, DateTime date)
        {
            Boolean spellcheck = true;

            for (int i = 0; i < Spells.Count; i++)
            {
                if (Spells[i].SpellName == spellname)
                {
                    Spells[i].Count++;
                    Spells[i].Time.Add(date);
                    spellcheck = false;
                    break;
                }
            }
            if (spellcheck)
            {
                Spell newspell = new Spell();
                newspell.SpellName = spellname;
                newspell.Time.Add(date);
                Spells.Add(newspell);
            }
        }
Ejemplo n.º 30
0
        internal bool HandleDeadPartymembers(string SpellName)
        {
            if (!Spells.ContainsKey(SpellName))
            {
                Spells.Add(SpellName, WowInterface.CharacterManager.SpellBook.GetSpellByName(SpellName));
            }

            if (Spells[SpellName] != null &&
                !CooldownManager.IsSpellOnCooldown(SpellName) &&
                Spells[SpellName].Costs < WowInterface.ObjectManager.Player.Mana)
            {
                IEnumerable <WowPlayer> players      = WowInterface.ObjectManager.WowObjects.OfType <WowPlayer>();
                List <WowPlayer>        groupPlayers = players.Where(e => e.IsDead && e.Health == 0 && WowInterface.ObjectManager.PartymemberGuids.Contains(e.Guid)).ToList();

                if (groupPlayers.Count > 0)
                {
                    WowPlayer player = groupPlayers.FirstOrDefault(e => RessurrectionTargets.ContainsKey(e.Name) ? RessurrectionTargets[e.Name] < DateTime.Now : true);

                    if (player != null)
                    {
                        if (!RessurrectionTargets.ContainsKey(player.Name))
                        {
                            RessurrectionTargets.Add(player.Name, DateTime.Now + TimeSpan.FromSeconds(2));
                            return(false);
                        }

                        if (RessurrectionTargets[player.Name] < DateTime.Now)
                        {
                            return(CastSpellIfPossible(SpellName, player.Guid, true));
                        }
                    }

                    return(true);
                }
            }

            return(false);
        }