File size: 46,422 Bytes
b6a38d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
820
821
822
-- ========== GENERATED BY ClassDef Editor (Ctrl-Alt-F3) DO NOT EDIT MANUALLY! ==========

DefineClass.AmmoProperties = {
	__parents = { "PropertyObject", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Caliber", id = "Caliber", 
			editor = "combo", default = false, template = true, items = function (self) return PresetGroupCombo("Caliber", "Default") end, },
		{ category = "Caliber", id = "MaxStacks", name = "Max Stacks", help = "Ammo can stack up to that number.", 
			editor = "number", default = 10, template = true, slider = true, min = 1, max = 10000, },
		{ id = "Modifications", 
			editor = "nested_list", default = false, template = true, base_class = "CaliberModification", inclusive = true, },
		{ category = "Combat", id = "AppliedEffects", name = "Applied Effects", 
			editor = "preset_id_list", default = {}, template = true, preset_class = "CharacterEffectCompositeDef", preset_group = "Default", item_default = "", },
		{ category = "General", id = "ammo_type_icon", name = "Ammo Type Icon", help = "Ammo type icon", 
			editor = "ui_image", default = false, template = true, },
	},
}

DefineClass.ArmorProperties = {
	__parents = { "ItemWithCondition", },
	__generated_by_class = "ClassDef",

	properties = {
		{ id = "Slot", 
			editor = "combo", default = "Torso", template = true, items = function (self) return {"Head", "Torso", "Legs"} end, },
		{ category = "Combat", id = "PenetrationClass", 
			editor = "number", default = 1, template = true, 
			name = function(self) return "Penetration Class: " .. (PenetrationClassIds[self.PenetrationClass] or "") end, slider = true, min = 1, max = 5, modifiable = true, },
		{ category = "Combat", id = "DamageReduction", name = "Damage Reduction (Base)", help = "How much damage the armor absorbs when the attack lands in an area covered by the armor.", 
			editor = "number", default = 10, template = true, scale = "%", slider = true, min = 0, max = 100, },
		{ category = "Combat", id = "AdditionalReduction", name = "Damage Reduction (Additional)", help = "Additional damage reduction applied when the effective Penetration Class of the attack is lower than the Penetration Class of the armor protecting the hit body part.", 
			editor = "number", default = 10, template = true, scale = "%", slider = true, min = 0, max = 100, },
		{ category = "Combat", id = "ProtectedBodyParts", name = "Protected Body Parts", 
			editor = "set", default = false, template = true, items = function (self) return PresetGroupCombo("TargetBodyPart", "Default") end, },
		{ category = "Combat", id = "Camouflage", 
			editor = "bool", default = false, template = true, },
	},
}

DefineClass.BobbyRayShopAmmoProperties = {
	__parents = { "BobbyRayShopItemProperties", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "BobbyRayShop", id = "CategoryPair", 
			editor = "preset_id", default = "12gauge", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "Ammo", },
	},
}

function BobbyRayShopAmmoProperties:GetShopStats(stacks)
	return BobbyRayStoreGetStats_Ammo(self)
end

DefineClass.BobbyRayShopArmorProperties = {
	__parents = { "BobbyRayShopUsedItemProperties", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "BobbyRayShop", id = "CategoryPair", 
			editor = "preset_id", default = "UtilityArmor", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "Armor", },
	},
}

function BobbyRayShopArmorProperties:GetShopStats(stacks)
	return BobbyRayStoreGetStats_Armor(self)
end

function BobbyRayShopArmorProperties:GetShopDescription()
	local hasDesc = self.Description and self.Description ~= ""
	local hasHint = self.AdditionalHint and self.AdditionalHint ~= ""
	local protectedParts = {}
	for part,val in sorted_pairs(self.ProtectedBodyParts) do
		local preset= Presets.TargetBodyPart.Default[part]
		table.insert(protectedParts, preset.display_name)
	end
	
	local protectedPartsText = ""
	if #protectedParts > 0 then 
		protectedPartsText = T{378508273050, "<bullet_point> Body parts - <parts>", parts = table.concat(protectedParts, ", ")}
	end
	
	--FindPreset("WeaponType", "Armor").Description
	
	local text = hasDesc and self.Description or hasHint and self.AdditionalHint or ""
	return protectedPartsText .. "\n" .. text
end

DefineClass.BobbyRayShopFirearmProperties = {
	__parents = { "BobbyRayShopWeaponProperties", },
	__generated_by_class = "ClassDef",

}

function BobbyRayShopFirearmProperties:GetShopStats(stacks)
	return BobbyRayStoreGetStats_Firearm(self)
end

function BobbyRayShopFirearmProperties:GenerateInventoryEntries(stacks)
	local items = {}
	if self.Used then
		local new_item = PlaceInventoryItem(self.class, self)
		new_item.Condition = self.Condition
		RestoreCloneWeaponComponents(new_item, self)
		new_item.Cost = new_item.Cost
		table.insert(items, new_item)
	else
		items = BobbyRayShopItemProperties.GenerateInventoryEntries(self, stacks)
	end
	
	for _, weapon in ipairs(items) do
		-- make sure all equipped firearms have ammo
		local ammo = GetAmmosWithCaliber(weapon.Caliber, "sort")[1]
		if ammo then
			local tempAmmo = PlaceInventoryItem(ammo.id)
			tempAmmo.Amount = tempAmmo.MaxStacks
			weapon:Reload(tempAmmo, "suspend_fx")
			DoneObject(tempAmmo)
		end
	end
	
	return items
end

function BobbyRayShopFirearmProperties:GetShopSubIcon()
	return CountWeaponUpgrades(self) > 0 and "UI/Inventory/w_mod" or ""
end

DefineClass.BobbyRayShopItemProperties = {
	__parents = { "PropertyObject", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "BobbyRayShop", id = "CanAppearInShop", 
			editor = "bool", default = false, template = true, },
		{ category = "BobbyRayShop", id = "Tier", name = "Tier", 
			editor = "combo", default = 1, no_edit = function(self) return not self.CanAppearInShop end, template = true, items = function (self) return { 1, 2, 3 } end, },
		{ category = "BobbyRayShop", id = "MaxStock", 
			editor = "number", default = 3, no_edit = function(self) return not self.CanAppearInShop end, template = true, min = 0, max = 99, },
		{ category = "BobbyRayShop", id = "RestockWeight", 
			editor = "number", default = 100, no_edit = function(self) return not self.CanAppearInShop end, template = true, min = 0, },
		{ category = "BobbyRayShop", id = "Stock", 
			editor = "number", default = 0, no_edit = true, template = true, min = 0, },
		{ category = "BobbyRayShop", id = "New", 
			editor = "bool", default = false, no_edit = true, },
		{ category = "BobbyRayShop", id = "Seen", 
			editor = "bool", default = false, no_edit = true, },
		{ category = "BobbyRayShop", id = "LastRestock", 
			editor = "number", default = -1, no_edit = true, template = true, min = -1, },
		{ category = "BobbyRayShop", id = "CanBeConsumed", 
			editor = "bool", default = true, no_edit = function(self) return not self.CanAppearInShop end, template = true, },
		{ category = "BobbyRayShop", id = "CategoryPair", 
			editor = "preset_id", default = "Missing", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "_Missing", },
		{ category = "BobbyRayShop", id = "ShopStackSize", 
			editor = "number", default = 1, no_edit = function(self) return not (g_Classes[self.id] and g_Classes[self.id].MaxStacks) or not self.CanAppearInShop end, template = true, min = 1, max = 99, },
		{ category = "BobbyRayShop", id = "CanAppearStandard", 
			editor = "bool", default = true, read_only = true, no_edit = true, },
	},
}

function BobbyRayShopItemProperties:GetShopDescription()
	return (self.Description and self.Description ~= "" and self.Description) or self.AdditionalHint
end

function BobbyRayShopItemProperties:GetShopSubIcon()
	return self.SubIcon
end

function BobbyRayShopItemProperties:GetShopStats(stacks)
	return {{ Untranslated("(design)"), Untranslated("Not implemented") }}
end

function BobbyRayShopItemProperties:GetCategory()
	return BobbyRayShopGetCategory(BobbyRayShopGetSubCategory(self.CategoryPair).Category)
end

function BobbyRayShopItemProperties:GetSubCategory()
	return BobbyRayShopGetSubCategory(self.CategoryPair)
end

function BobbyRayShopItemProperties:GenerateInventoryEntries(stacks)
	local items = {}
	if self.MaxStacks then
		local total_amount = stacks * (self.ShopStackSize or 1)
		local stacks = DivCeil(total_amount, self.MaxStacks)
		local remainder = total_amount - (stacks - 1) * self.MaxStacks
		for i = 1, stacks - 1 do
			local item = PlaceInventoryItem(self.class, self)
			item.Amount = item.MaxStacks
			table.insert(items, item)
		end
		local item = PlaceInventoryItem(self.class, self)
		item.Amount = remainder
		table.insert(items, item)
	else
		for i = 1, stacks do
			table.insert(items, PlaceInventoryItem(self.class, self))
		end
	end
	return items
end

DefineClass.BobbyRayShopMeleeWeaponProperties = {
	__parents = { "BobbyRayShopWeaponProperties", },
	__generated_by_class = "ClassDef",

}

function BobbyRayShopMeleeWeaponProperties:GetShopStats(stacks)
	return BobbyRayStoreGetStats_MeleeWeapon(self)
end

function BobbyRayShopMeleeWeaponProperties:GetShopSubIcon()
	return self.SubIcon
end

DefineClass.BobbyRayShopOtherProperties = {
	__parents = { "BobbyRayShopItemProperties", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "BobbyRayShop", id = "CategoryPair", 
			editor = "preset_id", default = "Other", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "Other", },
	},
}

function BobbyRayShopOtherProperties:GetShopDescription()
	return self.AdditionalHint
end

function BobbyRayShopOtherProperties:GetShopStats(stacks)
	return BobbyRayStoreGetStats_Other(self)
end

DefineClass.BobbyRayShopUsedItemProperties = {
	__parents = { "BobbyRayShopItemProperties", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "BobbyRayShop", id = "CanAppearUsed", 
			editor = "bool", default = true, no_edit = function(self) return not self.CanAppearInShop end, template = true, },
		{ category = "BobbyRayShop", id = "CanAppearStandard", 
			editor = "bool", default = true, no_edit = function(self) return not self.CanAppearInShop end, template = true, },
		{ category = "BobbyRayShop", id = "Used", 
			editor = "bool", default = false, no_edit = true, },
	},
}

function BobbyRayShopUsedItemProperties:GenerateInventoryEntries(stacks)
	if self.Used then
		local items = {}
		local new_item = PlaceInventoryItem(self.class, self)
		new_item.Condition = self.Condition
		new_item.Cost = new_item.Cost
		table.insert(items, new_item)
		return items
	else
		return BobbyRayShopItemProperties.GenerateInventoryEntries(self, stacks)
	end
end

function BobbyRayShopUsedItemProperties:GetShopConditionPercent()
	return Untranslated{"<percent(condPercent)>", condPercent = self:GetConditionPercent()}
end

DefineClass.BobbyRayShopWeaponProperties = {
	__parents = { "BobbyRayShopUsedItemProperties", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "BobbyRayShop", id = "CategoryPair", 
			editor = "preset_id", default = "UtilityWeapons", no_edit = function(self) return not self.CanAppearInShop end, template = true, preset_class = "BobbyRayShopSubCategory", preset_group = "Weapons", },
	},
}

function BobbyRayShopWeaponProperties:GetShopStats(stacks)
	if self:GetSubCategory().id == "MeleeWeapons" then
		return BobbyRayStoreGetStats_MeleeWeapon(self)
	else
		return BobbyRayStoreGetStats_Firearm(self)
	end
end

function BobbyRayShopWeaponProperties:GetShopDescription()
	local hasDesc = self.Description and self.Description ~= ""
	local hasHint = self.AdditionalHint and self.AdditionalHint ~= ""
	return hasDesc and self.Description or hasHint and self.AdditionalHint or FindPreset("WeaponType", self.WeaponType).Description
end

function BobbyRayShopWeaponProperties:GetShopSubIcon()
	if IsKindOf(self, "Firearm") then
		return CountWeaponUpgrades(self) > 0 and "UI/Inventory/w_mod" or ""
	else
			return BobbyRayShopItemProperties.GetShopSubIcon(self)
	end
end

DefineClass.CapacityItemProperties = {
	__parents = { "PropertyObject", },
	__generated_by_class = "ClassDef",

	properties = {
		{ id = "MaxCapacity", name = "Max Capacity", 
			editor = "number", default = 1000, template = true, min = 0, max = 10000, },
		{ id = "capacity", 
			editor = "number", default = false, no_edit = true, template = true, min = 0, max = 10000, },
		{ id = "deplete_progress", 
			editor = "number", default = 0, no_edit = true, template = true, min = 0, max = 10000, },
		{ id = "Deplete", 
			editor = "func", default = function (self, amount, holder)
self.capacity = self.capacity or self.MaxCapacity
AddScaledProgress(self, "deplete_progress", "capacity", -amount)
if self.capacity == 0 then
	local container_slot_name = GetContainerInventorySlotName(holder)
	local item = holder:RemoveItem(container_slot_name, self)
	if item then
		DoneObject(item)
		return true
	end
end
end, dont_save = true, no_edit = true, params = "self, amount, holder", },
		{ id = "IsDepleted", 
			editor = "func", default = function (self)
return (self.capacity or self.MaxCapacity) <= 0
end, dont_save = true, no_edit = true, },
	},
}

DefineClass.ExplosiveProperties = {
	__parents = { "PropertyObject", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Explosion", id = "CenterUnitDamageMod", name = "Unit Damage Modifier (Center)", help = "modifier applied to damage when damaging units in the central tile of the explosion", 
			editor = "number", default = 100, template = true, scale = "%", min = 0, max = 500, },
		{ category = "Explosion", id = "CenterObjDamageMod", name = "Object Damage Modifier (Center)", help = "modifier applied to damage when damaging objects in the central tile of the explosion", 
			editor = "number", default = 100, template = true, scale = "%", min = 0, max = 500, },
		{ category = "Explosion", id = "CenterAppliedEffects", name = "Applied Effects (Center)", help = "status effects applied in the central tile of the explosion", 
			editor = "preset_id_list", default = {}, template = true, preset_class = "CharacterEffectCompositeDef", preset_group = "Default", item_default = "", },
		{ category = "Explosion", id = "AreaOfEffect", name = "Area of Effect", help = "the blast range (radius) in number of tiles", 
			editor = "number", default = 3, template = true, min = 0, max = 20, modifiable = true, },
		{ category = "Explosion", id = "CenterAreaOfEffect", name = "Central Area of Effect", help = "the central blast area radius in number of tiles", 
			editor = "number", default = 1, template = true, min = 1, max = 20, modifiable = true, },
		{ category = "Explosion", id = "AreaUnitDamageMod", name = "Unit Damage Modifier (Area)", help = "modifier applied to damage when damaging units outside the central tile of the explosion", 
			editor = "number", default = 100, template = true, scale = "%", min = 0, max = 500, },
		{ category = "Explosion", id = "AreaObjDamageMod", name = "Object Damage Modifier (Area)", help = "modifier applied to damage when damaging objects outside the central tile of the explosion", 
			editor = "number", default = 100, template = true, scale = "%", min = 0, max = 500, modifiable = true, },
		{ category = "Explosion", id = "AreaAppliedEffects", name = "Applied Effects (Area)", help = "status effects applied outside the central tile of the explosion", 
			editor = "preset_id_list", default = {}, template = true, preset_class = "CharacterEffectCompositeDef", preset_group = "Default", item_default = "", },
		{ category = "Explosion", id = "PenetrationClass", 
			editor = "number", default = 5, template = true, 
			name = function(self) return "Penetration Class: " .. (PenetrationClassIds[self.PenetrationClass] or "") end, slider = true, min = 1, max = 5, modifiable = true, },
		{ category = "Explosion", id = "coneShaped", name = "Cone Shaped", 
			editor = "bool", default = false, template = true, },
		{ category = "Explosion", id = "coneAngle", name = "Cone Angle", help = "The angle of the bigger cone arc", 
			editor = "number", default = 30, no_edit = function(self) return not self.coneShaped end, template = true, min = 1, max = 360, },
		{ category = "Explosion", id = "BurnGround", 
			editor = "bool", default = true, template = true, },
		{ category = "Explosion", id = "DeathType", 
			editor = "choice", default = "Normal", template = true, items = function (self) return {"Normal", "BlowUp"} end, },
		{ id = "dbg_explosion_buttons", 
			editor = "buttons", default = false, buttons = { {name = "Set Debug Explosion Source", func = "DbgSetExplosionType"}, }, template = true, },
	},
}

DefineClass.FirearmProperties = {
	__parents = { "ItemWithCondition", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Caliber", id = "Caliber", 
			editor = "combo", default = false, template = true, items = function (self) return PresetGroupCombo("Caliber", "Default") end, },
		{ category = "General", id = "btnAddAmmo", 
			editor = "buttons", default = false, buttons = { {name = "Add Ammo To Current Unit", func = "UIPlaceInInventoryAmmo"}, }, template = true, },
		{ category = "Caliber", id = "Damage", help = "Damage of the firearm", 
			editor = "number", default = 0, template = true, min = 0, max = 1000, modifiable = true, },
		{ category = "Caliber", id = "ObjDamageMod", name = "Objects damage modifier", help = "Multiplicative damage modifier against objects (non-units)", 
			editor = "number", default = 100, template = true, scale = "%", min = 0, max = 1000, modifiable = true, },
		{ category = "Caliber", id = "AimAccuracy", name = "Aim Accuracy", help = "Base chance to hit increase per aim action", 
			editor = "number", default = 2, template = true, scale = "%", min = 1, modifiable = true, },
		{ category = "Caliber", id = "CritChance", name = "Crit Chance", help = "Base chance to cause a critical hit which deals more damage.", 
			editor = "number", default = 0, template = true, scale = "%", slider = true, min = 0, max = 100, modifiable = true, },
		{ category = "Caliber", id = "CritChanceScaled", name = "Crit Chance (Scaled)", help = "Additional chance to cause a critical hit (scaled by level, specified number is at merc level 10)", 
			editor = "number", default = 10, template = true, scale = "%", slider = true, min = 0, max = 100, modifiable = true, },
		{ category = "Caliber", id = "MagazineSize", name = "Magazine Size", help = "Number of bullets in a single clip", 
			editor = "number", default = 1, template = true, min = 1, max = 1000, modifiable = true, },
		{ category = "Caliber", id = "PenetrationClass", 
			editor = "number", default = 1, template = true, 
			name = function(self) return "Penetration Class: " .. (PenetrationClassIds[self.PenetrationClass] or "") end, slider = true, min = 1, max = 5, modifiable = true, },
		{ category = "Caliber", id = "IgnoreCoverReduction", name = "Ignore Cover Reduction", help = "If > 0 attacks with this weapon will ignore the damage reduction that would normally apply for targets in cover.", 
			editor = "number", default = 0, template = true, min = 0, max = 100, modifiable = true, },
		{ category = "Caliber", id = "WeaponRange", name = "Range", help = "Range at which the penalty of the gun is 100.", 
			editor = "number", default = 20, template = true, slider = true, min = 1, max = 200, modifiable = true, },
		{ category = "Caliber", id = "PointBlankBonus", help = "attacks get bonus CTH in point-blank range", 
			editor = "number", default = 0, template = true, min = 0, max = 1, modifiable = true, },
		{ category = "Caliber", id = "OverwatchAngle", name = "Overwatch Angle", help = "overwatch area cone angle", 
			editor = "number", default = 2400, template = true, 
			no_edit = function(self) return 
	(self.PreparedAttackType ~= "Overwatch" and self.PreparedAttackType ~= "Both" and self.PreparedAttackType ~= "Machine Gun")
end, scale = "deg", slider = true, min = 1, max = 5400, modifiable = true, },
		{ category = "Caliber", id = "BuckshotConeAngle", name = "Buckshot Cone Angle", 
			editor = "number", default = 1600, template = true, 
			no_edit = function(self) return not table.find(self.AvailableAttacks, "Buckshot") end, scale = "deg", min = 60, max = 7200, modifiable = true, },
		{ category = "Caliber", id = "BuckshotFalloffDamage", name = "Buckshot Falloff Damage", help = "what percent of nominal damage is the attack dealing at max range (cone length)", 
			editor = "number", default = 25, template = true, 
			no_edit = function(self) return not table.find(self.AvailableAttacks, "Buckshot") end, scale = "%", min = 0, max = 100, modifiable = true, },
		{ category = "Caliber", id = "BuckshotFalloffStart", name = "Buckshot Falloff Start", help = "at what percent of the max distance (cone length) does the damage falloff start", 
			editor = "number", default = 50, template = true, 
			no_edit = function(self) return not table.find(self.AvailableAttacks, "Buckshot") end, scale = "%", min = 0, max = 100, modifiable = true, },
		{ category = "Caliber", id = "Noise", name = "Noise Range", help = "Range (in tiles) in which the weapon alerts unaware enemies when firing.", 
			editor = "number", default = 20, template = true, min = 0, max = 100, modifiable = true, },
		{ category = "Caliber", id = "RangePenalty", name = "Range Penalty", 
			editor = "accuracy_chart", default = "", dont_save = true, template = true, },
		{ category = "General", id = "HandSlot", help = "One-haneded or two-handed weapon.", 
			editor = "combo", default = "OneHanded", template = true, items = function (self) return { "OneHanded", "TwoHanded" } end, },
		{ category = "Body & Components", id = "Entity", 
			editor = "combo", default = false, template = true, items = function (self) return GetWeaponEntities end, },
		{ category = "Body & Components", id = "fxClass", name = "FX Class", help = "use to override the default fx class of this weapon", 
			editor = "combo", default = "", template = true, items = function (self) return ItemTemplatesCombo("FirearmProperties") end, },
		{ category = "Body & Components", id = "ComponentSlots", 
			editor = "nested_list", default = false, template = true, base_class = "WeaponComponentSlot", inclusive = true, },
		{ category = "Body & Components", id = "Color", 
			editor = "combo", default = "Olive", template = true, items = function (self) return Presets.WeaponColor.Default end, },
		{ category = "Body & Components", id = "BaseDifficulty", help = 'Base difficulty value compared against the "Mechanical" skill.', 
			editor = "number", default = false, template = true, min = 0, max = 10000000, modifiable = true, },
		{ category = "Body & Components", id = "HolsterSlot", help = "By default Two Handed weapons go on shoulders, One Handed go to legs", 
			editor = "combo", default = "", template = true, items = function (self) return { "", "Shoulder", "Leg" } end, },
		{ category = "Body & Components", id = "ModifyRightHandGrip", 
			editor = "bool", default = false, template = true, },
		{ category = "General", id = "PreparedAttackType", name = "Prepared Attack Type", 
			editor = "choice", default = "Overwatch", template = true, items = function (self) return { "Overwatch", "Pin Down", "None", "Both", "Machine Gun" } end, },
		{ category = "General", id = "AvailableAttacks", name = "Available Attacks", 
			editor = "preset_id_list", default = {}, template = true, preset_class = "CombatAction", preset_group = "WeaponAttacks", item_default = "", },
		{ category = "ActionPoints", id = "ShootAP", name = "Shoot", help = "Action points needed to shoot a single shot", 
			editor = "number", default = 1000, template = true, scale = "AP", min = 1000, max = 50000, modifiable = true, },
		{ category = "ActionPoints", id = "ReloadAP", name = "Reload", help = "Action points needed to reload the gun", 
			editor = "number", default = 1000, template = true, scale = "AP", min = 1000, max = 50000, modifiable = true, },
		{ category = "ActionPoints", id = "MaxAimActions", name = "Max Aim Actions", help = "Max number of aim actions allowed", 
			editor = "number", default = 3, min = 0, max = 5, modifiable = true, },
		{ category = "Debug", id = "SetRange", name = "Range", 
			editor = "number", default = 10, dont_save = true, template = true, slider = true, min = 0, max = 50, },
		{ category = "Debug", id = "DPS", 
			editor = "number", default = false, dont_save = true, read_only = true, template = true, min = 0, max = 1000, },
	},
}

function FirearmProperties:GetDPS()
	return self:GetProperty("Damage") * Max(0, GetRangeAccuracy(self, self:GetProperty("SetRange")*const.SlabSizeX)) / 100
end

function FirearmProperties:HasPointBlankBonus()
	return self.PointBlankBonus ~= 0
end

DefineClass.GrenadeProperties = {
	__parents = { "ItemWithCondition", "MishapProperties", "ExplosiveProperties", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Combat", id = "BaseDamage", name = "Base Damage", 
			editor = "number", default = 20, template = true, min = 0, max = 200, },
		{ category = "Combat", id = "Scatter", help = "area in which the grenade may scatter defined as a radius in tiles.", 
			editor = "number", default = 3, template = true, min = 0, max = 20, },
		{ category = "Combat", id = "AttackAP", name = "Attack AP", help = "AP to throw the greanade", 
			editor = "number", default = 6000, template = true, scale = "AP", step = 1000, slider = true, min = 1000, max = 15000, },
		{ category = "Combat", id = "BaseRange", name = "Throw Range (Min)", help = "Number of tiles that this grenade can be thrown by a unit with 0 Strength.", 
			editor = "number", default = 5, template = true, min = -10, max = 30, },
		{ category = "Combat", id = "ThrowMaxRange", name = "Throw Range (Max)", help = "Number of tiles that this grenade can be thrown by a unit with 100 Strength.", 
			editor = "number", default = 15, template = true, min = -10, max = 30, },
		{ category = "Combat", id = "CanBounce", 
			editor = "bool", default = true, template = true, },
		{ category = "Combat", id = "InaccurateMinOffset", name = "Min Offset (Inaccurate Throw)", help = "Minimum distance to the target point for inaccurate throws, at 10 tiles", 
			editor = "number", default = 1000, template = true, scale = "m", min = 1, max = 20000, },
		{ category = "Combat", id = "InaccurateMaxOffset", name = "Max Offset (Inaccurate Throw)", help = "Maximum distance to the target point for inaccurate throws, at 10 tiles", 
			editor = "number", default = 5000, template = true, scale = "m", min = 1, max = 20000, },
		{ category = "Combat", id = "IgnoreCoverReduction", name = "Ignore Cover Reduction", help = "If > 0 attacks with this weapon will ignore the damage reduction that would normally apply for targets in cover.", 
			editor = "number", default = 0, template = true, min = 0, max = 100, modifiable = true, },
		{ category = "Combat", id = "Noise", name = "Noise", help = "Range (in tiles) in which the explosion alerts unaware enemies.", 
			editor = "number", default = 20, template = true, min = 0, max = 100, modifiable = true, },
		{ category = "Combat", id = "ThrowNoise", name = "Throw Noise", help = "Range (in tiles) in which items that do not explode immediately can still alert enemies when they land.", 
			editor = "number", default = 3, template = true, min = 0, max = 100, modifiable = true, },
		{ category = "Combat", id = "aoeType", name = "AOE Type", help = "additional effect that happens after the explosion (optional)", 
			editor = "choice", default = "none", template = true, items = function (self) return {"none", "fire", "smoke", "teargas", "toxicgas"} end, },
		{ category = "General", id = "Entity", 
			editor = "choice", default = false, read_only = true, no_edit = true, template = true, items = function (self) return ClassDescendantsCombo("GrenadeVisual") end, },
		{ category = "General", id = "ActionIcon", name = "Throw Action Icon", 
			editor = "ui_image", default = false, template = true, },
	},
}

DefineClass.HeavyWeaponProperties = {
	__parents = { "ItemWithCondition", "MishapProperties", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Caliber", id = "Caliber", 
			editor = "combo", default = false, template = true, items = function (self) return PresetGroupCombo("Caliber", "Default") end, },
		{ category = "Combat", id = "AttackAP", name = "Attack AP", help = "AP to throw the greanade", 
			editor = "number", default = 6000, template = true, scale = "AP", step = 1000, slider = true, min = 1000, max = 15000, },
		{ category = "Combat", id = "BombardRadius", help = "defines the radius (in tiles) of the zone where the bombard ordnance can fall", 
			editor = "number", default = 4, template = true, min = 0, max = 10, modifiable = true, },
		{ category = "Body & Components", id = "ComponentSlots", 
			editor = "nested_list", default = false, template = true, base_class = "WeaponComponentSlot", inclusive = true, },
		{ category = "Body & Components", id = "Entity", 
			editor = "combo", default = false, template = true, items = function (self) return GetWeaponEntities end, },
	},
}

DefineClass.InventoryItemProperties = {
	__parents = { "ItemWithCondition", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "General", id = "Icon", 
			editor = "ui_image", default = "", template = true, image_preview_size = 400, },
		{ category = "General", id = "SubIcon", help = "A small icon on the bootom left side of the item's icon", 
			editor = "ui_image", default = "", template = true, image_preview_size = 30, },
		{ category = "General", id = "ItemType", 
			editor = "preset_id", default = false, template = true, preset_class = "WeaponType", },
		{ category = "General", id = "DisplayName", name = "Display Name", 
			editor = "text", default = false, template = true, translate = true, },
		{ category = "General", id = "DisplayNamePlural", name = "Display Name Plural", 
			editor = "text", default = false, template = true, translate = true, },
		{ category = "General", id = "colorStyle", name = "Color Style", 
			editor = "preset_id", default = false, template = true, preset_class = "TextStyle", },
		{ category = "General", id = "Description", 
			editor = "text", default = false, template = true, translate = true, lines = 1, max_lines = 3, },
		{ category = "General", id = "AdditionalHint", name = "Additional Hint", help = "Additional keywords text to add to item's rollover hint. Added after the autogenerated keyswors for weapons.", 
			editor = "text", default = false, template = true, translate = true, lines = 1, max_lines = 10, },
		{ category = "General", id = "LargeItem", 
			editor = "number", default = 0, template = true, slider = true, min = 0, max = 1, modifiable = true, },
		{ category = "General", id = "Cumbersome", 
			editor = "number", default = 0, template = true, slider = true, min = 0, max = 1, modifiable = true, },
		{ category = "General", id = "UnitStat", name = "Unit Stat", help = "Unit Properties stat.", 
			editor = "choice", default = false, template = true, items = function (self) return GetUnitStatsCombo() end, },
		{ category = "General", id = "Valuable", name = "Valuable Item (for VR only)", help = "Will check whether to play the ValuableItemFound VR", 
			editor = "number", default = 0, template = true, min = 0, max = 1, modifiable = true, },
		{ category = "General", id = "btnAddItem", 
			editor = "buttons", default = false, buttons = { {name = "Add To Current Unit", func = "UIPlaceInInventory"}, }, template = true, },
		{ category = "BobbyRayShop", id = "Cost", help = "How much this item costs to buy in $", 
			editor = "number", default = 1000, template = true, min = 0, max = 10000000, modifiable = true, },
		{ category = "General", id = "loot_def", name = "LootDef", help = "Loot def for the items ValuableItemContainer contains", 
			editor = "preset_id", default = false, no_edit = function(self) return self.object_class ~= "ValuableItemContainer" end, template = true, preset_class = "LootDef", },
		{ category = "General", id = "locked", name = "Locked", help = "Locked items cannot be moved from their slot. They also disappear when the bearer dies.", 
			editor = "bool", default = false, template = true, },
		{ category = "Reactions", id = "OnItemGained", 
			editor = "func", default = function (self, owner, slot)  end, template = true, params = "self, owner, slot", },
		{ category = "Reactions", id = "OnItemLost", 
			editor = "func", default = function (self, owner, slot)  end, template = true, params = "self, owner, slot", },
		{ id = "owner", name = "Owner", help = "The item owner if any.", 
			editor = "text", default = false, },
		{ id = "extra_tag", help = "Extra data to identify unique items. Note that for stacking items this will be wiped when they're stacked.", 
			editor = "text", default = false, },
		{ id = "base_drop_chance", 
			editor = "number", default = 5, read_only = true, no_edit = true, },
		{ id = "drop_chance", 
			editor = "number", default = 0, read_only = true, no_edit = true, },
		{ id = "guaranteed_drop", 
			editor = "bool", default = false, read_only = true, no_edit = true, },
	},
}

function InventoryItemProperties:GetColoredName(plural)
	local style = TextStyles[self.colorStyle]
	if style then
		local r, g, b = GetRGB(style.TextColor)
		local colorTag = string.format("<color %i %i %i>", r, g, b)
		return T{236471449642, "<colorTag><name></color>", colorTag = colorTag, name = plural and self.DisplayNamePlural or self.DisplayName }
	else
		return plural and self.DisplayNamePlural or self.DisplayName
	end
end

function InventoryItemProperties:GetEquipCost()
	return const["Action Point Costs"].EquipItem
end

function InventoryItemProperties:GetUIWidth()
	return self:IsLargeItem() and 2 or 1
end

function InventoryItemProperties:GetUIHeight()
	return 1
end

function InventoryItemProperties:GetRolloverType()
	return self.ItemType
end

function InventoryItemProperties:IsLargeItem()
	return self.LargeItem ~= 0
end

function InventoryItemProperties:IsCumbersome()
	return self.Cumbersome ~= 0
end

function InventoryItemProperties:IsValuable()
	return self.Valuable ~= 0
end

DefineClass.InventoryTab = {
	__parents = { "ListPreset", },
	__generated_by_class = "PresetDef",

	properties = {
		{ id = "display_name", 
			editor = "text", default = false, translate = true, lines = 2, max_lines = 100, },
		{ id = "icon", 
			editor = "ui_image", default = "UI/Inventory/tabs_all.png", image_preview_size = 100, },
		{ id = "item_classes", 
			editor = "string_list", default = {}, item_default = "", items = false, },
		{ id = "FilterItem", 
			editor = "func", default = function (self, item)
if not next(self.item_classes) then
	return true
end	
return IsKindOfClasses(item, self.item_classes)
end, template = true, params = "self, item", },
	},
	GlobalMap = "InventoryTabs",
}

DefineClass.ItemUpgradeProperties = {
	__parents = { "PropertyObject", },
	__generated_by_class = "ClassDef",

	properties = {
		{ id = "Slot", 
			editor = "combo", default = "Modification", template = true, items = function (self) return {"Underslung", "Muzzle", "Sights", "Magazine", "Modification"} end, },
	},
}

DefineClass.ItemWithCondition = {
	__parents = { "PropertyObject", "ScrapableItem", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Condition", id = "Condition", help = "The overall condition of the item which is lowered when the item is fired/hit", 
			editor = "number", default = 100, template = true, min = 0, max = 10000, },
		{ category = "Condition", id = "RepairCost", name = "Repair Cost", help = "How long it takes to repair the item using Mechanical skill. Each hour a mechanic contributes his/her skill towards repair. To increase Condition by 1 point the merc has to contribute this much points.", 
			editor = "number", default = 80, template = true, min = 0, max = 1000, },
		{ category = "Condition", id = "Repairable", name = "Repairable", help = "Whether the item can be repaired", 
			editor = "bool", default = true, template = true, },
		{ category = "Condition", id = "Reliability", help = "For guns. Percentage. How fast or slowly condition is lost when the gun is fired. High percentage means that the gun is more reliable.", 
			editor = "number", default = 40, template = true, 
			no_edit = function(self) local class = g_Classes[self.object_class or false]
return not IsKindOf(class, "FirearmBase") end, slider = true, min = 0, max = 98, modifiable = true, },
		{ category = "Condition", id = "Degradation", help = "For armors. When the armor is hit how much of the damage is transfered as condition loss.", 
			editor = "number", default = 50, template = true, 
			no_edit = function(self) local class = g_Classes[self.object_class or false]
return not IsKindOf(class, "Armor") end, slider = true, min = 0, max = 100, },
		{ category = "Condition", id = "repair_progress", 
			editor = "number", default = 0, no_edit = true, template = true, },
	},
}

function ItemWithCondition:AmountOfScrapPartsFromItem()
	local parts = self:GetScrapParts()
	if self.Condition and self.Condition < 50 then
		parts = parts / 2
	end
	return parts
end

DefineClass.MeleeWeaponProperties = {
	__parents = { "ItemWithCondition", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Combat", id = "BaseChanceToHit", name = "Base Chance To Hit", help = "Multiplies chance to hit finaly. Used to define differently accurate weapon types.", 
			editor = "number", default = 90, template = true, slider = true, min = 0, max = 100, },
		{ category = "Combat", id = "CritChance", name = "Crit Chance", help = "Base chance to cause a critical hit which deals more damage.", 
			editor = "number", default = 0, template = true, scale = "%", slider = true, min = 0, max = 100, modifiable = true, },
		{ category = "Combat", id = "CritChanceScaled", name = "Crit Chance (Scaled)", help = "Additional chance to cause a critical hit (scaled by level, specified number is at merc level 10)", 
			editor = "number", default = 10, template = true, scale = "%", slider = true, min = 0, max = 100, modifiable = true, },
		{ category = "Combat", id = "BaseDamage", name = "Base Damage", help = "Melee weapon damage scales based on damage. This property defines the base cost.", 
			editor = "number", default = 10, template = true, min = 0, max = 200, },
		{ category = "Combat", id = "AimAccuracy", name = "Aim Accuracy", help = "Base chance to hit increase per aim action", 
			editor = "number", default = 2, template = true, scale = "%", min = 1, modifiable = true, },
		{ category = "Combat", id = "PenetrationClass", 
			editor = "number", default = 1, template = true, 
			name = function(self) return "Penetration Class: " .. (PenetrationClassIds[self.PenetrationClass] or "") end, slider = true, min = 1, max = 5, modifiable = true, },
		{ category = "Combat", id = "DamageMultiplier", name = "Damage Multiplier", help = "In %. Strength stat is multiplied by this percentage when multiplying melee damage", 
			editor = "number", default = 200, template = true, scale = "%", min = 0, max = 1000, },
		{ category = "Combat", id = "IgnoreCoverReduction", name = "Ignore Cover Reduction", help = "If > 0 attacks with this weapon will ignore the damage reduction that would normally apply for targets in cover.", 
			editor = "number", default = 0, template = true, min = 0, max = 100, modifiable = true, },
		{ category = "Combat", id = "CanThrow", name = "Can Throw", 
			editor = "bool", default = false, template = true, },
		{ category = "Combat", id = "WeaponRange", name = "Range", help = "Range at which the penalty of the gun is 100.", 
			editor = "number", default = 8, template = true, 
			no_edit = function(self) return not self.CanThrow end, slider = true, min = 1, max = 20, modifiable = true, },
		{ category = "Combat", id = "Charge", 
			editor = "bool", default = false, template = true, },
		{ category = "Combat", id = "IsUnarmed", 
			editor = "bool", default = false, template = true, },
		{ category = "Action Points", id = "AttackAP", name = "Attack", help = "Action Points needed to make a basic attack.", 
			editor = "number", default = 5000, template = true, scale = "AP", min = 0, max = 30000, },
		{ category = "Action Points", id = "MaxAimActions", name = "Max Aim Actions", help = "Max number of allowed aim actions.", 
			editor = "number", default = 2, template = true, min = 0, max = 4, },
		{ category = "Melee Weapon", id = "Noise", help = "How much noise the weapon makes when attacking.", 
			editor = "number", default = 100, template = true, min = 0, max = 1000, },
		{ category = "Melee Weapon", id = "NeckAttackType", 
			editor = "choice", default = "bleed", template = true, items = function (self) return {"choke", "bleed", "lethal"} end, },
		{ category = "Body & Components", id = "Entity", 
			editor = "combo", default = false, template = true, items = function (self) return GetWeaponEntities end, },
		{ category = "Body & Components", id = "fxClass", name = "FX Class", help = "use to override the default fx class of this weapon", 
			editor = "combo", default = "", template = true, items = function (self) return ItemTemplatesCombo("MeleeWeaponProperties") end, },
		{ category = "Body & Components", id = "HolsterSlot", help = "By default Two Handed weapons go on shoulders, One Handed go to legs", 
			editor = "combo", default = "", template = true, items = function (self) return { "", "Shoulder", "Leg" } end, },
	},
}

DefineClass.MiscItemProperties = {
	__parents = { "ItemWithCondition", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Execution", id = "effect_moment", name = "Effect moment", 
			editor = "choice", default = false, template = true, items = function (self) return InventoryItemEffectMoments end, },
		{ category = "Execution", id = "Effects", help = "Effects that are executed when consuming an item.", 
			editor = "nested_list", default = false, template = true, base_class = "Effect", },
		{ category = "Execution", id = "action_name", name = "Name", help = "Action name", 
			editor = "text", default = false, template = true, translate = true, },
		{ category = "Execution", id = "destroy_item", name = "Destroy item", help = "Destroy item after execution.", 
			editor = "bool", default = false, template = true, },
		{ category = "Execution", id = "onlyOnMap", name = "Only on Map", help = "Can be used only when the unit is on a loaded map.", 
			editor = "bool", default = false, template = true, },
		{ category = "Execution", id = "APCost", name = "AP Cost", help = "How much does the item cost to use while in combat.", 
			editor = "number", default = 2, template = true, },
	},
}

DefineClass.OrdnanceProperties = {
	__parents = { "ExplosiveProperties", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Caliber", id = "Caliber", 
			editor = "combo", default = false, template = true, items = function (self) return PresetGroupCombo("Caliber", "Default") end, },
		{ category = "Caliber", id = "MaxStacks", name = "Max Stacks", help = "Ammo can stack up to that number.", 
			editor = "number", default = 10, template = true, slider = true, min = 1, max = 10000, },
		{ category = "Combat", id = "BaseDamage", name = "Base Damage", 
			editor = "number", default = 20, template = true, min = 0, },
		{ category = "Combat", id = "Noise", name = "Noise", help = "Range (in tiles) in which the explosion alerts unaware enemies.", 
			editor = "number", default = 20, template = true, min = 0, max = 100, modifiable = true, },
		{ category = "Combat", id = "aoeType", name = "AOE Type", help = "additional effect that happens after the explosion (optional)", 
			editor = "choice", default = "none", template = true, items = function (self) return {"none", "fire", "smoke", "teargas", "toxicgas"} end, },
		{ category = "Combat", id = "CanBounce", 
			editor = "bool", default = false, template = true, },
		{ category = "General", id = "Entity", 
			editor = "choice", default = false, read_only = true, no_edit = true, template = true, items = function (self) return ClassDescendantsCombo("GrenadeVisual") end, },
		{ category = "General", id = "ammo_type_icon", name = "Ammo Type Icon", help = "Ammo type icon", 
			editor = "ui_image", default = false, template = true, },
	},
}

DefineClass.QuestItemProperties = {
	__parents = { "PropertyObject", },
	__generated_by_class = "ClassDef",

}

DefineClass.ScrapableItem = {
	__parents = { "PropertyObject", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Condition", id = "ScrapParts", name = "Scrap Parts", help = "The number for Parts that are given to the player when its scraped", 
			editor = "number", default = 0, template = true, min = 0, max = 1000, },
	},
}

function ScrapableItem:GetScrapParts()
	return self.ScrapParts
end

function ScrapableItem:AmountOfScrapPartsFromItem()
	return  self:GetScrapParts()
end

DefineClass.StatBoostItemProperties = {
	__parents = { "ItemWithCondition", },
	__generated_by_class = "ClassDef",

	properties = {
		{ category = "Stat boost item", id = "stat", name = "Stat", 
			editor = "choice", default = false, template = true, items = function (self) return GetUnitStatsCombo end, },
		{ category = "Stat boost item", id = "boost", name = "Boost value", 
			editor = "number", default = false, template = true, },
	},
}

DefineClass.TransmutedItemProperties = {
	__parents = { "ItemWithCondition", },
	__generated_by_class = "ClassDef",

	properties = {
		{ id = "OriginalItemId", 
			editor = "preset_id", default = false, preset_class = "InventoryItemCompositeDef", },
		{ id = "RevertCondition", 
			editor = "combo", default = false, items = function (self) return {"attacks", "damage"} end, },
		{ id = "RevertConditionCounter", 
			editor = "number", default = false, },
	},
}

function TransmutedItemProperties:MakeTransmutation(fromitem)
	local new_item, prev_item
	if fromitem =="revert" then
		new_item = PlaceInventoryItem(self.OriginalItemId)
		prev_item = self
	else
		new_item = self
		prev_item = fromitem
	end
	new_item.Condition = prev_item.Condition
	return new_item, prev_item
end