diff --git a/bin/lacuna.psgi b/bin/lacuna.psgi index 9dc5ca60..ab4dd36a 100644 --- a/bin/lacuna.psgi +++ b/bin/lacuna.psgi @@ -82,6 +82,7 @@ $urlmap->map(Lacuna::RPC::Building::Espionage->new->to_app_with_url); $urlmap->map(Lacuna::RPC::Building::Fission->new->to_app_with_url); $urlmap->map(Lacuna::RPC::Building::FoodReserve->new->to_app_with_url); $urlmap->map(Lacuna::RPC::Building::Fusion->new->to_app_with_url); +$urlmap->map(Lacuna::RPC::Building::DeployedBleeder->new->to_app_with_url); $urlmap->map(Lacuna::RPC::Building::GasGiantLab->new->to_app_with_url); $urlmap->map(Lacuna::RPC::Building::GasGiantPlatform->new->to_app_with_url); $urlmap->map(Lacuna::RPC::Building::Geo->new->to_app_with_url); diff --git a/docs/Buildings.pod b/docs/Buildings.pod index 0fee92a8..3a1e64b3 100644 --- a/docs/Buildings.pod +++ b/docs/Buildings.pod @@ -320,6 +320,8 @@ Below is a list of the different types of structures that can be built on planet =item L +=item L + =item L =item L diff --git a/docs/DeployedBleeder.pod b/docs/DeployedBleeder.pod new file mode 100644 index 00000000..fdb076cc --- /dev/null +++ b/docs/DeployedBleeder.pod @@ -0,0 +1,7 @@ +=head1 Deployed Bleeder Methods + +Deployed Bleeder is accessible via the URL C. + +The list of methods below represents changes and additions to the methods that all L share. + +=cut diff --git a/docs/GasGiantLab.pod b/docs/GasGiantLab.pod index ed961b67..4f5aa9d1 100644 --- a/docs/GasGiantLab.pod +++ b/docs/GasGiantLab.pod @@ -1,7 +1,7 @@ -=head1 Gas GiantLab Methods +=head1 Gas Giant Lab Methods -Gas GiantLab is accessible via the URL C. +Gas Giant Lab is accessible via the URL C. The list of methods below represents changes and additions to the methods that all L share. -=cut \ No newline at end of file +=cut diff --git a/lib/Lacuna/Constants.pm b/lib/Lacuna/Constants.pm index c11ee6c5..090cd7f9 100644 --- a/lib/Lacuna/Constants.pm +++ b/lib/Lacuna/Constants.pm @@ -106,7 +106,7 @@ use constant SHIP_TYPES => (qw( probe short_range_colony_ship colony_ship spy_po gas_giant_settlement_ship scow dory freighter snark snark2 snark3 drone fighter spy_shuttle observatory_seeker security_ministry_seeker spaceport_seeker excavator detonator scanner barge hulk galleon - placebo placebo2 placebo3 placebo4 placebo5 placebo6 + placebo placebo2 placebo3 placebo4 placebo5 placebo6 bleeder )); diff --git a/lib/Lacuna/DB/Result/Building.pm b/lib/Lacuna/DB/Result/Building.pm index 84af3907..51db4995 100644 --- a/lib/Lacuna/DB/Result/Building.pm +++ b/lib/Lacuna/DB/Result/Building.pm @@ -762,12 +762,13 @@ sub is_upgrade_locked { } sub start_upgrade { - my ($self, $cost) = @_; + my ($self, $cost, $in_parallel) = @_; my $body = $self->body; $cost ||= $self->cost_to_upgrade; # set time to build, plus what's in the queue - my $time_to_build = $body->get_existing_build_queue_time->add(seconds=>$cost->{time}); + my $time_to_build = $in_parallel ? DateTime->now : $body->get_existing_build_queue_time; + $time_to_build->add(seconds=>$cost->{time}); # add to queue $self->update({ is_upgrading => 1, @@ -1019,6 +1020,7 @@ sub spend_efficiency { 'Lacuna::DB::Result::Building::Permanent::PantheonOfHagness' => 'Lacuna::DB::Result::Building::Permanent::PantheonOfHagness', 'Lacuna::DB::Result::Building::SubspaceSupplyDepot' => 'Lacuna::DB::Result::Building::SubspaceSupplyDepot', 'Lacuna::DB::Result::Building::ThemePark' => 'Lacuna::DB::Result::Building::ThemePark', + 'Lacuna::DB::Result::Building::DeployedBleeder' => 'Lacuna::DB::Result::Building::DeployedBleeder', 'Lacuna::DB::Result::Building::Permanent::BlackHoleGenerator' => 'Lacuna::DB::Result::Building::Permanent::BlackHoleGenerator', 'Lacuna::DB::Result::Building::Permanent::GratchsGauntlet' => 'Lacuna::DB::Result::Building::Permanent::GratchsGauntlet', 'Lacuna::DB::Result::Building::Permanent::HallsOfVrbansk' => 'Lacuna::DB::Result::Building::Permanent::HallsOfVrbansk', diff --git a/lib/Lacuna/DB/Result/Building/DeployedBleeder.pm b/lib/Lacuna/DB/Result/Building/DeployedBleeder.pm new file mode 100644 index 00000000..24603973 --- /dev/null +++ b/lib/Lacuna/DB/Result/Building/DeployedBleeder.pm @@ -0,0 +1,47 @@ +package Lacuna::DB::Result::Building::DeployedBleeder; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::DB::Result::Building'; +use Lacuna::Util qw(randint); +use Lacuna::Constants qw(FOOD_TYPES ORE_TYPES); + +use constant controller_class => 'Lacuna::RPC::Building::DeployedBleeder'; + +around can_build => sub { + my ($orig, $self, $body) = @_; + if ($body->get_plan(__PACKAGE__, 1)) { + return $orig->($self, $body); + } + confess [1013,"If you want a Bleeder, build one at the Shipyard."]; +}; + +sub can_upgrade { + confess [1013, "You can't upgrade a Deployed Bleeder."]; +} + +use constant image => 'deployedbleeder'; + +sub image_level { + my ($self) = @_; + return $self->image.'1'; +} + +use constant name => 'Deployed Bleeder'; +use constant time_to_build => 15; + +after finish_upgrade => sub { + my $self = shift; + $self->start_upgrade(undef, 1); +}; + +use constant food_consumption => 125; +use constant energy_consumption => 125; +use constant ore_consumption => 125; +use constant water_consumption => 125; +use constant waste_production => 500; + + +no Moose; +__PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/lib/Lacuna/DB/Result/Medals.pm b/lib/Lacuna/DB/Result/Medals.pm index 721f8a33..818f15a9 100644 --- a/lib/Lacuna/DB/Result/Medals.pm +++ b/lib/Lacuna/DB/Result/Medals.pm @@ -43,6 +43,7 @@ use constant MEDALS => { placebo4 => 'Built Placebo IV', placebo5 => 'Built Placebo V', placebo6 => 'Built Placebo VI', + bleeder => 'Built Bleeder', galleon => 'Built Galleon', hulk => 'Built Hulk', freighter => 'Built Freighter', @@ -197,6 +198,7 @@ use constant MEDALS => { Sand => 'Discovered a Patch of Sand', Grove => 'Discovered a Grove of Trees', Crater => 'Discovered a Crater', + DeployedBleeder => 'Deployed a Bleeder', Dairy => 'Built Dairy Farm', Denton => 'Built Denton Root Farm', Development => 'Built Development Ministry', diff --git a/lib/Lacuna/DB/Result/Ships.pm b/lib/Lacuna/DB/Result/Ships.pm index 9c77b01f..ec705bd0 100644 --- a/lib/Lacuna/DB/Result/Ships.pm +++ b/lib/Lacuna/DB/Result/Ships.pm @@ -60,6 +60,7 @@ __PACKAGE__->typecast_map(type => { 'spy_shuttle' => 'Lacuna::DB::Result::Ships::SpyShuttle', 'drone' => 'Lacuna::DB::Result::Ships::Drone', 'fighter' => 'Lacuna::DB::Result::Ships::Fighter', + 'bleeder' => 'Lacuna::DB::Result::Ships::Bleeder', 'observatory_seeker' => 'Lacuna::DB::Result::Ships::ObservatorySeeker', 'spaceport_seeker' => 'Lacuna::DB::Result::Ships::SpacePortSeeker', 'security_ministry_seeker' => 'Lacuna::DB::Result::Ships::SecurityMinistrySeeker', diff --git a/lib/Lacuna/DB/Result/Ships/Bleeder.pm b/lib/Lacuna/DB/Result/Ships/Bleeder.pm new file mode 100644 index 00000000..fbe5ce19 --- /dev/null +++ b/lib/Lacuna/DB/Result/Ships/Bleeder.pm @@ -0,0 +1,29 @@ +package Lacuna::DB::Result::Ships::Bleeder; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::DB::Result::Ships'; + +use constant prereq => { class=> 'Lacuna::DB::Result::Building::MunitionsLab', level => 12 }; +use constant base_food_cost => 8000; +use constant base_water_cost => 21000; +use constant base_energy_cost => 69010; +use constant base_ore_cost => 95020; +use constant base_time_cost => 60 * 60 * 13; +use constant base_waste_cost => 12200; +use constant base_speed => 600; +use constant base_stealth => 2850; +use constant base_combat => 1700; +use constant base_hold_size => 0; +use constant build_tags => ['War']; + +with "Lacuna::Role::Ship::Send::Planet"; +with "Lacuna::Role::Ship::Send::Inhabited"; +with "Lacuna::Role::Ship::Send::NotIsolationist"; +with "Lacuna::Role::Ship::Arrive::TriggerDefense"; +with "Lacuna::Role::Ship::Arrive::DeployBleeder"; + + +no Moose; +__PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/lib/Lacuna/RPC/Building/DeployedBleeder.pm b/lib/Lacuna/RPC/Building/DeployedBleeder.pm new file mode 100644 index 00000000..af961b71 --- /dev/null +++ b/lib/Lacuna/RPC/Building/DeployedBleeder.pm @@ -0,0 +1,18 @@ +package Lacuna::RPC::Building::DeployedBleeder; + +use Moose; +use utf8; +no warnings qw(uninitialized); +extends 'Lacuna::RPC::Building'; + +sub app_url { + return '/deployedbleeder'; +} + +sub model_class { + return 'Lacuna::DB::Result::Building::DeployedBleeder'; +} + +no Moose; +__PACKAGE__->meta->make_immutable; + diff --git a/lib/Lacuna/Role/Ship/Arrive/DeployBleeder.pm b/lib/Lacuna/Role/Ship/Arrive/DeployBleeder.pm new file mode 100644 index 00000000..cf4b75d7 --- /dev/null +++ b/lib/Lacuna/Role/Ship/Arrive/DeployBleeder.pm @@ -0,0 +1,35 @@ +package Lacuna::Role::Ship::Arrive::DeployBleeder; + +use strict; +use Moose::Role; + +after handle_arrival_procedures => sub { + my ($self) = @_; + + # we're coming home + return if ($self->direction eq 'in'); + + # deploy the bleeder + my $body_attacked = $self->foreign_body; + my ($x, $y) = $body_attacked->find_free_space; + my $deployed = Lacuna->db->resultset('Lacuna::DB::Result::Building')->new({ + class => 'Lacuna::DB::Result::Building::DeployedBleeder', + x => $x, + y => $y, + }); + $body_attacked->build_building($deployed); + + # notify home + $self->body->empire->send_predefined_message( + tags => ['Alert'], + filename => 'bleeder_deployed.txt', + params => [$body_attacked->x, $body_attacked->y, $body_attacked->name], + ); + + # all pow + $self->delete; + confess [-1]; +}; + + +1; diff --git a/var/messages/bleeder_deployed.txt b/var/messages/bleeder_deployed.txt new file mode 100644 index 00000000..8712aa54 --- /dev/null +++ b/var/messages/bleeder_deployed.txt @@ -0,0 +1,7 @@ +Bleeder Deployed +~~~ +Our Bleeder is now deployed on {Starmap %s %s %s}. + +Regards, + +Your Humble Assistant diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index d71e9f15..4c67043d 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -29,7 +29,7 @@ - Freighters can no longer fetch or deliver spies. - Added Barge, Galleon, and Hulk trade ship classes. - Added Placebo 1 thru 6, which are used to fake an attack. - + - Added Bleeder attack ship. 2.3902 - Halls of Vrbansk now also returns building URL. diff --git a/var/www/public/resources.json b/var/www/public/resources.json index 91e192c4..fc7f60fa 100644 --- a/var/www/public/resources.json +++ b/var/www/public/resources.json @@ -1,5 +1,6 @@ { "buildings" : { + "/deployedbleeder" : { "description" : "Converts planet's resources directly into waste.", "wiki" : "http://community.lacunaexpanse.com/wiki/bleeder" }, "/oracleofanid" : { "description" : "The all seeing Oracle can help detect enemy threats.", "wiki" : "http://community.lacunaexpanse.com/wiki/oracle-of-anid" }, "/themepark" : { "description" : "Produces happiness for your citizens through food and entertainment.", "wiki" : "http://community.lacunaexpanse.com/wiki/theme-park" }, "/geneticslab" : { "description" : "Allows genetic experiements on captured spies to improve your species.", "wiki" : "http://community.lacunaexpanse.com/wiki/genetics-lab" }, @@ -135,6 +136,7 @@ "terraforming_platform_ship" : { "description" : "Allows you to settle planets your species could not normally colonize.", "wiki" : "http://community.lacunaexpanse.com/wiki/terraforming-platform-ship" }, "gas_giant_settlement_ship" : { "description" : "Allows you to settle gas giants.", "wiki" : "http://community.lacunaexpanse.com/wiki/gas-giant-settlement-ship" }, "scow" : { "description" : "Robotic waste transport ship. Can be used to dispose of waste in space.", "wiki" : "http://community.lacunaexpanse.com/wiki/scow" }, + "bleeder" : { "description" : "Robotic war ship. Once deployed on enemy planet, starts stealing resources and converting them into waste.", "wiki" : "http://community.lacunaexpanse.com/wiki/bleeder" }, "dory" : { "description" : "Small transport ship. Can be used to push resources between your colonies, trade with other empires, or gather ore from mining platforms.", "wiki" : "http://community.lacunaexpanse.com/wiki/dory" }, "barge" : { "description" : "Versatile transport ship. Can be used to push resources between your colonies, trade with other empires, or gather ore from mining platforms.", "wiki" : "http://community.lacunaexpanse.com/wiki/barge" }, "galleon" : { "description" : "Fast medium transport ship. Can be used to push resources between your colonies, trade with other empires, or gather ore from mining platforms.", "wiki" : "http://community.lacunaexpanse.com/wiki/galleon" },