Skip to content

Commit

Permalink
Generate potions with names and values
Browse files Browse the repository at this point in the history
  • Loading branch information
Allofich committed Nov 22, 2017
1 parent 7a36d13 commit 8536f2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Assets/Scripts/Game/Items/ItemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ public string ResolveItemLongName(DaggerfallUnityItem item)
result = string.Format("{0} {1}", materialName, result);
}

// Resolve potion names
if (item.ItemGroup == ItemGroups.UselessItems1 && item.TemplateIndex == (int)UselessItems1.Glass_Bottle)
return MacroHelper.GetValue("%po", item);

return result;
}

Expand Down
5 changes: 4 additions & 1 deletion Assets/Scripts/Internal/DaggerfallLoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,16 @@ public void RandomlyAddMap(int chance)

/// <summary>
/// Randomly add a potion
/// TODO: Add potion contents. Just a glass bottle for now.
/// </summary>
public void RandomlyAddPotion(int chance)
{
ushort[] potionValues = { 25, 50, 50, 50, 75, 75, 75, 75, 100, 100, 100, 100, 125, 125, 125, 200, 200, 200, 250, 500 };
if (Random.Range(1, 101) < chance)
{
DaggerfallUnityItem potion = new DaggerfallUnityItem(ItemGroups.UselessItems1, 1);
byte recipe = (byte)Random.Range(0, 20);
potion.typeDependentData = recipe;
potion.value = potionValues[recipe];
items.AddItem(potion);
}
}
Expand Down

0 comments on commit 8536f2c

Please sign in to comment.