#textdomain wesnoth-did
# Reflects (melee) damage
[unit]
	id=Mirror
	name= _ "Mirror"
	race=mechanical
	image="scenery/slab1.png"
	[defend]
		[frame]
			begin=-150
			end=150
			image="scenery/slab1.png"
		[/frame]
	[/defend]
	hitpoints=100
	movement_type=none
	movement=1
	[defense]
		deep_water=100
		shallow_water=100
		swamp_water=100
		grassland=100
		sand=100
		forest=100
		hills=100
		mountains=100
		village=100
		castle=100
		cave=100
		tundra=100
		canyon=100
		cavewall=100
		fungus=100
	[/defense]

	[resistance]
		blade=0
		pierce=0
		impact=0
		fire=0
		cold=0
		arcane=0
	[/resistance]
	experience=100
	level=0
	alignment=neutral
	advanceto=null
	{AMLA_TOUGH 3}
	cost=1
	usage=fighter
	unit_description=_ "A slab of rock.  It vaguely resembles an altar."
	# NEED HIGH RESISTANCES AND NO MOVEMENT
	[attack]
		name=reflect
		description=_ "reflect"
		type=blade
		range=melee
		damage=1
		number=0
		icon=
	[/attack]
	[event]
		# this only works for Malin or someone else with a short sword
		name=attacker_hits
		first_time_only=no
		[filter_second]
			type=Mirror
		[/filter_second]
		[special_filter]
			[or]
				weapon=short sword
				weapon=rusty sword
			[/or]
		[/special_filter]
		[store_unit]
			[filter]
				x,y=$x1,$y1
			[/filter]
			variable=tempStore
			kill=no
		[/store_unit]
		{VARIABLE_OP reflectedDamage format $tempStore.attack[0].damage}
		{VARIABLE_OP reflectedDamage multiply (-1)}
		{VARIABLE_OP tempStore.hitpoints add $reflectedDamage}
		{VARIABLE_OP reflectedDamage multiply (-1)}
		[unstore_unit]
			variable=tempStore
			find_vacant=no
			{COLOR_HARM}
			text=$reflectedDamage
		[/unstore_unit]
		{CLEAR_VARIABLE reflectedDamage}
		{CLEAR_VARIABLE tempStore}
	[/event]
[/unit]
