anchor.diff:  					false -> false 
   			end 
   		end, EnemyInRangeVertices).
  +
  +attack_entities(InRangeEnemyBcEntities, State) ->
  +	case lists:filter(fun(EnemyBcEntity) ->
  +						bc_entity:entity_type(EnemyBcEntity) == base
  +					  end, InRangeEnemyBcEntities) of
  +		InRangeEnemyBaseBcEntity when length(InRangeEnemyBaseBcEntity) > 0 ->
  +			EnemyBaseBcEntity = lists:nth(1, InRangeEnemyBaseBcEntity),
  +			attack_entity(EnemyBaseBcEntity, State);
  +		_ ->
  +			InRangeEnemyBcEntity = lists:nth(1, InRangeEnemyBcEntities),
  +			EnemyBcEntity = 
  +				lists:foldl(
  +				    fun(BcEntity, AccBcEntity) ->
  +						case bc_entity:health(BcEntity) < 
  +								 bc_entity:health(AccBcEntity) of
  +							true -> BcEntity;
  +							false -> AccBcEntity
  +						end 
  +					end, InRangeEnemyBcEntity, InRangeEnemyBcEntities),
  +			attack_entity(InRangeEnemyBcEntity, State)
  +	end.
  +
  +attack_entity(EnemyBcEntity, #state{entity = BcEntity,
  +									entity_config = BcEntityConfig,
  +									entities = BcEntities, 
  +									entity_event_handler = EventHandler} = State) ->
  +	Orientation = determine_orientation(BcEntity, EnemyBcEntity),
  +	ReorientedEntity = reorient_entity(Orientation, BcEntity, BcEntities),
  +	UpdatedState =
  +		case EventHandler of
  +			undefined ->
  +				EntitiesEventPid = bc_entities:event(BcEntities),
  +				gen_event:notify(EntitiesEventPid, {entity_attacking, ReorientedEntity}),
  +				EntityUuid = bc_entity:uuid(ReorientedEntity),
  +				EnemyUuid = bc_entity:uuid(EnemyBcEntity),
  +				EntitiesEventPid = bc_entities:event(BcEntities),
  +				Handler = {bc_died_event, EntityUuid},
  +				Result = gen_event:add_sup_handler(EntitiesEventPid, 
  +												   Handler, 
  +												   [EnemyUuid, self()]),
  +				State#state{entity = ReorientedEntity,
  +							entity_event_handler = Handler};
  +			_ ->
  +				State
  +		end,
  +	EnemyBcAiFsm = bc_entity:ai_fsm(EnemyBcEntity),
  +	Damage = calculate_damage(BcEntityConfig, EnemyBcEntity, BcEntities),
  +	bc_ai_fsm:damage_entity(EnemyBcAiFsm, Damage),
  +	AttackSpeed = bc_entity_config:attack_speed(BcEntityConfig),
  +	TimerRef = send_action_complete(AttackSpeed),
  +	{next_state, attacking, UpdatedState#state{timer = TimerRef}}.
  +
  +calculate_damage(BcEntityConfig, EnemyBcEntity, BcEntities) ->
  +	EnemyEntityType = bc_entity:entity_type(EnemyBcEntity),
  +	{ok, EnemyBcEntityConfig} = bc_entities:entity_config(EnemyEntityType, BcEntities),
  +	EntityClass = bc_entity_config:entity_class(BcEntityConfig),
  +	EnemyEntityClass = bc_entity_config:entity_class(EnemyBcEntityConfig),
  +	Modifier = 
  +		case {EntityClass, EnemyEntityClass} of
  +			{infantry, light_armor} -> 0.8;
  +			{infantry, armor} -> 0.65;
  +			{anti_infantry, infantry} -> 1.35;
  +			{anti_infantry, light_armor} -> 0.75;
  +			{anti_infantry, armor} -> 0.7;
  +			{armor, structure} -> 1.3;
  +			{light_armor, structure} -> 1.2;
  +			_ -> 1.0
  +		end,
  +	{MinDamage, MaxDamage} = bc_entity_config:damage(BcEntityConfig),
  +	{ModMinDamage, ModMaxDamage} = {erlang:trunc(MinDamage * Modifier), 
  +									erlang:trunc(MaxDamage * Modifier)},
  +	DamageDiff = ModMaxDamage - ModMinDamage,
  +	RandDamage = rand:uniform(DamageDiff),
  +	ModMinDamage + RandDamage.
   
   move_in_range(InRangeBcVertices, NearbyBcEntities, 
   			  #state{entity = BcEntity, map = BcMap} = State) ->
  
positive.code: 					right
  			end
  	end.
  
  calculate_damage(BcEntityConfig, EnemyBcEntity, BcEntities) ->
  	EnemyEntityType = bc_entity:entity_type(EnemyBcEntity),
  	{ok, EnemyBcEntityConfig} = bc_entities:entity_config(EnemyEntityType, BcEntities),
  	EntityClass = bc_entity_config:entity_class(BcEntityConfig),
  	EnemyEntityClass = bc_entity_config:entity_class(EnemyBcEntityConfig),
  	Modifier = 
  		case {EntityClass, EnemyEntityClass} of
  			{infantry, light_armor} -> 0.8;
  			{infantry, armor} -> 0.65;
  			{anti_infantry, infantry} -> 1.35;
  			{anti_infantry, light_armor} -> 0.75;
  			{anti_infantry, armor} -> 0.7;
  			{armor, structure} -> 1.3;
  			{light_armor, structure} -> 1.2;
  			_ -> 1.0
  		end,
  	{MinDamage, MaxDamage} = bc_entity_config:damage(BcEntityConfig),
  	{ModMinDamage, ModMaxDamage} = {erlang:trunc(MinDamage * Modifier), 
  									erlang:trunc(MaxDamage * Modifier)},
  	DamageDiff = ModMaxDamage - ModMinDamage,
  	RandDamage = rand:uniform(DamageDiff),
  	ModMinDamage + RandDamage.
  
  nearby_entities(#state{entity = BcEntity, 
  					   entities = BcEntities, 
  
negative.code: 			bc_entities:insert(UpdatedBcEntity, BcEntities),
  			UpdatedBcEntity
  	end.
  
  send_action_complete(Speed) ->
  	DelayFloat = 1000 - (1000 * Speed),
  	DelayInt = erlang:trunc(DelayFloat),
  	gen_fsm:send_event_after(DelayInt, action_complete).
  
  