local EFFECT_DEFS = {	
	damage = {
		aspect = "health",
		init_stats = function(self, stats, amt)
			self.damage_factor = (stats.damage or 0)
			self.damage_piercing = ((stats.pierce or 0)+1)
			--always some base piercing
		end,
		apply = function(self, ent, amt, src)
			local armor = ent.defense_armor
			local damage = -amt*self.damage_factor			

			if armor and ent:can_use_armor() then
				local armor_roll = math.random()*armor
				local attack_roll = math.random()*self.damage_piercing
				if attack_roll < armor_roll then
					if ent.aspects.effect_feedback then
						ent:add_feedback("deflect", 1)
						ent:emit_feedback_text(30,"Deflect", COLORS.armor, 0.75)
					end
					return false
				end
			end
			
			ent:modify_health(damage)
			if ent.aspects.effect_feedback then
				if ent.dead then
					ent:add_feedback("dead",1)
				else
					ent:add_feedback("flash", 1)
				end
				ent:emit_feedback_text(30,tostring(math.abs(damage)), COLORS.damage, 0.6)
			end
			return true
		end,
		aggressive = true,
	},
	push = {
		aspect = "movement",
		init_stats = function(self, stats, amt)
			self.push_factor = (1+(stats.push or 0))
		end,
		apply = function(self, ent, amt, src)
			if src then
				local angle = src.angle
				local mass = (ent.mass or 1)
				local force = self.push_factor*math.distance(0,0,src.dx,src.dy)/mass
				ent:add_impact_force(math.cos(angle)*force, math.sin(angle)*force, force*0.5 + ((ent.z <= 0) and force*0.5 or 0))
				return true
			end
		end,
		aggressive = true,
	},
	heal = {
		aspect = "health",
		init_stats = function(self, stats, amt)
			self.heal_factor = (stats.heal or 1)
		end,
		apply = function(self, ent, amt)			
			ent:modify_health(amt*self.heal_factor)
			if ent.aspects.effect_feedback then
				ent:add_feedback("heal",1)
			end
		end,
	},	
	bounce = {

	},
	pierce = {
		
	},
	knock = {
		aggressive = true,
	},
	chain = {
		
	}
}

return EFFECT_DEFS