public override void SpellCast(SpellCaster player) { if (player.iMana < iManaCost) { PanelHolder.instance.displayNotify("Not enough Mana!", "You do not have enough mana to cast this spell.", "OK"); } else { // subtract mana and glyph costs player.iMana -= iManaCost; ItemList itemList = GameObject.Find("ItemList").GetComponent <ItemList>(); List <ItemObject> highTiers = new List <ItemObject>(); highTiers.AddRange(itemList.tier1Items); highTiers.AddRange(itemList.tier2Items); ItemObject item1 = highTiers[Random.Range(0, highTiers.Count)]; ItemObject item2 = highTiers[Random.Range(0, highTiers.Count)]; ItemObject item3 = highTiers[Random.Range(0, highTiers.Count)]; player.AddToInventory(item1); player.AddToInventory(item2); player.AddToInventory(item3); PanelHolder.instance.displayNotify("Hollow Creation", "You created " + item1.name + ", " + item2.name + ", and " + item3.name + ". Hollow Creation disappeared from your memory without a trace...", "MainPlayerScene"); // remove this spell from castable spells once it's cast player.chapter.spellsCollected.Remove(this); player.numSpellsCastThisTurn++; } }
public override void SpellCast(SpellCaster player) { if (player.inventory.Count < 2) { PanelHolder.instance.displayNotify("Not enough Items!", "You need 2 items to cast this spell.", "OK"); } // cast spell for free if Umbra's Eclipse is active else if (SpellTracker.instance.CheckUmbra()) { // destroy 2 random items from inventory ItemObject item1 = player.inventory[Random.Range(0, player.inventory.Count)]; player.RemoveFromInventory(item1); ItemObject item2 = player.inventory[Random.Range(0, player.inventory.Count)]; player.RemoveFromInventory(item2); // get a random item string[] items = new string[] { "Mimetic Vellum", "Crystal Mirror", "Rift Talisman" }; ItemObject newItem = GameObject.Find("ItemList").GetComponent <ItemList>().GetItemFromName(items[Random.Range(0, 3)]); player.AddToInventory(newItem); PanelHolder.instance.displayBoardScan("Rigel's Ascension", "You destroyed " + item1.name + " and " + item2.name + " and gained " + newItem.name + "!", newItem.sprite, "MainPlayerScene"); player.numSpellsCastThisTurn++; SpellTracker.instance.lastSpellCasted = this; } else if (player.iMana < iManaCost) { PanelHolder.instance.displayNotify("Not enough Mana!", "You do not have enough mana to cast this spell.", "OK"); } else { // subtract mana and glyph costs player.iMana -= iManaCost; // destroy 2 random items from inventory ItemObject item1 = player.inventory[Random.Range(0, player.inventory.Count)]; player.RemoveFromInventory(item1); ItemObject item2 = player.inventory[Random.Range(0, player.inventory.Count)]; player.RemoveFromInventory(item2); // get a random item string[] items = new string[] { "Mimetic Vellum", "Crystal Mirror", "Rift Talisman" }; ItemObject newItem = GameObject.Find("ItemList").GetComponent <ItemList>().GetItemFromName(items[Random.Range(0, 3)]); player.AddToInventory(newItem); PanelHolder.instance.displayBoardScan("Rigel's Ascension", "You destroyed " + item1.name + " and " + item2.name + " and gained " + newItem.name + "!", newItem.sprite, "MainPlayerScene"); player.numSpellsCastThisTurn++; SpellTracker.instance.lastSpellCasted = this; } }
// called from ForestSceneHandler.cs public void DoForecast() { if (forecastItem != null) { // add 2 of the items into inventory spellCaster.AddToInventory(forecastItem); spellCaster.AddToInventory(forecastItem); PanelHolder.instance.displayBoardScan("Forecast Active", "Because of Forecast, you found 2 " + forecastItem.name + "!", forecastItem.sprite, "MainPlayerScene"); // reset forecast item and remove forecast from active spells list forecastItem = null; } RemoveFromActiveSpells("Forecast"); }
public override void UseItem(SpellCaster player) { if (player.chapter.spellsCollected.Count <= 0) { PanelHolder.instance.displayNotify("No Spells Collected", "You do not have any spells that can be stored in the cabochon.", "OK"); } else { // check to see if they have at least 1 non combat spell to put in bool hasNonCombatSpell = false; foreach (Spell spell in player.chapter.spellsCollected) { if (!spell.combatSpell) { hasNonCombatSpell = true; break; } } if (!hasNonCombatSpell) { PanelHolder.instance.displayNotify("No Spells Collected", "You do not have any spells that can be stored in the cabochon.", "OK"); } else { SoundManager.instance.PlaySingle(SoundManager.hollowCabochon); player.RemoveFromInventory(this); player.AddToInventory(new GlimmeringCabochon()); PanelHolder.instance.displayNotify("Hollow Cabochon", "Your Hollow Cabochon has turned into a Glimmering Cabochon!", "InventoryScene"); } } }
public override void SpellCast(SpellCaster player) { // cast spell for free if Umbra's Eclipse is active if (SpellTracker.instance.CheckUmbra()) { // get 2 random items List <ItemObject> itemsList = GameObject.Find("ItemList").GetComponent <ItemList>().listOfItems; ItemObject item1 = itemsList[Random.Range(0, itemsList.Count)]; ItemObject item2 = itemsList[Random.Range(0, itemsList.Count)]; player.AddToInventory(item1); player.AddToInventory(item2); PanelHolder.instance.displayNotify("Corpse Taker", "You found " + item1.name + " and " + item2.name + "!", "MainPlayerScene"); player.numSpellsCastThisTurn++; SpellTracker.instance.lastSpellCasted = this; } else if (player.iMana < iManaCost) { PanelHolder.instance.displayNotify("Not enough Mana!", "You do not have enough mana to cast this spell.", "OK"); } else { // subtract mana and glyph costs player.iMana -= iManaCost; // get 2 random items List <ItemObject> itemsList = GameObject.Find("ItemList").GetComponent <ItemList>().listOfItems; ItemObject item1 = itemsList[Random.Range(0, itemsList.Count)]; ItemObject item2 = itemsList[Random.Range(0, itemsList.Count)]; player.AddToInventory(item1); player.AddToInventory(item2); PanelHolder.instance.displayNotify("Corpse Taker", "You found " + item1.name + " and " + item2.name + "!", "MainPlayerScene"); player.numSpellsCastThisTurn++; SpellTracker.instance.lastSpellCasted = this; } }
void Start() { SoundManager.instance.PlayGameBCM(SoundManager.marketBGM); allItems = GameObject.Find("ItemList").GetComponent <ItemList>().listOfItems; spellcaster = GameObject.FindGameObjectWithTag("LocalPlayer").GetComponent <Player>().spellcaster; button_exitButton.onClick.AddListener(() => { SoundManager.instance.PlayGameBCM(SoundManager.gameBCG); SoundManager.instance.PlaySingle(SoundManager.buttonconfirm); // remove Charming Negotiator from active spells if it's active SpellTracker.instance.RemoveFromActiveSpells("Potion of Charm"); SceneManager.LoadScene("MainPlayerScene"); }); QuestTracker.instance.TrackLocationQuest("location_capital"); CrisisHandler.instance.CheckCrisis(GameObject.FindGameObjectWithTag("LocalPlayer").GetComponent <Player>(), CrisisHandler.instance.currentCrisis, "location_capital"); float size = allItems.Count; //Choose 4 random items from item pool to put for sale. item0 = allItems[(int)UnityEngine.Random.Range(0f, size - 1)]; if (size > 1) { item1 = allItems[(int)UnityEngine.Random.Range(0f, size - 1)]; while (item1.name.Equals(item0.name)) { item1 = allItems[(int)UnityEngine.Random.Range(0f, size - 1)]; } } if (size > 2) { item2 = allItems[(int)UnityEngine.Random.Range(0f, size - 1)]; while (item2.name.Equals(item0.name) || item2.name.Equals(item1.name)) { item2 = allItems[(int)UnityEngine.Random.Range(0f, size - 1)]; } } if (size > 3) { item3 = allItems[(int)UnityEngine.Random.Range(0f, size - 1)]; while (item3.name.Equals(item0.name) || item3.name.Equals(item1.name) || item3.name.Equals(item2.name)) { item3 = allItems[(int)UnityEngine.Random.Range(0f, size - 1)]; } } image_item0.sprite = item0.sprite; image_item1.sprite = item1.sprite; image_item2.sprite = item2.sprite; image_item3.sprite = item3.sprite; text_myMana.text = spellcaster.iMana + ""; button_buyButton.onClick.AddListener(() => { if (spellcaster.iMana >= currentSelected.buyPrice) { SoundManager.instance.PlaySingle(SoundManager.purchase); spellcaster.LoseMana((int)currentSelected.buyPrice); text_myMana.text = spellcaster.iMana + ""; spellcaster.AddToInventory(currentSelected); text_itemDesc.text = "He he he thank you.."; } else { text_itemDesc.text = "Not enough mana stranger!"; } }); button_item0.onClick.AddListener(() => { SoundManager.instance.PlaySingle(SoundManager.buttonconfirm); PopulateSaleUI(item0); BuyButton.gameObject.SetActive(true); }); button_item1.onClick.AddListener(() => { SoundManager.instance.PlaySingle(SoundManager.buttonconfirm); PopulateSaleUI(item1); BuyButton.gameObject.SetActive(true); }); button_item2.onClick.AddListener(() => { SoundManager.instance.PlaySingle(SoundManager.buttonconfirm); PopulateSaleUI(item2); BuyButton.gameObject.SetActive(true); }); button_item3.onClick.AddListener(() => { SoundManager.instance.PlaySingle(SoundManager.buttonconfirm); PopulateSaleUI(item3); BuyButton.gameObject.SetActive(true); }); // if Charming Negotiator is active, discount sale price by 50% if (SpellTracker.instance.SpellIsActive(new CharmingNegotiator())) { List <ItemObject> itemsList = new List <ItemObject>() { item0, item1, item2, item3 }; foreach (ItemObject i in itemsList) { i.buyPrice = (int)(i.buyPrice * 0.5); } } }