Example #1
0
 static BootItemForm()
 {
     BootItemForm.MIN_BOOT_SCREEN = 0;
     BootItemForm.MAX_BOOT_SCREEN = 1;
     BootItemForm.SZ_BOOT_SCREEN  = new string[2]
     {
         "Picture",
         "Char String"
     };
     BootItemForm.DefaultBootItem = new BootItem();
     BootItemForm.data            = new BootItem();
     BootItemForm.dataContent     = new BootContent();
 }
        void Init()
        {
            BackgroundColor           = Constants.BackgroundColor;
            Lbl_Username.TextColor    = Constants.MainTextColor;
            Lbl_Password.TextColor    = Constants.MainTextColor;
            ActivitySpinner.IsVisible = false;
            LoginIcon.HeightRequest   = Constants.LoginIconHeight;

            Entry_Username.Completed += (sender, e) => Entry_Password.Focus();
            Entry_Password.Completed += (sender, e) => SignInProcedure(sender, e);
            Constants.towns           = new ObservableCollection <TownModel>();
            Constants.Hero            = new Models.Character()
            {
                hp = 40, mp = 10, inventory = new Models.Inventory(), name = "Szymon"
            };
            Constants.Hero.updateStats();
            Constants.levelRate.Add(1, 50);
            Constants.levelRate.Add(2, 75);
            Constants.levelRate.Add(3, 125);
            Constants.levelRate.Add(4, 200);
            Constants.levelRate.Add(5, 300);
            Constants.levelRate.Add(6, 430);
            Constants.levelRate.Add(7, 580);
            Constants.levelRate.Add(8, 700);
            Constants.levelRate.Add(9, 1000);
            Constants.levelRate.Add(10, 1350);
            Constants.levelRate.Add(11, 1900);
            Constants.levelRate.Add(12, 2600);
            Constants.levelRate.Add(13, 3500);
            Constants.levelRate.Add(14, 4500);
            Constants.levelRate.Add(15, 6000);
            Constants.levelRate.Add(16, 7800);
            Constants.levelRate.Add(17, 9800);
            Constants.levelRate.Add(18, 12500);
            Constants.levelRate.Add(19, 14000);
            Constants.levelRate.Add(20, 18000);
            Constants.levelRate.Add(21, 25000);
            Constants.levelRate.Add(22, 35000);
            Constants.levelRate.Add(23, 50000);
            Constants.levelRate.Add(24, 67000);
            Constants.levelRate.Add(25, 83500);

            /*Constants.levelRate.Add(26, 50);
             *
             */
            //Przedmioty Startowe dopóki nie ma dwóch miast jest to na sztywno
            ConsumableItem item1 = new ConsumableItem()
            {
                name = "Mikstura Życia", type = 0, hpRestore = 500, price = 50, image = "elixir.png", isConsuamble = true
            };
            OneHandItem oneHand1 = new OneHandItem()
            {
                atk = 3, type = 1, name = "Sztylet", price = 200, image = "dagger.png", IsEquable = true
            };
            ShieldItem ShieldItem1 = new ShieldItem()
            {
                def = 3, type = 2, name = "Prosta Tarcza", price = 200, image = "shield.png", IsEquable = true
            };
            HelmetItem helmet1 = new HelmetItem()
            {
                mdef = 2, type = 3, name = "Prosty Hełm", price = 200, image = "viking.png", IsEquable = true
            };
            BodyItem body1 = new BodyItem()
            {
                def = 3, mdef = 1, type = 4, name = "Łachmany", price = 500, image = "armor.png", IsEquable = true
            };
            BootItem boot1 = new BootItem()
            {
                luck = 3, type = 5, name = "Buty", price = 200, image = "boots.png", IsEquable = true
            };
            RingItem ring1 = new RingItem()
            {
                hp = 30, type = 6, name = "Pierscień Życia", price = 200, image = "shenRing.png", IsEquable = true
            };
            //  TwoHandItem twohand = new TwoHandItem() { atk = 3, type=7, name = "Sztylet",  price = 200, image = "swords.png", IsEquable = true };

            ObservableCollection <Models.Item> items = new ObservableCollection <Item>();

            items.Add(item1);
            items.Add(oneHand1);
            items.Add(ShieldItem1);
            items.Add(helmet1);
            items.Add(body1);
            items.Add(boot1);
            items.Add(ring1);
            //Twohand!

            //Skille
            Constants.allSkills = new List <Skill>();
            AttackSkill wolfBite = new AttackSkill()
            {
                name = "Ugryzienie", manaCost = 2, skillStr = 5
            };


            Quest firstQuest = new Quest()
            {
                exp = 30, done = 0, desc = "Tutaj znajduje się opis pierwszego questa", gold = 50, itemReward = null, name = "Pierwszy Quest", reqDone = 3, reward = "armor.png"
            };
            ObservableCollection <Quest> firstTown = new ObservableCollection <Quest>();

            firstTown.Add(firstQuest);

            //enemies


            Enemy enemy = new Enemy()
            {
                name = "Osa", rarity = "Common", image = "bee.png", def = 4, exp = 10, gold = 10, hp = 40, id = 0, items = new List <Item>(), loot = new List <Item>(), mag = 3, str = 8, luck = 5, lvl = 1, mp = 12, spr = 3, speed = 9, maxHP = 40, maxMP = 12
            };
            Enemy wolf = new Enemy()
            {
                name = "Wilk", rarity = "Common", image = "wolf.png", def = 6, freqAi = 69, isAi = true, exp = 12, gold = 9, hp = 60, id = 1, items = new List <Item>(), loot = new List <Item>(), mag = 1, str = 14, luck = 4, lvl = 1, mp = 16, spr = 6, skills = new List <Skill>(), speed = 12, maxHP = 60, maxMP = 16
            };

            wolf.skills.Add(wolfBite);



            TownModel town = new TownModel()
            {
                image = "village.jpg", noTown = 0, Name = "Deling", Quests = firstTown, Shop = items, isUnlocked = true
            };

            Constants.towns.Add(town);
            Constants.actualTown           = 0;
            Constants.Hero.inventory.items = new ObservableCollection <Item>();
            Constants.allItems             = new Dictionary <string, Item>();
            Constants.allItems.Add(item1.name, item1);
            Constants.allItems.Add(oneHand1.name, oneHand1);
            Constants.allItems.Add(ShieldItem1.name, ShieldItem1);
            Constants.allItems.Add(helmet1.name, helmet1);
            Constants.allItems.Add(body1.name, body1);
            Constants.allItems.Add(boot1.name, boot1);
            Constants.allItems.Add(ring1.name, ring1);

            enemy.addLoot(new List <Item>()
            {
                item1
            });


            Constants.allEnemies = new List <Enemy>();
            Constants.allEnemies.Add(enemy);
            Constants.allEnemies.Add(wolf);
        }
        public void EquipArmour(ArmourItem armourItem)
        {
            #region Base Stats

            _playerAbilitySystem.strength     += armourItem.strengthAmount;
            _playerAbilitySystem.intelligence += armourItem.intelligenceAmount;
            _playerAbilitySystem.strengthPhysicalDamageIncreaseAmount      += armourItem.physicalArmour;
            _playerAbilitySystem.intelligenceElementalDamageIncreaseAmount += armourItem.elementalArmour;

            switch (armourItem.healthAmount)
            {
            case > 0:
                _player.maxHp += armourItem.healthAmount;
                break;

            case < 0:
                _player.maxHp -= armourItem.healthAmount;
                break;
            }

            switch (armourItem.manaAmount)
            {
            case > 0:
                _playerAbilitySystem.maxMana += armourItem.manaAmount;
                break;

            case < 0:
                _playerAbilitySystem.maxMana -= armourItem.manaAmount;
                break;
            }

            switch (armourItem.strengthAmount)
            {
            // Update Player Stats
            case < 0:
                _player.maxHp -= (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
                break;

            case > 0:
                _player.maxHp += (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
                break;
            }

            switch (armourItem.intelligenceAmount)
            {
            case < 0:
                _playerAbilitySystem.maxMana -= _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
                break;

            case > 0:
                _playerAbilitySystem.maxMana += _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
                break;
            }

            #endregion

            // ## HELMET ITEM ##
            if (armourItem is HelmetItem helmetItem)
            {
                head = helmetItem;
                _playerAbilitySystem.manaRegenerationPercentage += helmetItem.manaRegenerationPercentage;
                _player.GetComponent <SkillsManager>().activeSkills.ForEach(skill => skill.manaCost -= helmetItem.reducedManaCostOfSkillsAmount);
                _playerAbilitySystem.reducedManaCostOfSkillsAmount += helmetItem.reducedManaCostOfSkillsAmount;
            }

            // ## CHEST ITEM ##
            if (armourItem is ChestItem chestItem)
            {
                chest = chestItem;
                _playerAbilitySystem.healthOnHitAmount += chestItem.healthOnHitAmount;
                if (_playerAbilitySystem.GetComponent <PlayerEquipmentManager>().hasWeaponEquipped)
                {
                    _playerAbilitySystem.GetComponent <PlayerEquipmentManager>().weaponItem.weaponRange += chestItem.additionalWeaponRangeAmount;
                }
            }

            if (armourItem is BootItem bootItem)
            {
                boots = bootItem;
                _playerAbilitySystem.moveSpeedIncreaseAmount += bootItem.moveSpeedIncrease;
                // Increase Movement Speed
                GetComponent <NavMeshAgent>().speed += (bootItem.moveSpeedIncrease / 100 * GetComponent <NavMeshAgent>().speed);
            }

            // ## Add Armour to Equipment Inventory ##
            _equipmentInventory.AddItem(armourItem);
        }
        // public void EquipHelmet(HelmetItem helmetItem)
        // {
        //     head = helmetItem;
        //     _playerAbilitySystem.strength += helmetItem.strengthAmount;
        //     _playerAbilitySystem.intelligence += helmetItem.intelligenceAmount;
        //
        //     _playerAbilitySystem.strengthPhysicalDamageIncreaseAmount += helmetItem.physicalArmour;
        //     _playerAbilitySystem.intelligenceElementalDamageIncreaseAmount += helmetItem.elementalArmour;
        //     _playerAbilitySystem.manaRegenerationPercentage += helmetItem.manaRegenerationPercentage;
        //
        //     switch (helmetItem.strengthAmount)
        //     {
        //         // Update Player Stats
        //         case < 0:
        //             _player.maxHp -= (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
        //             break;
        //         case > 0:
        //             _player.maxHp += (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
        //             break;
        //     }
        //
        //     switch (helmetItem.intelligenceAmount)
        //     {
        //         case < 0:
        //             _playerAbilitySystem.maxMana -= _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
        //             break;
        //         case > 0:
        //             _playerAbilitySystem.maxMana += _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
        //             break;
        //     }
        //
        //     switch (helmetItem.healthAmount)
        //     {
        //         case > 0:
        //             _player.maxHp += helmetItem.healthAmount;
        //             break;
        //         case < 0:
        //             _player.maxHp -= helmetItem.healthAmount;
        //             break;
        //     }
        //
        //     switch (helmetItem.manaAmount)
        //     {
        //         case > 0:
        //             _playerAbilitySystem.maxMana += helmetItem.manaAmount;
        //             break;
        //         case < 0:
        //             _playerAbilitySystem.maxMana -= helmetItem.manaAmount;
        //             break;
        //     }
        //
        //     _equipmentInventory.AddItem(helmetItem);
        // }

        // public void EquipChest(ChestItem chestItem)
        // {
        //     chest = chestItem;
        //     _playerAbilitySystem.strength += chestItem.strengthAmount;
        //     _playerAbilitySystem.intelligence += chestItem.intelligenceAmount;
        //
        //     _playerAbilitySystem.strengthPhysicalDamageIncreaseAmount += chestItem.physicalArmour;
        //     _playerAbilitySystem.intelligenceElementalDamageIncreaseAmount += chestItem.elementalArmour;
        //
        //     switch (chestItem.strengthAmount)
        //     {
        //         // Update Player Stats
        //         case < 0:
        //             _player.maxHp -= (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
        //             break;
        //         case > 0:
        //             _player.maxHp += (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
        //             break;
        //     }
        //
        //     switch (chestItem.intelligenceAmount)
        //     {
        //         case < 0:
        //             _playerAbilitySystem.maxMana -= _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
        //             break;
        //         case > 0:
        //             _playerAbilitySystem.maxMana += _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
        //             break;
        //     }
        //
        //     switch (chestItem.healthAmount)
        //     {
        //         case > 0:
        //             _player.maxHp += chestItem.healthAmount;
        //             break;
        //         case < 0:
        //             _player.maxHp -= chestItem.healthAmount;
        //             break;
        //     }
        //
        //     switch (chestItem.manaAmount)
        //     {
        //         case > 0:
        //             _playerAbilitySystem.maxMana += chestItem.manaAmount;
        //             break;
        //         case < 0:
        //             _playerAbilitySystem.maxMana -= chestItem.manaAmount;
        //             break;
        //     }
        //
        //     if (_playerAbilitySystem.GetComponent<PlayerEquipmentManager>().weaponItem != null)
        //         _playerAbilitySystem.GetComponent<PlayerEquipmentManager>().weaponItem.weaponRange += chestItem.additionalWeaponRangeAmount;
        //
        //     _equipmentInventory.AddItem(chestItem);
        // }

        public void UnEquip(Item item)
        {
            equipmentInventoryUI.hoverInterface.SetActive(false);
            _equipmentInventory.RemoveItem(item);

            if (item is WeaponItem)
            {
                hasWeaponEquipped = false;
                weaponItem        = null;
                _playerInventory.AddItem(item);

                // Remove weapon from player's hands
                Destroy(playerWeaponHolsterTransform.gameObject.GetComponentInChildren <EnemyHitDetection>().gameObject);
            }

            if (item is ArmourItem armourItem)
            {
                switch (armourItem.healthAmount)
                {
                case > 0:
                    _player.maxHp -= armourItem.healthAmount;
                    break;

                case < 0:
                    _player.maxHp += armourItem.healthAmount;
                    break;
                }

                switch (armourItem.manaAmount)
                {
                case > 0:
                    _playerAbilitySystem.maxMana -= armourItem.manaAmount;
                    break;

                case < 0:
                    _playerAbilitySystem.maxMana += armourItem.manaAmount;
                    break;
                }

                switch (armourItem.strengthAmount)
                {
                // Update Player Stats
                case < 0:
                    _player.maxHp += (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
                    break;

                case > 0:
                    _player.maxHp -= (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength);
                    break;
                }

                switch (armourItem.intelligenceAmount)
                {
                case < 0:
                    _playerAbilitySystem.maxMana += _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
                    break;

                case > 0:
                    _playerAbilitySystem.maxMana -= _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence;
                    break;
                }

                // ## HELMET ITEM ##
                if (armourItem is HelmetItem helmetItem)
                {
                    head = null;
                    _playerAbilitySystem.manaRegenerationPercentage -= helmetItem.manaRegenerationPercentage;
                    _player.GetComponent <SkillsManager>().activeSkills.ForEach(skill => skill.manaCost -= helmetItem.reducedManaCostOfSkillsAmount);
                    _playerAbilitySystem.reducedManaCostOfSkillsAmount -= helmetItem.reducedManaCostOfSkillsAmount;
                }

                // ## CHEST ITEM ##
                if (armourItem is ChestItem chestItem)
                {
                    chest = null;
                    _playerAbilitySystem.healthOnHitAmount -= chestItem.healthOnHitAmount;
                    if (_playerAbilitySystem.GetComponent <PlayerEquipmentManager>().hasWeaponEquipped)
                    {
                        _playerAbilitySystem.GetComponent <PlayerEquipmentManager>().weaponItem.weaponRange -= chestItem.additionalWeaponRangeAmount;
                    }
                }

                if (armourItem is BootItem bootItem)
                {
                    boots = null;
                    _playerAbilitySystem.moveSpeedIncreaseAmount -= bootItem.moveSpeedIncrease;
                    // Increase Movement Speed
                    GetComponent <NavMeshAgent>().speed -= (bootItem.moveSpeedIncrease / 100 * _basePlayerMoveSpeed);
                }

                _playerAbilitySystem.strength     -= armourItem.strengthAmount;
                _playerAbilitySystem.intelligence -= armourItem.intelligenceAmount;
                _playerAbilitySystem.strengthPhysicalDamageIncreaseAmount      -= armourItem.physicalArmour;
                _playerAbilitySystem.intelligenceElementalDamageIncreaseAmount -= armourItem.elementalArmour;

                _playerInventory.AddItem(item);
            }

            // Double check to make sure player's HP is not over the maximum
            if (_player.CurrentHp > _player.maxHp)
            {
                _player.CurrentHp = _player.maxHp;
            }
        }