public void Create(Potions potion) { _potion = potion; _spriteRenderer.sprite = potion.icon; transform.localScale *= 2; _spriteRenderer.sortingOrder = (int)transform.position.y * -15; }
public void Drink(Potions potion) { int potionIndex = (int)potion.potionType; print(potionIndex); switch (potionIndex) { case 0: print("Case 0"); DrinkHealthPotion(potion.healthModifier); break; case 1: print("Case 1"); //DrinkDamagePotion(int potionDamageModifier); break; case 2: print("Case 2"); break; default: print("potion outside range"); break; } }
private void GenerateItems() { //ArmorName, Defense, Price ShopItems.Add(new Armor("Leather", 4, 8)); ShopItems.Add(new Armor("BreastPlate", 8, 20)); ShopItems.Add(new Armor("Augmented Chain", 15, 45)); ShopItems.Add(new Armor("CorosPlate", 25, 60)); //WeaponName, Strength, Price ShopItems.Add(new Weapon("Recurve bow", 3, 9)); ShopItems.Add(new Weapon("BigAxe", 6, 22)); ShopItems.Add(new Weapon("XV sword", 19, 49)); ShopItems.Add(new Weapon("Arming sword", 29, 65)); //ShieldName, Defense, Price ShopItems.Add(new Shield("Wooden Shield", 3, 10)); ShopItems.Add(new Shield("Battle Shield", 8, 26)); ShopItems.Add(new Shield("Dragon Shield", 15, 40)); //PotionName,HealthRestore, Price Potions.Add(new Potion("Health Potion", 4, 5)); Potions.Add(new Potion("Strong Health Potion", 7, 7)); Potions.Add(new Potion("Great Health Potion", 14, 10)); Potions.Add(new Potion("Gold Health Potion", 19, 13)); }
public void SetPotion(Potions potion) { currentPotion = potion; startTimer = potion.tempsDeLaRecette; timerComplete = false; UpdateGraphics(); }
public void UpdateInventoryCategories() { Potions.Clear(); Treasures.Clear(); Weapons.Clear(); Allies.Clear(); foreach (var GameItem in _inventory) { if (GameItem.GameItem is Potion) { Potions.Add(GameItem); } if (GameItem.GameItem is Treasure) { Treasures.Add(GameItem); } if (GameItem.GameItem is Weapon) { Weapons.Add(GameItem); } if (GameItem.GameItem is Allies) { Allies.Add(GameItem); } } }
/// <summary> /// update the game item category lists /// </summary> public void UpdateInventoryCategories() { Potions.Clear(); Weapons.Clear(); Treasure.Clear(); Relics.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Potion) { Potions.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Weapon) { Weapons.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Treasure) { Treasure.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Relic) { Relics.Add(gameItemQuantity); } } }
/// <summary> /// Add 'quantity' of 'itemToAdd' to inventory, or increase existing quantity /// </summary> /// <param name="itemToAdd">Item to be added to inventory (can already be in inventory)</param> /// <param name="quantity">Amount of item to be added (Default = 1)</param> public void AddItemToInventory(Item itemToAdd, int quantity = 1) { InventoryItem item = Inventory.SingleOrDefault( ii => ii.Details.ID == itemToAdd.ID); if (item == null) { // They didn't have the item, so add it to their inventory // If there are none of this type of item, and it has a "CurrentItem" // property, then set this to it, so indexing will work right // NOTE: The UI code will follow-thru with the updates, based on // RaiseInventoryChangedEvent and Player.PropertyChanged event if (itemToAdd is Weapon && !Weapons.Any()) { CurrentWeapon = (Weapon)itemToAdd; } if (itemToAdd is HealingPotion && !Potions.Any()) { CurrentPotion = (HealingPotion)itemToAdd; } Inventory.Add(new InventoryItem(itemToAdd, quantity)); } else { // They already have the item in inventory, so just increase quantity item.Quantity += quantity; } // An inventory quantity was changed, raise an event RaiseInventoryChangedEvent(itemToAdd); }
private void PrintPotions() { while (AttackGears.Count < numberOfAttackGears) { Potions.Add(PotionFactory.MakePotion(5)); continue; } }
public static List <Potions> LoadPotions(string user) { List <Potions> potionsList = new List <Potions>(); StreamReader inputFile; inputFile = File.OpenText($"{Environment.CurrentDirectory}/save/{user}/{user}-Potions.data"); int i = 0; while (!inputFile.EndOfStream) { string line = inputFile.ReadLine(); if (i != 0) { string[] words = line.Split(','); string id = words[0]; string name = words[1]; string desc = words[2]; string input = words[3]; int hp = int.Parse(input); string room = words[4]; Potions loadedPotion = Potions.GetPotions(id, name, desc, hp, room); potionsList.Add(loadedPotion); } i++; } return(potionsList); }
public static PotionResult ExecutePotion(ShardedCommandContext context, string potion, ulong user, ulong target) { var config = GlobalUserAccounts.GetUserAccount(user); var choms = ActiveChomusuke.GetActiveChomusuke(user, config.OpponentId); var chom1 = choms.Item1; var chom2 = choms.Item2; var result = new PotionResult(); switch (potion) { case "Strength Potion": result = Potions.StrengthPotion(context, chom1, chom2, target); break; case "Debuff Potion": result = Potions.DebuffPotion(context, chom1, chom2, target); break; case "Speed Potion": result = Potions.SpeedPotion(context, chom1, chom2, target); break; case "Equalizer Potion": result = Potions.EqualizerPotion(context, chom1, chom2, target); break; } return(result); }
public void AddPotion(Potion potion) { var potions = Potions.ToList(); potions.Add(potion); Potions = potions; }
public Inventory Remove(Potion w) { if (Potions.Contains(w)) { Potions.Remove(w); } return(this); }
public static IEnumerable <WoWItem> GetPotionsSortedByPriority(this Inventory bag) { var potions = bag .GetAllItems() .Where(item => item.IsPotion()); return(Potions.SortByPriority(potions)); }
private void TurnOptionsOff() { XP.SetActive(false); Points.SetActive(false); Batles.SetActive(false); Monsters.SetActive(false); Potions.SetActive(false); }
public void AddPotion(IEventArgs potion) { EventArgsPotAth potAth = potion as EventArgsPotAth; Potions pot = potAth.Pot; int id = potAth.Id; _potions[id].SetPotion(pot); }
public Inventory Add(Potion w) { if (Potions.Count >= MaxSize) { throw new ArgumentOutOfRangeException(); } Potions.Add(w); return(this); }
IEnumerator UsePotion(Potions pot) { PotionEffect(pot); _usable = false; yield return(new WaitForSeconds(_playerData.PotionsCooldown)); _usable = true; }
private void CallCoroutine(int index) { Potions pot = _playerData.Inventory.UsePotion(index); if (pot == null) { return; } StartCoroutine(UsePotion(pot)); }
public void CreatePotion() { newPotion = new Potions(); //create description newPotion.ItemDescription = "Restores your Health/Mana"; //Potion ID newPotion.ItemID = Random.Range(1, 101); //Potion type ChoosePotionType(); }
public void MixPotion(Potions p) { if (Time.fixedTime - last_time < wait) { return; } Instantiate(prefabs[(int)p], transform); last_time = Time.fixedTime; }
public void Pay(string selection) { if (selection.Substring(0, 1) == "W") { var weapon = (Weapon)NameItemList[selection]; if (Hero.Gold >= weapon.OriginalValue) { Hero.Gold -= weapon.OriginalValue; Weapons.Remove(weapon); Hero.WeaponsBag.Add(weapon); Console.WriteLine($"You spent {weapon.OriginalValue} gold for a {weapon.Name}"); Menu(); } else { Console.WriteLine($"NO gold , No sell"); Menu(); } } else if (selection.Substring(0, 1) == "A") { var armor = (Armor)NameItemList[selection]; if (Hero.Gold >= armor.OriginalValue) { Hero.Gold -= armor.OriginalValue; Armors.Remove(armor); Hero.ArmorsBag.Add(armor); Console.WriteLine($"You spent {armor.OriginalValue} gold for a {armor.Name}"); Menu(); } else { Console.WriteLine($"NO gold , No sell"); Menu(); } } else if (selection.Substring(0, 1) == "P") { var potion = (Potion)NameItemList[selection]; if (Hero.Gold >= potion.OriginalValue) { Hero.Gold -= potion.OriginalValue; Potions.Remove(potion); Hero.PotionsBag.Add(potion); Console.WriteLine($"You spent {potion.OriginalValue} gold for a {potion.Name}"); Menu(); } else { Console.WriteLine($"NO gold , No sell"); Menu(); } } }
public void CountDuplicatesTest_GiveDuplicatesAndSingleItems_WillPrintThemGrouped() { Swords testSword = new Swords(); testSword.Name = "testSword"; testSword.Price = 5; Shields testShield = new Shields(); testShield.Name = "testShield"; testShield.Price = 10; Consumables testConsumable = new Consumables(); testConsumable.Name = "testConsumable"; testConsumable.Price = 15; Potions testPotion = new Potions(); testPotion.Name = "testPotion"; testPotion.Price = 20; Masks testMask = new Masks(); testMask.Name = "testMask"; testMask.Price = 25; List <Product> testCart = new List <Product>(); for (int i = 0; i < 5; i++) { testCart.Add(testSword); } for (int i = 0; i < 132; i++) { testCart.Add(testShield); } testCart.Add(testConsumable); for (int i = 0; i < 45; i++) { testCart.Add(testPotion); } for (int i = 0; i < 98; i++) { testCart.Add(testMask); } string expected = "testSword x 5 - - - 25 Rupees\n\ntestShield x 132 - - - 1320 Rupees\n\ntestConsumable" + " x 1 - - - 15 Rupees\n\ntestPotion x 45 - - - 900 Rupees\n\ntestMask x 98 - - - 2450 Rupees\n\n"; string itemizerTest = Itemizer.CountDuplicates(testCart); Assert.AreEqual(expected, itemizerTest); }
private static void InitActivator() { MyMenuExtensions.ActivatorMenu = Menu.AddMenu("Flowers' Activator"); AutoLevels.AddToMenu(MyMenuExtensions.ActivatorMenu); Cleanese.AddToMenu(MyMenuExtensions.ActivatorMenu); //Defensives.AddToMenu(MyMenuExtensions.ActivatorMenu); //Offensives.AddToMenu(MyMenuExtensions.ActivatorMenu); Potions.AddToMenu(MyMenuExtensions.ActivatorMenu); Chat.Print("Flowers' ADC Series: Activator Init Successful! Made by NightMoon"); }
/// <summary> /// Drink Potion is a method that is specific to heros. I did not inherit it from Character. Therefore I don't need the override keyword. /// Also, I don't want to rewrite this method for every single class that inherits from hero, so I am making one to rule them all here. /// </summary> public void DrinkPotion(PotionName PotionName) { Potion p = Potions.Where(p => p.Name == PotionName).FirstOrDefault(); p.Drink(Name); // Potions give you a health boost. So make sure to increase your health bar! HealthBar += p.HealthBoostAmount; // Potions are a one time use, so remove it from your list of potions Potions.Remove(p); }
public void BuyPotion() { //Display weapon list Console.Clear(); Console.WriteLine("----------------------------------------------------------------------------------------------"); Console.WriteLine("# Potions"); Console.WriteLine("----------------------------------------------------------------------------------------------"); Console.WriteLine(String.Format("{0,3} | {1,-25} | {2,-7} | {3,-7} |", "ID", "Name", "Healing", "Price")); Console.WriteLine("----------------------------------------------------------------------------------------------"); for (var i = 0; i < Potions.Count(); i++) { Console.WriteLine(String.Format("{0,3} | {1,-25} | {2,-7} | {3,-7} |", i + 1, Potions[i].Name, Potions[i].HealthRestored + " HP", Potions[i].Price + " Gold")); } Console.WriteLine("----------------------------------------------------------------------------------------------"); Console.WriteLine($"# You have {Hero.GoldCoin} Gold now!"); Console.WriteLine("----------------------------------------------------------------------------------------------"); Console.Write("# Select the Potion ID you want to buy : "); var KeyInput = Hero.GetUserInputNumber(); var shopPotion = Potions.ElementAtOrDefault(0); if (KeyInput > Potions.Count() || KeyInput <= 0) { Console.WriteLine("# Select the corrent Potion ID : "); shopPotion = null; } else { shopPotion = Potions.ElementAtOrDefault(KeyInput - 1); } if (shopPotion != null) { if ((Hero.GoldCoin - shopPotion.Price) >= 0) { Hero.PotionsBag.Add(shopPotion); Hero.GoldCoin = Hero.GoldCoin - shopPotion.Price; Console.WriteLine($"Buying '{shopPotion.Name}' is Completed!"); } else { Console.WriteLine("Sorry, you don't have enough Gold !"); } } else { Console.WriteLine("Sorry,No result!"); } Console.WriteLine("----------------------------------------------------------------------------------------------"); }
public void GetTotalTest_GiveRandomPricedProducts_WillPrintTheTotalPrice() { Swords testSword = new Swords(); testSword.Name = "testSword"; testSword.Price = 5; Shields testShield = new Shields(); testShield.Name = "testShield"; testShield.Price = 10; Consumables testConsumable = new Consumables(); testConsumable.Name = "testConsumable"; testConsumable.Price = 15; Potions testPotion = new Potions(); testPotion.Name = "testPotion"; testPotion.Price = 20; Masks testMask = new Masks(); testMask.Name = "testMask"; testMask.Price = 25; List <Product> testCart = new List <Product>(); for (int i = 0; i < 5; i++) { testCart.Add(testSword); } for (int i = 0; i < 132; i++) { testCart.Add(testShield); } testCart.Add(testConsumable); for (int i = 0; i < 45; i++) { testCart.Add(testPotion); } for (int i = 0; i < 98; i++) { testCart.Add(testMask); } int actual = Itemizer.GetTotal(testCart); Assert.AreEqual(4710, actual); }
// Use this for initialization void Start() { foreach (Aspects.Secondary aspect in Enum.GetValues(typeof(Aspects.Secondary))) { if (aspect == Aspects.Secondary.NONE) { Potions.instance().add( PrimaryAspects[0], PrimaryAspects[1], PrimaryAspects[2], new MultiSet <Aspects.Secondary>(), Slot, aspect, null); } else if (aspect == Aspects.Secondary.UNKNOWN || aspect == Aspects.Secondary.BASIC) { // No op. Weird special cases } else { Effect effect = getEffectForAspect(aspect); Potions.instance().add( PrimaryAspects[0], PrimaryAspects[1], PrimaryAspects[2], new MultiSet <Aspects.Secondary>() { aspect, aspect, aspect }, Slot, aspect, effect); Potions.instance().add( PrimaryAspects[0], PrimaryAspects[1], PrimaryAspects[2], new MultiSet <Aspects.Secondary>() { aspect, aspect }, Slot, Aspects.Secondary.BASIC, null); } } Destroy(this); }
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)); } } }
static void Main(string[] args) { List <int> maListe = new List <int>(); maListe.Add(42); TypedList <int> maListeTypee = new TypedList <int>(); maListeTypee.x = 2; // x est maintenant un int d'après la TypeList int coutn = ListCount <int>(maListe); //--------------------------------------------------------- Inventory inventaire = new Inventory(); inventaire.weapons.AddItem(new Weapon { name = "excalibur", strenght = 99 }); inventaire.weapons.AddItem(new Weapon { name = "excalifour", strenght = 10 }); Potions elixir = new Potions(); elixir.name = "elixir"; elixir.useCount = 1; // inventaire.weapons.AddItem(elixir) Ceci ne marche pas car les classes sont typés et le AddItem attend un weapon inventaire.consumables.AddItem(elixir); Sword woodenSword = new Sword(); woodenSword.name = "stick"; woodenSword.strenght = 42; inventaire.weapons.AddItem(woodenSword); //--------------------------------------------------------- }
public static void FindAndUsePotion(Potions p, out bool found) { var _backpack = World.Player.FindItemByLayer(Layer.Backpack); found = false; var potion = World.Player.FindItemByGraphic((ushort)p); if (potion != null) { GameActions.DoubleClickQueued(potion); GameActions.Print("AP: Using Potions."); found = true; } }
// Use this for initialization void Start() { int num1 = 4; int num2 = num1; num1 = 7; Potions greenPotion = new Potions(5,Color.green); Potions bluePotion = new Potions (9,Color.cyan); Potions yellowPotion = greenPotion; yellowPotion.potionColor = Color.yellow; Debug.Log ("greenpotion potency: " + greenPotion.potionColor); Debug.Log ("bluepotion potency: " + bluePotion.potionColor); Func(num2, bluePotion); }
void Func(int _num, Potions _pot) { _num = 10; _pot.potionColor = Color.gray; }