mutate($user, $villageId, function (Simulation $sim, Village $village, CarbonImmutable $now) use ($buildingId) { $building = $this->building($village, $buildingId); $offer = $sim->demolishOffer($building) ?? throw new GameRuleViolation('core_building', 'Core buildings cannot go below level 0.'); $sim->enqueue([ 'building_id' => $building->id, 'type' => $building->type, 'action' => BuildOrder::DEMOLISH, 'target_level' => $offer['target_level'], 'x' => $building->x, 'y' => $building->y, 'cost' => ['wood' => 0, 'clay' => 0, 'iron' => 0], ], $now); }); } }