package BaseStatusEffect
using RTDB, Effectors, Prereqs, Perks, Items

MaxtacCloaked : StatusEffect
{
	statusEffectType = "BaseStatusEffectTypes.Cloaked";
	duration = "BaseStats.InfiniteDuration";
	packages = 
	[
		{
			effectors = 
			[
				"BaseStatusEffect.CamoEffector"
			];
		} : GameplayLogicPackage
	];
}

Cloaked : StatusEffect
{
	statusEffectType = "BaseStatusEffectTypes.Cloaked";
	duration = "BaseStats.InfiniteDuration";
	gameplayTags += 
	[
		"Cloak"
	];
	packages = 
	[
		{
			effectors = 
			[
				"BaseStatusEffect.CamoEffector", "BaseStatusEffect.CamoSFXEffector", "BaseStatusEffect.DisableTargetingEffector", "BaseStatusEffect.ApplyExitCamoEffector"
			];
		} : GameplayLogicPackage
	];
}

CloakedSoMiSQ : StatusEffect
{
	statusEffectType = "BaseStatusEffectTypes.Cloaked";
	duration = "BaseStats.InfiniteDuration";
	gameplayTags += 
	[
		"Cloak", "CloakSoMiSQ"
	];
	packages = 
	[
		{
			effectors = 
			[
				"BaseStatusEffect.CamoEffector", "BaseStatusEffect.CamoSFXEffector", "BaseStatusEffect.DisableTargetingEffector", "BaseStatusEffect.ApplyExitCamoSoMiSQEffector"
			];
		} : GameplayLogicPackage
	];
}

CloakedOda : StatusEffect
{
	statusEffectType = "BaseStatusEffectTypes.Cloaked";
	duration = "BaseStats.InfiniteDuration";
	gameplayTags += 
	[
		"OdaStatusEffect", "Cloak"
	];
	packages = 
	[
		{
			effectors = 
			[
				"HitReactionThresholdModifiers.ForceStaggerEffector", "BaseStatusEffect.CamoEffectorOda", "BaseStatusEffect.CamoSFXEffector", "BaseStatusEffect.DisableTargetingEffector"
			];
		} : GameplayLogicPackage
	];
}

Cloaked_Exit : StatusEffect
{
	statusEffectType = "BaseStatusEffectTypes.Cloaked";
	gameplayTags += 
	[
		"Cloak", "Cloak_Exit"
	];
	duration = 
	{
		statModifiers = 
		[
			{
				statType = "BaseStats.MaxDuration";
				modifierType = "Additive";
				value = 5.f;
			} : ConstantStatModifier
		];
	};
	VFX = 
	[
		{
			name = "status_emp";
		}
	];
}

Cloaked_Exit_SoMiSQ : StatusEffect
{
	statusEffectType = "BaseStatusEffectTypes.Cloaked";
	gameplayTags += 
	[
		"Cloak", "CloakSoMiSQ", "Cloak_Exit"
	];
	duration = 
	{
		statModifiers = 
		[
			{
				statType = "BaseStats.MaxDuration";
				modifierType = "Additive";
				value = 5.f;
			} : ConstantStatModifier
		];
	};
}

DeactivateCloakedtatusEffects : Effector
{
	prereqRecord = "Prereqs.AlwaysTruePrereq";
	effectorClassName = "RemoveStatusEffectsEffector";
	string[] statusEffects = 
	[
		"BaseStatusEffect.Cloaked"
	];
}

DeactivateCloakedOdatatusEffects : Effector
{
	prereqRecord = "Prereqs.AlwaysTruePrereq";
	effectorClassName = "RemoveStatusEffectsEffector";
	string[] statusEffects = 
	[
		"BaseStatusEffect.CloakedOda"
	];
}

DisableTargetingEffector : Effector
{
	prereqRecord = "Prereqs.AlwaysTruePrereq";
	effectorClassName = "DisableTargetingEffector";
}

ApplyExitCamoEffector : ApplyStatusEffectEffector
{
	effectorClassName = "ApplyStatusEffectEffector";
	fk< StatusEffect > statusEffect = "BaseStatusEffect.Cloaked_Exit";
	removeWithEffector = true;
	inverted = true;
}

ApplyExitCamoSoMiSQEffector : ApplyStatusEffectEffector
{
	effectorClassName = "ApplyStatusEffectEffector";
	fk< StatusEffect > statusEffect = "BaseStatusEffect.Cloaked_Exit_SoMiSQ";
	removeWithEffector = true;
	inverted = true;
}

CamoEffector : Effector
{
	effectorClassName = "ApplyShaderEffector";
	CName overrideMaterialName = "cloaking_effect";
	CName overrideMaterialTag = "cloakOda";
	bool applyToOwner = true;
	bool applyToWeapon = true;
}

CamoEffectorOda : CamoEffector
{
	CName overrideMaterialTag = "cloakOda";
}

CamoSFXEffector : Effector
{
	prereqRecord = "Prereqs.AlwaysTruePrereq";
	effectorClassName = "PlaySFXEffector";
	CName activationSFXName = "nme_ability_camo_activate";
	CName deactivationSFXName = "nme_ability_camo_deactivate";
}

ForceVisibility : StatusEffect
{
	statusEffectType = "BaseStatusEffectTypes.PassiveDebuff";
	duration = "BaseStats.InfiniteDuration";
	packages = 
	[
		{
			stats = 
			[
				{
					statType = "BaseStats.Visibility";
					modifierType = "AdditiveMultiplier";
					value = 1.f;
				} : ConstantStatModifier
			];
		} : GameplayLogicPackage
	];
}

OpticalCamoPlayerBuffBase : StatusEffect
{
	gameplayTags += 
	[
		"Buff", "Cloak", "CamoActiveOnPlayer", "ActiveCamo", "CyberwareBuff"
	];
	statusEffectType = "BaseStatusEffectTypes.PassiveBuff";
	VFX = 
	[
		{
			name = "optical_camo";
		}
	];
	packages = 
	[
		{
			bool stackable = false;
			effectors = 
			[
				"BaseStatusEffect.OpticalCamoPlayerSFXEffector"
			];
		} : GameplayLogicPackage, 
		{
			effectors = 
			[
				{
					prereqRecord = "Prereqs.AlwaysTruePrereq";
					effectorClassName = "ApplyShaderOnEquipmentEffector";
					CName overrideMaterialName = "cloaking_effect";
					CName overrideMaterialTag = "player_cloak";
				}, 
				{
					prereqRecord = 
					{
						waitForVisuals = true;
					} : Prereqs.AnyWeaponHeldPrereq;
					effectorClassName = "ApplyShaderOnObjectEffector";
					CName applicationTarget = "Weapon";
					CName overrideMaterialName = "cloaking_effect";
					CName overrideMaterialTag = "player_cloak";
					bool overrideMaterialClearOnDetach = true;
				}, 
				{
					prereqRecord = 
					{
						nestedPrereqs = 
						[
							{
								statType = "CoolSkill";
								valueToCheck = 60;
								comparisonType = "GreaterOrEqual";
							} : StatPrereq, 
							{
								nestedPrereqs = 
								[
									"Perks.IsWeaponMeleeAllowProjection", "Perks.IsWeaponRangedAllowProjection"
								];
							} : ORPrereq
						];
					} : ANDPrereq;
					value = 1.25;
				} : MultiplyDamage
			];
			stats = 
			[
				{
					statType = "BaseStats.OpticalCamoIsActive";
					modifierType = "Additive";
					value = 1f;
				} : ConstantStatModifier, 
				{
					statType = "BaseStats.TBHsBaseCoefficient";
					modifierType = "AdditiveMultiplier";
					value = 15;
				} : ConstantStatModifier, 
				{
					statType = "BaseStats.OpticalCamoChargesRegenRate";
					modifierType = "Multiplier";
					value = 0;
				} : ConstantStatModifier
			];
		} : GameplayLogicPackage
	];
}

OpticalCamoPlayerBuffBase_LowTier : OpticalCamoPlayerBuffBase
{
	packages += 
	[
		{
			effectors = 
			[
				"Effectors.AttachCloakVisionBlocker"
			];
		}
	];
}

OpticalCamoPlayerBuffBase_HighTier : OpticalCamoPlayerBuffBase
{
	packages += 
	[
		{
			effectors = 
			[
				"Effectors.AttachPerfectCloakVisionBlocker"
			];
		}
	];
}

OpticalCamoPlayerBuffBaseUncommon : OpticalCamoPlayerBuffBase
{
	packages += 
	[
		{
			effectors = 
			[
				"Effectors.AttachCloakVisionBlockerUncommon"
			];
		}
	];
}

OpticalCamoPlayerBuffBaseRare : OpticalCamoPlayerBuffBase
{
	packages += 
	[
		{
			effectors = 
			[
				"Effectors.AttachCloakVisionBlockerRare"
			];
		}
	];
}

OpticalCamoPlayerBuffBaseEpic : OpticalCamoPlayerBuffBase
{
	packages += 
	[
		{
			effectors = 
			[
				"Effectors.AttachCloakVisionBlockerEpic"
			];
		}
	];
}

OpticalCamoPlayerBuffBaseLegendary : OpticalCamoPlayerBuffBase
{
	packages += 
	[
		{
			effectors = 
			[
				"Effectors.AttachCloakVisionBlockerLegendary"
			];
		}
	];
}

OpticalCamoPlayerBuffCommon : OpticalCamoPlayerBuffBase_LowTier
{
	duration = 
	{
		statModifiers += 
		[
			{
				statType = "BaseStats.MaxDuration";
				modifierType = "Additive";
				value = 4;
			} : ConstantStatModifier
		];
	} : OpticalCamoDuration;
}

OpticalCamoPlayerBuffUncommon : OpticalCamoPlayerBuffBaseUncommon
{
	duration = 
	{
		statModifiers += 
		[
			{
				statType = "BaseStats.MaxDuration";
				modifierType = "Additive";
				value = 4;
			} : ConstantStatModifier
		];
	} : OpticalCamoDuration;
	packages += 
	[
		{
			stats = 
			[
				{
					statType = "BaseStats.TBHsBaseCoefficient";
					modifierType = "AdditiveMultiplier";
					value = 10;
				} : ConstantStatModifier
			];
		} : GameplayLogicPackage
	];
}

OpticalCamoPlayerBuffRare : OpticalCamoPlayerBuffBaseRare
{
	duration = 
	{
		statModifiers += 
		[
			{
				statType = "BaseStats.MaxDuration";
				modifierType = "Additive";
				value = 5;
			} : ConstantStatModifier
		];
	} : OpticalCamoDuration;
	packages += 
	[
		{
			stats = 
			[
				{
					statType = "BaseStats.TBHsBaseCoefficient";
					modifierType = "AdditiveMultiplier";
					value = 12;
				} : ConstantStatModifier
			];
		} : GameplayLogicPackage
	];
}

OpticalCamoPlayerBuffEpic : OpticalCamoPlayerBuffBaseEpic
{
	duration = 
	{
		statModifiers += 
		[
			{
				statType = "BaseStats.MaxDuration";
				modifierType = "Additive";
				value = 6;
			} : ConstantStatModifier
		];
	} : OpticalCamoDuration;
	packages += 
	[
		{
			stats = 
			[
				{
					statType = "BaseStats.TBHsBaseCoefficient";
					modifierType = "AdditiveMultiplier";
					value = 16;
				} : ConstantStatModifier
			];
		} : GameplayLogicPackage
	];
}

OpticalCamoPlayerBuffLegendary : OpticalCamoPlayerBuffBaseLegendary
{
	duration = 
	{
		statModifiers += 
		[
			{
				statType = "BaseStats.MaxDuration";
				modifierType = "Additive";
				value = 7;
			} : ConstantStatModifier
		];
	} : OpticalCamoDuration;
	packages += 
	[
		{
			stats = 
			[
				{
					statType = "BaseStats.TBHsBaseCoefficient";
					modifierType = "AdditiveMultiplier";
					value = 20;
				} : ConstantStatModifier
			];
		} : GameplayLogicPackage
	];
}

OpticalCamoPlayerSFXEffector : Effector
{
	CName effectorClassName = "PlaySFXEffector";
	CName activationSFXName = "w_cyb_camo_activate";
	CName deactivationSFXName = "w_cyb_camo_deactivate";
	bool unique = true;
}

OpticalCamoCoolPerkShort : OpticalCamoPlayerBuffBase_LowTier
{
	gameplayTags += 
	[
		"OpticalCamoSlideCoolPerk"
	];
	duration = "BaseStats.InfiniteDuration";
	packages += 
	[
		{
			stats += 
			[
				{
					statType = "BaseStats.OpticalCamoChargesDecayRate";
					modifierType = "Additive";
					value = -0.4;
				} : ConstantStatModifier
			];
		}
	];
}

OpticalCamo_Cool_40 : OpticalCamoPlayerBuffBase
{
	gameplayTags += 
	[
		"OpticalCamoGrapple"
	];
	duration = "BaseStats.InfiniteDuration";
	packages += 
	[
		{
			effectors = 
			[
				{
					prereqRecord = "Prereqs.AlwaysTruePrereq";
					visionBlockerDetectionModifier = 0.5f;
				} : AttachCloakVisionBlocker, 
				{
					prereqRecord = "Perks.IsPlayerGrappling";
					statusEffect = "BaseStatusEffect.OpticalCamo_Cool_40_Cooldown";
					inverted = true;
				} : ApplyStatusEffectEffector
			];
			stats += 
			[
				{
					statType = "BaseStats.OpticalCamoIsActive";
					modifierType = "Multiplier";
					value = 0f;
				} : ConstantStatModifier
			];
		} : GameplayLogicPackage
	];
}

