/**************************************************************************

template_modifier.tgi
Copyright © 2002-2003 TimeGate Studios

DESCRIPTION: template classes for the modifier system.  Properties are sets of
			modifiers.  Modifiers are used to alter an actor or an actor's attributes.

REVISION HISTORY:
drp090602 - created

USAGE:

	[Modifier template=Modifier]
	This node goes inside a [ModifierProperty] node to describe all the modifiers associated
	with that property.  The "Modifier" template should not actually be used.  There are more 
	specific ones.
	
	[Modifier template=FlagModifier]
	
	[Modifier template=AddModifier]
	
	[Modifier template=MultiplyModifier]
	
	[Modifier template=EnchantmentImmunityModifier]
	
	[Modifier template=MeleeAttackEffectModifier]
		use this to add an effect to melee attacks
	[Modifier template=MeleeDamageEffectModifier]
		use this to add extra damage to melee attacks
	[Modifier template=RangedAttackEffectModifier]
		use this to add an effect to ranged attacks
	[Modifier template=RangedDamageEffectModifier]
		use this to add extra damage to ranged attacks
		
	[Modifier template=ResistDamageModifier]
	[Modifier template=PeriodicDamageModifier]
	[Modifier template=ReverseAbilityModifier]	
	
	[Modifier template=PeriodicHealModifier]

	[Modifier template=ModifyCostModifier]

**************************************************************************/

[Template Modifier]
{
	;; hard-coded modifier_type (hidden field - defined by appropriate template)
	string	type		
}

[Template FlagModifier Inherit=Modifier]
{
	type = FLAG

	;; hard-coded gameplay flag, one of:
	;;	TRAILBLAZING - ignores terrain speed
	;;	PARALYZE - completely frozen
	;;	ENTANGLE - cannot activate mover component
	;;	BERSERK - ignores morale loss
	;;	SUMMONED - dies if stops fighting
	;;  SUPPLIED - always in supply
	;;	INVISIBLE_TO_ENEMY - invisible to enemy if not engaged (currently not working)
	;;	REVEAL_ENEMY_RZOD - reveals RZOD of all enemies
	;;	MINIMAP_NO_FOG - no fog on minimap
	;;	NO_UPKEEP - upkeep ignored
	;;	NOT_CAPTURABLE - actor is not capturable
	;;  NOT_DISPOSABLE - actor cannot be razed, disbanded or sold
	string	modifier_flag
}

[Template AddModifier Inherit=Modifier]
{
	type = ADD

	;; an actor's atribute to be added to (hard-coded):
	;;	AV, AV_MELEE, AV_RANGED, DV, ABILITY_HEAL, SUPPLY_RANGE, DETECTION_RANGE,
	;;  MORALE, MORALE_BREAKPOINT, PROJECTILE_ABILITY_RANGE, BOMBARD_ABILITY_RANGE
	string	attribute

	;; amount to add
	fixed	amount
	
	;; extended attribute flags for the add modifier
	bool	repair = false				;; used only for ABILITY_HEAL
}

[Template MultiplyModifier Inherit=Modifier]
{
	type = MULTIPLY

	;; an actor's attribute that can be multipled (hard-coded):
	;; 	SPEED_MAX, RESUPPLY_RATE, ENTRENCHMENT_RATE, MORALE_RECOVERY_RATE, MORALE_LOSS_RATE,
	;;	STRUCURE_COST, HEALTH, CONTROL_RANGE, ATTACK_EFFICIENCY_ACTUAL, ATTACK_EFFICIENCY_DESIRED,
	;;  RECRUIT_COST, RECHARGE_TIME
	;;
	;; NOTE: Actual attack efficiency takes priority over desired attack efficiency (i.e.
	;; (i.e. desired AE should be used in formation properties, while actual AE should be used
	;; in things such as actor state properties)
	string	attribute

	;; amount to multiply by
	fixed	amount
	
	;; extended attribute flags for the multiply modifier
}

;; NOTE: if multiple of these modifers are encountered, the max of all is used
[Template AutoUpgradeModifier Inherit=Modifier]
{
	type = ADD
	attribute = AUTO_UPGRADE

	;; required age of actor (in seconds, from time actor created) before it will auto-upgrade
	fixed	amount
	
	;; the repair flag doesn't apply for this ADD modifier attribute
	bool	repair = false
}

[Template EnchantmentImmunityModifier Inherit=Modifier]
{
	type = ENCHANTMENT_IMMUNITY

	;; ids of an enchantment type, or NULL for all enchantments
	string	enchantment_type
}

[Template AbilityEffectModifier Inherit=Modifier]
{
	type = ABILITY_EFFECT

	string	ability_type
	
	[Effect Template=Effect]
}

[Template MeleeAttackEffectModifier Inherit=AbilityEffectModifier]
{
	ability_type = ATTACK_MELEE
}

[Template MeleeDamageEffectModifier Inherit=MeleeAttackEffectModifier]
{
	[Effect Template=AddDamageEffect]
}

[Template RangedAttackEffectModifier Inherit=AbilityEffectModifier]
{
	ability_type = ATTACK_RANGED
}

[Template RangedDamageEffectModifier Inherit=RangedAttackEffectModifier]
{
	[Effect Template=AddDamageEffect]
}

[Template DamageModifier Inherit=Modifier]
{
	string	damage_type
}

[Template ResistDamageModifier Inherit=DamageModifier]
{
	type = RESIST_DAMAGE

	fixed	amount
}

;; Modifies the cost of creating actors with the required_property_ids.
;; NOTE: This modifier is not currently implemented
/*
[Template CostModifier Inherit=Modifier]
{
	type = MODIFY_COST

	string	required_property_IDS
	fixed	amount
}
*/

[Template PeriodicDamageModifier Inherit=DamageModifier]
{
	type = PERIODIC_DAMAGE

	string	damage_type
	
	fixed	amount
}

[Template PeriodicHealModifier Inherit=Modifier]
{
	type = PERIODIC_HEAL

	fixed	amount
}

[Template ReverseAbilityModifier Inherit=Modifier]
{
	type = REVERSE_ABILITY
	
	string	ability_definition
}

[Template ResourceProductionModifier Inherit=Modifier]
{
	type = RESOURCE_PRODUCTION

	[Production Template=ProductionList]
}
