Example #1
0
 void EnchantClicked(Enchanter e)
 {
     EnchantButton.interactable = Weapon.Item.Item != null;
     Enchanter.SetData(e, 1, $"{e.GetName()}\n{e.GetDescription()}", EnchantViewerClicked);
     Result.SetData(null, 0, "Result of enchantment goes here.", () => {});
     ItemViewer.Close();
 }
Example #2
0
    void CreateCharacters(char id, Vector3 pos, Vector2 bPos, int team)
    {
        GameObject obj = null;
        Character  c   = null;

        switch (id)
        {
        case 'w':
            obj          = Instantiate(CharacterObject, pos, transform.rotation, CharacterParent.transform);
            c            = new Warrior(obj, Random.Range(4, 7), bPos, 20, 3);
            c.TeamNumber = team;
            obj.GetComponent <CharacterObject>().Type = id;
            break;

        case 'r':
            obj          = Instantiate(CharacterObject, pos, transform.rotation, CharacterParent.transform);
            c            = new Ranger(obj, Random.Range(6, 10), bPos, 15, 5);
            c.TeamNumber = team;
            obj.GetComponent <CharacterObject>().Type = id;

            break;

        case 'e':
            obj          = Instantiate(CharacterObject, pos, transform.rotation, CharacterParent.transform);
            c            = new Enchanter(obj, Random.Range(2, 7), bPos, 10, 2);
            c.TeamNumber = team;
            obj.GetComponent <CharacterObject>().Type = id;
            break;
        }
        ListCharacters.Add(c);
    }
Example #3
0
        public void SetData(string saveString, params object[] otherData)
        {
            DummySave ds = JsonUtility.FromJson <DummySave>(saveString);

            ID     = ds.ID;
            Random = ds.Random;
            TapsWithWeapon.Value = ds.Taps;
            MarkedAsTrash        = ds.Trash;
            Level = ds.Level;

            if (ds.EnchantID != -1 && CreatedFromOriginal)
            {
                Enchanter og = DataManager.Instance.AllItems.First(it => it.ID == ds.EnchantID) as Enchanter;
                Enchantment = Instantiate(og);
                Enchantment.CreatedFromOriginal = true;
                Enchantment.SetData(ds.EnchantSave, og);
            }

            SetValuesBasedOnRandom();

            if (CreatedFromOriginal)
            {
                return;
            }

            Weapon original;

            if (otherData[0] is PersistentSetItem)
            {
                PersistentSetItem allItems = (PersistentSetItem)otherData[0];
                original = allItems.First(it => it.ID == ID) as Weapon;
            }
            else
            {
                original = otherData[0] as Weapon;
            }

            // Copy Original Values
            base.CopyValues(original);
            DamageAtLevel0 = original.DamageAtLevel0;
            LevelUp        = original.LevelUp;

            if (ds.EnchantID != -1)
            {
                Enchanter og = DataManager.Instance.AllItems.First(it => it.ID == ds.EnchantID) as Enchanter;
                Enchantment = Instantiate(og);
                Enchantment.CreatedFromOriginal = true;
                Enchantment.SetData(ds.EnchantSave, og);
            }
        }
Example #4
0
    public void Enchant()
    {
        Weapon    w = Weapon.Item.Item as Weapon;
        Enchanter e = Enchanter.Item.Item as Enchanter;

        if (w == null || e == null)
        {
            return;
        }

        NumberOfEnchantedWeapons.Value++;

        Inventory.Remove(e);
        w.Enchant(e);

        Start();

        Result.SetData(w, 1, "Enchant Damage: " + w.GetEnchantDamage(), () => { WeaponUI.SetWeaponWithDefaults(w); });
        EquipItemProcessor.Instance.ProcessItem(w, null);
    }
Example #5
0
 public void Enchant(Enchanter e)
 {
     Enchantment = e;
 }
Example #6
0
        void Handle4XButton(Button button)
        {
            switch (button.Action)
            {
            case "enchanter":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Enchanter.Copy(HashID++));
                    EnchanterButtons = GenerateEnchantments();
                    UpdateOptions    = true;
                    GoldRoomChosen   = true;
                }
                break;

            case "merchant":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    ShopInventory = GenerateShopInventory();
                    Save.GetGoldRoom().AddToRoom(Merchant.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "alchemist":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Alchemist.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "medic":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Medic.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "gambler":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Gambler.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "pharmacist":
                if (!GoldRoomChosen)
                {
                    button.Sprite = GoldRoomSelected;
                    Save.GetGoldRoom().AddToRoom(Pharmacist.Copy(HashID++));
                    UpdateOptions  = true;
                    GoldRoomChosen = true;
                }
                break;

            case "room":
                if (!((RoomButton)button).Room.Worked && Save.Kevin.Power >= ((RoomButton)button).Room.Cost)
                {
                    ((RoomButton)button).Room.Worked  = true;
                    ((RoomButton)button).Room.Visited = true;
                    Save.Kevin.Power         -= ((RoomButton)button).Room.Cost;
                    Save.Kevin.PowerPerTurn  += ((RoomButton)button).Room.Power;
                    Save.Kevin.WealthPerTurn += ((RoomButton)button).Room.Wealth;
                    Save.Kevin.ExperiencePerTurn++;
                    button.Sprite = PoweredRoom;
                }
                break;

            case "door":
                // Congrats
                break;
            }
        }