Inheritance: MonoBehaviour
Exemple #1
0
    Potions()
    {
        potions = new Dictionary<MultiSet<Aspects.Primary>, List<Potion>>();
        createdPotions = new List<CreatedPotion>();

        defaultPotion = new Potion(Aspects.Primary.UNKNOWN, Aspects.Primary.UNKNOWN, Aspects.Primary.UNKNOWN, new MultiSet<Aspects.Secondary>(), PotionSlot.NONE, Aspects.Secondary.UNKNOWN, null);
    }
Exemple #2
0
 public void AddPotion(Potion potion)
 {
     potion.sellFraction = sellFraction;
     CalculatePrice (potion);
     itemManager.allItems.Add (potion);
     allPotions.Add (potion);
 }
Exemple #3
0
 public Eye()
 {
     health = 100;
     currentHealth = health;
     strength = 2;
     armor = 2;
     drop = new Potion ();
 }
 public CreatedPotion(Potion potion, IngredientType ingredient1, IngredientType ingredient2, IngredientType ingredient3)
 {
     this.potion = potion;
     ingredients = new List<IngredientType>();
     ingredients.Add(ingredient1);
     ingredients.Add(ingredient2);
     ingredients.Add(ingredient3);
 }
Exemple #5
0
 public Dragon()
 {
     health = 25;
     currentHealth = health;
     strength = 6;
     armor = 2;
     drop = new Potion ();
 }
Exemple #6
0
 public Spider()
 {
     health = 20;
     currentHealth = health;
     strength = 5;
     armor = 1;
     drop = new Potion ();
 }
Exemple #7
0
 public Chest(int id, string name, EquipmentRarity rarity, Equipment equipment, Potion potion, int coin)
 {
     this.id = id;
     this.rarity = rarity;
     this.equipment = equipment;
     this.potion = potion;
     this.coin = coin;
 }
Exemple #8
0
    public void UsePotion(Stats stats, Potion potion)
    {
        if (potion.type == PotionType.Health) {

            int heal = (int)((float)stats.maxHealth * (float)potion.healPercentage / 100);

            stats.Heal (heal);
        }
    }
Exemple #9
0
 public bool ajouterPotion(Potion p)
 {
     for (int i = 0; i < nbPotionMax; i++)
         if (_potions[i] == null){
             _potions[i] = p;
             return true;
         }
     return false;
 }
Exemple #10
0
        public int GetCount(Potion potion)
        {
            lock (this._potionCounts)
            {
                if (!this._potionCounts.ContainsKey(potion))
                    return new int();

                return this._potionCounts[potion];
            }
        }
Exemple #11
0
        public void UsePotion(Potion potion)
        {
            if (!this.AllowPotions)
                throw new InvalidOperationException("Potions have been disabled in this world!");
            if (this.DisabledPotions.Contains(potion))
                throw new InvalidOperationException("That potion has been disabled in this world!");
            if (this.GetCount(potion) == 0)
                throw new InvalidOperationException("Bot does not own any potions of that type!");

            this.Events.Raise(new PotionSendEvent(potion));
        }
Exemple #12
0
    public void add(Aspects.Primary primary1, Aspects.Primary primary2, Aspects.Primary primary3, MultiSet<Aspects.Secondary> secondaries, PotionSlot slot, Aspects.Secondary type, Effect effect)
    {
        Potion potion = new Potion(primary1, primary2, primary3, secondaries, slot, type, effect);
        MultiSet<Aspects.Primary> primaries = new MultiSet<Aspects.Primary>();
        primaries.Add(primary1);
        primaries.Add(primary2);
        primaries.Add(primary3);

        if (!potions.ContainsKey(primaries)) {
            potions.Add(primaries, new List<Potion>());
        }

        potions[primaries].Add(potion);
    }
	void CreateNewPotionAsset(){
		//Potion potion = ScriptableObject.CreateInstance<Potion>();
		Potion potion = new Potion();
		potion.type = Item;
		potion.name = Name;
		potion.price = price;
		//AssetDatabase.AddObjectToAsset(potion,_items);
		//AssetDatabase.CreateAsset(potion,"Assets/Resources/Items/"+potion.name.ToString()+".asset");
		//AssetDatabase.SaveAssets();
		//AssetDatabase.Refresh();
		_items.Add(potion);


	}
Exemple #14
0
    public void CreatePotions()
    {
        Potion potion;

        potion = new Potion ("Diluted Health Potion", PotionType.Health);
        potion.healPercentage = 25;
        AddPotion (potion);
        potion = new Potion ("Health Potion", PotionType.Health);
        potion.healPercentage = 50;
        AddPotion (potion);
        potion = new Potion ("Full Health Potion", PotionType.Health);
        potion.healPercentage = 100;
        AddPotion (potion);
        potion = new Potion ("Antidote", PotionType.Antidote);
        AddPotion (potion);
    }
Exemple #15
0
	public int AddPotion(Potion potion){
		potions.Add(potion);
		potion.transform.parent = GameObject.Find("Head").transform;

		potion.GetComponent<Collider>().enabled = false;
		potion.GetComponent<Rigidbody>().isKinematic = true;

		potion.transform.localRotation = Quaternion.identity;
		potion.transform.localPosition = new Vector3(-.16f + 0.032f * (potions.Count-1),.125f + potion.yMod,.37f);
		potion.transform.localScale    = new Vector3(potion.scale, potion.scale, potion.scale);
		if(potions.Count == 1)potion.transform.localScale *= 1.2f;

		if(potionsVisible){
			potion.transform.localPosition += new Vector3(0f,-0.07f,0f);
		}

		return potions.Count;
	}
Exemple #16
0
    public Equipment(Weapon mainHand, Weapon offHand, Armor shield, Weapon ammunition, Weapon hidden1, Weapon hidden2, Weapon hidden3, Weapon hidden4, 
	Armor armor, Potion potion1, Potion potion2, Potion potion3, Potion potion4, Scroll scroll1, Scroll scroll2, Scroll scroll3, Scroll scroll4)
    {
        this.mainHand = mainHand;
        this.offHand = offHand;
        this.shield = shield;
        this.ammunition = ammunition;
        this.hidden1 = hidden1;
        this.hidden2 = hidden2;
        this.hidden3 = hidden3;
        this.hidden4 = hidden4;
        this.armor = armor;
        this.potion1 = potion1;
        this.potion2 = potion2;
        this.potion3 = potion3;
        this.potion4 = potion4;
        this.scroll1 = scroll1;
        this.scroll2 = scroll2;
        this.scroll3 = scroll3;
        this.scroll4 = scroll4;
    }
Exemple #17
0
    public void PrintPotion(Potion potion)
    {
        if (potion.type == PotionType.Health) {

            print (potion.name
            + " - "
            + potion.healPercentage
            + "% Heal, Buy price: "
            + potion.price
            + ", Sell price: "
            + potion.sellPrice ());
        }
        else {

            print (potion.name
            + " - Buy price: "
            + potion.price
            + ", Sell price: "
            + potion.sellPrice ());
        }
    }
Exemple #18
0
 public AutoPot(Menu menu)
 {
     _menu = menu.AddSubMenu(new Menu("Potion Manager", "PotionManager"));
     _menu.AddItem(new MenuItem("HPTrigger", "HP Trigger Percent").SetValue(new Slider(30)));
     _menu.AddItem(new MenuItem("HealthPotion", "Health Potion").SetValue(true));
     _menu.AddItem(new MenuItem("MPTrigger", "MP Trigger Percent").SetValue(new Slider(30)));
     _menu.AddItem(new MenuItem("ManaPotion", "Mana Potion").SetValue(true));
     _healthPotion = new Potion(ItemId.Health_Potion);
     _manaPotion = new Potion(ItemId.Mana_Potion);
     _biscuitPotion = new Potion((ItemId)2010);
     _flaskPotion = new Potion((ItemId)2041);
     MenuItem autoarrangeMenu = _menu.AddItem(new MenuItem("AutoArrange", "Auto Arrange").SetValue(false));
     autoarrangeMenu.ValueChanged += (sender, e) =>
     {
         if (e.GetNewValue<bool>())
         {
             ResetTrigger();
         }
     };
     Game.OnUpdate += Game_OnGameUpdate;
     Champion.OnLevelUp += OnLevelUp;
 }
    // Start is called before the first frame update
    void Start()
    {
        //    numeros = new int[5];

        //    for (int i = 0; i < numeros.Length; i++)
        //    {
        //        numeros[i] = i * 2;
        //        print(numeros[i]);
        //    }

        //Potion newPotion = Instantiate<Potion>(potions[0]);
        //newPotion.transform.position = potionPosition;

        for (int i = 0; i < numberOfPotions; i++)
        {
            int    randomNumber = Random.Range(0, potions.Length);
            Potion newPotion    = Instantiate <Potion>(potions[randomNumber]);
            newPotion.transform.position = potionPosition;

            potionPosition.x += spaceBetweenPotions;
            potionPosition.y  = Random.Range(minYPosition, maxYPosition);
        }
    }
Exemple #20
0
    public void RemovePotion(Potion potion)
    {
        for (int i = 0; i < potions.Length; i++)
        {
            if (potions[i] == potion)
            {
                potions[i] = null;
                break;
            }
        }

        for (int i = 0; i < potions.Length - 1; i++)
        {
            if (potions[i] == null)
            {
                Potion temp = potions[i + 1];
                potions[i]     = temp;
                potions[i + 1] = null;
            }
        }

        OnItemListChanged?.Invoke(this, EventArgs.Empty);
    }
Exemple #21
0
        public AutoPot(Menu menu)
        {
            _menu = menu.AddSubMenu(new Menu("Potion Manager", "PotionManager"));
            _menu.AddItem(new MenuItem("HPTrigger", "HP Trigger Percent").SetValue(new Slider(30)));
            _menu.AddItem(new MenuItem("HealthPotion", "Health Potion").SetValue(true));
            _menu.AddItem(new MenuItem("MPTrigger", "MP Trigger Percent").SetValue(new Slider(30)));
            _menu.AddItem(new MenuItem("ManaPotion", "Mana Potion").SetValue(true));
            _healthPotion  = new Potion(ItemId.Health_Potion);
            _manaPotion    = new Potion(ItemId.Mana_Potion);
            _biscuitPotion = new Potion((ItemId)2010);
            _flaskPotion   = new Potion((ItemId)2041);
            MenuItem autoarrangeMenu = _menu.AddItem(new MenuItem("AutoArrange", "Auto Arrange").SetValue(false));

            autoarrangeMenu.ValueChanged += (sender, e) =>
            {
                if (e.GetNewValue <bool>())
                {
                    ResetTrigger();
                }
            };
            Game.OnUpdate      += Game_OnGameUpdate;
            Champion.OnLevelUp += OnLevelUp;
        }
Exemple #22
0
        private static Potion randomPotion(int level)
        {
            Potion res   = null;
            int    value = rnd.Next((level * 4), 10 + (level * 4));

            if (value < 10)
            {
                res = randomPotionTier1();
            }
            else if (value < 20)
            {
                res = randomPotionTier2();
            }
            else if (value < 30)
            {
                res = randomPotionTier3();
            }
            else
            {
                res = randomPotionTier4();
            }
            return(res);
        }
Exemple #23
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Potion")
     {
         Potion potion = collision.GetComponent <Potion>();
         if (potion)
         {
             if (potion.type == PotionType.HEALTH)
             {
                 if (currentHealth < 100)
                 {
                     currentHealth += potion.Use();
                     if (currentHealth > 100)
                     {
                         currentHealth = 100;
                     }
                     potion.Pickup();
                     UpdateUI();
                 }
             }
         }
     }
 }
    private void PotionClicked(GameObject potionClicked)
    {
        Potion     potion         = potionClicked.GetComponent <Potion>();
        Vector2Int potionPosition = potion.GetPosition();

        Debug.Log("Potion clicked colour: " + potion.colour + ", at position: " + potionPosition);          //TODO Remove log

        HashSet <GameObject> effectedTiles = TraverseAdjoiningTiles(potionPosition, potion.colour, Direction.None);

        effectedTiles.Add(potionClicked);

        // TODO Remove this
        foreach (var tile in effectedTiles)
        {
            Vector2Int pos = tile.GetComponent <Potion>().GetPosition();
            Debug.Log(tile.name + ", position: " + pos.x + ", " + pos.y);
        }
        // ----------------

        // TODO: Note if implementing a minimum number of potions, (e.g. 3) then we need to set traveresed back to false
        RemoveTiles(effectedTiles);
        StartCoroutine(ReplaceTiles(0.5f));
    }
Exemple #25
0
    public Potion createPotion(IngredientType ingredient1, IngredientType ingredient2, IngredientType ingredient3)
    {
        IngredientData data1 = Ingredients.instance().getIngredient(ingredient1);
        IngredientData data2 = Ingredients.instance().getIngredient(ingredient2);
        IngredientData data3 = Ingredients.instance().getIngredient(ingredient3);

        MultiSet <Aspects.Secondary> secondaries = new MultiSet <Aspects.Secondary>();

        secondaries.Add(data1.secondary);
        secondaries.Add(data2.secondary);
        secondaries.Add(data3.secondary);

        Potion createdPotion = getBestMatch(data1.primary, data2.primary, data3.primary, secondaries);

        logPotionCreation(createdPotion, ingredient1, ingredient2, ingredient3);

        if (!hasDoneAutoPause && createdPotion != defaultPotion)
        {
            hasDoneAutoPause = true;
            GameObject.FindObjectOfType <PauseMenuController>().pause();
        }
        return(createdPotion);
    }
Exemple #26
0
    PlayerStatus ConvertAttribute(Potion pot)
    {
        switch (pot.Primary)
        {
        case Ingredient.Attributes.poison:
            return(PlayerStatus.poisoned);

        case Ingredient.Attributes.speed:
            return(PlayerStatus.fast);

        case Ingredient.Attributes.invisibility:
            return(PlayerStatus.invisible);

        case Ingredient.Attributes.transformation:
            return(PlayerStatus.transformed);

        case Ingredient.Attributes.sleep:
            return(PlayerStatus.asleep);

        default:
            return(PlayerStatus.none);
        }
    }
Exemple #27
0
 /// <summary>
 /// used prof.holmes' code for this
 /// setting the color of potion
 /// </summary>
 /// <param name="ptn"></param>
 /// <returns></returns>
 private static SolidColorBrush GetColorBrush(Potion ptn)
 {
     if (ptn.Color == Potion.Colors.Blue)
     {
         return(new SolidColorBrush(Colors.LightBlue));
     }
     else if (ptn.Color == Potion.Colors.Red)
     {
         return(new SolidColorBrush(Colors.LightPink));
     }
     else if (ptn.Color == Potion.Colors.Green)
     {
         return(new SolidColorBrush(Colors.LightGreen));
     }
     else if (ptn.Color == Potion.Colors.Purple)
     {
         return(new SolidColorBrush(Colors.Thistle));
     }
     else
     {
         return(new SolidColorBrush(Colors.Black));
     }
 }
Exemple #28
0
        public static void CreatePotion()
        {
            Potion potion = new Potion();

            try
            {
                StreamWriter outputFile = File.AppendText(@"../../../TextAdventureLib/Docs/Potions.csv");
                Console.Write("Enter the name of the potion: ");
                potion.Name = Console.ReadLine().Trim();
                Console.Write("Enter the description of the potion: ");
                potion.Description = Console.ReadLine().Trim();

                outputFile.Write($"{potion.Name},{potion.Description}");
                outputFile.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            World.potions.Add(potion);
            Console.WriteLine("Potion created successfully!");
        }
Exemple #29
0
 private void OnDrop()
 {
     if (UICamera.currentTouchID == -1)
     {
         if (DragDropManager.Instance.DraggedItem is ItemDragObject)
         {
             Character      selectedCharacter = LegacyLogic.Instance.WorldManager.Party.SelectedCharacter;
             ItemDragObject itemDragObject    = (ItemDragObject)DragDropManager.Instance.DraggedItem;
             if (itemDragObject.ItemSlot != null && !selectedCharacter.DoneTurn && !selectedCharacter.ConditionHandler.CantDoAnything())
             {
                 LegacyLogic.Instance.WorldManager.Party.SelectCharacter(selectedCharacter.Index);
                 Int32     index     = itemDragObject.ItemSlot.Index;
                 Potion    potion    = itemDragObject.Item as Potion;
                 Equipment equipment = itemDragObject.Item as Equipment;
                 PartyInventoryController partyInventoryController = itemDragObject.ItemSlot.Parent.Inventory as PartyInventoryController;
                 if (potion != null && partyInventoryController != null)
                 {
                     partyInventoryController.ConsumeItem(index, selectedCharacter.Index);
                 }
                 if (equipment != null)
                 {
                     Int32 autoSlot = (Int32)selectedCharacter.Equipment.GetAutoSlot(equipment);
                     if (autoSlot >= 0 && selectedCharacter.Equipment.IsItemPlaceableAt(equipment, autoSlot))
                     {
                         EquipCommand p_command = new EquipCommand(selectedCharacter.Equipment, partyInventoryController, selectedCharacter.Equipment.GetItemAt((EEquipSlots)autoSlot), equipment, autoSlot, index);
                         if (LegacyLogic.Instance.UpdateManager.PartyTurnActor.CanDoCommand(p_command, LegacyLogic.Instance.WorldManager.Party.CurrentCharacter))
                         {
                             LegacyLogic.Instance.CommandManager.AddCommand(p_command);
                         }
                     }
                 }
             }
         }
         DragDropManager.Instance.CancelDragAction();
     }
 }
Exemple #30
0
        static void Main(string[] args)
        {
            Warrior warriorOne = new Warrior("Jack", 150, 25, 15, 50);
            Warrior warriorTwo = new Warrior("Chad", 150, 30, 20, 20);

            Potion potion  = new Potion("Medicine", 40, 3);
            Potion potion2 = new Potion("Medicine", 40, 3);
            Sword  sword   = new Sword("Rozcinacz na kwadry", 20);
            Shield shield  = new Shield("GIMP Logo Shield", 30);

            warriorOne.AddPotionToEquipment(potion);
            warriorTwo.AddPotionToEquipment(potion2);

            warriorOne.AddSwordToEquipment(sword);
            warriorTwo.AddShieldToEquipment(shield);

            Battle battle = new Battle();

            battle.Start(warriorOne, warriorTwo);



            Console.ReadLine();
        }
Exemple #31
0
        public async Task CreatePotion()
        {
            LoadingPotion = true;
            NotifyStateChanged();

            var postData = new
            {
                AlchemistPerkRank     = AlchemistPerkRank,
                AlchemyLevel          = AlchemyLevel,
                FortifyAlchemyPercent = FortifyAlchemyPercent,
                HasBenefactorPerk     = HasBenefactorPerk,
                HasPhysicianPerk      = HasPhysicianPerk,
                HasPoisonerPerk       = HasPoisonerPerk,
                HasPurityPerk         = HasPurityPerk,
                IngredientIds         = SelectedIngredientIds
            };

            var response = await client.PostJsonAsync <PotionResponse>("./api/alchemy/potion", postData);

            Potion = response.Potion;

            LoadingPotion = false;
            NotifyStateChanged();
        }
Exemple #32
0
        //---------------------------------------------------------------------------------------------

        public static UOItem FindPotion(Potion potion, UOItem container)
        {
            Graphic gra   = potion.DefaultGraphic;
            UOColor color = potion.DefaultColor;

            UOItem potionItem = new UOItem(Serial.Invalid);

            foreach (UOItem item in container.AllItems)
            {
                if (item.Graphic == gra)
                {
                    if (item.Color == color)
                    {
                        potionItem = item;
                        break;
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(item.Name))
                        {
                            item.Click();
                            Game.Wait(100);
                        }

                        string name = String.Empty + item.Name;
                        if (name.ToLower().Contains(potion.name.ToLower()))
                        {
                            potionItem = item;
                            break;
                        }
                    }
                }
            }

            return(potionItem);
        }
Exemple #33
0
        public void UseTest1()
        {
            Dictionary <string, int> Hero1Stats = new Dictionary <string, int>();
            Dictionary <string, int> Hero2Stats = new Dictionary <string, int>();
            int healthReduction = 20;

            Hero1Stats.Add("Level", 1);
            Hero1Stats.Add("Strength", 15);
            Hero1Stats.Add("Intelligence", 11);
            Hero1Stats.Add("Agility", 12);
            Hero1Stats.Add("Constitution", 14);
            Hero1Stats.Add("Luck", 10);

            Hero2Stats.Add("Level", 1);
            Hero2Stats.Add("Strength", 12);
            Hero2Stats.Add("Intelligence", 10);
            Hero2Stats.Add("Agility", 16);
            Hero2Stats.Add("Constitution", 12);
            Hero2Stats.Add("Luck", 15);

            Character player1 = new Character("Player1", Hero1Stats);
            Character player2 = new Character("Player2", Hero2Stats);

            var    quantity = 6;
            Potion potion   = new Potion(quantity);

            var player1StartHealth = player1.Health;
            var player2StartHealth = player2.Health;

            player1.ReduceHealth(healthReduction);
            player2.ReduceHealth(healthReduction);
            potion.Use(new Character[] { player1, player2 });

            Assert.AreEqual(player1StartHealth, player1.Health);
            Assert.AreEqual(player2StartHealth, player2.Health);
        }
    public Item CreateItemWithID(string _id)
    {
        switch (FinditemTypeWithItemID(_id))
        {
        case (int)Slot.SlotType.Equip:
            Equip equit = FindingEquipItem(_id);
            return(equit);

        case (int)Slot.SlotType.Potion:
            Potion potion = FindingConsumeItem(_id);
            return(potion);

        case (int)Slot.SlotType.Parts:
            Parts parts = FindingPartsItem(_id);
            return(parts);

        case (int)Slot.SlotType.Etc:
            Etc etc = FindingEtcItem(_id);
            return(etc);

        default:
            return(null);
        }
    }
Exemple #35
0
        public void RunAllFileTests()
        {
            var csv = CSV.Read("VerifiedPotionResults.csv", true);

            for (int i = 0; i < csv.Rows; i++)
            {
                PerkConfiguration perks = new PerkConfiguration(
                    AlchemySkill: Convert.ToInt32(csv.GetEntry("Alchemy Skill", i)),
                    AlchemistPerk: Convert.ToInt32(csv.GetEntry("Alchemist Perk", i)),
                    PhysicianPerk: csv.GetEntry("Physician Perk", i) == "Y" ? true : false,
                    BenefactorPerk: csv.GetEntry("Benefactor Perk", i) == "Y" ? true : false,
                    PoisonerPerk: csv.GetEntry("Poisoner Perk", i) == "Y" ? true : false,
                    FortifyAlchemy: Convert.ToInt32(csv.GetEntry("Fortify Alchemy", i))
                    );

                var ingredients = new List <Ingredient>();
                for (int j = 0; j < 3; j++)
                {
                    var ingredient = Ingredient.GetIngredient(csv.GetEntry($"Ingredient {j+1}", i));
                    if (ingredient is object)
                    {
                        ingredients.Add(ingredient);
                    }
                }

                var potion = new Potion(ingredients, perks);

                string expectedName      = csv.GetEntry("Potion Name", i);
                var    expectedValue     = Convert.ToInt32(csv.GetEntry("Potion Value", i));
                var    expectedMagnitude = Convert.ToDouble(csv.GetEntry("Potion Magnitude", i));
                var    expectedDuration  = Convert.ToInt32(csv.GetEntry("Potion Duration", i));

                Assert.AreEqual(actual: potion.Name, expected: expectedName);
                //AssertWithinPercentage(actual: potion.Value)74077
            }
        }
Exemple #36
0
        private Item BuildItemObject(XmlNode itemNode)
        {
            Item item;

            switch (itemNode.Attributes[0].Value)
            {
            case "Key":
                item = Key.BuildFromXmlNode(itemNode); break;

            case "Text":
                item = Text.BuildFromXmlNode(itemNode); break;

            case "Potion":
                item = Potion.BuildFromXmlNode(itemNode); break;

            case "DamageAmplifier":
                item = DamageAmplifier.BuildFromXmlNode(itemNode); break;

            default:
                throw new Exception("Item build failed - No type");
            }
            ItemAddSpawnItems(item, itemNode);
            return(item);
        }
Exemple #37
0
    public void Start()
    {
        //testing concrete classes
        Food hotdog      = new Food("hot dog", 8);
        Book warAndPeace = new Book("War and Peace", "\"We can know only that we know nothing.\"", 1215);

        hotdog.taste();
        hotdog.checkIfSpoiled();
        hotdog.use();

        warAndPeace.use();
        warAndPeace.open();
        warAndPeace.close();
        warAndPeace.close();

        //instancing concrete classes for lists
        Food soup     = new Food("bisque", 7);
        Food salad    = new Food("Caesar salad", 6);
        Book lifeOfPi = new Book("Life of Pi",
                                 "\"To choose doubt as a philosophy of life...\"", 356);
        Book littlePrince = new Book("The Little Prince", "\"It is only with the heart " +
                                     "that one can see rightly...\"", 128);
        Potion mediumPotion = new Potion("Mysterious Vial", 2);

        //polymorphic list of type Item (abstract class)
        itemList.Add(soup);
        itemList.Add(salad);
        itemList.Add(lifeOfPi);
        itemList.Add(littlePrince);
        itemList.Add(mediumPotion);

        //polymorphic list of type Consumable (interface)
        consumeList.Add(soup);
        consumeList.Add(salad);
        consumeList.Add(mediumPotion);
    }
Exemple #38
0
        public static void useItems()
        {
            var useBTRK = Misc.isChecked(ItemsMenu, "useBTRK");
            var myHP    = Misc.getSliderValue(ItemsMenu, "myHP");
            var enemyHP = Misc.getSliderValue(ItemsMenu, "enemyHP");
            var usePOT  = Misc.isChecked(ItemsMenu, "usePOT");

            if (Potion.IsReady() && !_Player.HasBuff("RegenerationPotion") && usePOT && !_Player.IsInShopRange())
            {
                if (_Player.CountEnemiesInRange(700) > 0 && _Player.Health + 200 < _Player.MaxHealth)
                {
                    Potion.Cast();
                }
                else if (_Player.Health < _Player.MaxHealth * 0.6)
                {
                    Potion.Cast();
                }
            }

            if (Btrk.IsOwned() || Cutl.IsOwned())
            {
                var t = TargetSelector.GetTarget(Btrk.Range, DamageType.Physical);
                if (t == null || !t.IsValidTarget())
                {
                    return;
                }
                if (useBTRK &&
                    _Player.HealthPercent <= myHP &&
                    t.HealthPercent <= enemyHP &&
                    (Btrk.IsReady() || Cutl.IsReady()))
                {
                    Btrk.Cast(t);
                    Cutl.Cast(t);
                }
            }
        }
Exemple #39
0
 void UseSlotInventory()
 {
     if (loot.contentloot != null)
     {
         GameObject objCreate = loot.contentloot.Use();
         if (loot.contentloot is Spell)
         {
             Ball bullet = objCreate.GetComponent <Ball>();
             if (bullet != null)
             {
                 //bullet.SetTarget();
             }
             Ring anneau = objCreate.GetComponent <Ring>();
             if (anneau != null)
             {
             }
             Potion potion = objCreate.GetComponent <Potion>();
             if (potion != null)
             {
             }
         }
     }
     //loot.Use();
 }
Exemple #40
0
    public void Consumable(Potion pot)
    {
        Inventory.instance.Consumable(pot);
        pot.Effect(player);

        if (pot.hasDuration)
        {
            if (pot.type == PotionTypes.AntiVenom)
            {
                StartCoroutine(AntiVenom());
            }

            else if (!consumableEffects.Contains(pot))
            {
                consumableEffects.Add(pot);
            }

            if (!timerIsActive)
            {
                timerIsActive = true;
                StartCoroutine(TemporaryBoostTimer(consumableEffects));
            }
        }
    }
Exemple #41
0
        /// <summary>
        /// Load the file and construct a Shop from
        /// the found items
        /// </summary>
        /// <param name="file">file to load</param>
        /// <returns></returns>
        public Shop load(string file)
        {
            var weapons = new List <Weapon>();
            var armours = new List <Armour>();
            var potions = new List <Potion>();

            try {
                File.ReadAllLines(file).ToList().ForEach(line => {
                    var s    = line.Split(',');
                    var rest = s.Skip(1).ToArray();
                    switch (s[0])
                    {
                    case "W":
                        weapons.Add(WeaponImpl.FromCSV(rest));
                        break;

                    case "A":
                        armours.Add(Armour.FromCSV(rest));
                        break;

                    case "P":
                        potions.Add(Potion.FromCSV(rest));
                        break;

                    default:
                        throw new InvalidItemException("Invalid entry in file");
                    }
                });
            } catch (FileNotFoundException e) {
                throw new ShopLoaderException(e.Message, e);
            } catch (InvalidItemException e) {
                throw new ShopLoaderException(e.Message, e);
            }

            return(new Shop(weapons, armours, potions));
        }
        public void priceTest()
        {
            Player            player      = new Player("", 500);
            Ingredient        ingredient1 = new Ingredient("Flaming Tail", "beast.png", 700, Rarity.Uncommon, (AlchymicEffect)8448);  //0010000100000000
            Ingredient        ingredient2 = new Ingredient("Koro Tentacle", "fish.png", 3500, Rarity.Godlike, (AlchymicEffect)12560); //0011000100010000
            Ingredient        ingredient3 = new Ingredient("Twisted Root", "plant.png", 200, Rarity.Inferior, (AlchymicEffect)30);    //0000000000011110
            List <Ingredient> ingredients = new List <Ingredient>();
            AlchymicEffect    effects     = 0;

            ingredients.Add(ingredient1);
            ingredients.Add(ingredient2);
            ingredients.Add(ingredient3);

            Potion potion = new Potion("", "potion.png", ((ingredient1.price + ingredient2.price + ingredient3.price) * (int)Rarity.Rubbish), Rarity.Rubbish, ingredients, effects);

            AlchymyTable table = new AlchymyTable(player, ingredient1, ingredient2, ingredient3, potion);

            table.craftPotion();
            //i1    0010000100000000
            //i2    0011000100010000
            //i3    0000000000011110
            //result0010000100010000
            Assert.AreEqual((4400 * 7), table.Potion.price);
        }
        public override void Run(ILiveEntity caster, MapDirection direction)
        {
            var    actionHandStorage = caster.Body.GetBodyStorage(ActionHandStorageType.Instance);
            Potion actionHandItem    = actionHandStorage.Storage[0] as Potion;
            var    readyHandStorage  = caster.Body.GetBodyStorage(ReadyHandStorageType.Instance);
            Potion readyHandItem     = readyHandStorage.Storage[0] as Potion;
            Potion flask             = actionHandItem ?? readyHandItem;

            if (flask != null && flask.FactoryBase == Factory.PotionFactories[20])
            {
                IBodyPart usedStorage = flask == actionHandItem ? actionHandStorage : readyHandStorage;
                usedStorage.TakeItemFrom(0);
                var item = Factory.PotionFactory.Create(new PotionInitializer
                {
                    PotionPower = rand.Next(16) + PowerSymbol.LevelOrdinal * 40
                });

                usedStorage.AddItemTo(item, 0);
            }
            else
            {
                GameConsole.Instance.Out.WriteLine(caster + "C10_FAILURE_NEEDS_FLASK_IN_HAND");
            }
        }
Exemple #44
0
    public void Redraw()
    {
        List <Potion> potions = book.GetSorted();

        foreach (Transform t in container)
        {
            Destroy(t.gameObject);
        }

        for (int i = 0; i < recipesPerPage; i++)
        {
            int index = i + pageNumber * recipesPerPage;
            if (index >= potions.Count)
            {
                break;
            }
            Potion r = potions[index];

            RecipeRenderer newRenderer = Instantiate(recipeRendererPrefab, container).GetComponent <RecipeRenderer>();
            newRenderer.potion = r;
        }

        pageTextField.text = (pageNumber + 1).ToString();
    }
Exemple #45
0
    protected override void OnShown()
    {
        if (contentType == "scar")
        {
            Scar scar = (Scar)content;
            _pic.url = "image/Scar/" + scar.scarId;
            ScarStaticInfo sinfo = GameStaticData.getInstance().getScarInfo(scar.scarId);
            _name.text = sinfo.scarName;
            _desp.text = sinfo.scarDesp;
        }
        else if (contentType == "potion")
        {
            Potion potion = (Potion)content;
            _pic.url = "image/Potion/" + potion.pid;
            PotionStaticInfo pinfo = GameStaticData.getInstance().getPotionInfo(potion.pid);
            _name.text = pinfo.pname;
            _desp.text = pinfo.pname;
        }
        else if (contentType == "talent")
        {
            HeroTalent talent = (HeroTalent)content;
            _pic.url   = "image/Talent/" + talent.talentId;
            _name.text = GameStaticData.getInstance().talents[int.Parse(talent.talentId)].talentName;
            _desp.text = GameStaticData.getInstance().talents[int.Parse(talent.talentId)].talentDesp;
        }
        else if (contentType == "tower_skill")
        {
            SkillState skill = (SkillState)content;
            _pic.url   = "image/TowerSkill/" + skill.skillId;
            _name.text = GameStaticData.getInstance().getTowerSkillInfo(skill.skillId).skillName;
            _desp.text = GameStaticData.getInstance().getTowerSkillInfo(skill.skillId).skillDesp;
        }


        //_pic.url = "";
    }
Exemple #46
0
        //---------------------------------------------------------------------------------------------

        public void FillKadRecursive(Potion potion, PotionQuality quality)
        {
            UOItem p = UO.Backpack.Items.FindType(potion.DefaultGraphic, potion.DefaultColor);

            PotionQualityDefinition pqDef = potion.GetQualityDefinition(quality);
            UOColor kadColor    = pqDef != null ? pqDef.KadColor : potion.TopKadColor;
            UOColor potionColor = pqDef != null ? pqDef.Color : potion.DefaultColor;

            UOItem kad = FindKadAround(Potion.KadGraphic, kadColor);

            if (p.Exist && kad.Exist)
            {
                Journal.Clear();
                //Game.Wait(250);
                kad.Use();
                UO.WaitTargetObject(p);
                JournalEventWaiter jew = new JournalEventWaiter(true, "Tohle nejde");
                jew.Wait(250);
                if (UO.Backpack.Items.FindType(potion.DefaultGraphic, potionColor).Exist)
                {
                    FillKadRecursive(potion, quality);
                }
            }
        }
Exemple #47
0
 public void RemovePotion(Potion potion)
 {
     itemManager.allItems.Remove (potion);
     allPotions.Remove (potion);
 }
Exemple #48
0
        private static void Misc()
        {
            var target = TargetSelector.GetTarget(1000, DamageType.Magical, Player.Instance.Position);

            if (check(misc, "AUTOPOT") && (!myhero.HasBuff("RegenerationPotion") && !myhero.HasBuff("ItemMiniRegenPotion") && !myhero.HasBuff("ItemCrystalFlask")) &&
                myhero.HealthPercent <= slider(misc, "POTMIN"))
            {
                if (Item.HasItem(Potion.Id) && Item.CanUseItem(Potion.Id))
                {
                    Potion.Cast();
                }

                else if (Item.HasItem(Biscuit.Id) && Item.CanUseItem(Biscuit.Id))
                {
                    Biscuit.Cast();
                }

                else if (Item.HasItem(RPotion.Id) && Item.CanUseItem(RPotion.Id))
                {
                    RPotion.Cast();
                }
            }

            if (check(misc, "skinhax"))
            {
                myhero.SetSkinId((int)misc["skinID"].Cast <ComboBox>().CurrentValue);
            }

            if (target != null && target.IsValidTarget() && !target.IsInvulnerable)
            {
                var Qpred = DemSpells.Q.GetPrediction(target);

                if (check(misc, "ksQ") && QDamage(target) > target.Health && DemSpells.Q.CanCast(target) && !Qpred.Collision &&
                    Qpred.HitChancePercent >= slider(pred, "QPred"))
                {
                    DemSpells.Q.Cast(Qpred.CastPosition);
                }

                if (check(misc, "autoign") && ignt.IsReady() && target.IsValidTarget(ignt.Range) &&
                    myhero.GetSummonerSpellDamage(target, DamageLibrary.SummonerSpells.Ignite) > target.Health)
                {
                    ignt.Cast(target);
                }
            }

            if (check(misc, "WSAVE") && !myhero.HasWBuff() && DemSpells.W1.IsReady())
            {
                var allies  = EntityManager.Heroes.Allies.Where(x => !x.IsDead && x.IsAlly && !x.IsMe && x.Distance(myhero.Position) < DemSpells.W1.Range);
                var enemies = EntityManager.Heroes.Enemies.Where(x => !x.IsDead && x.IsEnemy && x.Distance(myhero.Position) < 1500);

                if (allies.Any() && enemies.Any())
                {
                    var ClosestAlly  = allies.OrderBy(x => x.Distance(myhero.Position)).FirstOrDefault();
                    var ClosestEnemy = enemies.OrderBy(x => x.Distance(ClosestAlly.Position)).FirstOrDefault();

                    if (ClosestAlly != null && ClosestEnemy != null)
                    {
                        switch (myhero.CountAlliesInRange(DemSpells.W1.Range) > 1)
                        {
                        case false:
                            if (ClosestAlly.Distance(myhero.Position) <= DemSpells.W1.Range && ClosestAlly.CountEnemiesInRange(800) >= slider(misc, "WMINE") &&
                                ClosestAlly.HealthPercent <= slider(misc, "WMINH") &&
                                DemSpells.W1.CanCast(ClosestAlly))
                            {
                                DemSpells.W1.Cast(ClosestAlly);
                            }
                            break;

                        case true:
                            foreach (var ally in allies)
                            {
                                if (ally.Distance(myhero.Position) <= DemSpells.W1.Range && ally.CountEnemiesInRange(800) >= slider(misc, "WMINE") &&
                                    ally.HealthPercent <= slider(misc, "WMINH") &&
                                    DemSpells.W1.CanCast(ally))
                                {
                                    DemSpells.W1.Cast(ally);
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }
Exemple #49
0
    protected void CalculatePrice(Potion potion)
    {
        if (potion.type == PotionType.Health) {

            potion.price = potion.healPercentage * 4;
        }

        else potion.price = 100;
    }
        public BaseItem GetItemByItemID(int itemID)
        {
            DbParameter itemIdParameter = _db.CreateParameter(DbNames.GETITEMBYITEMID_ITEMID_PARAMETER, itemID);
            itemIdParameter.DbType = DbType.Int32;

            BaseItem b = null;

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETITEMBYITEMID_STOREDPROC, CommandType.StoredProcedure, itemIdParameter);

            int ordinalITEM_ITEMID = reader.GetOrdinal(DbNames.ITEM_ITEMID);
            int ordinalITEM_OWNERID = reader.GetOrdinal(DbNames.ITEM_OWNERID);
            int ordinalITEM_REFERENCEID = reader.GetOrdinal(DbNames.ITEM_REFERENCEID);
            int ordinalITEM_BTYPE = reader.GetOrdinal(DbNames.ITEM_BTYPE);
            int ordinalITEM_BKIND = reader.GetOrdinal(DbNames.ITEM_BKIND);
            int ordinalITEM_VISUALID = reader.GetOrdinal(DbNames.ITEM_VISUALID);
            int ordinalITEM_COST = reader.GetOrdinal(DbNames.ITEM_COST);
            int ordinalITEM_CLASS = reader.GetOrdinal(DbNames.ITEM_CLASS);
            int ordinalITEM_AMOUNT = reader.GetOrdinal(DbNames.ITEM_AMOUNT);
            int ordinalITEM_LEVEL = reader.GetOrdinal(DbNames.ITEM_LEVEL);
            int ordinalITEM_DEX = reader.GetOrdinal(DbNames.ITEM_DEX);
            int ordinalITEM_STR = reader.GetOrdinal(DbNames.ITEM_STR);
            int ordinalITEM_STA = reader.GetOrdinal(DbNames.ITEM_STA);
            int ordinalITEM_ENE = reader.GetOrdinal(DbNames.ITEM_ENE);
            int ordinalITEM_MAXIMBUES = reader.GetOrdinal(DbNames.ITEM_MAXIMBUES);
            int ordinalITEM_MAXDURA = reader.GetOrdinal(DbNames.ITEM_MAXDURA);
            int ordinalITEM_CURDURA = reader.GetOrdinal(DbNames.ITEM_CURDURA);
            int ordinalITEM_DAMAGE = reader.GetOrdinal(DbNames.ITEM_DAMAGE);
            int ordinalITEM_DEFENCE = reader.GetOrdinal(DbNames.ITEM_DEFENCE);
            int ordinalITEM_ATTACKRATING = reader.GetOrdinal(DbNames.ITEM_ATTACKRATING);
            int ordinalITEM_ATTACKSPEED = reader.GetOrdinal(DbNames.ITEM_ATTACKSPEED);
            int ordinalITEM_ATTACKRANGE = reader.GetOrdinal(DbNames.ITEM_ATTACKRANGE);
            int ordinalITEM_INCMAXLIFE = reader.GetOrdinal(DbNames.ITEM_INCMAXLIFE);
            int ordinalITEM_INCMAXMANA = reader.GetOrdinal(DbNames.ITEM_INCMAXMANA);
            int ordinalITEM_LIFEREGEN = reader.GetOrdinal(DbNames.ITEM_LIFEREGEN);
            int ordinalITEM_MANAREGEN = reader.GetOrdinal(DbNames.ITEM_MANAREGEN);
            int ordinalITEM_CRITICAL = reader.GetOrdinal(DbNames.ITEM_CRITICAL);
            int ordinalITEM_PLUS = reader.GetOrdinal(DbNames.ITEM_PLUS);
            int ordinalITEM_SLVL = reader.GetOrdinal(DbNames.ITEM_SLVL);
            int ordinalITEM_IMBUETRIES = reader.GetOrdinal(DbNames.ITEM_IMBUETRIES);
            int ordinalITEM_DRAGONSUCCESSIMBUETRIES = reader.GetOrdinal(DbNames.ITEM_DRAGONSUCCESSIMBUETRIES);
            int ordinalITEM_DISCOUNTREPAIRFEE = reader.GetOrdinal(DbNames.ITEM_DISCOUNTREPAIRFEE);
            int ordinalITEM_TOTALDRAGONIMBUES = reader.GetOrdinal(DbNames.ITEM_TOTALDRAGONIMBUES);
            int ordinalITEM_DRAGONDAMAGE = reader.GetOrdinal(DbNames.ITEM_DRAGONDAMAGE);
            int ordinalITEM_DRAGONDEFENCE = reader.GetOrdinal(DbNames.ITEM_DRAGONDEFENCE);
            int ordinalITEM_DRAGONATTACKRATING = reader.GetOrdinal(DbNames.ITEM_DRAGONATTACKRATING);
            int ordinalITEM_DRAGONLIFE = reader.GetOrdinal(DbNames.ITEM_DRAGONLIFE);
            int ordinalITEM_MAPPEDSTUFF = reader.GetOrdinal(DbNames.ITEM_MAPPEDSTUFF);
            int ordinalITEM_FORCENUMBER = reader.GetOrdinal(DbNames.ITEM_FORCENUMBER);
            int ordinalITEM_REBIRTHHOLE = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLE);
            int ordinalITEM_REBIRTHHOLEITEM = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLEITEM);
            int ordinalITEM_REBIRTHHOLESTAT = reader.GetOrdinal(DbNames.ITEM_REBIRTHHOLESTAT);
            int ordinalITEM_TOMAPID = reader.GetOrdinal(DbNames.ITEM_TOMAPID);
            int ordinalITEM_IMBUERATE = reader.GetOrdinal(DbNames.ITEM_IMBUERATE);
            int ordinalITEM_IMBUEINCREASE = reader.GetOrdinal(DbNames.ITEM_IMBUEINCREASE);
            int ordinalITEM_BOOKSKILLID = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLID);
            int ordinalITEM_BOOKSKILLLEVEL = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLLEVEL);
            int ordinalITEM_BOOKSKILLDATA = reader.GetOrdinal(DbNames.ITEM_BOOKSKILLDATA);
            int ordinalITEM_MAXPOLISHTRIES = reader.GetOrdinal(DbNames.ITEM_MAXPOLISHTRIES);
            int ordinalITEM_POLISHTRIES = reader.GetOrdinal(DbNames.ITEM_POLISHTRIES);
            int ordinalITEM_VIGISTAT1 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT1);
            int ordinalITEM_VIGISTAT2 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT2);
            int ordinalITEM_VIGISTAT3 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT3);
            int ordinalITEM_VIGISTAT4 = reader.GetOrdinal(DbNames.ITEM_VIGISTAT4);
            int ordinalITEM_VIGISTATADD1 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD1);
            int ordinalITEM_VIGISTATADD2 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD2);
            int ordinalITEM_VIGISTATADD3 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD3);
            int ordinalITEM_VIGISTATADD4 = reader.GetOrdinal(DbNames.ITEM_VIGISTATADD4);
            int ordinalITEM_BAG = reader.GetOrdinal(DbNames.ITEM_BAG);
            int ordinalITEM_SLOT = reader.GetOrdinal(DbNames.ITEM_SLOT);
            int ordinalITEM_SIZEX = reader.GetOrdinal(DbNames.ITEM_SIZEX);
            int ordinalITEM_SIZEY = reader.GetOrdinal(DbNames.ITEM_SIZEY);

            while (reader.Read())
            {
                int BType = reader.GetByte(ordinalITEM_BTYPE);
                int BKind = reader.GetByte(ordinalITEM_BKIND);

                if (BType == (byte)bType.Weapon || BType == (byte)bType.Clothes || BType == (byte)bType.Hat || BType == (byte)bType.Necklace
                    || BType == (byte)bType.Ring || BType == (byte)bType.Shoes || BType == (byte)bType.Cape)
                {
                    if (BKind == (byte)bKindWeapons.Sword && BType == (byte)bType.Weapon)
                    {
                        b = new Sword();
                    }
                    if (BKind == (byte)bKindWeapons.Blade && BType == (byte)bType.Weapon)
                    {
                        b = new Blade();
                    }
                    if (BKind == (byte)bKindWeapons.Fan && BType == (byte)bType.Weapon)
                    {
                        b = new Fan();
                    }
                    if (BKind == (byte)bKindWeapons.Brush && BType == (byte)bType.Weapon)
                    {
                        b = new Brush();
                    }
                    if (BKind == (byte)bKindWeapons.Claw && BType == (byte)bType.Weapon)
                    {
                        b = new Claw();
                    }
                    if (BKind == (byte)bKindWeapons.Axe && BType == (byte)bType.Weapon)
                    {
                        b = new Axe();
                    }
                    if (BKind == (byte)bKindWeapons.Talon && BType == (byte)bType.Weapon)
                    {
                        b = new Talon();
                    }
                    if (BKind == (byte)bKindWeapons.Tonfa && BType == (byte)bType.Weapon)
                    {
                        b = new Tonfa();
                    }
                    if (BKind == (byte)bKindArmors.SwordMan && BType == (byte)bType.Clothes)
                    {
                        b = new Clothes();
                    }
                    if (BKind == (byte)bKindArmors.Mage && BType == (byte)bType.Clothes)
                    {
                        b = new Dress();
                    }
                    if (BKind == (byte)bKindArmors.Warrior && BType == (byte)bType.Clothes)
                    {
                        b = new Armor();
                    }
                    if (BKind == (byte)bKindArmors.GhostFighter && BType == (byte)bType.Clothes)
                    {
                        b = new LeatherClothes();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Hat)
                    {
                        b = new Hood();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Hat)
                    {
                        b = new Tiara();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Hat)
                    {
                        b = new Helmet();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Hat)
                    {
                        b = new Hat();
                    }
                    if (BKind == (byte)bKindHats.SwordMan && BType == (byte)bType.Shoes)
                    {
                        b = new SmBoots();
                    }
                    if (BKind == (byte)bKindHats.Mage && BType == (byte)bType.Shoes)
                    {
                        b = new MageBoots();
                    }
                    if (BKind == (byte)bKindHats.Warrior && BType == (byte)bType.Shoes)
                    {
                        b = new WarriorShoes();
                    }
                    if (BKind == (byte)bKindHats.GhostFighter && BType == (byte)bType.Shoes)
                    {
                        b = new GhostFighterShoes();
                    }
                    if (BKind == 0 && BType == (byte)bType.Ring)
                    {
                        b = new Ring();
                    }
                    if (BKind == 0 && BType == (byte)bType.Necklace)
                    {
                        b = new Necklace();
                    }
                    if (BType == (byte)bType.Cape)
                    {
                        b = new Cape();
                        Cape c = b as Cape;
                        c.MaxPolishImbueTries = reader.GetInt16(ordinalITEM_MAXPOLISHTRIES);
                        c.PolishImbueTries = reader.GetByte(ordinalITEM_POLISHTRIES);
                        c.VigiStat1 = reader.GetInt16(ordinalITEM_VIGISTAT1);
                        c.VigiStatAdd1 = reader.GetInt16(ordinalITEM_VIGISTATADD1);
                        c.VigiStat2 = reader.GetInt16(ordinalITEM_VIGISTAT2);
                        c.VigiStatAdd2 = reader.GetInt16(ordinalITEM_VIGISTATADD2);
                        c.VigiStat3 = reader.GetInt16(ordinalITEM_VIGISTAT3);
                        c.VigiStatAdd3 = reader.GetInt16(ordinalITEM_VIGISTATADD3);
                        c.VigiStat4 = reader.GetInt16(ordinalITEM_VIGISTAT4);
                        c.VigiStatAdd4 = reader.GetInt16(ordinalITEM_VIGISTATADD4);
                    }

                    Equipment e = b as Equipment;
                    e.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    e.RequiredDexterity = reader.GetInt16(ordinalITEM_DEX);
                    e.RequiredStrength = reader.GetInt16(ordinalITEM_STR);
                    e.RequiredStamina = reader.GetInt16(ordinalITEM_STA);
                    e.RequiredEnergy = reader.GetInt16(ordinalITEM_ENE);
                    e.MaxImbueTries = reader.GetByte(ordinalITEM_MAXIMBUES);
                    e.Durability = reader.GetInt16(ordinalITEM_CURDURA);
                    e.MaxDurability = reader.GetInt16(ordinalITEM_MAXDURA);
                    e.Damage = reader.GetInt16(ordinalITEM_DAMAGE);
                    e.Defence = reader.GetInt16(ordinalITEM_DEFENCE);
                    e.AttackRating = reader.GetInt16(ordinalITEM_ATTACKRATING);
                    e.AttackSpeed = reader.GetInt16(ordinalITEM_ATTACKSPEED);
                    e.AttackRange = reader.GetInt16(ordinalITEM_ATTACKRANGE);
                    e.IncMaxLife = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    e.IncMaxMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                    e.IncLifeRegen = reader.GetInt16(ordinalITEM_LIFEREGEN);
                    e.IncManaRegen = reader.GetInt16(ordinalITEM_MANAREGEN);
                    e.Critical = reader.GetInt16(ordinalITEM_CRITICAL);
                    e.Plus = reader.GetByte(ordinalITEM_PLUS);
                    e.Slvl = reader.GetByte(ordinalITEM_SLVL);
                    e.ImbueTries = reader.GetByte(ordinalITEM_IMBUETRIES);
                    e.DragonSuccessImbueTries = reader.GetInt16(ordinalITEM_DRAGONSUCCESSIMBUETRIES);
                    e.DiscountRepairFee = reader.GetByte(ordinalITEM_DISCOUNTREPAIRFEE);
                    e.TotalDragonImbueTries = reader.GetInt16(ordinalITEM_TOTALDRAGONIMBUES);
                    e.DragonDamage = reader.GetInt16(ordinalITEM_DRAGONDAMAGE);
                    e.DragonDefence = reader.GetInt16(ordinalITEM_DRAGONDEFENCE);
                    e.DragonAttackRating = reader.GetInt16(ordinalITEM_DRAGONATTACKRATING);
                    e.DragonLife = reader.GetInt16(ordinalITEM_DRAGONLIFE);
                    e.MappedData = reader.GetByte(ordinalITEM_MAPPEDSTUFF);
                    e.ForceSlot = reader.GetByte(ordinalITEM_FORCENUMBER);
                    e.RebirthHole = reader.GetByte(ordinalITEM_REBIRTHHOLE);
                    e.RebirthHoleItem = reader.GetByte(ordinalITEM_REBIRTHHOLEITEM);
                    e.RebirthHoleStat = reader.GetInt16(ordinalITEM_REBIRTHHOLESTAT);
                }

                if (BType == (byte)bType.ImbueItem)
                {
                    if (BKind == (byte)bKindStones.Black)
                    {
                        b = new Black();
                    }
                    if (BKind == (byte)bKindStones.White)
                    {
                        b = new White();
                    }
                    if (BKind == (byte)bKindStones.Red)
                    {
                        b = new Red();
                    }
                    if (BKind == (byte)bKindStones.Dragon)
                    {
                        b = new Dragon();
                    }

                    ImbueItem im = b as ImbueItem;
                    im.ImbueChance = reader.GetInt16(ordinalITEM_IMBUERATE);
                    im.IncreaseValue = reader.GetInt16(ordinalITEM_IMBUEINCREASE);
                }

                if (BType == (byte)bType.Potion)
                {
                    if (BKind == (byte)bKindPotions.Normal)
                    {
                        b = new Potion();
                    }
                    if (BKind == (byte)bKindPotions.Elixir)
                    {
                        b = new Elixir();
                    }

                    PotionItem pot = b as PotionItem;
                    pot.HealHp = reader.GetInt16(ordinalITEM_INCMAXLIFE);
                    pot.HealMana = reader.GetInt16(ordinalITEM_INCMAXMANA);
                }
                if (BType == (byte)bType.Book)
                {
                    if (BKind == (byte)bKindBooks.SoftBook)
                    {
                        b = new SoftBook();
                    }
                    if (BKind == (byte)bKindBooks.HardBook)
                    {
                        b = new HardBook();
                    }

                    BookItem book = b as BookItem;
                    book.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                    book.RequiredLevel = reader.GetInt16(ordinalITEM_LEVEL);
                    book.SkillID = reader.GetInt32(ordinalITEM_BOOKSKILLID);
                    book.SkillLevel = reader.GetByte(ordinalITEM_BOOKSKILLLEVEL);
                    book.SkillData = reader.GetInt32(ordinalITEM_BOOKSKILLDATA);
                }
                if (BType == (byte)bType.Bead)
                {
                    if (BKind == (byte)bKindBeads.Normal)
                    {
                        b = new Bead();
                    }
                    BeadItem bead = b as BeadItem;
                    bead.ToMapID = reader.GetInt32(ordinalITEM_TOMAPID);
                }

                b.ItemID = reader.GetInt32(ordinalITEM_ITEMID);
                b.OwnerID = reader.GetInt32(ordinalITEM_OWNERID);
                b.ReferenceID = reader.GetInt16(ordinalITEM_REFERENCEID);
                b.VisualID = reader.GetInt16(ordinalITEM_VISUALID);
                b.Bag = reader.GetByte(ordinalITEM_BAG);
                b.Slot = reader.GetByte(ordinalITEM_SLOT);
                b.bType = reader.GetByte(ordinalITEM_BTYPE);
                b.bKind = reader.GetByte(ordinalITEM_BKIND);
                b.RequiredClass = reader.GetByte(ordinalITEM_CLASS);
                b.Amount = reader.GetInt16(ordinalITEM_AMOUNT);
                b.SizeX = reader.GetByte(ordinalITEM_SIZEX);
                b.SizeY = reader.GetByte(ordinalITEM_SIZEY);
                b.Price = reader.GetInt32(ordinalITEM_COST);
            }

            reader.Close();
            _db.Close();

            return b;
        }
 public void addPotion(Potion potion)
 {
     string name = "p" + objects.Count;
     potion._name  = name;
     objects[name] = potion;
 }
Exemple #52
0
 public void SetIsNearPotion (bool isNearP, Potion p)
 {
     isNearPotion = isNearP;
     potion = p;
 }
 public void spawnPotion(Potion potion, Point spawnTile, int spawnType)
 {
     potion.onSpawn(spawnTile, spawnType);
 }
Exemple #54
0
 public BuffProxy(GetUnitDelegate del, AuraProxy ar)
     : base(del)
 {
     Source = ar;
     pre_steady_focus = new PreSteadyFocus(this);
     bloodlust = new Bloodlust(this);
     potion = new Potion(this);
     anytrinket = new AnyTrinket(this);
     incanters_flow = new IncantersFlow(this);
     raging_blow = new BuffInternal(dbc.Spells[131116], this, "raging_blow_special");
     colossus_smash = new DebuffProxy.DebuffInternal(dbc.Spells[SimcNames.debuffs["colossus_smash"].First().V2], this, "colossus_smash");
     colossus_smash_up = new DebuffProxy.DebuffInternal(dbc.Spells[SimcNames.debuffs["colossus_smash"].First().V2], this, "colossus_smash_up");
 }
Exemple #55
0
 public void TouchPlayer(int userId, Potion reason)
 {
     this.Events.Raise(new TouchUserSendEvent(userId, reason));
 }
Exemple #56
0
 public TouchUserSendEvent(int userId, Potion reason)
 {
     this.UserId = userId;
     this.Reason = reason;
 }
Exemple #57
0
        private void PotionManagement()
        {
            if (Player.HasBuff("RegenerationPotion") || Player.HasBuff("ItemMiniRegenPotion") || Player.HasBuff("ItemCrystalFlaskJungle") || Player.HasBuff("ItemDarkCrystalFlask"))
            {
                return;
            }

            if (Potion.IsReady())
            {
                if (Player.Health + 200 < Player.MaxHealth && Player.CountEnemiesInRange(700) > 0)
                {
                    Potion.Cast();
                }
                else if (Player.Health < Player.MaxHealth * 0.6)
                {
                    Potion.Cast();
                }
                return;
            }
            else if (Biscuit.IsReady())
            {
                if (Player.Health + 250 < Player.MaxHealth && Player.CountEnemiesInRange(700) > 0)
                {
                    Biscuit.Cast();
                }
                else if (Player.Health < Player.MaxHealth * 0.6)
                {
                    Biscuit.Cast();
                }
                return;
            }
            else if (Hunter.IsReady())
            {
                if (Player.Health + 250 < Player.MaxHealth && Player.CountEnemiesInRange(700) > 0)
                {
                    Hunter.Cast();
                }
                else if (Player.Health < Player.MaxHealth * 0.6)
                {
                    Hunter.Cast();
                }
                return;
            }
            else if (Corrupting.IsReady())
            {
                if (Player.Health + 250 < Player.MaxHealth && Player.CountEnemiesInRange(700) > 0)
                {
                    Corrupting.Cast();
                }
                else if (Player.Health < Player.MaxHealth * 0.6)
                {
                    Corrupting.Cast();
                }

                return;
            }
            else if (Refillable.IsReady())
            {
                if (Player.Health + 250 < Player.MaxHealth && Player.CountEnemiesInRange(700) > 0)
                {
                    Refillable.Cast();
                }
                else if (Player.Health < Player.MaxHealth * 0.6)
                {
                    Refillable.Cast();
                }
                return;
            }
        }
Exemple #58
0
 public CooldownProxy(GetUnitDelegate del)
     : base(del)
 {
     potion = new Potion(this);
 }
Exemple #59
0
 public bool addPotion(Potion p)
 {
     if(p.getWeight() + weight > weightLimit) {
         return false;
     } else {
         potions.Add(p);
         weight += p.getWeight();
         return true;
     }
 }
Exemple #60
0
        private void SetPotion(Potion potion, int value)
        {
            lock (this._potionCounts)
            {
                this._potionCounts[potion] = value;

                this.SynchronizePlatform.Do(() =>
                    this.Events.Raise(new PotionCountEvent(potion, value)));
            }
        }