Exemplo n.º 1
0
 public IEquipment AddEnchantment(IEquipment equip)
 {
     IEquipment equip2 = equip;
     Console.Write(String.Format(ApplicationSettings.AddEnchantmentPrompt));
     Selection selectOrb = (Selection)Enum.Parse(typeof(Selection),
                            Console.ReadLine(), true);
     switch (selectOrb)
     {
         case Selection.A:
             {
                 equip2 = new BlueOrb(equip);
                 break;
             }
         case Selection.B:
             {
                 equip2 = new GreenOrb(equip);
                 break;
             }
         case Selection.C:
             {
                 equip2 = new RedOrb(equip);
                 break;
             }
     }
     return equip2;
 }
 public ExpandAdorner(UIElement parent)
     : base(parent) {
     IsHitTestVisible = false; // Seems Adorner is hit test visible?
     equiElement = parent as FrameworkElement;
     equi = parent as IEquipment;
     visualChildern = new VisualCollection(this);
     initExpandRect();
 }
Exemplo n.º 3
0
 public static IEnumerable<IEquipmentLineItem> GetEquipmentLineItemsByEquipment(IEquipment e)
 {
     return Cache.CacheResult(() =>
     {
         switch (AccountingSystem)
         {
             case AccountingSystems.MasterBuilder:
                 return GetMBEquipmentLineItemsByEquipment(e);
             default:
                 throw new NotImplementedException();
         }
     }, e.EquipmentNumber);
 }
Exemplo n.º 4
0
        public IItem RemoveInventoryItem(IItem item, IEquipment equipment) {
            IItem result = null;

            result = inventory.Where(i => i.Id == item.Id).SingleOrDefault();
            inventory.RemoveWhere(i => i.Id == item.Id);

            if (result == null) { //so if it wasn't in the inventory we need to check what is equipped
                foreach (KeyValuePair<Wearable, IItem> slot in equipment.equipped) {
                    if (slot.Value == item) {
                        result = (IItem)slot.Value;
                        equipment.equipped.Remove(slot.Key);
                        break;
                    }
                }
            }
            return result;
        }
Exemplo n.º 5
0
 public EquipmentCombatNode(IEquipment equipment)
 {
     LoadElementAttackScalar(equipment.OffensiveScalar);
     LoadElementDefenseScalar(equipment.DefensiveScalar);
     LoadAttribute(equipment.AttributeExtra);
 }
 public static UpperBodySlot UpperBodySlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.UpperBodySlot) as UpperBodySlot;
 public static FootSlot FootSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.FootSlot) as FootSlot;
 public static WristSlot WristSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.WristSlot) as WristSlot;
 public static MainHandSlot MainHandSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.MainHandSlot) as MainHandSlot;
Exemplo n.º 10
0
        public void FrostboltSpellUnitTest()
        {
            Player player = new Player("test", PlayerClassType.Mage)
            {
                HitPoints = 200, MaxHitPoints = 200, FrostResistance = 0
            };

            OutputHelper.Display.ClearUserOutput();
            Monster monster = new Monster(1, MonsterType.Skeleton);

            while (monster.SkeletonCategory != SkeletonType.Mage)
            {
                monster = new Monster(1, MonsterType.Skeleton);
            }
            MonsterBuilder.BuildMonster(monster);
            monster.MonsterWeapon.CritMultiplier = 1;             // Remove crit chance to remove "noise" in test
            int spellIndex = monster.Spellbook.FindIndex(
                f => f.SpellCategory == SpellType.Frostbolt);

            foreach (IItem item in player.Inventory.Where(item => item is IEquipment eItem && eItem.Equipped))
            {
                IEquipment eItem = item as IEquipment;
                eItem.Equipped = false;
            }
            monster.Spellbook[spellIndex].CastFrostOffense(monster, player, spellIndex);
            int spellCost = monster.Spellbook[spellIndex].EnergyCost;

            Assert.AreEqual(monster.MaxEnergyPoints - spellCost, monster.EnergyPoints);
            int spellDamage = monster.Spellbook[spellIndex].Offensive.Amount;

            Assert.AreEqual(player.MaxHitPoints - spellDamage, player.HitPoints);
            int spellMaxRounds = monster.Spellbook[spellIndex].Offensive.AmountMaxRounds;

            Assert.AreEqual(spellMaxRounds, player.Effects[0].MaxRound);
            string attackString = $"The {monster.Name} conjures up a frostbolt and launches it at you!";

            Assert.AreEqual(attackString, OutputHelper.Display.Output[0][2]);
            string attackSuccessString = $"The {monster.Name} hits you for {spellDamage} frost damage.";

            Assert.AreEqual(attackSuccessString, OutputHelper.Display.Output[1][2]);
            const string frozenString = "You are frozen. Physical, frost and arcane damage to you will be increased by 50%!";

            Assert.AreEqual(frozenString, OutputHelper.Display.Output[2][2]);
            Assert.AreEqual(true, player.Effects[0] is FrozenEffect);
            FrozenEffect frozenEffect = player.Effects[0] as FrozenEffect;

            // Remove all spells after casting to make monster decide to use physical attack for unit test
            monster.Spellbook = null;
            for (int i = 2; i < 4; i++)
            {
                int    playerHitPointsBefore = player.HitPoints;
                double multiplier            = frozenEffect.EffectMultiplier;
                int    baseDamage            = monster.MonsterWeapon.RegDamage;
                int    frozenDamage          = (int)(monster.MonsterWeapon.RegDamage * multiplier);
                Assert.AreEqual(frozenDamage, baseDamage * multiplier, 1);
                monster.MonsterWeapon.Durability = 100;
                monster.Attack(player);
                Assert.AreEqual(i, player.Effects[0].CurrentRound);
                Assert.AreEqual(frozenString, OutputHelper.Display.Output[i][2]);
                Assert.AreEqual(playerHitPointsBefore - frozenDamage, player.HitPoints, 7);
            }
            GameHelper.RemovedExpiredEffectsAsync(player);
            Thread.Sleep(1000);
            Assert.AreEqual(false, player.Effects.Any());
        }
Exemplo n.º 11
0
 public static NeckSlot NeckSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.NeckSlot) as NeckSlot;
        public void Register(IPlayer character)
        {
            IOutputService message = new ConsoleOutput();

            character.CharacterName = message.NamePrompt();


            character.Health       = 100;
            character.SelectAction = ActionSelection.Attack;

            IEquipment weapon = null;

            string    optionWeap = message.WeaponPrompt();
            Selection selectWeap = (Selection)Enum.Parse(typeof(Selection),
                                                         optionWeap, true);

            switch (selectWeap)
            {
            case Selection.A:
            {
                weapon = new Knife();
                break;
            }

            case Selection.B:
            {
                weapon = new Sword();
                break;
            }

            case Selection.C:
            {
                weapon = new Blade();
                break;
            }

            case Selection.D:
            {
                weapon = new Katana();
                break;
            }
            }
            if (weapon != null)
            {
                character.WeaponName  = weapon.EquipmentName;
                character.WeaponValue = message.AddEnchantment(weapon).EquipmentValue;
            }

            string    optionArm = message.ArmorPrompt();
            Selection selectArm = (Selection)Enum.Parse(typeof(Selection),
                                                        optionArm, true);

            IEquipment armor = null;

            switch (selectArm)
            {
            case Selection.A:
            {
                armor = new Guard();
                break;
            }

            case Selection.B:
            {
                armor = new Buckler();
                break;
            }

            case Selection.C:
            {
                armor = new Shield();
                break;
            }

            case Selection.D:
            {
                armor = new ThornShield();
                break;
            }
            }
            if (armor != null)
            {
                character.ArmorName  = armor.EquipmentName;
                character.ArmorValue = message.AddEnchantment(armor).EquipmentValue;
            }
        }
Exemplo n.º 13
0
        protected void OnEquipmentUpdated(IEquipment equipment)
        {
            IReadOnlyList <AnimationClipOverride> overrideClips = equipment?.AnimationOverrides ?? new List <AnimationClipOverride>();

            OverrideAnimationController(equipment.AnimationOverrides);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Equips the item.
 /// </summary>
 /// <param name="item">Item to equip. Adds gear if not already added</param>
 public void EquipItem(IEquipment item)
 {
     this.AddGear(item);
     this.equippedGear.Add(item);
 }
Exemplo n.º 15
0
 /// <summary>adds/resets the unit's health, shield, and inventory (weapons and grenades) to the named profile. resets if third parameter is true, adds if false. weapons will be marked as garbage if fourth parameter is true (for respawning equipment).</summary>
 public void unit_add_equipment(IUnit unit, IEquipment equipment, bool reset, bool isGarbage)
 {
 }
Exemplo n.º 16
0
        public IResult PerformCommand(IMobileObject performer, ICommand command)
        {
            IResult result = base.PerfomCommand(performer, command);

            if (result != null)
            {
                return(result);
            }

            if (command.Parameters.Count <= 0)
            {
                StringBuilder strBldr = new StringBuilder();
                foreach (Equipment.AvalableItemPosition position in Enum.GetValues(typeof(Equipment.AvalableItemPosition)))
                {
                    if (position != Equipment.AvalableItemPosition.NotWorn)
                    {
                        bool found = false;
                        foreach (IEquipment equipment in performer.EquipedEquipment)
                        {
                            if (equipment.ItemPosition == position)
                            {
                                strBldr.AppendLine(position.ToString() + " " + equipment.ShortDescription);
                                found = true;
                                break;
                            }
                        }

                        if (!found)
                        {
                            strBldr.AppendLine(position.ToString() + " <Nothing>");
                        }
                    }
                }
                return(new Result(strBldr.ToString().Trim(), true));
            }

            IParameter parm = command.Parameters[0];
            IItem      item = GlobalReference.GlobalValues.FindObjects.FindHeldItemsOnMob(performer, parm.ParameterValue, parm.ParameterNumber);

            if (item != null)
            {
                if (!(item is IEquipment equipment) ||
                    equipment.ItemPosition == Equipment.AvalableItemPosition.NotWorn)
                {
                    string message = string.Format("You can not equip the {0}.", item.SentenceDescription);
                    return(new Result(message, true));
                }

                IEquipment equipedItem = performer.EquipedEquipment.Where(i => i.ItemPosition == equipment.ItemPosition).FirstOrDefault();
                if (equipedItem != null)
                {
                    string message = string.Format("You already have {0} in the {1} position.", equipedItem.SentenceDescription, equipedItem.ItemPosition);
                    return(new Result(message, true));
                }
                else
                {
                    performer.Items.Remove(equipment);
                    performer.AddEquipment(equipment);
                    string message = string.Format("You equipped the {0}.", equipment.SentenceDescription);
                    return(new Result(message, false));
                }
            }
            else
            {
                string message = string.Format("You were unable to find {0}.", parm.ParameterValue);
                return(new Result(message, true));
            }
        }
Exemplo n.º 17
0
 public void RemoveEqipment(IEquipment item)
 {
     equipment.Remove(item);
     UpdateEquipment();
 }
Exemplo n.º 18
0
 public void AddEqipment(IEquipment item)
 {
     equipment.Add(item);
     UpdateEquipment();
 }
Exemplo n.º 19
0
 public GreenOrb(IEquipment equip)
 {
     this.equip = equip;
 }
Exemplo n.º 20
0
 public RedOrb(IEquipment equip)
 {
     this.equip = equip;
 }
Exemplo n.º 21
0
 private static IEnumerable<IEquipmentLineItem> GetMBEquipmentLineItemsByEquipment(IEquipment e)
 {
     using (var cmd = Connections.Connection.CreateCommand())
     {
         cmd.CommandText = string.Format("select recnum, linnum from tmeqln where eqpnum = {0}", e.EquipmentNumber);
         var rdr = cmd.ExecuteReader();
         while (rdr.Read())
         {
             yield return new MasterBuilder.EquipmentLineItem(Convert.ToInt32(rdr[0]), Convert.ToInt32(rdr[1]));
         }
     }
 }
Exemplo n.º 22
0
 public static IEquipment CreateItem(IEquipment item)
 {
     item.CreateItem();
     return(item);
 }
Exemplo n.º 23
0
        public int CountEquipmentQuantity(IEquipment thisItem)
        {
            var amountFound = equipment.Where(x => x.Name == thisItem.Name).ToList();

            return(amountFound.Count());
        }
Exemplo n.º 24
0
 private static string GetRareItemName(IEquipment item)
 {
     return($"Death Kill"); //code magic goes here
 }
 public void RemoveItem(IEquipment Item, int Quantity = 1)
 {
     Equipment = CharacterManager.RemoveItem(Item, Quantity, Equipment);
 }
Exemplo n.º 26
0
 public void AddEquipment(IEquipment equipment)
 {
     this.equipment.Add(equipment);
 }
Exemplo n.º 27
0
 public static HeadSlot HeadSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.HeadSlot) as HeadSlot;
Exemplo n.º 28
0
        protected override ArmorSetSearchResult IsArmorSetMatching(IEquipment weapon, IEquipment[] equipments)
        {
            List <ArmorSetJewelResult> requiredJewels = jewelResultObjectPool.GetObject();

            int[] availableSlots = availableSlotsObjectPool.GetObject();

            void OnArmorSetMismatch()
            {
                requiredJewels.Clear();
                jewelResultObjectPool.PutObject(requiredJewels);

                ReturnSlotsArray(availableSlots);
            }

            SolverUtils.AccumulateAvailableSlots(weapon, availableSlots);

            foreach (IEquipment equipment in equipments)
            {
                SolverUtils.AccumulateAvailableSlots(equipment, availableSlots);
            }

            foreach (IAbility ability in desiredAbilities)
            {
                int armorAbilityTotal = 0;

                if (IsAbilityMatchingArmorSet(ability, equipments))
                {
                    continue;
                }

                foreach (IEquipment equipment in equipments)
                {
                    if (equipment == null)
                    {
                        continue;
                    }

                    foreach (IAbility a in equipment.Abilities)
                    {
                        if (a.Skill.Id == ability.Skill.Id)
                        {
                            armorAbilityTotal += a.Level;
                        }
                    }
                }

                int remaingAbilityLevels = ability.Level - armorAbilityTotal;

                if (remaingAbilityLevels <= 0)
                {
                    continue;
                }

                if (SolverUtils.AreAllSlotsUsed(availableSlots))
                {
                    OnArmorSetMismatch();
                    return(ArmorSetSearchResult.NoMatch);
                }

                foreach (SolverDataJewelModel j in matchingJewels)
                {
                    // bold assumption, will be f****d if they decide to create jewels with multiple skills
                    IAbility a = j.Jewel.Abilities[0];

                    if (a.Skill.Id != ability.Skill.Id)
                    {
                        continue;
                    }

                    int requiredJewelCount = remaingAbilityLevels / a.Level; // This will turn into a bug with jewels providing skill with level 2 or more.

                    if (j.Available < requiredJewelCount)
                    {
                        OnArmorSetMismatch();
                        return(ArmorSetSearchResult.NoMatch);
                    }

                    if (ConsumeSlots(availableSlots, j.Jewel.SlotSize, requiredJewelCount) == false)
                    {
                        OnArmorSetMismatch();
                        return(ArmorSetSearchResult.NoMatch);
                    }

                    remaingAbilityLevels -= requiredJewelCount * a.Level;

                    requiredJewels.Add(new ArmorSetJewelResult {
                        Jewel = j.Jewel, Count = requiredJewelCount
                    });

                    break;
                }

                if (remaingAbilityLevels > 0)
                {
                    OnArmorSetMismatch();
                    return(ArmorSetSearchResult.NoMatch);
                }
            }

            return(new ArmorSetSearchResult
            {
                IsMatch = true,
                Jewels = requiredJewels,
                SpareSlots = availableSlots
            });
        }
Exemplo n.º 29
0
 public static RingSlot Ring2Slot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.Ring2Slot) as RingSlot;
Exemplo n.º 30
0
 public String Validate(IEquipment equipment)
 {
     return(string.Join(",\n", equipment.GetConstructionStatus()));
 }
Exemplo n.º 31
0
 public static OffHandSlot OffHandSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.OffHandSlot) as OffHandSlot;
Exemplo n.º 32
0
        private static IAdventure create(KeyValuePair <int, string> dungeonID_FilePath,
                                         IEquipmentRepository items)
        {
            IList <string>     dungeonText = new List <string>();
            IList <IEquipment> loot        = new List <IEquipment>();

            IEnumerable <string> lines = System.IO.File.ReadLines(dungeonID_FilePath.Value, UTF8Encoding.Default);
            int textIter = 1;

            string[] header = lines.ElementAt(textIter).Split(',');
            string   name   = header[0];
            int      numEncounters;

            int.TryParse(header[1], out numEncounters);
            int baseSuccessRate;

            int.TryParse(header[2], out baseSuccessRate);
            int minLevel;

            int.TryParse(header[3], out minLevel);
            int maxLevel;

            int.TryParse(header[4], out maxLevel);

            textIter++;
            string[] enemies = lines.ElementAt(textIter).Split(',');
            if ((enemies.Count() / 2) != numEncounters)
            {
                throw new InvalidOperationException("Dungeon at " + dungeonID_FilePath.Value +
                                                    " has a mismatch for # of encounters & encounter data.");
            }

            IDictionary <string, int> encounters = new Dictionary <string, int>();

            for (int i = 0; i < enemies.Count(); i += 2)
            {
                int difficulty = 0;
                int.TryParse(enemies[i + 1], out difficulty);
                encounters.Add(enemies[i], difficulty);
            }

            textIter++;
            string desc = lines.ElementAt(textIter);

            textIter++;
            string victory = lines.ElementAt(textIter);

            textIter++;
            string defeat = lines.ElementAt(textIter);

            textIter++;
            if (lines.ElementAt(textIter).StartsWith("Loot="))
            {
                string[] temp = lines.ElementAt(textIter).Split('=');
                string[] ids  = temp[1].Split(',');
                for (int i = 0; i < ids.Length; i++)
                {
                    int toAdd = -1;
                    int.TryParse(ids[i], out toAdd);
                    IEquipment equipment = items.getById(toAdd);
                    if (equipment != null)
                    {
                        loot.Add(equipment);
                    }
                }
                textIter++;
            }

            int iter = 0;

            foreach (var line in lines.Skip(textIter))
            {
                dungeonText.Add(line);
                iter++;
            }

            SortedSet <IEncounter>    encounterSet         = new SortedSet <IEncounter>();
            IDictionary <string, int> encounter_difficulty = new Dictionary <string, int>();
            int j = 0;

            for (int i = 0; i < dungeonText.Count; i += 2, j++)
            {
                IEncounter e = new Encounter(j, dungeonText[i], encounters.ElementAt(j).Value,
                                             dungeonText[i + 1]);
                encounterSet.Add(e);
            }



            return(new Adventure(dungeonID_FilePath.Key, name, desc, maxLevel, minLevel,
                                 baseSuccessRate, LEGACY_COST, defeat, victory, encounterSet,
                                 loot, LEGACY_REWARD_MOD));
        }
Exemplo n.º 33
0
 public static LowerBodySlot LowerBodySlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.LowerBodySlot) as LowerBodySlot;
 public AllEquipmentController(IEquipment IEquipment)
 {
     _IEquipment = IEquipment;
 }
Exemplo n.º 35
0
 public static BackSlot BackSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.BackSlot) as BackSlot;
Exemplo n.º 36
0
 public BlueOrb(IEquipment equip)
 {
     this.equip = equip;
 }
 public Task <IEquipment> CreateAsync(IEquipment equipment)
 {
     return(EquipmentRepository.CreateAsync(equipment));
 }
Exemplo n.º 38
0
        public static bool CollectInput(List <IResource> resourceList, List <IResource> discardList, double spaceAvailable, IEquipment equipment)
        {
            Console.Clear();

            var plantResources = new List <string>();

            resourceList.OfType <Plant>().ToList().ForEach(pl => plantResources.Add(pl.Type));

            List <ResourceType> resourceTypeTotals = (from resource in resourceList
                                                      group resource by resource.GetType().Name into resourceType
                                                      select new ResourceType {
                Type = resourceType.Key, Total = resourceType.Count()
            }).ToList();

            int rNum = 1;

            Console.WriteLine("Select a resource to process:");
            foreach (var resourceType in resourceTypeTotals)
            {
                if (plantResources.Contains(resourceType.Type))
                {
                    Console.WriteLine($"{rNum}. {resourceType.Type} ({resourceType.Total} rows available)");
                }
                else
                {
                    Console.WriteLine($"{rNum}. {resourceType.Type} ({resourceType.Total} available)");
                }
                rNum++;
            }
            Console.Write(">");

            int resourceTypeIndex = Int32.Parse(Console.ReadLine()) - 1;

            var selectedResource = resourceTypeTotals[resourceTypeIndex];

            if (plantResources.Contains(selectedResource.Type))
            {
                Console.WriteLine($"There are {selectedResource.Total} {selectedResource.Type} rows. How many do you want to process?");
            }
            else
            {
                Console.WriteLine($"There are {selectedResource.Total} {selectedResource.Type}s. How many do you want to process?");
            }
            Console.Write(">");
            int numSelected = Int32.Parse(Console.ReadLine());

            if (numSelected > selectedResource.Total)
            {
                Console.WriteLine($"There are not that many {selectedResource.Type}s available");
                Console.WriteLine("Press enter to return to list of facilities");
                Console.ReadLine();
                return(false);
            }
            else
            {
                //find animals in availableResourcesList that match the type of animal that was selected and limit the number to the number of animals the user wants to process
                var processThese = (from animal in resourceList
                                    where animal.GetType().Name == selectedResource.Type
                                    select animal
                                    ).Take(numSelected).ToList();
                //add them to discardList
                int numToAdd = numSelected;

                if (equipment.Name == "Egg Gatherer" && (processThese[0] is IEggProducing))
                {
                    IEggProducing eggResource     = (IEggProducing)processThese[0];
                    int           eggsPerResource = eggResource.CollectEggs();
                    numToAdd = numSelected * eggsPerResource;
                }


                if (numToAdd > spaceAvailable)
                {
                    Console.WriteLine("You have exceeded the maximum number of resources that this processor can handle");
                    Console.WriteLine("Press enter to return to list of facilities");
                    Console.ReadLine();
                    return(false);
                }
                else
                {
                    discardList.AddRange(processThese);
                    Console.WriteLine("Ready to process? (Y/n)");
                    var processYN = Console.ReadLine();
                    if (processYN.ToLower() == "y")
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Exemplo n.º 39
0
 public void AddEquipment(IEquipment eq)
 {
     equipment.Add(eq);
 }
Exemplo n.º 40
0
        private Party parent_party;                   //ссылка на партию,в которой состоит данная операция

        public Operation(int id_, string name_, TimeSpan duration_, List <IOperation> Prev, IEquipment equipment_, Party party)
        {
            id                 = id_;
            name               = name_;
            duration           = duration_;
            PreviousOperations = new List <IOperation>();
            foreach (IOperation prev in Prev)
            {
                PreviousOperations.Add(prev);
            }
            enable       = false;
            equipment    = equipment_;
            parent_party = party;
        }
Exemplo n.º 41
0
        public void AddEquipment(IEquipment equipment)
        {
            equipment.SetOwner(this);

            this.equipment.Add(equipment);
        }
Exemplo n.º 42
0
 public BlueOrb(IEquipment equip)
 {
     this.equip = equip;
 }