class Game_Actor < Game_Battler
	alias_method :take_skill_effect_noFriendlyFire, :take_skill_effect
	def take_skill_effect(user,skill,can_sap=true)
		return map_token.perform_dodge if self == $game_player.actor && user.master == $game_player #Companion hits player
#Next line is not tested at all. Uncomment at your own risk.
#		return map_token.perform_dodge if (user.class == Game_PorjectileCharacter || user.class == Game_DestroyableObject) && user.event && user.event.summon_data[:user] && user.event.summon_data[:user].master == $game_player #companion's projectile hits player
		take_skill_effect_noFriendlyFire(user,skill,can_sap)
	end
end

module Battle_System
	alias_method :take_skill_effect_noFriendlyFire, :take_skill_effect
	def take_skill_effect(user,skill,can_sap=false,force_hit=false)
		return map_token.perform_dodge if $game_player.actor == user && self.master == $game_player #Player hits companion
		return map_token.perform_dodge if (user.class == Game_PorjectileCharacter || user.class == Game_DestroyableObject) && user.event && user.event.summon_data[:user] == $game_player && self.master == $game_player #player's projectile hits companion
		take_skill_effect_noFriendlyFire(user,skill,can_sap,force_hit)
	end
end