-
Notifications
You must be signed in to change notification settings - Fork 0
/
classLibrary2.cs
822 lines (665 loc) · 29.6 KB
/
classLibrary2.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
using System;
using System.Collections.Generic;
using System.Text;
namespace Inventory_System
{
public static class usefulTools
{
public static List<string> arrToList(this string[] ourArrSubj)
{
List<string> ourListRes = new List<string>();
foreach (string CYC in ourArrSubj)
{
ourListRes.Add(CYC);
}
return ourListRes;
}
public static void enchantmentTransferFromBookTo(this Item thisEnchantmentBook, Item subjectOfEnchant)
{
if (thisEnchantmentBook.IDofItem == 5)
{
while (thisEnchantmentBook.enchantmentsOfItem.Count > 0)
{
thisEnchantmentBook.enchantmentsOfItem[0].applyEnchant(thisEnchantmentBook, subjectOfEnchant);
}
}
}
public static string showOpposingEffect(this string effectTypeSubj)
{
switch (effectTypeSubj)
{
case "agility": return "slowness";
case "slowness": return "agility";
case "resistance": return "fragility";
case "fragility": return "resistance";
case "mighty": return "weakness";
case "weakness": return "mighty";
}
return "empty";
}
public static void individualSearchToAddEnch(short valueWeWantToIns)
{
}
public static List<Enchantments> updateEnchants(this List<string> enchantmentsGiven, Item ourSubjectOfEnchnatUpdate)
{
var ourEnchantedResult = ourSubjectOfEnchnatUpdate.enchantmentsOfItem;
for (byte cycle = 0; cycle < enchantmentsGiven.Count; cycle++)
{
ourEnchantedResult.Add(new Enchantments(enchantmentsGiven[cycle]));
}
for (short mainCycle = 0; mainCycle < ourEnchantedResult.Count; mainCycle++)
{
for (short cycle = (byte)(mainCycle + 1); cycle < ourEnchantedResult.Count; cycle++)
{
short valueStore = ourEnchantedResult[cycle].magicalPower;
if (ourEnchantedResult[mainCycle].enchantNameSearch == ourEnchantedResult[cycle].enchantNameSearch && valueStore > 0)
{
ourEnchantedResult[mainCycle].magicalPower += valueStore;
ourEnchantedResult[cycle].magicalPower -= valueStore;
Console.WriteLine("hi " + ourEnchantedResult[mainCycle].magicalPower + " " + ourEnchantedResult[cycle].magicalPower);
}
}
}
byte orginalLength = (byte)(ourEnchantedResult.Count);
byte foundVoid = 0;
do
{
foundVoid = 0;
for (byte Cycle = 0; Cycle < ourEnchantedResult.Count; Cycle++)
{
ourEnchantedResult[Cycle].updateEnchStats();
if (ourEnchantedResult[Cycle].magicalPower <= 0)
{
ourEnchantedResult.RemoveAt(Cycle);
foundVoid++;
}
}
} while (foundVoid > 0);
return ourEnchantedResult;
}
public static List<Effects> fuseEffects(this List<string> effectsGiven)
{
List<Effects> effectSolution = new List<Effects>();
short[] multiplierList = new short[effectsGiven.Count];
for (byte quickCyc = 0; quickCyc < multiplierList.Length; quickCyc++)
{
multiplierList[quickCyc] = 1;
}
for (short mainCycle = 0; mainCycle < effectsGiven.Count; mainCycle++)
{
for (short cycle = (byte)(mainCycle + 1); cycle < effectsGiven.Count; cycle++)
{
short valueStore = multiplierList[mainCycle];
if (effectsGiven[mainCycle] == showOpposingEffect(effectsGiven[cycle]))
{
//Console.WriteLine(ourListOfEffectGiven[mainCycle] + " " + valueStore);
multiplierList[mainCycle] -= valueStore;
//Console.WriteLine(ourListOfEffectGiven[cycle] + " " + multiplierList[cycle]);
multiplierList[cycle] -= valueStore;
}
if (effectsGiven[mainCycle] == effectsGiven[cycle])
{
multiplierList[mainCycle] += valueStore;
multiplierList[cycle] -= valueStore;
}
}
}
for (byte cyc = 0; cyc < effectsGiven.Count; cyc++)
{
string currentCycle = effectsGiven[cyc];
string[] arrayOfBaseEffectTypes = new string[3];
arrayOfBaseEffectTypes[0] = "baseSpeed";
arrayOfBaseEffectTypes[1] = "baseHealth";
arrayOfBaseEffectTypes[2] = "baseStrength";
switch (currentCycle.ToLower())
{
case "agility":
effectSolution.Add(new Effects(multiplierList[cyc], arrayOfBaseEffectTypes[0])); break;
case "slowness":
effectSolution.Add(new Effects(-1 * multiplierList[cyc], arrayOfBaseEffectTypes[0])); break;
case "resistance":
effectSolution.Add(new Effects(multiplierList[cyc], arrayOfBaseEffectTypes[1])); break;
case "fragility":
effectSolution.Add(new Effects(-1 * multiplierList[cyc], arrayOfBaseEffectTypes[1])); break;
case "mighty":
effectSolution.Add(new Effects(multiplierList[cyc], arrayOfBaseEffectTypes[2])); break;
case "weakness":
effectSolution.Add(new Effects(-1 * multiplierList[cyc], arrayOfBaseEffectTypes[2])); break;
default:
Random randomizer = new Random();
short chosenSide = (short)randomizer.Next(-1, 2);
while (chosenSide == 0)
{
chosenSide = (short)randomizer.Next(-1, 2);
}
effectSolution.Add(new Effects(chosenSide * multiplierList[cyc], arrayOfBaseEffectTypes[randomizer.Next(0, 3)])); break;
}
effectSolution[cyc].updateName();
}
byte foundVoid = 0;
do
{
foundVoid = 0;
for (byte Cycle = 0; Cycle < effectSolution.Count; Cycle++)
{
if (effectSolution[Cycle].findEffectTytpe == "empty")
{
effectSolution.RemoveAt(Cycle);
foundVoid++;
}
}
} while (foundVoid > 0);
return effectSolution;
}
public static void manageEnchantments(this Enchantments enchantmentWeWantToTransfer, Item enchantmentGiver, Item subjectItem)
{
var ourEnchantingHost = subjectItem.enchantmentsOfItem;
var ourEnchantingDonator = enchantmentGiver.enchantmentsOfItem;
if ((subjectItem.IDofItem == 3 || subjectItem.IDofItem == 4) && enchantmentGiver.IDofItem == 5)
{
ourEnchantingHost.Add(enchantmentWeWantToTransfer);
ourEnchantingDonator.RemoveAt(ourEnchantingDonator.IndexOf(enchantmentWeWantToTransfer));
}
}
public static short closestBase(short ourValue, short baseVal, bool doesReturnValQ = true)
{
if (ourValue < 0)
{
ourValue = (short)Math.Pow(Math.Pow(ourValue, 2), 0.5);
}
byte startingPower = 0;
while (ourValue > Math.Pow(baseVal, startingPower))
{
startingPower++;
}
if (doesReturnValQ == false)
{
return (short)Math.Pow(baseVal, startingPower - 1);
}
return (short)Math.Pow(baseVal, startingPower);
}
public static void displayEfcs(this Item ourSubject, string spacing = " ")
{
var effectsOfOurSubject = ourSubject.lingeringEffects;
string accumulatedInfo = "";
if (effectsOfOurSubject.Count > 0)
{
foreach (Effects currentCyc in effectsOfOurSubject)
{
accumulatedInfo += currentCyc.findEffectTytpe + spacing + "speed value: " + currentCyc.baseEffectSpeed + spacing + "health value: " + currentCyc.baseEffectHealth + spacing + "strength value: " + currentCyc.baseEffectStrength + "\n";
}
}
else
{
accumulatedInfo = "No effects";
}
if (ourSubject.IDofItem == 2)
{
Console.WriteLine("Potency Factor: " + ourSubject.potionInfo.potency + spacing + "Duration Period: " + ourSubject.potionInfo.duration + "\n" + accumulatedInfo);
}
else if (ourSubject.IDofItem == 1)
{
Console.WriteLine("Hunger Cancellation: " + ourSubject.foodStats.hungerBoost + spacing + "Required Period to consume: " + ourSubject.foodStats.timeToEat + "\n" + accumulatedInfo + "in food, duration of effects dure very short time");
}
else
{
Console.WriteLine("Effects which are not of food/potion class are offensive: " + accumulatedInfo);
}
}
public static void displayEnchs(this Item ourSubject, string spacing = " ")
{
var enchantmentsOfSubject = ourSubject.enchantmentsOfItem;
string accumulatedInfo = "";
if (enchantmentsOfSubject.Count > 0)
{
foreach (Enchantments currentCyc in enchantmentsOfSubject)
{
accumulatedInfo += currentCyc.enchantNameSearch + spacing + currentCyc.level + "\n";
}
}
else
{
accumulatedInfo = "No enchantments";
}
if (ourSubject.IDofItem == 3)
{
var quickPointer = ourSubject.weaponStats;
Console.WriteLine("Attack Value: " + quickPointer.damagePoints + spacing + "Blocking ability: " + quickPointer.blockChance + spacing + "Reach of weapon: " + quickPointer.reachOfWeapon + "\n" + accumulatedInfo);
}
if (ourSubject.IDofItem == 4)
{
var quickPointer = ourSubject.clothingInfo;
Console.WriteLine("Type of clothing/armor/dress: " + quickPointer.setTypeofClothing + spacing + "Armor points: " + quickPointer.armorPoints + spacing + "Weight of armor(unknown units): " + spacing + quickPointer.weightOfCloth + "\n" + accumulatedInfo);
}
if (ourSubject.IDofItem == 5)
{
Console.WriteLine("Author of Book: " + ourSubject.bookDetails.authorOfBook + spacing + "Contents: " + ourSubject.bookDetails.contentsOfBook + "\n" + accumulatedInfo);
}
}
public class toolDetails
{
public short durabilityLimit;
public short currentDurability;
//temporary storage for enchantments, they are not yet applied
public toolDetails(short durabilityLimAssigned = 0, short naturalDurability = 0)
{
currentDurability = naturalDurability;
durabilityLimit = durabilityLimAssigned;
if (naturalDurability == 0)
{
currentDurability = durabilityLimAssigned;
}
}
}
public class Enchantments
{
public short magicalPower;
public short copiesReqToLvlUp;
private string enchantType;
public short level;
public Enchantments(string nameOfEnchant = "Unbreaking", short magicGiven = 0)
{
enchantNameSearch = nameOfEnchant;
enchantFuseReqSearch = 0;
if (magicGiven == 0)
{
magicalPower = enchantFuseReqSearch;
}
updateEnchStats();
//default enchantmnet name is Unbreaking
}
public void updateEnchStats()
{
level = (short)(Math.Log(magicalPower, copiesReqToLvlUp));
}
public string enchantNameSearch
{
get { return enchantType; }
set
{
string[] legalEnchantments = { "unbreaking", "light weight", "protection", "sharpness", "mending", "sweeping edge", "blocking power", "fire aspect" };
foreach (string cycleCheck in legalEnchantments)
{
if (cycleCheck == value.ToLower())
{
enchantType = value;
break;
}
else
{
Random randomEnchantAssigment = new Random();
enchantType = legalEnchantments[randomEnchantAssigment.Next(0, legalEnchantments.Length)];
}
}
}
}
public short enchantFuseReqSearch
{
get { return copiesReqToLvlUp; }
set
{
string[] enchesReq3 = { "mending", "fire aspect", "light weight" };
if (arrToList(enchesReq3).Contains(enchantType))
{
copiesReqToLvlUp = 3;
}
else
{
copiesReqToLvlUp = 2;
}
}
}
public void applyEnchant(Item enchantmentBook, Item subjectOfEnchant)
{
//ID 4 for cllothes, ID 3 for utensils
if (subjectOfEnchant.IDofItem == 3 || subjectOfEnchant.IDofItem == 4)
{
if (enchantNameSearch == "unbreaking")
{
var ourEnchantingHost = subjectOfEnchant.specificDetailsOfItem;
ourEnchantingHost.durabilityLimit *= (short)(level + 1);
ourEnchantingHost.currentDurability *= (short)(level + 1);
manageEnchantments(this, enchantmentBook, subjectOfEnchant);
}
if (enchantNameSearch == "mending")
{
manageEnchantments(this, enchantmentBook, subjectOfEnchant);
}
}
if (subjectOfEnchant.IDofItem == 4)
{
if (enchantNameSearch == "protection")
{
subjectOfEnchant.clothingInfo.armorPoints += (short)(level * subjectOfEnchant.clothingInfo.armorPoints * 0.2);
manageEnchantments(this, enchantmentBook, subjectOfEnchant);
}
if (enchantNameSearch == "light weight")
{
subjectOfEnchant.clothingInfo.weightOfCloth += (short)(level * subjectOfEnchant.clothingInfo.weightOfCloth * 0.2);
manageEnchantments(this, enchantmentBook, subjectOfEnchant);
}
}
if (subjectOfEnchant.IDofItem == 3)
{
if (enchantNameSearch == "sweeping edge")
{
subjectOfEnchant.weaponStats.reachOfWeapon += (short)(level * subjectOfEnchant.weaponStats.reachOfWeapon * 0.2);
manageEnchantments(this, enchantmentBook, subjectOfEnchant);
}
if (enchantNameSearch == "sharpness")
{
subjectOfEnchant.weaponStats.damagePoints += (short)(level * subjectOfEnchant.weaponStats.damagePoints * 0.1);
manageEnchantments(this, enchantmentBook, subjectOfEnchant);
}
if (enchantNameSearch == "blocking power")
{
subjectOfEnchant.weaponStats.blockChance += (short)(level * subjectOfEnchant.weaponStats.blockChance * 0.1);
manageEnchantments(this, enchantmentBook, subjectOfEnchant);
}
if (enchantNameSearch == "fire aspect")
{
List<string> fireEffectAccumulator = new List<string>();
for (short cycle = 0; cycle < level; cycle++)
{
fireEffectAccumulator.Add("fragility");
}
fuseEffects(fireEffectAccumulator);
manageEnchantments(this, enchantmentBook, subjectOfEnchant);
}
}
}
}
public class weaponSpecialization
{
public short damagePoints;
public short reachOfWeapon;
public short blockChance;
public weaponSpecialization(short valueOfWeapon = 0, short weaponRange = 0)
{
byte absoluteValue = (byte)Math.Pow(Math.Pow(valueOfWeapon, 2), 0.5);
damagePoints = 0;
blockChance = 0;
if (valueOfWeapon < 0)
{
damagePoints = absoluteValue;
}
if (valueOfWeapon > 0)
{
blockChance = absoluteValue;
}
reachOfWeapon = weaponRange;
}
}
public struct foodNutritionalValue
{
public byte timeToEat;
public byte hungerBoost;
public foodNutritionalValue(byte hungerPointsIncreaser, byte consumingTime)
{
timeToEat = consumingTime;
hungerBoost = hungerPointsIncreaser;
}
}
public class clothingValue
{
public short armorPoints;
/*hat, helmet by default have coveredArea value of 5
pants, trousres have default coveredArea value of 8
socks and shoes have default coveredArea value of 4
cloth, chestplate have default coveredArea value of 9
*/
public short weightOfCloth;
private string typeOfClothing;
public clothingValue(short armorValueGiven = 0, short weightAssigned = 0, string desiredClothType = null)
{
armorPoints = armorValueGiven;
if (weightAssigned == 0)
{
//default way of balancing armor/clothing, more armorPoints, more WieighTvalue
weightAssigned = (short)((float)armorValueGiven / (float)closestBase(armorValueGiven, 10));
}
weightOfCloth = weightAssigned;
typeOfClothing = desiredClothType;
}
public string setTypeofClothing
{
get { return typeOfClothing; }
set
{
List<string> allowedTypesOfClothing = new List<string>() { "hat", "helmet", "pants", "trousers", "shoes", "socks", "chestplate", null };
foreach (string cycleOfSelection in allowedTypesOfClothing)
{
if (value.ToLower() == cycleOfSelection)
{
typeOfClothing = value;
break;
}
else { typeOfClothing = null; }
}
}
}
}
public struct potionValue
{
public byte potency;
public short duration;
public potionValue(byte potencyGiven = 1, short durationGiven = 60)
{
potency = potencyGiven;
duration = durationGiven;
}
}
public struct Effects
{
/*public byte rateOfEffectPerUnitDuration
^^^^^^^ I added this just incase i want to add new effect types or make a change the whole potion system
*/
//doesnt matter the magnitude, we only care of if its either {+,0,-}
public short baseEffectStrength;
public short baseEffectHealth;
public short baseEffectSpeed;
private string effectName;
public Effects(int effectValGiven = 0, string baseType = "baseEmpty")
{
baseEffectStrength = 0;
baseEffectHealth = 0;
baseEffectSpeed = 0;
if (baseType.ToLower() == "basestrength")
{
baseEffectStrength = (short)effectValGiven;
}
else if (baseType.ToLower() == "basehealth")
{
baseEffectHealth = (short)effectValGiven;
}
else if (baseType.ToLower() == "basespeed")
{
baseEffectSpeed = (short)effectValGiven;
}
effectName = "empty";
findEffectTytpe = "";
}
public string findEffectTytpe
{
get { return effectName; }
set
{
if (baseEffectSpeed > 0 && baseEffectHealth == 0 && baseEffectStrength == 0)
{
effectName = "agility";
}
else if (baseEffectSpeed < 0 && baseEffectHealth == 0 && baseEffectStrength == 0)
{
effectName = "slowness";
}
else if (baseEffectSpeed == 0 && baseEffectHealth > 0 && baseEffectStrength == 0)
{
effectName = "resistance";
}
else if (baseEffectSpeed == 0 && baseEffectHealth < 0 && baseEffectStrength == 0)
{
effectName = "fragility";
}
else if (baseEffectSpeed == 0 && baseEffectHealth == 0 && baseEffectStrength > 0)
{
effectName = "mighty";
}
else if (baseEffectSpeed == 0 && baseEffectHealth == 0 && baseEffectStrength < 0)
{
effectName = "weakness";
}
//the following effects are place holders if the editor wants to add more effect types
else if (baseEffectSpeed != 0 || baseEffectHealth != 0 || baseEffectStrength != 0)
{
effectName = "other";
}
else
{
effectName = "empty";
}
}
}
public void updateName()
{
findEffectTytpe = effectName;
}
}
public class bookValue
{
public string contentsOfBook;
public string authorOfBook;
public bookValue(string deliveredContents = null, string supposedAuthor = "unknown")
{
contentsOfBook = deliveredContents;
authorOfBook = supposedAuthor;
}
}
public struct Item
{
//general Info
public string itemName;
public string description;
public byte IDofItem;
public byte itemStackLimit;
public byte stackValue;
//if ID == 1, for food
public foodNutritionalValue foodStats;
//if ID == 2, for potion effect
public potionValue potionInfo;
//If ID == 3, for weapons
public weaponSpecialization weaponStats;
//if ID==4, for clothing
public clothingValue clothingInfo;
public toolDetails specificDetailsOfItem;
//this next List<Effects> is 100% to work with potions
//but if we apply it to food there is a small possibility and it lasts a short random period
public List<Effects> lingeringEffects;
public List<Enchantments> enchantmentsOfItem;
//for ID == 5, books
public bookValue bookDetails;
public Item(string nameOfItem, string detailsOfItem, byte stackLim = 64, byte amountLoaded = 16)
{
itemName = nameOfItem;
description = detailsOfItem;
itemStackLimit = stackLim;
stackValue = amountLoaded;
//default ID is 0
IDofItem = 0;
foodStats = new foodNutritionalValue();
potionInfo = new potionValue();
weaponStats = new weaponSpecialization();
clothingInfo = new clothingValue();
specificDetailsOfItem = new toolDetails();
lingeringEffects = new List<Effects>();
enchantmentsOfItem = new List<Enchantments>();
bookDetails = new bookValue();
}
public void assignWeaponRole(short DfsOrDmgValue, short weaponRange, short durabilityGiven = 100)
{
IDofItem = 3;
specificDetailsOfItem = new toolDetails(durabilityGiven);
enchantmentsOfItem = new List<Enchantments>();
weaponStats = new weaponSpecialization(DfsOrDmgValue, weaponRange);
}
public void assignFoodUse(byte hungerVal, byte timeRequiredToConsume)
{
IDofItem = 1;
foodStats = new foodNutritionalValue(hungerVal, timeRequiredToConsume);
}
public void assignClothingRole(short armorValue, short weightAssigned = 0, short durabilityGiven = 100, string clothingType = "cloth")
{
IDofItem = 4;
specificDetailsOfItem = new toolDetails(durabilityGiven);
enchantmentsOfItem = new List<Enchantments>();
clothingInfo = new clothingValue(armorValue, weightAssigned, clothingType);
clothingInfo.setTypeofClothing = clothingType;
}
public void assignPotionUse(byte intensityInitiation, byte durationInitiation)
{
IDofItem = 2;
//by default poions are empty
potionInfo = new potionValue(intensityInitiation, durationInitiation);
}
public void turnIntoBook(string contentsWanted, string authorOfBook = "unknown")
{
IDofItem = 5;
bookDetails = new bookValue(contentsWanted, authorOfBook);
}
public void updateEnchantmentStatus(List<string> enchantmentsWanted)
{
if (IDofItem == 3 || IDofItem == 4 || IDofItem == 5)
{
updateEnchants(enchantmentsWanted, this);
}
}
}
//using minecraft inventory set up as a inspiration
public class Inventory
{
public string playerNickName;
public Item[][] storageOfItems;
public Item[] armorInventory;
public Item[] quickAccessInventory;
public Item offHand;
public Item mainHand;
public byte hungerBarSize;
public byte hungerPoints;
public byte healthBarSize;
public byte healthPoints;
public byte armorBar;
public byte armorPoints;
public byte expBar;
public List<Effects> statusEffects;
public Inventory(short xSizeOfPlayerStorage, short ySizeOfPlayerStorage, short sizeOfQuickAccesInventory, byte statsSet)
{
storageOfItems = new Item[ySizeOfPlayerStorage][];
for (byte cycleYStorage = 0; cycleYStorage < ySizeOfPlayerStorage; cycleYStorage++)
{
storageOfItems[cycleYStorage] = new Item[xSizeOfPlayerStorage];
for (byte cycleXStorage = 0; cycleXStorage < xSizeOfPlayerStorage; cycleXStorage++)
{
storageOfItems[cycleYStorage][cycleXStorage] = new Item(null, null, 0, 0);
}
}
healthBarSize = statsSet;
healthPoints = statsSet;
hungerBarSize = statsSet;
hungerPoints = statsSet;
armorBar = statsSet;
armorPoints = 0;
armorInventory = new Item[4];
for (byte cycleArmor = 0; cycleArmor < armorInventory.Length; cycleArmor++)
{
armorInventory[cycleArmor] = new Item(null, null, 1, 0);
}
offHand = new Item(null, null, 0, 0);
quickAccessInventory = new Item[sizeOfQuickAccesInventory];
for (byte cycleQuickAccess = 0; cycleQuickAccess < sizeOfQuickAccesInventory; cycleQuickAccess++)
{
quickAccessInventory[cycleQuickAccess] = new Item(null, null, 0, 0);
}
mainHand = quickAccessInventory[0];
}
}
}
}