<configs>


	<append xpath="/buffs">

		
		<!-- When this buff is applied, it'll share its attack / revenge target with every NPC in the area that share the laeader.-->
		<buff name="buffNotifyTeamAttack" hidden="true">
			<stack_type value="ignore"/>
			<duration value="1"/>
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="NotifyTeamAttack, SCore" target="positionAOE" range="20" />
			</effect_group>
		</buff>

		<buff name="buffTeleportTest" hidden="true">
			<stack_type value="ignore"/>
			<duration value="1"/>
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="Teleport, SCore" location="destination=samplePortal01b" />
			</effect_group>
		</buff>

		<buff name="buffTeleportTest02" hidden="true">
			<stack_type value="ignore"/>
			<duration value="1"/>
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="Teleport, SCore" location="destination=Hello" />
			</effect_group>
		</buff>

		<buff name="buffTeleportCooldown" hidden="true">
			<stack_type value="ignore"/>
			<duration value="5"/>
		</buff>

		<buff name="buffFreshnessSCore" name_key="buffFreshnessSCoreName" description_key="buffFreshnessSCoreDesc" icon="ui_game_symbol_add">
			<stack_type value="ignore"/>
			<duration value="20"/>
		</buff>

		<buff name="buffAttackCoolDown" hidden="true">
			<stack_type value="ignore"/>
			<duration value="30"/>
		</buff>

		<buff name="buffOrderStay"  hidden="true" >
			<stack_type value="ignore"/>
			<duration value="1" />
			<effect_group>
				<!-- Allows modders to change the FailOnDistance on a per-entity level through a cvar for UAI
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="FailOnDistance" operation="set" value="10"/>
				-->
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="CurrentOrder" operation="set" value="2"/>
				<triggered_effect trigger="onSelfBuffStart" action="GuardThere, SCore"/> <!-- makes the entity stay in the position-->
			</effect_group>
		</buff>

		<!--
			This is the buff used by NPC Core to get NPCs to stand where the player is standing and remain there.
			To do this, it sets the current order to Stay, and includes UAI considerations that look at this order.
		-->
		<buff name="buffOrderGuardHere"  hidden="true" >
			<stack_type value="ignore"/>
			<duration value="1" />
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="CurrentOrder" operation="set" value="2"/>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="Guarding" operation="set" value="1"/>
				<triggered_effect trigger="onSelfBuffStart" action="GuardHere, SCore"/> <!-- copies the player's current location for the entity to replace.-->
			</effect_group>
		</buff>

		<!--
			This is the buff used by pathing cubes to get NPCs to stand where they are, but they can also leave to attack.
			To do this, it sets the order to Guard, so any UAI tasks that won't fire with Stay will still fire.
		-->
		<buff name="buffOrderGuard" hidden="true">
			<stack_type value="ignore" />
			<duration value="1" />
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="CurrentOrder" operation="set" value="9" />
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="Guarding" operation="set" value="2"/>
				<triggered_effect trigger="onSelfBuffStart" action="GuardHere, SCore" /> <!-- copies the entity's current location for the entity to replace.-->
			</effect_group>
		</buff>

		<buff name="buffOrderFollow" >
			<stack_type value="ignore"/>
			<duration value="1" />
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="Guarding" operation="set" value="0"/>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="CurrentOrder" operation="set" value="1"/>
			</effect_group>
		</buff>

		<buff name="buffOrderWander" >
			<stack_type value="ignore"/>
			<duration value="1" />
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="Guarding" operation="set" value="0"/>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="CurrentOrder" operation="set" value="3"/>
			</effect_group>
		</buff>

		<buff name="buffOrderPatrol" >
			<stack_type value="ignore"/>
			<duration value="1" />
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="Guarding" operation="set" value="0"/>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="CurrentOrder" operation="set" value="5"/>
			</effect_group>
		</buff>

		<buff name="buffOrderLoot" >
			<stack_type value="ignore"/>
			<duration value="1" />
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="CurrentOrder" operation="set" value="7"/>
			</effect_group>
		</buff>

		<buff name="buffOrderDismiss" >
			<stack_type value="replace"/>
			<duration value="5" />
			<duration value="5" />
			<effect_group>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="CurrentOrder" operation="set" value="3"/>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="Leader" operation="set" value="0"/>
				<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="Owner" operation="set" value="0"/>
			</effect_group>
		</buff>

		<!-- Template Buff for an NPC to go gather random loot items for you -->

		<buff name="buffGatherResources" hidden="true">
			<stack_type value="ignore" />
			<duration value="600 "/>

			<!-- Make the NPC disappear for the duration of the buff -->
			<effect_group name="Start">
				<triggered_effect trigger="onSelfBuffStart" action="HideNPCSDX, SCore" hide="true" />
			</effect_group>

			<!-- Put items in its containers, make it appear, and give a boost to its loot experience-->
			<effect_group name="End">
				<!-- Grab items from the brassResource group -->
				<triggered_effect trigger="onSelfBuffRemove" action="RandomLootSDX, SCore" lootgroup="brassResource" />
				<!-- This cvar is used to determine both the amount of items to retrieve from the lootgroup, plus the quality tier, if applicable.-->
				<!-- This gets reounded, so once it hits 2, it'll start pulling in two items from the brassResource group, up to a max of 5.-->
				<triggered_effect trigger="onSelfBuffRemove" action="ModifyCVar" cvar="spLootExperience" operation="add" value="0.1" />

				<!-- Make the NPC visible! -->
				<triggered_effect trigger="onSelfBuffRemove" action="HideNPCSDX, SCore" hide="false" />
			</effect_group>

		</buff>

		<!--
			This buff is an example of how you can use SCore cvars, requirements, and triggered
			actions to implement a "forgiveness" mechanic for NPCs. It does this by resetting the
			revenge target if certain rules are met.

			The "forgiveness" rules:
			* If the faction relationship between the NPC and the revenge target is "like" or higher,
			  forgive immediately.
			* If the faction relationship between the NPC and the revenge target is "neutral",
			  forgive after the NPC hits back once, OR after five seconds.
			* Otherwise, let the revenge play out.

			Note: The revenge target does not get set until AFTER the onOtherAttackedSelf and
			onOtherDamagedSelf events are triggered. Setting the revenge target on these events
			will have no effect. Instead, use the onCombatEntered event.
		-->
		<buff name="buffNPCForgiveness" hidden="true" remove_on_death="false">
			<stack_type value="ignore" />
			<effect_group name="Like or Love">
				<triggered_effect trigger="onCombatEntered" action="SetRevengeTarget, SCore" value="0">
					<requirement name="FactionRelationshipValue, SCore" operation="GTE" value="like" />
				</triggered_effect>
			</effect_group>
			<effect_group name="Neutral">
				<!-- Remember the previous revenge target ID -->
				<triggered_effect trigger="onOtherDamagedSelf" action="ModifyCVar" cvar="$prevRevengeTarget" operation="set" value="@_revengeTargetId" />
				<!-- Remove the existing "reset" buff if this isn't the same revenge target -->
				<triggered_effect trigger="onCombatEntered" action="RemoveBuff" buff="buffResetRevengeTargetWhenFinished">
					<requirement name="CVarCompare" cvar="$prevRevengeTarget" operation="NotEquals" value="@_revengeTargetId" />
				</triggered_effect>
				<!-- Now, add/stack the "reset" buff for this revenge target -->
				<triggered_effect trigger="onCombatEntered" action="AddBuff" buff="buffResetRevengeTargetWhenFinished">
					<requirement name="FactionRelationshipValue, SCore" operation="GTE" value="neutral" />
					<requirement name="FactionRelationshipValue, SCore" operation="LT" value="like" />
				</triggered_effect>
				<!-- Once you have taken revenge on the target once, forgive them -->
				<triggered_effect trigger="onSelfAttackedOther" action="SetRevengeTarget, SCore" value="0">
					<requirement name="FactionRelationshipValue, SCore" operation="GTE" value="neutral" />
					<requirement name="FactionRelationshipValue, SCore" operation="LT" value="like" />
					<requirement name="TargetCVarCompare, SCore" cvar="_revengeTargetId" operation="EQ" targetcvar="_entityId" />
				</triggered_effect>
				<!-- Remove the "reset" buff after you take your revenge -->
				<triggered_effect trigger="onSelfAttackedOther" action="RemoveBuff" buff="buffResetRevengeTargetWhenFinished">
					<requirement name="FactionRelationshipValue, SCore" operation="GTE" value="neutral" />
					<requirement name="FactionRelationshipValue, SCore" operation="LT" value="like" />
					<requirement name="TargetCVarCompare, SCore" cvar="_revengeTargetId" operation="EQ" targetcvar="_entityId" />
				</triggered_effect>
			</effect_group>
		</buff>

		<!--
			Buff that resets the revenge target when its time runs out, in this case after 5 seconds.
			Stacking the buff will add an extra 5 seconds.
		-->
		<buff name="buffResetRevengeTargetWhenFinished" hidden="true" remove_on_death="false">
			<duration value="5" />
			<stack_type value="duration" />
			<effect_group>
				<triggered_effect trigger="onSelfBuffFinish" action="SetRevengeTarget, SCore" value="0" />
			</effect_group>
		</buff>
	</append>

</configs>
