sanguis::server::weapons::attack_result sanguis::server::weapons::spawn::do_attack( sanguis::server::weapons::attack const &_attack ) { return !sanguis::creator::tile_is_visible( _attack.environment().grid(), sanguis::server::world::center_to_grid_pos( sanguis::server::center{ _attack.target().get() } ), sanguis::server::world::center_to_grid_pos( this->owner().center() ) ) ? sanguis::server::weapons::attack_result::failure : fcppt::optional::maybe( this->do_spawn( _attack, spawn_weapon_ ), []{ return sanguis::server::weapons::attack_result::failure; }, [ this ]( fcppt::reference< sanguis::server::entities::base > const _inserted ) { this->kill_spawned(); spawned_ = dynamic_cast< sanguis::server::entities::ifaces::with_links & >( _inserted.get() ).link(); return sanguis::server::weapons::attack_result::success; } ) ; }
sanguis::server::weapons::attack_result sanguis::server::weapons::monster_spawner::do_attack( sanguis::server::weapons::attack const &_attack ) { return sanguis::server::weapons::insert_to_attack_result( _attack.environment().insert( sanguis::server::entities::enemies::create( this->random_generator(), common_parameters_, fcppt::random::distribution::make_basic( fcppt::random::distribution::parameters::make_uniform_enum< sanguis::creator::enemy_type >() )( this->random_generator() ), sanguis::creator::enemy_kind::normal, _attack.environment().difficulty(), _attack.environment().load_context(), sanguis::server::entities::spawn_owner( sanguis::server::entities::auto_weak_link() ), sanguis::server::entities::enemies::special_chance( 1.f ) ), sanguis::server::entities::insert_parameters( sanguis::server::center( _attack.target().get() ), _attack.angle() ) ) ); }