Пример #1
0
    public Item SpawnRandomItem(string rarityLevel)
    {
        string chosen  = itemPool.Draw(false);
        Item   newItem = new Item(allItems[chosen]);

        string rarityItem = null;

        if (rarityLevel == "Common")
        {
            rarityItem = commonRarities.Draw(false);
        }
        else if (rarityLevel == "Rare")
        {
            rarityItem = rareRarities.Draw(false);
        }

        SetRarity(newItem, rarityItem);

        return(newItem);
    }
Пример #2
0
    public Character ChooseEnemy()
    {
        Character theEnemy;

        //Check if lore forced the encounter
        if (forceEncounter == null || forceEncounter.myName == "")
        {
            string nameEnemy = mobPool.Draw(false);
            theEnemy = new Character(allMobs[nameEnemy]);
        }
        else
        {
            theEnemy = new Character(forceEncounter); forceEncounter = null;
        }

        theEnemy.SetRarity(levelConfront);
        theEnemy.myConditionsDisplayer = enemyConditionsTab.GetComponent <ObjectDisplayer>();

        return(theEnemy);
    }
Пример #3
0
 public void NextScene()
 {
     if (currentScene == lootScene)
     {
         nextScene = sceneProb.Draw(true);
         if (nextScene == "nothing")
         {
             nextScene = "Confront";
         }
         myLootHandler.followerTab.transform.Find("TextBackground").Find("Text").GetComponent <Text>().text = "";
         lootScene.SetActive(false);
     }
     else if (new List <GameObject> {
         healScene, upgradeScene
     }.Contains(currentScene))
     {
         nextScene = "Confront";
         currentScene.SetActive(false);
     }
     CheckSpecialEvent();
 }
Пример #4
0
    public void ResolveEvent(TriggerContent theEvent, GameObject target)
    {
        for (int i = 0; i < theEvent.effectNames.Count; i++)
        {
            string theText;

            switch (theEvent.effectNames[i])
            {
            // COMMENTARY EVENTS
            case "Pool_commentary":
                aBag = new WeightedBag();
                for (int j = 0; j < theEvent.effectData.Count; j++)
                {
                    aBag.AddElement(theEvent.effectData[j], theEvent.effectValues[j] / 100f);
                }

                theText = aBag.Draw(true);
                if (theText != "nothing")
                {
                    target.transform.Find("TextBackground").Find("Text").GetComponent <Text>().text += theText + "\n"; target.SetActive(true);
                }
                else
                {
                    target.SetActive(false);
                }
                break;

            case "Commentary":
                target.transform.Find("TextBackground").Find("Text").GetComponent <Text>().text += theEvent.effectData[i] + "\n";
                target.SetActive(true);
                break;

            case "Commentary_Variable":
                List <string> copyText = new List <string>(); theEvent.effectData.ForEach(x => copyText.Add(x));
                theText = DecodeString(copyText);
                target.transform.Find("TextBackground").Find("Text").GetComponent <Text>().text += theText + "\n";

                target.SetActive(true);
                break;

            case "Increment_counter":
                myData.allCounters[theEvent.effectData[i]].count += (int)theEvent.effectValues[i];
                myData.StoreCounters();

                ExecuteFromTrigger("Incremented_" + theEvent.effectData[i], target);
                break;

            case "Set_counter":
                myData.allCounters[theEvent.effectData[i]].count = (int)theEvent.effectValues[i];
                myData.StoreCounters();
                break;

            // EVENTS
            case "Special_Event":
                eventData = theEvent.effectData;
                GetComponent <GameHandler>().specialEvent = true;
                break;

            case "Force_encounter":
                CharacterContent encounter = new CharacterContent(myData.allMobs[theEvent.effectData[i]]);

                encounter.myName = theEvent.effectData[i + 1];   // dangerous... an encounter can be force-set without name change
                GetComponent <ConfrontationHandler>().forceEncounter = encounter;
                break;

            case "Force_loot":
                GetComponent <LootHandler>().forceLoot = theEvent.effectData[i];
                break;

            case "Pool_triggerEvent":
                aBag = new WeightedBag();
                for (int j = 0; j < theEvent.effectData.Count; j++)
                {
                    aBag.AddElement(theEvent.effectData[j], theEvent.effectValues[j] / 100f);
                }

                theText = aBag.Draw(true);
                ResolveEvent(myData.allEvents[theText], target);
                break;

            // TOOLS
            case "Activate":
                SetEventActive(theEvent.effectData[i], true);
                break;

            case "Deactivate":
                SetEventActive(theEvent.effectData[i], false);
                break;

            case "Deactivate_quest":
                foreach (string elt in myData.allEvents.Keys.ToList())
                {
                    if (elt.Contains(theEvent.effectData[i]))
                    {
                        SetEventActive(elt, false);
                    }
                }
                break;

            case "Unlock_enemy":
                UnlockEnemy(theEvent.effectData[i]);
                break;

            case "Unlock_item":
                UnlockItem(theEvent.effectData[i]);
                break;
            }
        }
    }