|
|
@@ -142,6 +142,7 @@ class CropLogic
|
|
|
$crop->land_id = $landId;
|
|
|
$crop->user_id = $userId;
|
|
|
$crop->seed_id = $seedId;
|
|
|
+ $crop->land_level = $land->land_type; // 记录种植时的土地等级
|
|
|
$crop->plant_time = now();
|
|
|
$crop->growth_stage = GROWTH_STAGE::SEED;
|
|
|
$crop->stage_start_time = now(); // 设置当前阶段开始时间
|
|
|
@@ -336,7 +337,7 @@ class CropLogic
|
|
|
'amount' => $outputAmount,
|
|
|
'harvest_log_id' => $harvestLog->id,
|
|
|
'growth_stage' => GROWTH_STAGE::MATURE->value,
|
|
|
- 'land_type' => $land->land_type ?? 1,
|
|
|
+ 'land_type' => $crop->land_level,
|
|
|
'old_stage' => $oldStage->value,
|
|
|
'new_stage' => GROWTH_STAGE::WITHERED->value,
|
|
|
'land_status_before' => $land->status,
|
|
|
@@ -666,7 +667,7 @@ class CropLogic
|
|
|
'disaster_type' => $disasterType,
|
|
|
'disaster_info' => $disasterInfo,
|
|
|
'growth_stage' => $crop->growth_stage->value,
|
|
|
- 'land_type' => $land->land_type ?? 1,
|
|
|
+ 'land_type' => $crop->land_level,
|
|
|
'has_other_active_disasters' => $hasActiveDisaster,
|
|
|
'old_land_status' => $oldLandStatus,
|
|
|
'new_land_status' => $land->status,
|
|
|
@@ -999,7 +1000,7 @@ class CropLogic
|
|
|
'crop_id' => $crop->id,
|
|
|
'user_id' => $crop->user_id,
|
|
|
'seed_id' => $seed->id,
|
|
|
- 'land_type' => $land->land_type,
|
|
|
+ 'land_type' => $crop->land_level,
|
|
|
'final_output_item_id' => $selectedOutput['item_id']
|
|
|
]);
|
|
|
|
|
|
@@ -1007,7 +1008,7 @@ class CropLogic
|
|
|
FarmCropLog::logFruitConfirmed($crop->user_id, $crop->land_id, $crop->id, $seed->id, [
|
|
|
'final_output_item_id' => $selectedOutput['item_id'],
|
|
|
'growth_stage' => $newStage,
|
|
|
- 'land_type' => $land->land_type,
|
|
|
+ 'land_type' => $crop->land_level,
|
|
|
'is_mystery_seed' => true,
|
|
|
'selected_output' => $selectedOutput,
|
|
|
'land_effect_applied' => true
|
|
|
@@ -1028,7 +1029,7 @@ class CropLogic
|
|
|
FarmCropLog::logFruitConfirmed($crop->user_id, $crop->land_id, $crop->id, $seed->id, [
|
|
|
'final_output_item_id' => $outputInfo['item_id'],
|
|
|
'growth_stage' => $newStage,
|
|
|
- 'land_type' => $crop->land->land_type ?? 1,
|
|
|
+ 'land_type' => $crop->land_level,
|
|
|
'is_mystery_seed' => false,
|
|
|
'output_info' => $outputInfo
|
|
|
]);
|
|
|
@@ -1376,8 +1377,9 @@ class CropLogic
|
|
|
// 3. 计算基础产量(随机值)
|
|
|
$baseAmount = mt_rand($minBaseAmount, $maxBaseAmount);
|
|
|
|
|
|
- // 3. 获取土地的产量加成
|
|
|
- $landOutputBonus = $land->landType->output_bonus ?? 0;
|
|
|
+ // 3. 获取土地的产量加成(使用种植时记录的土地等级)
|
|
|
+ $landType = \App\Module\Farm\Models\FarmLandType::find($crop->land_level);
|
|
|
+ $landOutputBonus = $landType ? $landType->output_bonus : 0;
|
|
|
|
|
|
// 4. 获取房屋的产量加成
|
|
|
$houseConfig = $farmUser->houseConfig;
|
|
|
@@ -1468,7 +1470,7 @@ class CropLogic
|
|
|
'disaster_max_amount' => $outputInfo['disaster_max_amount'] ?? 2000,
|
|
|
'global_max_output' => $globalMaxOutput,
|
|
|
'growth_stage' => GROWTH_STAGE::MATURE->value,
|
|
|
- 'land_type' => $crop->land->land_type ?? 1,
|
|
|
+ 'land_type' => $crop->land_level,
|
|
|
'final_output_item_id' => $crop->final_output_item_id
|
|
|
]);
|
|
|
|