-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCrafting.cs
62 lines (49 loc) · 1.51 KB
/
Crafting.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Text;
using Rpg;
namespace DiscordBot
{
public static class Crafting
{
static List<Recipe> recipes;
public static List<Recipe> CheckCraftables(Inventory inventory)
{
if (recipes == null)
BuildRecipes();
var items = inventory.GetVirtualList();
var recips = new List<Recipe>();
foreach (var recipe in recipes)
{
if (recipe.Craftability(inventory))
recips.Add(recipe);
}
return recips;
}
public static void BuildRecipes()
{
recipes = new List<Recipe>();
var stoneClub = new Weapon(0.1f);
stoneClub.SetStats(1.5f, 1f, 1f, 0f, 1f, 0f);
stoneClub.name = "Stone Club";
var stoneClubRecipe = new Recipe();
stoneClubRecipe.craft = stoneClub;
stoneClubRecipe.requirements = new List<Item>() { ItemGenerator.wood };
recipes.Add(stoneClubRecipe);
var bow = new Weapon(0.75f);
bow.agiFactor = 2f;
bow.agiBonus = 1f;
bow.strBonus = 1f;
bow.name = "Wood Bow";
}
public static Recipe GetRecipe(string craftName)
{
foreach (var item in recipes)
{
if (item.craft.name == craftName)
return item;
}
return null;
}
}
}