diff --git a/Assets/Scripts/InventorySlot.cs b/Assets/Scripts/InventorySlot.cs index cfb331b..79735b7 100644 --- a/Assets/Scripts/InventorySlot.cs +++ b/Assets/Scripts/InventorySlot.cs @@ -55,10 +55,18 @@ namespace Assets.Scripts inventory.itemDisplay.transform.Find("itemName").GetComponent().text = item.getName(); string text = "Stats:\r\n"; Dictionary attributes = item.getAttributes(); - foreach (string key in attributes.Keys) + if (item.getRarity() == ItemRarity.LEGENDARY) { - text = text + key + ": " + attributes[key] + "\r\n"; + text = "All stats: +" + attributes["STR"]; } + else + { + foreach (string key in attributes.Keys) + { + text = text + key + ": +" + attributes[key] + "\r\n"; + } + } + inventory.itemDisplay.transform.Find("itemStats").GetComponent().text = text; int changeY = 0; if (inventory.itemDisplay.transform.localScale == new Vector3(0,0,0)) diff --git a/Assets/Scripts/Item.cs b/Assets/Scripts/Item.cs index 75a4353..4da6b15 100644 --- a/Assets/Scripts/Item.cs +++ b/Assets/Scripts/Item.cs @@ -17,6 +17,7 @@ namespace Assets.Scripts public Item(int luck) { attributes = new Dictionary(); + luck = luck + GameObject.Find("Inventory").GetComponent().getEquipmentBonus()["LCK"]; int numberOfAttributes = 1; calculateRarity(luck); if (rarity > ItemRarity.COMMON) @@ -94,23 +95,23 @@ namespace Assets.Scripts private void calculateRarity(int luck) { - int number = rand.Next(101); + int number = rand.Next(100); if (number + luck < 74) { rarity = ItemRarity.COMMON; rarityColor = new Color32(0,255,20,255); } - else if (number + luck >= 75 && number + luck < 104) + else if (number + luck >= 75 && number + luck < 108) { rarity = ItemRarity.RARE; rarityColor = new Color32(0,100,255, 255); } - else if (number + luck >= 105 && number + luck < 113) + else if (number + luck >= 108 && number + luck < 117) { rarity = ItemRarity.EPIC; rarityColor = new Color32(255,0,230, 255); } - else if (number + luck >= 114) + else if (number + luck >= 117) { rarity = ItemRarity.LEGENDARY; rarityColor = new Color32(255,230,0, 255); @@ -288,6 +289,11 @@ namespace Assets.Scripts { return attributes; } + + public ItemRarity getRarity() + { + return rarity; + } } } \ No newline at end of file diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index cd11a86..2f1a56f 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -43,6 +43,7 @@ namespace Assets.Scripts int killcount = -1; int difficulty = 0; + Dictionary equipment; private void OnEnable() { @@ -56,6 +57,10 @@ namespace Assets.Scripts { uihandler = GameObject.Find("UIHandler").GetComponent(); audioHandler = GameObject.Find("AudioHandler").GetComponent(); + if (GameObject.Find("Inventory") != null) + { + equipment = GameObject.Find("Inventory").GetComponent().getEquipmentBonus(); + } } public void finishPlayerCreation() @@ -218,23 +223,23 @@ namespace Assets.Scripts public void regainSecondary() { - secondary = secondary + secondaryRegen; - if (secondary >= maxSecondary) + secondary = secondary + secondaryRegen + equipment["MPR"]; + if (secondary >= maxSecondary + equipment["MP"]) { - secondary = maxSecondary; + secondary = maxSecondary + equipment["MP"]; } } private void healPlayer() { - health = health + healthRegen; + health = health + healthRegen + equipment["HPR"]; if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S)) { health = health + 5; } - if (health >= maxHealth) + if (health >= maxHealth + equipment["HP"]) { - health = maxHealth; + health = maxHealth + +equipment["HP"]; } } @@ -342,9 +347,9 @@ namespace Assets.Scripts int bonus = 0; if (isCrit()) { - bonus = strength * 2; + bonus = (strength + equipment["STR"]) * 2; } - result = strength + bonus + 5; + result = strength + bonus + 5 + equipment["STR"]; switch (difficulty) { case 0: @@ -362,7 +367,7 @@ namespace Assets.Scripts public void updateKillcount(GameObject gameObject) { - gameObject.GetComponent().text = "Slimes: " + killcount + "/" + (20 * (difficulty + 1)); + gameObject.GetComponent().text = "Slimes: " + killcount + "/" + (30 * (difficulty + 1)); } public int castSkill(int index) @@ -377,11 +382,11 @@ namespace Assets.Scripts secondary = secondary - skills[index].getSecondaryConsumption(); if (role.classname == "Wizard") { - damage = skills[index].calculateDamage(intelligence, isCrit()); + damage = skills[index].calculateDamage(intelligence + equipment["INT"], isCrit()); } else { - damage = skills[index].calculateDamage(strength, isCrit()); + damage = skills[index].calculateDamage(strength + equipment["STR"], isCrit()); } switch (difficulty) @@ -414,7 +419,7 @@ namespace Assets.Scripts public bool isCrit() { - return rand.Next(1, 101) <= dexterity; + return rand.Next(1, 101) <= dexterity + equipment["DEX"]; } public int getKillCount() @@ -434,7 +439,7 @@ namespace Assets.Scripts } else { - if (rand.Next(1, 101) > dexterity + (intelligence / 2)) + if (rand.Next(1, 101) > dexterity + equipment["DEX"] + ((intelligence + equipment["INT"]) / 2)) { health = health - amount; audioHandler.playDamage(); @@ -450,7 +455,7 @@ namespace Assets.Scripts uihandler.showMessage("SUCCESS;You killed your enemy!"); killcount++; SteamWorksHandler.getSlimeAchievement(killcount); - if (killcount >= 30 * (difficulty + 1) && GameObject.Find("Worldgenerator").GetComponent().gameWon()) + if (killcount >= 30 * (difficulty + 1) && GameObject.Find("WorldGenerator").GetComponent().gameWon()) { uihandler.showMessage("SUCCESS;You won the game!"); switch (difficulty) diff --git a/Assets/Scripts/Slimes/BasicSlime.cs b/Assets/Scripts/Slimes/BasicSlime.cs index 07f7745..54d48ae 100644 --- a/Assets/Scripts/Slimes/BasicSlime.cs +++ b/Assets/Scripts/Slimes/BasicSlime.cs @@ -33,7 +33,7 @@ namespace Assets.Scripts.Slimes intelligence = playerStats[6]; experience = (int)(10 + playerStats[7] * 2.5f); level = playerStats[7]; - if (new System.Random().Next(100) + 1 < 1000)//50 + playerStats[11]) + if (new System.Random().Next(100) + 1 < 1000)//5 + playerStats[11]) { item = new Item(playerStats[11]); } diff --git a/Assets/Scripts/UIHandler.cs b/Assets/Scripts/UIHandler.cs index 4984852..1d1613f 100644 --- a/Assets/Scripts/UIHandler.cs +++ b/Assets/Scripts/UIHandler.cs @@ -362,16 +362,17 @@ namespace Assets.Scripts { // { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence }; int[] playerStats = player.GetComponent().getStats(); + Dictionary equipment = inventory.GetComponent().getEquipmentBonus(); GameObject foreground = GameObject.Find("healthForegroundPlayer"); GameObject background = GameObject.Find("healthBackgroundPlayer"); GameObject text = GameObject.Find("healthTextPlayer"); - updateBar(foreground, background, text, playerStats[1], playerStats[0]); + updateBar(foreground, background, text, playerStats[1] + equipment["HP"], playerStats[0]); foreground = GameObject.Find("secondaryForegroundPlayer"); background = GameObject.Find("secondaryBackgroundPlayer"); text = GameObject.Find("secondaryTextPlayer"); - updateBar(foreground, background, text, playerStats[3], playerStats[2]); + updateBar(foreground, background, text, playerStats[3] + equipment["MP"], playerStats[2]); } private void updateFightInterfaceEnemy(GameObject enemy) @@ -394,15 +395,16 @@ namespace Assets.Scripts { // { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience, points}; int[] playerStats = player.GetComponent().getStats(); + Dictionary equipment = inventory.GetComponent().getEquipmentBonus(); - GameObject.Find("txtStrength").GetComponent().text = "STR: " + playerStats[4]; - GameObject.Find("txtDexterity").GetComponent().text = "DEX: " + playerStats[5]; - GameObject.Find("txtIntelligence").GetComponent().text = "INT: " + playerStats[6]; - GameObject.Find("txtHealth").GetComponent().text = "Health: " + playerStats[1]; - GameObject.Find("txtSecondary").GetComponent().text = "Mana: " + playerStats[3]; + GameObject.Find("txtStrength").GetComponent().text = "STR: " + playerStats[4] + " (+" + equipment["STR"] + ")"; + GameObject.Find("txtDexterity").GetComponent().text = "DEX: " + playerStats[5] + " (+" + equipment["DEX"] + ")"; + GameObject.Find("txtIntelligence").GetComponent().text = "INT: " + playerStats[6] + " (+" + equipment["INT"] + ")"; + GameObject.Find("txtHealth").GetComponent().text = "Health: " + playerStats[1] + " (+" + equipment["HP"] + ")"; + GameObject.Find("txtSecondary").GetComponent().text = "Mana: " + playerStats[3] + " (+" + equipment["MP"] + ")"; - updateHealthUI(playerStats[0], playerStats[1]); - updateSecondaryUI(playerStats[2], playerStats[3]); + updateHealthUI(playerStats[0], playerStats[1] + equipment["HP"]); + updateSecondaryUI(playerStats[2], playerStats[3] + equipment["MP"]); updateExperienceUI(playerStats[8], playerStats[9]); player.updateName(GameObject.Find("txtName").GetComponent()); @@ -470,17 +472,18 @@ namespace Assets.Scripts { // { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience}; int[] playerStats = player.GetComponent().getStats(); + Dictionary equipment = inventory.GetComponent().getEquipmentBonus(); GameObject information = GameObject.Find("txtInformationHUD"); player.updateNameHUD(information.GetComponent()); GameObject foreground = GameObject.Find("healthForegroundHUD"); GameObject background = GameObject.Find("healthBackgroundHUD"); - updateBar(foreground, background, null, playerStats[1], playerStats[0]); + updateBar(foreground, background, null, playerStats[1] + equipment["HP"], playerStats[0]); foreground = GameObject.Find("secondaryForegroundHUD"); background = GameObject.Find("secondaryBackgroundHUD"); - updateBar(foreground, background, null, playerStats[3], playerStats[2]); + updateBar(foreground, background, null, playerStats[3] + equipment["MP"], playerStats[2]); } public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)