proc-gen equipment drops from monsters can be picked up
[sketchy-heroes.git] / prisma / seed / monsters.ts
1 import {Biome, MonsterType} from '@prisma/client';
2 import { prisma } from '../../src/lib/db';
3
4 const monsterList = [
5   {
6     name: "Rat",
7     monster_type: [MonsterType.BEAST],
8     availability: [
9       {
10         type: Biome.PLAINS,
11         weight: 0.5,
12         time: [{min: 0, max: 30}]
13       },
14       {
15         type: Biome.FIELDS,
16         weight: 0.5,
17         time: [{min: 0, max: 24}]
18       },
19       {
20         type: Biome.WOODLAND,
21         weight: 0.6,
22         time: [{min: 0, max: 24}]
23       }
24     ]
25   },
26   {
27     name: "Bat",
28     monster_type: [MonsterType.FLYING],
29     availability: [
30       {
31         type: Biome.FIELDS,
32         weight: 0.2,
33         time: [{min: 0, max: 4}, {min: 20, max: 24}]
34       },
35       {
36         type: Biome.WOODLAND,
37         weight: 0.4,
38         time: [{min: 0, max: 4}, {min: 20, max: 24}]
39       },
40       {
41         type: Biome.FOREST,
42         weight: 0.4,
43         time: [{min: 0, max: 4}, {min: 20, max: 24}]
44       }
45     ]
46   },
47   {
48     name: "Wild Boar",
49     monster_type: [MonsterType.BEAST],
50     availability: [
51       {
52         type: Biome.PLAINS,
53         weight: 0.3,
54         time: [{min: 0, max: 29}]
55       },
56       {
57         type: Biome.FIELDS,
58         weight: 0.3,
59         time: [{min: 0, max: 24}]
60       },
61       {
62         type: Biome.WOODLAND,
63         weight: 0.3,
64         time: [{min: 0, max: 24}]
65       }
66     ]
67   },
68   {
69     name: "Bandit",
70     monster_type: [MonsterType.HUMANOID],
71     availability: [
72       {
73         type: Biome.FIELDS,
74         weight: 0.3,
75         time: [{min: 0, max: 5}, {min: 16, max: 24}]
76       },
77       {
78         type: Biome.WOODLAND,
79         weight: 0.3,
80         time: [{min: 0, max: 5}, {min: 16, max: 24}]
81       },
82       {
83         type: Biome.FOREST,
84         weight: 0.1,
85         time: [{min: 0, max: 5}, {min: 16, max: 24}]
86       }
87     ]
88   },
89   {
90     name: "Thief",
91     monster_type: [MonsterType.HUMANOID],
92     availability: [
93       {
94         type: Biome.FIELDS,
95         weight: 0.3,
96         time: [{min: 0, max: 5}, {min: 18, max: 24}]
97       },
98       {
99         type: Biome.WOODLAND,
100         weight: 0.3,
101         time: [{min: 0, max: 5}, {min: 16, max: 24}]
102       },
103       {
104         type: Biome.FOREST,
105         weight: 0.1,
106         time: [{min: 0, max: 5}, {min: 16, max: 24}]
107       }
108     ]
109   },
110   {
111     name: "Sunstrider",
112     monster_type: [MonsterType.INSECT],
113     availability: [
114       {
115         type: Biome.FIELDS,
116         weight: 0.15,
117         time: [{min: 8, max: 15}]
118       },
119       {
120         type: Biome.PLAINS,
121         weight: 0.3,
122         time: [{min: 8, max: 17}]
123       }
124     ]
125   },
126   {
127     name: "Lich",
128     monster_type: [MonsterType.UNDEAD],
129     availability: [
130       {
131         type: Biome.FOREST,
132         weight: 0.15,
133         time: [{min: 19, max: 24}, {min: 0, max: 3}]
134       },
135       {
136         type: Biome.WOODLAND,
137         weight: 0.05,
138         time: [{min: 19, max: 24}, {min: 0, max: 3}]
139       }
140     ]
141   },
142   {
143     name: "Centaur",
144     monster_type: [MonsterType.HUMANOID, MonsterType.BEAST],
145     availability: [
146       {
147         type: Biome.WOODLAND,
148         weight: 0.2,
149         time: [{min: 0, max: 24}]
150       }
151     ]
152   },
153   {
154     name: "Giant Scorpion",
155     monster_type: [MonsterType.INSECT, MonsterType.GIANT],
156     availability: [
157       {
158         type: Biome.DESERT,
159         weight: 0.3,
160         time: [{min: 0, max: 24}]
161       }
162     ]
163   },
164   {
165     name: "Wolf",
166     onster_type: [MonsterType.BEAST],
167     availability: [
168       {
169         type: Biome.MOUNTAIN,
170         weight: 0.3,
171         time: [{min: 0, max: 24}]
172       },
173       {
174         type: Biome.FOREST,
175         weight: 0.3,
176         time: [{min: 0, max: 24}]
177       }
178     ]
179   },
180   {
181     name: "Bear",
182     monster_type: [MonsterType.BEAST],
183     availability: [
184       {
185         type: Biome.MOUNTAIN,
186         weight: 0.3,
187         time: [{min: 0, max: 24}]
188       },
189       {
190         type: Biome.FOREST,
191         weight: 0.3,
192         time: [{min: 0, max: 24}]
193       }
194     ]
195   },
196   {
197     name: "Troll",
198     monster_type: [MonsterType.HUMANOID],
199     availability: [
200       {
201         type: Biome.MOUNTAIN,
202         weight: 0.3,
203         time: [{min: 0, max: 4}, {min: 20, max: 24}]
204       },
205       {
206         type: Biome.FOREST,
207         weight: 0.3,
208         time: [{min: 0, max: 4}, {min: 20, max: 24}]
209       }
210     ]
211   }
212 ];
213
214
215 // wipe all monsters!
216 export async function down() {
217   await prisma.fight.deleteMany();
218   await prisma.monsterBiome.deleteMany();
219   await prisma.monster.deleteMany();
220 }
221
222 export async function up() {
223   monsterList.forEach(async monster => {
224     const createdMonster = await prisma.monster.create({
225       data: {
226         name: monster.name,
227         monsterType: monster.monster_type
228       }
229     });
230
231     await prisma.monsterBiome.createMany({
232       data: monster.availability.map(availability => {
233         return {
234           biome: availability.type,
235           monsterId: createdMonster.id,
236           weight: availability.weight,
237           time: availability.time
238         }
239       })
240     });
241   });
242 }