From dd0251cb3eb17c1ea4d1bde74008e2aa1118ccf2 Mon Sep 17 00:00:00 2001 From: Nicola Sovic Date: Mon, 4 Jul 2022 11:54:31 +0200 Subject: [PATCH] Updated rarity, fixed hp/mp display on point usage, fixed item moving issue, v1.3.0 --- Assets/Scripts/InventorySlot.cs | 30 ++++++++++++--------- Assets/Scripts/Item.cs | 42 ++++++++++++++--------------- Assets/Scripts/Player.cs | 4 +-- Assets/Scripts/Slimes/BasicSlime.cs | 2 +- audiosettings.txt | 2 +- 5 files changed, 42 insertions(+), 38 deletions(-) diff --git a/Assets/Scripts/InventorySlot.cs b/Assets/Scripts/InventorySlot.cs index 79735b7..be0e06b 100644 --- a/Assets/Scripts/InventorySlot.cs +++ b/Assets/Scripts/InventorySlot.cs @@ -125,16 +125,16 @@ namespace Assets.Scripts inventory.dragImage.GetComponent().color = new Color(0,0,0,0); inventory.dragImage.GetComponent().texture = null; inventory.dragImage.transform.position = new Vector3(0,0,0); - GameObject startDrag = inventory.getDrag(); + InventorySlot startDrag = inventory.getDrag().GetComponent(); Item item; bool isSwap = false; - if (startDrag.GetComponent().place == ItemPlace.BAG) + if (startDrag.place == ItemPlace.BAG) { - item = startDrag.GetComponent().getItem(currentBag); + item = startDrag.getItem(startDrag.currentBag); } else { - item = startDrag.GetComponent().getEquip(); + item = startDrag.getEquip(); } if (item != null) { @@ -146,13 +146,17 @@ namespace Assets.Scripts { if (items[currentBag] != null) { - if (startDrag.GetComponent().place == ItemPlace.BAG) + if (items[currentBag].getPlace() != startDrag.place) { - startDrag.GetComponent().setItem(items[currentBag], currentBag); + return; + } + if (startDrag.place == ItemPlace.BAG) + { + startDrag.setItem(items[currentBag], currentBag); } else { - startDrag.GetComponent().setEquip(items[currentBag]); + startDrag.setEquip(items[currentBag]); inventory.calculateStatBoost(item.getAttributes(), false); inventory.calculateStatBoost(items[currentBag].getAttributes(), true); } @@ -164,9 +168,9 @@ namespace Assets.Scripts { if (equip != null) { - if (startDrag.GetComponent().place == ItemPlace.BAG) + if (startDrag.place == ItemPlace.BAG) { - startDrag.GetComponent().setItem(equip, currentBag); + startDrag.setItem(equip, startDrag.currentBag); isSwap = true; inventory.calculateStatBoost(equip.getAttributes(), false); } @@ -180,14 +184,14 @@ namespace Assets.Scripts } if (!isSwap) { - if (startDrag.GetComponent().place != ItemPlace.BAG) + if (startDrag.place != ItemPlace.BAG) { - inventory.calculateStatBoost(startDrag.GetComponent().getEquip().getAttributes(), false); - startDrag.GetComponent().removeEquip(); + inventory.calculateStatBoost(startDrag.getEquip().getAttributes(), false); + startDrag.removeEquip(); } else { - startDrag.GetComponent().removeItem(); + startDrag.removeItem(); } } } diff --git a/Assets/Scripts/Item.cs b/Assets/Scripts/Item.cs index 4da6b15..9e8dbd6 100644 --- a/Assets/Scripts/Item.cs +++ b/Assets/Scripts/Item.cs @@ -96,22 +96,22 @@ namespace Assets.Scripts private void calculateRarity(int luck) { int number = rand.Next(100); - if (number + luck < 74) + if (number + luck < 80) { rarity = ItemRarity.COMMON; rarityColor = new Color32(0,255,20,255); } - else if (number + luck >= 75 && number + luck < 108) + else if (number + luck >= 80 && number + luck < 100) { rarity = ItemRarity.RARE; rarityColor = new Color32(0,100,255, 255); } - else if (number + luck >= 108 && number + luck < 117) + else if (number + luck >= 100 && number + luck < 120) { rarity = ItemRarity.EPIC; rarityColor = new Color32(255,0,230, 255); } - else if (number + luck >= 117) + else if (number + luck >= 120) { rarity = ItemRarity.LEGENDARY; rarityColor = new Color32(255,230,0, 255); @@ -134,71 +134,71 @@ namespace Assets.Scripts { itemName = "luck"; } - attributes.Add("LCK", Mathf.RoundToInt((float)(5 - (2 * i) + luck * 0.2))); + attributes.Add("LCK", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); break; case 1: if (i == 0) { itemName = "intelligence"; } - attributes.Add("INT", Mathf.RoundToInt((float)(5 - (2 * i) + luck * 0.2))); + attributes.Add("INT", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); break; case 2: if (i == 0) { itemName = "dexterity"; } - attributes.Add("DEX", Mathf.RoundToInt((float)(5 - (2 * i) + luck * 0.2))); + attributes.Add("DEX", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); break; case 3: if (i == 0) { itemName = "strength"; } - attributes.Add("STR", Mathf.RoundToInt((float)(5 - (2 * i) + luck * 0.2))); + attributes.Add("STR", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); break; case 4: if (i == 0) { itemName = "health"; } - attributes.Add("HP", Mathf.RoundToInt((float)(5 - (2 * i) + luck * 0.2))); + attributes.Add("HP", Mathf.RoundToInt((float)(10 - (2 * i) + luck * 0.1))); break; case 5: if (i == 0) { itemName = "mana"; } - attributes.Add("MP", Mathf.RoundToInt((float)(5 - (2 * i) + luck * 0.2))); + attributes.Add("MP", Mathf.RoundToInt((float)(10 - (2 * i) + luck * 0.1))); break; case 6: if (i == 0) { itemName = "health regeneration"; } - attributes.Add("HPR", Mathf.RoundToInt((float)(5 - (2 * i) + luck * 0.2))); + attributes.Add("HPR", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); break; case 7: if (i == 0) { itemName = "mana regeneration"; } - attributes.Add("MPR", Mathf.RoundToInt((float)(5 - (2 * i) + luck * 0.2))); + attributes.Add("MPR", Mathf.RoundToInt((float)(3 - (2 * i) + luck * 0.1))); break; } - indexes[0] = index; + indexes[i] = index; } } else { - attributes.Add("MPR", Mathf.RoundToInt((float)(5 + luck * 0.2))); - attributes.Add("HPR", Mathf.RoundToInt((float)(5 + luck * 0.2))); - attributes.Add("MP", Mathf.RoundToInt((float)(5 + luck * 0.2))); - attributes.Add("HP", Mathf.RoundToInt((float)(5 + luck * 0.2))); - attributes.Add("STR", Mathf.RoundToInt((float)(5 + luck * 0.2))); - attributes.Add("DEX", Mathf.RoundToInt((float)(5 + luck * 0.2))); - attributes.Add("INT", Mathf.RoundToInt((float)(5 + luck * 0.2))); - attributes.Add("LCK", Mathf.RoundToInt((float)(5 + luck * 0.2))); + attributes.Add("MPR", Mathf.RoundToInt((float)(3 + luck * 0.1))); + attributes.Add("HPR", Mathf.RoundToInt((float)(3 + luck * 0.1))); + attributes.Add("MP", Mathf.RoundToInt((float)(3 + luck * 0.1))); + attributes.Add("HP", Mathf.RoundToInt((float)(3 + luck * 0.1))); + attributes.Add("STR", Mathf.RoundToInt((float)(3 + luck * 0.1))); + attributes.Add("DEX", Mathf.RoundToInt((float)(3 + luck * 0.1))); + attributes.Add("INT", Mathf.RoundToInt((float)(3 + luck * 0.1))); + attributes.Add("LCK", Mathf.RoundToInt((float)(3 + luck * 0.1))); } } diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index 2f1a56f..af4c568 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -542,7 +542,7 @@ namespace Assets.Scripts if (points > 0) { maxHealth = maxHealth + 5; - health = maxHealth; + health = maxHealth + equipment["HP"]; points--; } else @@ -556,7 +556,7 @@ namespace Assets.Scripts if (points > 0) { maxSecondary = maxSecondary + 5; - secondary = maxSecondary; + secondary = maxSecondary + equipment["MP"]; points--; } else diff --git a/Assets/Scripts/Slimes/BasicSlime.cs b/Assets/Scripts/Slimes/BasicSlime.cs index 54d48ae..dd0e89f 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)//5 + playerStats[11]) + if (new System.Random().Next(100) + 1 < 1000)//10 + playerStats[11]) { item = new Item(playerStats[11]); } diff --git a/audiosettings.txt b/audiosettings.txt index f8fca58..3406059 100644 --- a/audiosettings.txt +++ b/audiosettings.txt @@ -1,2 +1,2 @@ Music:0 -Effects:0.5051396 +Effects:0