Updated rarity, fixed hp/mp display on point usage, fixed item moving issue, v1.3.0

This commit is contained in:
Nicola Sovic 2022-07-04 11:54:31 +02:00
parent 977f9ca5cf
commit dd0251cb3e
5 changed files with 42 additions and 38 deletions

View File

@ -125,16 +125,16 @@ namespace Assets.Scripts
inventory.dragImage.GetComponent<RawImage>().color = new Color(0,0,0,0);
inventory.dragImage.GetComponent<RawImage>().texture = null;
inventory.dragImage.transform.position = new Vector3(0,0,0);
GameObject startDrag = inventory.getDrag();
InventorySlot startDrag = inventory.getDrag().GetComponent<InventorySlot>();
Item item;
bool isSwap = false;
if (startDrag.GetComponent<InventorySlot>().place == ItemPlace.BAG)
if (startDrag.place == ItemPlace.BAG)
{
item = startDrag.GetComponent<InventorySlot>().getItem(currentBag);
item = startDrag.getItem(startDrag.currentBag);
}
else
{
item = startDrag.GetComponent<InventorySlot>().getEquip();
item = startDrag.getEquip();
}
if (item != null)
{
@ -146,13 +146,17 @@ namespace Assets.Scripts
{
if (items[currentBag] != null)
{
if (startDrag.GetComponent<InventorySlot>().place == ItemPlace.BAG)
if (items[currentBag].getPlace() != startDrag.place)
{
startDrag.GetComponent<InventorySlot>().setItem(items[currentBag], currentBag);
return;
}
if (startDrag.place == ItemPlace.BAG)
{
startDrag.setItem(items[currentBag], currentBag);
}
else
{
startDrag.GetComponent<InventorySlot>().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<InventorySlot>().place == ItemPlace.BAG)
if (startDrag.place == ItemPlace.BAG)
{
startDrag.GetComponent<InventorySlot>().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<InventorySlot>().place != ItemPlace.BAG)
if (startDrag.place != ItemPlace.BAG)
{
inventory.calculateStatBoost(startDrag.GetComponent<InventorySlot>().getEquip().getAttributes(), false);
startDrag.GetComponent<InventorySlot>().removeEquip();
inventory.calculateStatBoost(startDrag.getEquip().getAttributes(), false);
startDrag.removeEquip();
}
else
{
startDrag.GetComponent<InventorySlot>().removeItem();
startDrag.removeItem();
}
}
}

View File

@ -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)));
}
}

View File

@ -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

View File

@ -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]);
}

View File

@ -1,2 +1,2 @@
Music:0
Effects:0.5051396
Effects:0