Navigation Menu

Skip to content

Commit

Permalink
When leaving a Halls standing, prefer the one being used
Browse files Browse the repository at this point in the history
  • Loading branch information
ysth authored and lemming552 committed Mar 10, 2013
1 parent 5fc57a5 commit 56f72bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Lacuna/RPC/Building/HallsOfVrbansk.pm
Expand Up @@ -95,7 +95,11 @@ sub sacrifice_to_upgrade {
if ($total < $needed) { if ($total < $needed) {
confess [1009, 'The Halls of Vrbansk do not have the knowledge necessary to upgrade the '.$upgrade->name]; confess [1009, 'The Halls of Vrbansk do not have the knowledge necessary to upgrade the '.$upgrade->name];
} }
shift @halls if ($total > $needed); # Leave one hall standing if not needed for upgrade. # Leave one hall standing if not needed for upgrade.
if ($total > $needed) {
@halls = sort { ($a->id != $building_id) <=> ($b->id != $building_id) } @halls;
shift(@halls);
}
while ($needed) { while ($needed) {
my $hall = shift(@halls); my $hall = shift(@halls);
if ($hall) { if ($hall) {
Expand Down

0 comments on commit 56f72bf

Please sign in to comment.