package Items
using RTDB, BaseStats, WeaponFxPackage, Prereqs, Perks, Effectors

[ notQueryable ]
Preset_Borg4a_Default : Base_Borg4a
{
	CName appearanceResourceName = "Preset_Borg4a_Default";
	CName[] visualTags = 
	[
		"Default"
	];
	fk< SlotItemPartPreset >[] slotPartListPreset = 
	[
		{
			slot = "AttachmentSlots.Receiver";
			fk< Item > itemPartPreset = "Items.w_smg__midnight_borg__rcv1";
		}, 
		{
			slot = "AttachmentSlots.Barrel";
			fk< Item > itemPartPreset = "Items.w_smg__midnight_borg__base1";
		}, 
		{
			slot = "AttachmentSlots.Magazine";
			fk< Item > itemPartPreset = "Items.w_smg__midnight_borg__mag_std";
		}, 
		{
			slot = "AttachmentSlots.MagazineEmpty";
			fk< Item > itemPartPreset = "Items.w_smg__midnight_borg__mag_stdr";
		}, 
		{
			slot = "AttachmentSlots.Power_AR_SMG_LMG_WeaponMod1";
		} : Power_AR_SMG_LMG_ModList_Slot1, 
		{
			slot = "AttachmentSlots.Power_AR_SMG_LMG_WeaponMod2";
		} : Power_AR_SMG_LMG_ModList_Slot2
	];
}

[ notQueryable ]
Preset_Borg4a_Pimp : Preset_Borg4a_Default
{
	CName[] visualTags = 
	[
		"Pimp"
	];
	tags += 
	[
		"Pimp"
	];
}

[ notQueryable ]
Preset_Borg4a_Neon : Preset_Borg4a_Default
{
	CName[] visualTags = 
	[
		"Neon"
	];
	tags += 
	[
		"Neon"
	];
}

[ notQueryable ]
Preset_Borg4a_Military : Preset_Borg4a_Default
{
	CName[] visualTags = 
	[
		"Military"
	];
	tags += 
	[
		"Military"
	];
}

[ notQueryable ]
Preset_Borg4a_Legendary : Preset_Borg4a_Default
{
	CName[] visualTags = 
	[
		"Legendary"
	];
	tags += 
	[
		"Legendary"
	];
}

[ EP1 ]
[ notQueryable ]
VHard_50_IntRef_Weapon6 : Preset_Borg4a_HauntedGun
{
	quality = "Quality.Legendary";
	statModifiers += 
	[
		"Quality.PlusPlusModifier"
	];
}

[ notQueryable ]
Preset_Borg4a_HauntedGun : Preset_Borg4a_Default
{
	OnLooted += 
	[
		{
			effectors = 
			[
				{
					fact = "borg4a_hauntedgun_owned";
					value = 1;
				} : SetFactEffector
			];
		}
	];
	fk< ItemBlueprint > blueprint = "Items.Iconic_Ranged_Weapon_NoAttachments_Blueprint";
	displayName = "LocKey#85504";
	visualTags = 
	[
		"Haunted_Midnight"
	];
	quality = "Quality.Random";
	localizedDescription = "LocKey#85505";
	tags += 
	[
		"IconicWeapon", "CraftableIconic", "Haunted_Gun"
	];
	fk< WeaponFxPackage > fxPackage = "WeaponFxPackage.ShotgunBorg4a";
	statModifiers += 
	[
		"Quality.IconicItem"
	];
	npcRPGData = 
	{
		statModifiers += 
		[
			"Quality.IconicItem"
		];
	} : Base_Borg4a_NPC_Data;
	CraftingData = 
	{
		craftingRecipe += 
		[
			{
				ingredient = "Items.Q305_Cerberus_core_cracked";
				amount = 1;
			}
		];
	} : Craftable_Iconic_Weapon;
	slotPartListPreset = 
	[
		{
			slot = "AttachmentSlots.Receiver";
			fk< Item > itemPartPreset = "Items.w_smg__midnight_borg__rcv1";
		}, 
		{
			slot = "AttachmentSlots.Barrel";
			fk< Item > itemPartPreset = "Items.w_smg__midnight_borg__base1";
		}, 
		{
			slot = "AttachmentSlots.Magazine";
			fk< Item > itemPartPreset = "Items.w_smg__midnight_borg__mag_std";
		}, 
		{
			slot = "AttachmentSlots.MagazineEmpty";
			fk< Item > itemPartPreset = "Items.w_smg__midnight_borg__mag_stdr";
		}, 
		{
			slot = "AttachmentSlots.IconicWeaponModLegendary";
			itemPartPreset = "Items.Borg4aHauntedGunWeaponMod";
		}
	];
	statModifierGroups = 
	[
		"Items.CraftableIconicQualityRandomisation", "Items.Base_Borg4a_Technical_Stats", "Items.Base_Borg4a_Handling_Stats", "Items.Base_Borg4a_Recoil_Stats", "Items.Base_Borg4a_Spread_Stats", "Items.Base_Borg4a_Aim_Stats", "Items.Base_Borg4a_Constant_Stats", "Items.Base_Borg4a_Damage_Stats", "Items.Base_Power_Stats", "Items.Base_Power_Submachinegun_Mult_Stats", "Items.Base_Power_Submachinegun_Stats", "Items.Base_Submachinegun_RPG_Stats", "Items.Base_Submachinegun_Misc_Stats", "Items.Base_Submachinegun_Sway_Stats", "Items.Base_PlayerState_Spread_Stats", "Items.Base_Submachinegun_DeadReckoning_Stats", "Items.Base_Weapon_Damage_Type_Min_Max", "Items.Base_Weapon_Damage_Type_Electric"
	];
	fk< GameplayLogicPackage >[] OnAttach += 
	[
		{
			effectors = 
			[
				{
					prereqRecord = 
					{
						nestedPrereqs = 
						[
							{
								string stateName = "NoAmmo";
							} : Prereqs.RangedWeaponPSMPrereq, 
							"Perks.IsPlayer"
						];
					} : ANDPrereq;
					fact = "q305_haunted_weapon_reload";
				} : ToggleFactEffector, 
				{
					prereqRecord = 
					{
						nestedPrereqs = 
						[
							{
								nestedPrereqs = 
								[
									{
										stateName = "Jump";
									} : DetailedLocomotionPSMPrereq, 
									{
										stateName = "DoubleJump";
									} : DetailedLocomotionPSMPrereq, 
									{
										stateName = "ChargeJump";
									} : DetailedLocomotionPSMPrereq, 
									{
										stateName = "HoverJump";
									} : DetailedLocomotionPSMPrereq, 
									{
										stateName = "Dodge";
									} : DetailedLocomotionPSMPrereq, 
									{
										stateName = "DodgeAir";
									} : DetailedLocomotionPSMPrereq
								];
							} : ORPrereq, 
							"Perks.IsPlayer"
						];
					} : ANDPrereq;
					fact = "q305_haunted_weapon_disobedience";
				} : ToggleFactEffector, 
				{
					prereqRecord = "Items.HauntedGunHumanNPCKillPrereq";
					statusEffect = "BaseStatusEffect.Haunted_Weapon_Kill_Human";
				} : ApplyStatusEffectOnPlayer, 
				{
					prereqRecord = 
					{
						statusEffect = "BaseStatusEffect.Haunted_Weapon_Kill_Human";
						checkType = "CheckType.Record";
					} : StatusEffectPrereq;
					fact = "q305_haunted_weapon_npc_dead";
				} : ToggleFactEffector, 
				{
					prereqRecord = "Items.HauntedGunMechNPCKillPrereq";
					statusEffect = "BaseStatusEffect.Haunted_Weapon_Kill_Mechanical";
				} : ApplyStatusEffectOnPlayer, 
				{
					prereqRecord = 
					{
						statusEffect = "BaseStatusEffect.Haunted_Weapon_Kill_Mechanical";
						checkType = "CheckType.Record";
					} : StatusEffectPrereq;
					fact = "q305_haunted_weapon_android_dead";
				} : ToggleFactEffector
			];
		} : GameplayLogicPackage
	];
}

HauntedGunHumanNPCKillPrereq : ORPrereq
{
	nestedPrereqs = 
	[
		{
			conditions += 
			[
				{
					npcType = "Human";
					invert = false;
				} : TargetNPCTypeHitPrereqCondition, 
				{
					weaponType = "Ranged";
				} : WeaponTypeHitPrereqCondition
			];
		} : IsTargetKilled, 
		{
			conditions += 
			[
				{
					npcType = "Human";
					invert = false;
				} : TargetNPCTypeHitPrereqCondition, 
				{
					statusEffect = "HauntedBlackwallHackForceKill";
					checkType = "CheckType.Record";
				} : StatusEffectPresentHitPrereqCondition
			];
		} : IsTargetKilled
	];
}

HauntedGunMechNPCKillPrereq : ORPrereq
{
	nestedPrereqs = 
	[
		{
			conditions += 
			[
				{
					npcType = "Human";
					invert = true;
				} : TargetNPCTypeHitPrereqCondition, 
				{
					weaponType = "Ranged";
				} : WeaponTypeHitPrereqCondition
			];
		} : IsTargetKilled, 
		{
			conditions += 
			[
				{
					npcType = "Human";
					invert = true;
				} : TargetNPCTypeHitPrereqCondition, 
				{
					statusEffect = "HauntedBlackwallHackForceKill";
					checkType = "CheckType.Record";
				} : StatusEffectPresentHitPrereqCondition
			];
		} : IsTargetKilled, 
		{
			conditions += 
			[
				{
					npcType = "Human";
					invert = true;
				} : TargetNPCTypeHitPrereqCondition, 
				{
					hitFlag = "HauntedGun";
				} : HitFlagHitPrereqCondition
			];
		} : IsTargetKilled
	];
}

[ notQueryable ]
Common_Borg4a_HauntedGun : Preset_Borg4a_HauntedGun
{
	quality = "Quality.Common";
	CraftingData = 
	{
		craftingRecipe += 
		[
			{
				ingredient = "Items.Q305_Cerberus_core_cracked";
				amount = 1;
			}
		];
	} : Craftable_Common_Iconic_Weapon;
}

[ notQueryable ]
Uncommon_Borg4a_HauntedGun : Preset_Borg4a_HauntedGun
{
	quality = "Quality.Uncommon";
	CraftingData = 
	{
		craftingRecipe += 
		[
			{
				ingredient = "Items.Q305_Cerberus_core_cracked";
				amount = 1;
			}
		];
	} : Craftable_Uncommon_Iconic_Weapon;
}

[ notQueryable ]
Rare_Borg4a_HauntedGun : Preset_Borg4a_HauntedGun
{
	quality = "Quality.Rare";
	CraftingData = 
	{
		craftingRecipe += 
		[
			{
				ingredient = "Items.Q305_Cerberus_core_cracked";
				amount = 1;
			}
		];
	} : Craftable_Rare_Iconic_Weapon;
}

[ notQueryable ]
Epic_Borg4a_HauntedGun : Preset_Borg4a_HauntedGun
{
	quality = "Quality.Epic";
	CraftingData = 
	{
		craftingRecipe += 
		[
			{
				ingredient = "Items.Q305_Cerberus_core_cracked";
				amount = 1;
			}
		];
	} : Craftable_Epic_Iconic_Weapon;
}

[ notQueryable ]
Legendary_Borg4a_HauntedGun : Preset_Borg4a_HauntedGun
{
	quality = "Quality.Legendary";
	CraftingData = 
	{
		craftingRecipe += 
		[
			{
				ingredient = "Items.Q305_Cerberus_core_cracked";
				amount = 1;
			}
		];
	} : Craftable_Legendary_Iconic_Weapon;
}

[ notQueryable ]
Recipe_Preset_Borg4a_HauntedGun : IconicRecipe
{
	displayName = "";
	craftingResult = 
	{
		item = "Items.Preset_Borg4a_HauntedGun";
	};
	hideOnItemsAdded = 
	[
		"Items.HauntedCyberdeck_Rare", "Items.HauntedCyberdeck_Epic", "Items.HauntedCyberdeck_Legendary"
	];
	OnLooted = 
	[
		{
			effectors = 
			[
				{
					prereqRecord = 
					{
						fact = "haunted_weapon_recipe_acquired";
						value = 0;
						comparisonType = "Equal";
					} : FactValuePrereq;
					fact = "haunted_weapon_recipe_acquired";
					value = 1;
				} : SetFactEffector
			];
		}
	];
}

Recipe_Common_Borg4a_HauntedGun : Recipe_Preset_Borg4a_HauntedGun
{
	craftingResult = 
	{
		item = "Items.Common_Borg4a_HauntedGun";
	};
	hideOnItemsAdded += 
	[
		"Items.Common_Borg4a_HauntedGun"
	];
}

Recipe_Uncommon_Borg4a_HauntedGun : Recipe_Preset_Borg4a_HauntedGun
{
	craftingResult = 
	{
		item = "Items.Uncommon_Borg4a_HauntedGun";
	};
	hideOnItemsAdded += 
	[
		"Items.Uncommon_Borg4a_HauntedGun"
	];
}

Recipe_Rare_Borg4a_HauntedGun : Recipe_Preset_Borg4a_HauntedGun
{
	craftingResult = 
	{
		item = "Items.Rare_Borg4a_HauntedGun";
	};
	hideOnItemsAdded += 
	[
		"Items.Rare_Borg4a_HauntedGun"
	];
}

Recipe_Epic_Borg4a_HauntedGun : Recipe_Preset_Borg4a_HauntedGun
{
	craftingResult = 
	{
		item = "Items.Epic_Borg4a_HauntedGun";
	};
	hideOnItemsAdded += 
	[
		"Items.Epic_Borg4a_HauntedGun"
	];
}

Recipe_Legendary_Borg4a_HauntedGun : Recipe_Preset_Borg4a_HauntedGun
{
	craftingResult = 
	{
		item = "Items.Legendary_Borg4a_HauntedGun";
	};
	hideOnItemsAdded += 
	[
		"Items.Legendary_Borg4a_HauntedGun"
	];
}

