#abilities

#define ABILITY_HEALS
	[heals]
		value=4
		id=healing
		affect_allies=yes
		name= _ "heals +4"
		description=  _ "Heals +4:
Allows the unit to heal adjacent friendly units at the beginning of each turn.

A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
		affect_self=no
		poison=slowed
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
		[/affect_adjacent]
	[/heals]
#enddef

#define ABILITY_CURES
	[heals]
		value=8
		id=healing
		affect_allies=yes
		name= _ "heals +8"
		description= _ "Heals +8:
This unit combines herbal remedies with magic to heal units more quickly than is normally possible on the battlefield.

A unit cared for by this healer may heal up to 8 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
		affect_self=no
		poison=slowed
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
		[/affect_adjacent]
	[/heals]
	[heals]
		affect_allies=yes
		id=curing
		name= _ "cures"
		description= _ "Cures:
A curer can cure a unit of poison, although that unit will receive no additional healing on the turn it is cured of the poison."
		affect_self=no
		poison=cured
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
		[/affect_adjacent]
	[/heals]
#enddef

#define ABILITY_REGENERATES
	[regenerate]
		value=8
		id=healing
		name= _ "regenerates"
		description= _ "Regenerates:
The unit will heal itself 8 HP per turn. If it is poisoned, it will remove the poison instead of healing."
		affect_self=yes
		poison=cured
	[/regenerate]
#enddef

#define ABILITY_STEADFAST
	[resistance]
		id=steadfast
		multiply=2
		max_value=50
		apply_to=blade,pierce,impact,fire,cold,holy
		[filter_base_value]
			greater_than=0
		[/filter_base_value]
		name= _ "steadfast"
		description= _ "Steadfast:
This unit's resistances are doubled, up to a maximum of 50%, when defending. Vulnerabilities are not affected."
		affect_self=yes
		active_on=defense
	[/resistance]
#enddef

#define ABILITY_LEADERSHIP_LEVEL_1
	[leadership]
		id=leadership
		value=25
		cumulative=no
		name= _ "leadership"
		description= _ "Leadership:
This unit can lead friendly units that are next to it, making them fight better.

Adjacent friendly units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=0
			[/filter]
		[/affect_adjacent]
	[/leadership]
#enddef

#define ABILITY_LEADERSHIP_LEVEL_2
	[leadership]
		id=leadership
		value=50
		cumulative=no
		name= _ "leadership"
		description= _ "Leadership:
This unit can lead friendly units that are next to it, making them fight better.

Adjacent friendly units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=0
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=25
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=1
			[/filter]
		[/affect_adjacent]
	[/leadership]
#enddef

#define ABILITY_LEADERSHIP_LEVEL_3
	[leadership]
		id=leadership
		value=75
		cumulative=no
		name= _ "leadership"
		description= _ "Leadership:
This unit can lead friendly units that are next to it, making them fight better.

Adjacent friendly units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=0
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=50
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=1
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=25
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=2
			[/filter]
		[/affect_adjacent]
	[/leadership]
#enddef

#define ABILITY_LEADERSHIP_LEVEL_4
	[leadership]
		id=leadership
		value=100
		cumulative=no
		name= _ "leadership"
		description= _ "Leadership:
This unit can lead friendly units that are next to it, making them fight better.

Adjacent friendly units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=0
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=75
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=1
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=50
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=2
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=25
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=3
			[/filter]
		[/affect_adjacent]
	[/leadership]
#enddef

#define ABILITY_LEADERSHIP_LEVEL_5
	[leadership]
		id=leadership
		value=125
		cumulative=no
		name= _ "leadership"
		description= _ "Leadership:
This unit can lead friendly units that are next to it, making them fight better.

Adjacent friendly units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=0
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=100
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=1
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=75
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=2
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=50
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=3
			[/filter]
		[/affect_adjacent]
	[/leadership]
	[leadership]
		id=leadership
		value=25
		cumulative=no
		affect_self=no
		[affect_adjacent]
			adjacent=n,ne,se,s,sw,nw
			[filter]
				level=4
			[/filter]
		[/affect_adjacent]
	[/leadership]
#enddef

#define ABILITY_SKIRMISHER
	[skirmisher]
		name= _ "skirmisher"
		description= _ "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."
		affect_self=yes
	[/skirmisher]
#enddef

#define ABILITY_ILLUMINATES
	[illuminates]
		id=illumination
		value=25
		max_value=25
		cumulative=no
		name= _ "illuminates"
		description= _ "Illuminates:
This unit illuminates the surrounding area, making lawful units fight better, and chaotic units fight worse.

Any units adjacent to this unit will fight as if it were dusk when it is night, and as if it were day when it is dusk."
		affect_self=yes
	[/illuminates]
#enddef

#define ABILITY_TELEPORT
	[teleport]
		name= _ "teleport"
		description= _ "Teleport:
This unit may teleport between any two friendly villages using one of its moves."
	[/teleport]
#enddef

#define ABILITY_AMBUSH
	[hides]
		name= _ "ambush"
		name_inactive= _ "ambush"
		description= _ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see or attack this unit when it is in forest, except for any turn immediately after this unit has attacked, or if there are enemy units next to this unit."
		description_inactive= _ "Ambush:
This unit can hide in forest, and remain undetected by its enemies.

Enemy units cannot see or attack this unit when it is in forest, except for any turn immediately after this unit has attacked, or if there are enemy units next to this unit."
		affect_self=yes
		[filter_self]
			[filter_location]
				terrain=f,T,F
			[/filter_location]
		[/filter_self]
	[/hides]
#enddef

#define ABILITY_NIGHTSTALK
	[hides]
		name= _ "nightstalk"
		description= _ "Nightstalk:
The unit becomes invisible during night.

Enemy units cannot see or attack this unit at night, except for any turn immediately after this unit has attacked, or if there are enemy units next to this unit."
		name_inactive= _ "nightstalk"
		description_inactive= _ "Nightstalk:
The unit becomes invisible during night.

Enemy units cannot see or attack this unit at night, except for any turn immediately after this unit has attacked, or if there are enemy units next to this unit."
		affect_self=yes
		[filter_self]
			[filter_location]
				time_of_day=chaotic
			[/filter_location]
		[/filter_self]
	[/hides]
#enddef

#define ABILITY_SUBMERGE
	[hides]
		name= _ "submerge"
		description= _ "Submerge:
This unit can hide in deep water, and remain undetected by its enemies.

Enemy units cannot see or attack this unit when it is in deep water, except for any turn immediately after this unit has attacked, or if there are enemy units next to this unit."
		name_inactive= _ "submerge"
		description_inactive= _ "Submerge:
This unit can hide in deep water, and remain undetected by its enemies.

Enemy units cannot see or attack this unit when it is in deep water, except for any turn immediately after this unit has attacked, or if there are enemy units next to this unit."
		affect_self=yes
		[filter_self]
			[filter_location]
				terrain=s
			[/filter_location]
		[/filter_self]
	[/hides]
#enddef




#weapons specials

#define WEAPON_SPECIAL_BERSERK
		[berserk]
			id=berserk
			name= _ "berserk"
			description= _ "Berserk:
Whether used offensively or defensively, this attack presses the engagement until one of the combatants is slain, or 30 rounds of attacks have occurred."
			value=30
		[/berserk]
#enddef

#define WEAPON_SPECIAL_BACKSTAB
		[damage]
			id=backstab
			name= _ "backstab"
			description= _ "Backstab:
This attack deals double damage if there is an enemy of the target on the opposite side of the target, and that unit is not incapacitated (e.g. turned to stone)."
			multiply=2
			backstab=yes
			active_on=offense
		[/damage]
#enddef

#define WEAPON_SPECIAL_PLAGUE_TYPE TYPE
		[plague]
			name= _ "plague"
			description= _ "Plague:
When a unit is killed by a Plague attack, that unit is replaced with a unit identical to and on the same side as the unit with the Plague attack. (This doesn't work on Undead or units in villages.)"
			type={TYPE}
		[/plague]
#enddef
#define WEAPON_SPECIAL_PLAGUE
		[plague]
			name= _ "plague"
			description= _ "Plague:
When a unit is killed by a Plague attack, that unit is replaced with a unit identical to and on the same side as the unit with the Plague attack. (This doesn't work on Undead or units in villages.)"
		[/plague]
#enddef

#define WEAPON_SPECIAL_SLOW
		[slow]
			id=slow
			name= _ "slows"
			description= _ "Slow:
This attack slows the target until it ends a turn. Slow halves the damage caused by attacks and the movement cost for a slowed unit is doubled."
		[/slow]
#enddef

#define WEAPON_SPECIAL_STONE
		[stones]
			name= _ "stones"
			description= _ "Stone:
This attack turns the target to stone. Units that have been turned to stone may not move or attack."
		[/stones]
#enddef

#define WEAPON_SPECIAL_MARKSMAN
		[chance_to_hit]
			id=marksman
			name= _ "marksman"
			description= _ "Marksman:
When used offensively, this attack always has at least a 60% chance to hit."
			value=60
			cumulative=yes
			active_on=offense
		[/chance_to_hit]
#enddef

#define WEAPON_SPECIAL_MAGICAL
		[chance_to_hit]
			id=magical
			name= _ "magical"
			description= _ "Magical:
This attack always has a 70% chance to hit."
			value=70
			cumulative=no
		[/chance_to_hit]
#enddef

#define WEAPON_SPECIAL_SWARM
		[attacks]
			name= _ "swarm"
			description= _ "Swarm:
The number of strikes of this attack decreases when the unit is wounded. The number of strikes is proportional to the % of HP/maximum HP the unit has. For example a unit with 3/4 of its maximum HP will get 3/4 of the number of strikes."
		[/attacks]
#enddef

#define WEAPON_SPECIAL_CHARGE
		[damage]
			id=charge
			name= _ "charge"
			description= _ "Charge:
This attack deals double damage to the target. It also causes this unit to take double damage from the target's counterattack."
			multiply=2
			apply_to=both
			active_on=offense
		[/damage]
#enddef

#define WEAPON_SPECIAL_DRAIN
		[drains]
			id=drains
			name= _ "drains"
			description= _ "Drain:
This unit drains health from living units, healing itself for half the amount of damage it deals (rounded down)."
		[/drains]
#enddef

#define WEAPON_SPECIAL_FIRSTSTRIKE
		[firststrike]
			name= _ "firststrike"
			description= _ "First Strike:
This unit always strikes first with this attack, even if they are defending."
		[/firststrike]
#enddef

#define WEAPON_SPECIAL_POISON
		[poison]
			id=poison
			name= _ "poison"
			description= _ "Poison:
This attack poisons the target. Poisoned units lose 8 HP every turn until they are cured or are reduced to 1 HP."
		[/poison]
#enddef
