Зроби повну копію гри Farming Simulator 25 - Initial Deployment
Browse files- README.md +7 -5
- index.html +873 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: farming
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,873 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Farming Simulator 25</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
@keyframes pulse {
|
| 11 |
+
0% { transform: scale(1); }
|
| 12 |
+
50% { transform: scale(1.05); }
|
| 13 |
+
100% { transform: scale(1); }
|
| 14 |
+
}
|
| 15 |
+
.pulse-animation {
|
| 16 |
+
animation: pulse 2s infinite;
|
| 17 |
+
}
|
| 18 |
+
.field-tile {
|
| 19 |
+
transition: all 0.3s ease;
|
| 20 |
+
}
|
| 21 |
+
.field-tile:hover {
|
| 22 |
+
transform: scale(1.05);
|
| 23 |
+
box-shadow: 0 0 10px rgba(0,0,0,0.3);
|
| 24 |
+
}
|
| 25 |
+
.progress-bar {
|
| 26 |
+
transition: width 0.5s ease;
|
| 27 |
+
}
|
| 28 |
+
.vehicle {
|
| 29 |
+
transition: all 0.5s ease;
|
| 30 |
+
}
|
| 31 |
+
.harvest-effect {
|
| 32 |
+
position: absolute;
|
| 33 |
+
background-color: gold;
|
| 34 |
+
border-radius: 50%;
|
| 35 |
+
pointer-events: none;
|
| 36 |
+
transform: scale(0);
|
| 37 |
+
opacity: 0.7;
|
| 38 |
+
animation: harvest-animation 1s forwards;
|
| 39 |
+
}
|
| 40 |
+
@keyframes harvest-animation {
|
| 41 |
+
0% { transform: scale(0); opacity: 0.7; }
|
| 42 |
+
100% { transform: scale(3); opacity: 0; }
|
| 43 |
+
}
|
| 44 |
+
</style>
|
| 45 |
+
</head>
|
| 46 |
+
<body class="bg-green-100 font-sans">
|
| 47 |
+
<div class="container mx-auto px-4 py-6">
|
| 48 |
+
<!-- Game Header -->
|
| 49 |
+
<header class="flex justify-between items-center mb-6 bg-green-800 text-white p-4 rounded-lg shadow-lg">
|
| 50 |
+
<div class="flex items-center">
|
| 51 |
+
<i class="fas fa-tractor text-3xl mr-3"></i>
|
| 52 |
+
<h1 class="text-2xl font-bold">Farming Simulator 25</h1>
|
| 53 |
+
</div>
|
| 54 |
+
<div class="flex items-center space-x-4">
|
| 55 |
+
<div class="bg-green-700 px-4 py-2 rounded-lg">
|
| 56 |
+
<span class="font-bold">$</span>
|
| 57 |
+
<span id="money">50,000</span>
|
| 58 |
+
</div>
|
| 59 |
+
<div class="bg-green-700 px-4 py-2 rounded-lg">
|
| 60 |
+
<span class="font-bold">Day:</span>
|
| 61 |
+
<span id="day">1</span>
|
| 62 |
+
</div>
|
| 63 |
+
<button id="next-day-btn" class="bg-yellow-600 hover:bg-yellow-700 px-4 py-2 rounded-lg font-bold transition">
|
| 64 |
+
Next Day <i class="fas fa-forward ml-1"></i>
|
| 65 |
+
</button>
|
| 66 |
+
</div>
|
| 67 |
+
</header>
|
| 68 |
+
|
| 69 |
+
<!-- Main Game Area -->
|
| 70 |
+
<div class="flex flex-col lg:flex-row gap-6">
|
| 71 |
+
<!-- Left Panel - Farm Field -->
|
| 72 |
+
<div class="flex-1 bg-white p-4 rounded-lg shadow-lg">
|
| 73 |
+
<div class="flex justify-between items-center mb-4">
|
| 74 |
+
<h2 class="text-xl font-bold text-green-800">Your Farm</h2>
|
| 75 |
+
<div class="flex space-x-2">
|
| 76 |
+
<button id="buy-field-btn" class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded text-sm">
|
| 77 |
+
Buy Field ($5,000)
|
| 78 |
+
</button>
|
| 79 |
+
<button id="sell-field-btn" class="bg-red-600 hover:bg-red-700 text-white px-3 py-1 rounded text-sm">
|
| 80 |
+
Sell Field ($3,000)
|
| 81 |
+
</button>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
|
| 85 |
+
<div id="farm-field" class="grid grid-cols-5 gap-2">
|
| 86 |
+
<!-- Field tiles will be generated here -->
|
| 87 |
+
</div>
|
| 88 |
+
|
| 89 |
+
<div class="mt-6 bg-gray-100 p-4 rounded-lg">
|
| 90 |
+
<h3 class="font-bold mb-2">Field Status</h3>
|
| 91 |
+
<div id="field-status" class="text-sm">
|
| 92 |
+
Select a field to see details
|
| 93 |
+
</div>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
|
| 97 |
+
<!-- Right Panel - Controls -->
|
| 98 |
+
<div class="w-full lg:w-80 bg-white p-4 rounded-lg shadow-lg h-fit">
|
| 99 |
+
<div class="mb-6">
|
| 100 |
+
<h2 class="text-xl font-bold text-green-800 mb-4">Equipment</h2>
|
| 101 |
+
<div class="grid grid-cols-2 gap-3">
|
| 102 |
+
<div class="bg-gray-100 p-3 rounded-lg cursor-pointer hover:bg-gray-200 transition equipment-btn" data-equipment="tractor">
|
| 103 |
+
<i class="fas fa-tractor text-3xl text-blue-600 mb-1"></i>
|
| 104 |
+
<div class="text-sm font-bold">Tractor</div>
|
| 105 |
+
<div class="text-xs">$15,000</div>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="bg-gray-100 p-3 rounded-lg cursor-pointer hover:bg-gray-200 transition equipment-btn" data-equipment="harvester">
|
| 108 |
+
<i class="fas fa-harvest text-3xl text-green-600 mb-1"></i>
|
| 109 |
+
<div class="text-sm font-bold">Harvester</div>
|
| 110 |
+
<div class="text-xs">$25,000</div>
|
| 111 |
+
</div>
|
| 112 |
+
<div class="bg-gray-100 p-3 rounded-lg cursor-pointer hover:bg-gray-200 transition equipment-btn" data-equipment="plow">
|
| 113 |
+
<i class="fas fa-tools text-3xl text-yellow-600 mb-1"></i>
|
| 114 |
+
<div class="text-sm font-bold">Plow</div>
|
| 115 |
+
<div class="text-xs">$5,000</div>
|
| 116 |
+
</div>
|
| 117 |
+
<div class="bg-gray-100 p-3 rounded-lg cursor-pointer hover:bg-gray-200 transition equipment-btn" data-equipment="seeder">
|
| 118 |
+
<i class="fas fa-seedling text-3xl text-green-700 mb-1"></i>
|
| 119 |
+
<div class="text-sm font-bold">Seeder</div>
|
| 120 |
+
<div class="text-xs">$8,000</div>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
+
<div class="mb-6">
|
| 126 |
+
<h2 class="text-xl font-bold text-green-800 mb-4">Crops</h2>
|
| 127 |
+
<div class="grid grid-cols-2 gap-3">
|
| 128 |
+
<div class="bg-gray-100 p-3 rounded-lg cursor-pointer hover:bg-gray-200 transition crop-btn" data-crop="wheat">
|
| 129 |
+
<i class="fas fa-wheat-alt text-3xl text-yellow-500 mb-1"></i>
|
| 130 |
+
<div class="text-sm font-bold">Wheat</div>
|
| 131 |
+
<div class="text-xs">$200/unit</div>
|
| 132 |
+
</div>
|
| 133 |
+
<div class="bg-gray-100 p-3 rounded-lg cursor-pointer hover:bg-gray-200 transition crop-btn" data-crop="corn">
|
| 134 |
+
<i class="fas fa-corn text-3xl text-yellow-700 mb-1"></i>
|
| 135 |
+
<div class="text-sm font-bold">Corn</div>
|
| 136 |
+
<div class="text-xs">$300/unit</div>
|
| 137 |
+
</div>
|
| 138 |
+
<div class="bg-gray-100 p-3 rounded-lg cursor-pointer hover:bg-gray-200 transition crop-btn" data-crop="soybean">
|
| 139 |
+
<i class="fas fa-leaf text-3xl text-green-600 mb-1"></i>
|
| 140 |
+
<div class="text-sm font-bold">Soybean</div>
|
| 141 |
+
<div class="text-xs">$250/unit</div>
|
| 142 |
+
</div>
|
| 143 |
+
<div class="bg-gray-100 p-3 rounded-lg cursor-pointer hover:bg-gray-200 transition crop-btn" data-crop="sunflower">
|
| 144 |
+
<i class="fas fa-sun text-3xl text-yellow-400 mb-1"></i>
|
| 145 |
+
<div class="text-sm font-bold">Sunflower</div>
|
| 146 |
+
<div class="text-xs">$350/unit</div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
|
| 151 |
+
<div class="bg-gray-100 p-4 rounded-lg">
|
| 152 |
+
<h3 class="font-bold mb-2">Actions</h3>
|
| 153 |
+
<div class="space-y-2">
|
| 154 |
+
<button id="plow-btn" class="w-full bg-yellow-600 hover:bg-yellow-700 text-white py-2 rounded disabled:opacity-50" disabled>
|
| 155 |
+
Plow Field
|
| 156 |
+
</button>
|
| 157 |
+
<button id="plant-btn" class="w-full bg-green-600 hover:bg-green-700 text-white py-2 rounded disabled:opacity-50" disabled>
|
| 158 |
+
Plant Crops
|
| 159 |
+
</button>
|
| 160 |
+
<button id="harvest-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 rounded disabled:opacity-50" disabled>
|
| 161 |
+
Harvest Crops
|
| 162 |
+
</button>
|
| 163 |
+
<button id="sell-btn" class="w-full bg-purple-600 hover:bg-purple-700 text-white py-2 rounded disabled:opacity-50" disabled>
|
| 164 |
+
Sell Harvest
|
| 165 |
+
</button>
|
| 166 |
+
</div>
|
| 167 |
+
</div>
|
| 168 |
+
</div>
|
| 169 |
+
</div>
|
| 170 |
+
|
| 171 |
+
<!-- Inventory and Stats -->
|
| 172 |
+
<div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
|
| 173 |
+
<div class="bg-white p-4 rounded-lg shadow-lg">
|
| 174 |
+
<h2 class="text-xl font-bold text-green-800 mb-3">Inventory</h2>
|
| 175 |
+
<div id="inventory" class="space-y-2">
|
| 176 |
+
<div class="flex justify-between">
|
| 177 |
+
<span>Wheat:</span>
|
| 178 |
+
<span id="wheat-inv">0 units</span>
|
| 179 |
+
</div>
|
| 180 |
+
<div class="flex justify-between">
|
| 181 |
+
<span>Corn:</span>
|
| 182 |
+
<span id="corn-inv">0 units</span>
|
| 183 |
+
</div>
|
| 184 |
+
<div class="flex justify-between">
|
| 185 |
+
<span>Soybean:</span>
|
| 186 |
+
<span id="soybean-inv">0 units</span>
|
| 187 |
+
</div>
|
| 188 |
+
<div class="flex justify-between">
|
| 189 |
+
<span>Sunflower:</span>
|
| 190 |
+
<span id="sunflower-inv">0 units</span>
|
| 191 |
+
</div>
|
| 192 |
+
</div>
|
| 193 |
+
</div>
|
| 194 |
+
|
| 195 |
+
<div class="bg-white p-4 rounded-lg shadow-lg">
|
| 196 |
+
<h2 class="text-xl font-bold text-green-800 mb-3">Equipment Owned</h2>
|
| 197 |
+
<div id="equipment-owned" class="space-y-2">
|
| 198 |
+
<div class="flex items-center">
|
| 199 |
+
<i class="fas fa-tractor text-blue-600 mr-2"></i>
|
| 200 |
+
<span>Tractor:</span>
|
| 201 |
+
<span class="ml-auto font-bold">1</span>
|
| 202 |
+
</div>
|
| 203 |
+
<div class="flex items-center">
|
| 204 |
+
<i class="fas fa-harvest text-green-600 mr-2"></i>
|
| 205 |
+
<span>Harvester:</span>
|
| 206 |
+
<span class="ml-auto font-bold">0</span>
|
| 207 |
+
</div>
|
| 208 |
+
<div class="flex items-center">
|
| 209 |
+
<i class="fas fa-tools text-yellow-600 mr-2"></i>
|
| 210 |
+
<span>Plow:</span>
|
| 211 |
+
<span class="ml-auto font-bold">0</span>
|
| 212 |
+
</div>
|
| 213 |
+
<div class="flex items-center">
|
| 214 |
+
<i class="fas fa-seedling text-green-700 mr-2"></i>
|
| 215 |
+
<span>Seeder:</span>
|
| 216 |
+
<span class="ml-auto font-bold">0</span>
|
| 217 |
+
</div>
|
| 218 |
+
</div>
|
| 219 |
+
</div>
|
| 220 |
+
|
| 221 |
+
<div class="bg-white p-4 rounded-lg shadow-lg">
|
| 222 |
+
<h2 class="text-xl font-bold text-green-800 mb-3">Stats</h2>
|
| 223 |
+
<div class="space-y-2">
|
| 224 |
+
<div class="flex justify-between">
|
| 225 |
+
<span>Fields Owned:</span>
|
| 226 |
+
<span id="fields-owned">1</span>
|
| 227 |
+
</div>
|
| 228 |
+
<div class="flex justify-between">
|
| 229 |
+
<span>Total Harvested:</span>
|
| 230 |
+
<span id="total-harvested">0 units</span>
|
| 231 |
+
</div>
|
| 232 |
+
<div class="flex justify-between">
|
| 233 |
+
<span>Total Sold:</span>
|
| 234 |
+
<span id="total-sold">$0</span>
|
| 235 |
+
</div>
|
| 236 |
+
<div class="flex justify-between">
|
| 237 |
+
<span>Days Played:</span>
|
| 238 |
+
<span id="days-played">1</span>
|
| 239 |
+
</div>
|
| 240 |
+
</div>
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
|
| 244 |
+
<!-- Vehicle Display -->
|
| 245 |
+
<div id="vehicle-display" class="mt-6 bg-white p-4 rounded-lg shadow-lg relative" style="height: 120px;">
|
| 246 |
+
<div id="tractor" class="vehicle absolute bottom-4 left-4 hidden">
|
| 247 |
+
<i class="fas fa-tractor text-4xl text-blue-600"></i>
|
| 248 |
+
</div>
|
| 249 |
+
<div id="harvester" class="vehicle absolute bottom-4 left-20 hidden">
|
| 250 |
+
<i class="fas fa-harvest text-4xl text-green-600"></i>
|
| 251 |
+
</div>
|
| 252 |
+
<div id="plow" class="vehicle absolute bottom-4 left-36 hidden">
|
| 253 |
+
<i class="fas fa-tools text-4xl text-yellow-600"></i>
|
| 254 |
+
</div>
|
| 255 |
+
<div id="seeder" class="vehicle absolute bottom-4 left-52 hidden">
|
| 256 |
+
<i class="fas fa-seedling text-4xl text-green-700"></i>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
|
| 261 |
+
<!-- Modals -->
|
| 262 |
+
<div id="notification-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
|
| 263 |
+
<div class="bg-white p-6 rounded-lg max-w-md w-full">
|
| 264 |
+
<h3 class="text-xl font-bold mb-2" id="notification-title">Notification</h3>
|
| 265 |
+
<p id="notification-message">This is a notification message.</p>
|
| 266 |
+
<button id="notification-close" class="mt-4 bg-blue-600 text-white px-4 py-2 rounded">OK</button>
|
| 267 |
+
</div>
|
| 268 |
+
</div>
|
| 269 |
+
|
| 270 |
+
<script>
|
| 271 |
+
// Game State
|
| 272 |
+
const gameState = {
|
| 273 |
+
money: 50000,
|
| 274 |
+
day: 1,
|
| 275 |
+
selectedField: null,
|
| 276 |
+
selectedEquipment: null,
|
| 277 |
+
selectedCrop: null,
|
| 278 |
+
fields: [],
|
| 279 |
+
inventory: {
|
| 280 |
+
wheat: 0,
|
| 281 |
+
corn: 0,
|
| 282 |
+
soybean: 0,
|
| 283 |
+
sunflower: 0
|
| 284 |
+
},
|
| 285 |
+
equipment: {
|
| 286 |
+
tractor: 1,
|
| 287 |
+
harvester: 0,
|
| 288 |
+
plow: 0,
|
| 289 |
+
seeder: 0
|
| 290 |
+
},
|
| 291 |
+
stats: {
|
| 292 |
+
fieldsOwned: 1,
|
| 293 |
+
totalHarvested: 0,
|
| 294 |
+
totalSold: 0,
|
| 295 |
+
daysPlayed: 1
|
| 296 |
+
},
|
| 297 |
+
prices: {
|
| 298 |
+
wheat: 200,
|
| 299 |
+
corn: 300,
|
| 300 |
+
soybean: 250,
|
| 301 |
+
sunflower: 350,
|
| 302 |
+
tractor: 15000,
|
| 303 |
+
harvester: 25000,
|
| 304 |
+
plow: 5000,
|
| 305 |
+
seeder: 8000,
|
| 306 |
+
field: 5000,
|
| 307 |
+
fieldSell: 3000
|
| 308 |
+
}
|
| 309 |
+
};
|
| 310 |
+
|
| 311 |
+
// DOM Elements
|
| 312 |
+
const moneyEl = document.getElementById('money');
|
| 313 |
+
const dayEl = document.getElementById('day');
|
| 314 |
+
const nextDayBtn = document.getElementById('next-day-btn');
|
| 315 |
+
const farmFieldEl = document.getElementById('farm-field');
|
| 316 |
+
const fieldStatusEl = document.getElementById('field-status');
|
| 317 |
+
const buyFieldBtn = document.getElementById('buy-field-btn');
|
| 318 |
+
const sellFieldBtn = document.getElementById('sell-field-btn');
|
| 319 |
+
const plowBtn = document.getElementById('plow-btn');
|
| 320 |
+
const plantBtn = document.getElementById('plant-btn');
|
| 321 |
+
const harvestBtn = document.getElementById('harvest-btn');
|
| 322 |
+
const sellBtn = document.getElementById('sell-btn');
|
| 323 |
+
const equipmentBtns = document.querySelectorAll('.equipment-btn');
|
| 324 |
+
const cropBtns = document.querySelectorAll('.crop-btn');
|
| 325 |
+
const notificationModal = document.getElementById('notification-modal');
|
| 326 |
+
const notificationTitle = document.getElementById('notification-title');
|
| 327 |
+
const notificationMessage = document.getElementById('notification-message');
|
| 328 |
+
const notificationClose = document.getElementById('notification-close');
|
| 329 |
+
const vehicleDisplay = document.getElementById('vehicle-display');
|
| 330 |
+
|
| 331 |
+
// Initialize the game
|
| 332 |
+
function initGame() {
|
| 333 |
+
updateUI();
|
| 334 |
+
createInitialField();
|
| 335 |
+
setupEventListeners();
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
// Create initial field
|
| 339 |
+
function createInitialField() {
|
| 340 |
+
gameState.fields.push({
|
| 341 |
+
id: 1,
|
| 342 |
+
size: 1,
|
| 343 |
+
plowed: false,
|
| 344 |
+
planted: null,
|
| 345 |
+
growth: 0,
|
| 346 |
+
ready: false
|
| 347 |
+
});
|
| 348 |
+
renderFields();
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
// Render all fields
|
| 352 |
+
function renderFields() {
|
| 353 |
+
farmFieldEl.innerHTML = '';
|
| 354 |
+
gameState.fields.forEach(field => {
|
| 355 |
+
const fieldEl = document.createElement('div');
|
| 356 |
+
fieldEl.className = 'field-tile bg-brown-200 h-24 rounded-lg cursor-pointer flex flex-col items-center justify-center relative overflow-hidden';
|
| 357 |
+
|
| 358 |
+
// Set field appearance based on state
|
| 359 |
+
if (field.ready) {
|
| 360 |
+
// Ready to harvest
|
| 361 |
+
let bgColor = '';
|
| 362 |
+
if (field.planted === 'wheat') bgColor = 'bg-yellow-300';
|
| 363 |
+
else if (field.planted === 'corn') bgColor = 'bg-yellow-600';
|
| 364 |
+
else if (field.planted === 'soybean') bgColor = 'bg-green-500';
|
| 365 |
+
else if (field.planted === 'sunflower') bgColor = 'bg-yellow-400';
|
| 366 |
+
|
| 367 |
+
fieldEl.className = `field-tile ${bgColor} h-24 rounded-lg cursor-pointer flex flex-col items-center justify-center relative overflow-hidden`;
|
| 368 |
+
|
| 369 |
+
const iconClass = field.planted === 'wheat' ? 'fa-wheat-alt' :
|
| 370 |
+
field.planted === 'corn' ? 'fa-corn' :
|
| 371 |
+
field.planted === 'soybean' ? 'fa-leaf' : 'fa-sun';
|
| 372 |
+
|
| 373 |
+
fieldEl.innerHTML = `
|
| 374 |
+
<i class="fas ${iconClass} text-3xl ${field.planted === 'sunflower' ? 'text-yellow-600' : 'text-white'} mb-1"></i>
|
| 375 |
+
<div class="text-xs font-bold">Ready!</div>
|
| 376 |
+
<div class="absolute bottom-0 left-0 right-0 bg-green-800 text-white text-center py-1 text-xs">
|
| 377 |
+
Field ${field.id}
|
| 378 |
+
</div>
|
| 379 |
+
`;
|
| 380 |
+
} else if (field.planted) {
|
| 381 |
+
// Growing
|
| 382 |
+
let bgColor = '';
|
| 383 |
+
if (field.planted === 'wheat') bgColor = 'bg-yellow-100';
|
| 384 |
+
else if (field.planted === 'corn') bgColor = 'bg-yellow-200';
|
| 385 |
+
else if (field.planted === 'soybean') bgColor = 'bg-green-200';
|
| 386 |
+
else if (field.planted === 'sunflower') bgColor = 'bg-yellow-100';
|
| 387 |
+
|
| 388 |
+
fieldEl.className = `field-tile ${bgColor} h-24 rounded-lg cursor-pointer flex flex-col items-center justify-center relative overflow-hidden`;
|
| 389 |
+
|
| 390 |
+
const iconClass = field.planted === 'wheat' ? 'fa-wheat-alt' :
|
| 391 |
+
field.planted === 'corn' ? 'fa-corn' :
|
| 392 |
+
field.planted === 'soybean' ? 'fa-leaf' : 'fa-sun';
|
| 393 |
+
|
| 394 |
+
fieldEl.innerHTML = `
|
| 395 |
+
<i class="fas ${iconClass} text-2xl ${field.planted === 'sunflower' ? 'text-yellow-500' : 'text-green-700'} mb-1"></i>
|
| 396 |
+
<div class="w-full px-2">
|
| 397 |
+
<div class="bg-gray-300 h-2 rounded-full overflow-hidden">
|
| 398 |
+
<div class="progress-bar bg-green-600 h-2" style="width: ${field.growth}%"></div>
|
| 399 |
+
</div>
|
| 400 |
+
</div>
|
| 401 |
+
<div class="text-xs mt-1">Growing...</div>
|
| 402 |
+
<div class="absolute bottom-0 left-0 right-0 bg-green-800 text-white text-center py-1 text-xs">
|
| 403 |
+
Field ${field.id}
|
| 404 |
+
</div>
|
| 405 |
+
`;
|
| 406 |
+
} else if (field.plowed) {
|
| 407 |
+
// Plowed but not planted
|
| 408 |
+
fieldEl.className = 'field-tile bg-brown-300 h-24 rounded-lg cursor-pointer flex flex-col items-center justify-center relative overflow-hidden';
|
| 409 |
+
fieldEl.innerHTML = `
|
| 410 |
+
<i class="fas fa-seedling text-3xl text-green-700 mb-1"></i>
|
| 411 |
+
<div class="text-xs">Ready to plant</div>
|
| 412 |
+
<div class="absolute bottom-0 left-0 right-0 bg-green-800 text-white text-center py-1 text-xs">
|
| 413 |
+
Field ${field.id}
|
| 414 |
+
</div>
|
| 415 |
+
`;
|
| 416 |
+
} else {
|
| 417 |
+
// Untouched field
|
| 418 |
+
fieldEl.className = 'field-tile bg-brown-400 h-24 rounded-lg cursor-pointer flex flex-col items-center justify-center relative overflow-hidden';
|
| 419 |
+
fieldEl.innerHTML = `
|
| 420 |
+
<i class="fas fa-grass text-3xl text-green-800 mb-1"></i>
|
| 421 |
+
<div class="text-xs">Needs plowing</div>
|
| 422 |
+
<div class="absolute bottom-0 left-0 right-0 bg-green-800 text-white text-center py-1 text-xs">
|
| 423 |
+
Field ${field.id}
|
| 424 |
+
</div>
|
| 425 |
+
`;
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
// Highlight selected field
|
| 429 |
+
if (gameState.selectedField === field.id) {
|
| 430 |
+
fieldEl.classList.add('ring-4', 'ring-yellow-500');
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
fieldEl.addEventListener('click', () => selectField(field.id));
|
| 434 |
+
farmFieldEl.appendChild(fieldEl);
|
| 435 |
+
});
|
| 436 |
+
}
|
| 437 |
+
|
| 438 |
+
// Select a field
|
| 439 |
+
function selectField(fieldId) {
|
| 440 |
+
gameState.selectedField = fieldId;
|
| 441 |
+
updateFieldStatus();
|
| 442 |
+
renderFields();
|
| 443 |
+
updateActionButtons();
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
// Update field status display
|
| 447 |
+
function updateFieldStatus() {
|
| 448 |
+
if (!gameState.selectedField) {
|
| 449 |
+
fieldStatusEl.textContent = 'Select a field to see details';
|
| 450 |
+
return;
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
const field = gameState.fields.find(f => f.id === gameState.selectedField);
|
| 454 |
+
if (!field) return;
|
| 455 |
+
|
| 456 |
+
let status = `Field ${field.id} - Size: ${field.size} acre(s)\n`;
|
| 457 |
+
|
| 458 |
+
if (field.ready) {
|
| 459 |
+
status += `Status: Ready to harvest (${field.planted})\n`;
|
| 460 |
+
status += `Estimated yield: ${field.size * 10} units`;
|
| 461 |
+
} else if (field.planted) {
|
| 462 |
+
status += `Status: Growing ${field.planted} (${field.growth}%)\n`;
|
| 463 |
+
status += `Time remaining: ${Math.ceil((100 - field.growth) / 10)} days`;
|
| 464 |
+
} else if (field.plowed) {
|
| 465 |
+
status += 'Status: Plowed and ready for planting';
|
| 466 |
+
} else {
|
| 467 |
+
status += 'Status: Needs plowing';
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
fieldStatusEl.innerHTML = status.split('\n').map(line => `<div>${line}</div>`).join('');
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
// Update action buttons based on selection
|
| 474 |
+
function updateActionButtons() {
|
| 475 |
+
const field = gameState.fields.find(f => f.id === gameState.selectedField);
|
| 476 |
+
|
| 477 |
+
// Reset all buttons
|
| 478 |
+
plowBtn.disabled = true;
|
| 479 |
+
plantBtn.disabled = true;
|
| 480 |
+
harvestBtn.disabled = true;
|
| 481 |
+
sellBtn.disabled = true;
|
| 482 |
+
|
| 483 |
+
if (!gameState.selectedField) return;
|
| 484 |
+
|
| 485 |
+
// Plow button - enabled if field is not plowed
|
| 486 |
+
if (!field.plowed) {
|
| 487 |
+
plowBtn.disabled = false;
|
| 488 |
+
}
|
| 489 |
+
|
| 490 |
+
// Plant button - enabled if field is plowed but not planted
|
| 491 |
+
if (field.plowed && !field.planted && gameState.selectedCrop) {
|
| 492 |
+
plantBtn.disabled = false;
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
// Harvest button - enabled if crop is ready
|
| 496 |
+
if (field.ready) {
|
| 497 |
+
harvestBtn.disabled = false;
|
| 498 |
+
}
|
| 499 |
+
|
| 500 |
+
// Sell button - enabled if there's anything in inventory
|
| 501 |
+
if (Object.values(gameState.inventory).some(amount => amount > 0)) {
|
| 502 |
+
sellBtn.disabled = false;
|
| 503 |
+
}
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
// Update all UI elements
|
| 507 |
+
function updateUI() {
|
| 508 |
+
// Money and day
|
| 509 |
+
moneyEl.textContent = gameState.money.toLocaleString();
|
| 510 |
+
dayEl.textContent = gameState.day;
|
| 511 |
+
|
| 512 |
+
// Inventory
|
| 513 |
+
document.getElementById('wheat-inv').textContent = `${gameState.inventory.wheat} units`;
|
| 514 |
+
document.getElementById('corn-inv').textContent = `${gameState.inventory.corn} units`;
|
| 515 |
+
document.getElementById('soybean-inv').textContent = `${gameState.inventory.soybean} units`;
|
| 516 |
+
document.getElementById('sunflower-inv').textContent = `${gameState.inventory.sunflower} units`;
|
| 517 |
+
|
| 518 |
+
// Equipment owned
|
| 519 |
+
const equipmentEl = document.getElementById('equipment-owned');
|
| 520 |
+
equipmentEl.innerHTML = `
|
| 521 |
+
<div class="flex items-center">
|
| 522 |
+
<i class="fas fa-tractor text-blue-600 mr-2"></i>
|
| 523 |
+
<span>Tractor:</span>
|
| 524 |
+
<span class="ml-auto font-bold">${gameState.equipment.tractor}</span>
|
| 525 |
+
</div>
|
| 526 |
+
<div class="flex items-center">
|
| 527 |
+
<i class="fas fa-harvest text-green-600 mr-2"></i>
|
| 528 |
+
<span>Harvester:</span>
|
| 529 |
+
<span class="ml-auto font-bold">${gameState.equipment.harvester}</span>
|
| 530 |
+
</div>
|
| 531 |
+
<div class="flex items-center">
|
| 532 |
+
<i class="fas fa-tools text-yellow-600 mr-2"></i>
|
| 533 |
+
<span>Plow:</span>
|
| 534 |
+
<span class="ml-auto font-bold">${gameState.equipment.plow}</span>
|
| 535 |
+
</div>
|
| 536 |
+
<div class="flex items-center">
|
| 537 |
+
<i class="fas fa-seedling text-green-700 mr-2"></i>
|
| 538 |
+
<span>Seeder:</span>
|
| 539 |
+
<span class="ml-auto font-bold">${gameState.equipment.seeder}</span>
|
| 540 |
+
</div>
|
| 541 |
+
`;
|
| 542 |
+
|
| 543 |
+
// Stats
|
| 544 |
+
document.getElementById('fields-owned').textContent = gameState.stats.fieldsOwned;
|
| 545 |
+
document.getElementById('total-harvested').textContent = `${gameState.stats.totalHarvested} units`;
|
| 546 |
+
document.getElementById('total-sold').textContent = `$${gameState.stats.totalSold.toLocaleString()}`;
|
| 547 |
+
document.getElementById('days-played').textContent = gameState.stats.daysPlayed;
|
| 548 |
+
|
| 549 |
+
// Update vehicle display
|
| 550 |
+
updateVehicleDisplay();
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
// Update vehicle display
|
| 554 |
+
function updateVehicleDisplay() {
|
| 555 |
+
// Hide all vehicles first
|
| 556 |
+
document.querySelectorAll('.vehicle').forEach(el => el.classList.add('hidden'));
|
| 557 |
+
|
| 558 |
+
// Show owned vehicles
|
| 559 |
+
if (gameState.equipment.tractor > 0) {
|
| 560 |
+
document.getElementById('tractor').classList.remove('hidden');
|
| 561 |
+
}
|
| 562 |
+
if (gameState.equipment.harvester > 0) {
|
| 563 |
+
document.getElementById('harvester').classList.remove('hidden');
|
| 564 |
+
}
|
| 565 |
+
if (gameState.equipment.plow > 0) {
|
| 566 |
+
document.getElementById('plow').classList.remove('hidden');
|
| 567 |
+
}
|
| 568 |
+
if (gameState.equipment.seeder > 0) {
|
| 569 |
+
document.getElementById('seeder').classList.remove('hidden');
|
| 570 |
+
}
|
| 571 |
+
|
| 572 |
+
// Highlight selected equipment
|
| 573 |
+
if (gameState.selectedEquipment) {
|
| 574 |
+
const selectedEl = document.getElementById(gameState.selectedEquipment);
|
| 575 |
+
if (selectedEl) {
|
| 576 |
+
selectedEl.classList.add('pulse-animation');
|
| 577 |
+
}
|
| 578 |
+
}
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
// Show notification
|
| 582 |
+
function showNotification(title, message) {
|
| 583 |
+
notificationTitle.textContent = title;
|
| 584 |
+
notificationMessage.textContent = message;
|
| 585 |
+
notificationModal.classList.remove('hidden');
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
// Setup event listeners
|
| 589 |
+
function setupEventListeners() {
|
| 590 |
+
// Equipment selection
|
| 591 |
+
equipmentBtns.forEach(btn => {
|
| 592 |
+
btn.addEventListener('click', () => {
|
| 593 |
+
const equipment = btn.dataset.equipment;
|
| 594 |
+
|
| 595 |
+
// Check if player owns this equipment
|
| 596 |
+
if (gameState.equipment[equipment] === 0) {
|
| 597 |
+
// Try to buy
|
| 598 |
+
if (gameState.money >= gameState.prices[equipment]) {
|
| 599 |
+
if (confirm(`Buy ${equipment} for $${gameState.prices[equipment].toLocaleString()}?`)) {
|
| 600 |
+
gameState.money -= gameState.prices[equipment];
|
| 601 |
+
gameState.equipment[equipment]++;
|
| 602 |
+
updateUI();
|
| 603 |
+
showNotification('Purchase Complete', `You bought a ${equipment}!`);
|
| 604 |
+
}
|
| 605 |
+
} else {
|
| 606 |
+
showNotification('Not Enough Money', `You need $${gameState.prices[equipment].toLocaleString()} to buy a ${equipment}.`);
|
| 607 |
+
}
|
| 608 |
+
} else {
|
| 609 |
+
// Select equipment
|
| 610 |
+
gameState.selectedEquipment = equipment;
|
| 611 |
+
document.querySelectorAll('.equipment-btn').forEach(b => b.classList.remove('bg-gray-300'));
|
| 612 |
+
btn.classList.add('bg-gray-300');
|
| 613 |
+
|
| 614 |
+
// Remove pulse animation from all vehicles
|
| 615 |
+
document.querySelectorAll('.vehicle').forEach(el => el.classList.remove('pulse-animation'));
|
| 616 |
+
|
| 617 |
+
// Add pulse to selected vehicle
|
| 618 |
+
const vehicleEl = document.getElementById(equipment);
|
| 619 |
+
if (vehicleEl) {
|
| 620 |
+
vehicleEl.classList.add('pulse-animation');
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
updateActionButtons();
|
| 624 |
+
}
|
| 625 |
+
});
|
| 626 |
+
});
|
| 627 |
+
|
| 628 |
+
// Crop selection
|
| 629 |
+
cropBtns.forEach(btn => {
|
| 630 |
+
btn.addEventListener('click', () => {
|
| 631 |
+
const crop = btn.dataset.crop;
|
| 632 |
+
gameState.selectedCrop = crop;
|
| 633 |
+
document.querySelectorAll('.crop-btn').forEach(b => b.classList.remove('bg-gray-300'));
|
| 634 |
+
btn.classList.add('bg-gray-300');
|
| 635 |
+
updateActionButtons();
|
| 636 |
+
});
|
| 637 |
+
});
|
| 638 |
+
|
| 639 |
+
// Action buttons
|
| 640 |
+
plowBtn.addEventListener('click', () => {
|
| 641 |
+
if (!gameState.selectedField || !gameState.selectedEquipment) return;
|
| 642 |
+
|
| 643 |
+
const field = gameState.fields.find(f => f.id === gameState.selectedField);
|
| 644 |
+
if (!field || field.plowed) return;
|
| 645 |
+
|
| 646 |
+
if (gameState.selectedEquipment !== 'plow') {
|
| 647 |
+
showNotification('Wrong Equipment', 'You need to select the plow to plow a field.');
|
| 648 |
+
return;
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
// Animate plowing
|
| 652 |
+
const fieldEl = document.querySelector(`.field-tile:nth-child(${gameState.fields.findIndex(f => f.id === field.id) + 1})`);
|
| 653 |
+
if (fieldEl) {
|
| 654 |
+
fieldEl.classList.add('bg-brown-300');
|
| 655 |
+
fieldEl.innerHTML = `
|
| 656 |
+
<i class="fas fa-tools text-3xl text-yellow-600 animate-spin mb-2"></i>
|
| 657 |
+
<div class="text-xs">Plowing...</div>
|
| 658 |
+
`;
|
| 659 |
+
|
| 660 |
+
setTimeout(() => {
|
| 661 |
+
field.plowed = true;
|
| 662 |
+
renderFields();
|
| 663 |
+
updateFieldStatus();
|
| 664 |
+
updateActionButtons();
|
| 665 |
+
showNotification('Field Plowed', `Field ${field.id} has been plowed and is ready for planting.`);
|
| 666 |
+
}, 1500);
|
| 667 |
+
}
|
| 668 |
+
});
|
| 669 |
+
|
| 670 |
+
plantBtn.addEventListener('click', () => {
|
| 671 |
+
if (!gameState.selectedField || !gameState.selectedCrop || !gameState.selectedEquipment) return;
|
| 672 |
+
|
| 673 |
+
const field = gameState.fields.find(f => f.id === gameState.selectedField);
|
| 674 |
+
if (!field || !field.plowed || field.planted) return;
|
| 675 |
+
|
| 676 |
+
if (gameState.selectedEquipment !== 'seeder') {
|
| 677 |
+
showNotification('Wrong Equipment', 'You need to select the seeder to plant crops.');
|
| 678 |
+
return;
|
| 679 |
+
}
|
| 680 |
+
|
| 681 |
+
// Animate planting
|
| 682 |
+
const fieldEl = document.querySelector(`.field-tile:nth-child(${gameState.fields.findIndex(f => f.id === field.id) + 1})`);
|
| 683 |
+
if (fieldEl) {
|
| 684 |
+
let bgColor = '';
|
| 685 |
+
if (gameState.selectedCrop === 'wheat') bgColor = 'bg-yellow-100';
|
| 686 |
+
else if (gameState.selectedCrop === 'corn') bgColor = 'bg-yellow-200';
|
| 687 |
+
else if (gameState.selectedCrop === 'soybean') bgColor = 'bg-green-200';
|
| 688 |
+
else if (gameState.selectedCrop === 'sunflower') bgColor = 'bg-yellow-100';
|
| 689 |
+
|
| 690 |
+
fieldEl.className = `field-tile ${bgColor} h-24 rounded-lg cursor-pointer flex flex-col items-center justify-center relative overflow-hidden`;
|
| 691 |
+
fieldEl.innerHTML = `
|
| 692 |
+
<i class="fas fa-seedling text-3xl text-green-700 animate-bounce mb-2"></i>
|
| 693 |
+
<div class="text-xs">Planting...</div>
|
| 694 |
+
`;
|
| 695 |
+
|
| 696 |
+
setTimeout(() => {
|
| 697 |
+
field.planted = gameState.selectedCrop;
|
| 698 |
+
field.growth = 10; // Start at 10%
|
| 699 |
+
renderFields();
|
| 700 |
+
updateFieldStatus();
|
| 701 |
+
updateActionButtons();
|
| 702 |
+
showNotification('Crops Planted', `You planted ${gameState.selectedCrop} in field ${field.id}.`);
|
| 703 |
+
}, 1500);
|
| 704 |
+
}
|
| 705 |
+
});
|
| 706 |
+
|
| 707 |
+
harvestBtn.addEventListener('click', () => {
|
| 708 |
+
if (!gameState.selectedField || !gameState.selectedEquipment) return;
|
| 709 |
+
|
| 710 |
+
const field = gameState.fields.find(f => f.id === gameState.selectedField);
|
| 711 |
+
if (!field || !field.ready) return;
|
| 712 |
+
|
| 713 |
+
if (gameState.selectedEquipment !== 'harvester') {
|
| 714 |
+
showNotification('Wrong Equipment', 'You need to select the harvester to harvest crops.');
|
| 715 |
+
return;
|
| 716 |
+
}
|
| 717 |
+
|
| 718 |
+
// Animate harvesting
|
| 719 |
+
const fieldEl = document.querySelector(`.field-tile:nth-child(${gameState.fields.findIndex(f => f.id === field.id) + 1})`);
|
| 720 |
+
if (fieldEl) {
|
| 721 |
+
// Create harvest effect
|
| 722 |
+
for (let i = 0; i < 5; i++) {
|
| 723 |
+
setTimeout(() => {
|
| 724 |
+
const effect = document.createElement('div');
|
| 725 |
+
effect.className = 'harvest-effect';
|
| 726 |
+
effect.style.width = '20px';
|
| 727 |
+
effect.style.height = '20px';
|
| 728 |
+
effect.style.left = `${Math.random() * 80 + 10}%`;
|
| 729 |
+
effect.style.top = `${Math.random() * 80 + 10}%`;
|
| 730 |
+
fieldEl.appendChild(effect);
|
| 731 |
+
|
| 732 |
+
// Remove effect after animation
|
| 733 |
+
setTimeout(() => effect.remove(), 1000);
|
| 734 |
+
}, i * 300);
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
setTimeout(() => {
|
| 738 |
+
// Calculate yield
|
| 739 |
+
const yieldAmount = field.size * 10;
|
| 740 |
+
gameState.inventory[field.planted] += yieldAmount;
|
| 741 |
+
gameState.stats.totalHarvested += yieldAmount;
|
| 742 |
+
|
| 743 |
+
// Reset field
|
| 744 |
+
field.planted = null;
|
| 745 |
+
field.ready = false;
|
| 746 |
+
field.growth = 0;
|
| 747 |
+
field.plowed = false;
|
| 748 |
+
|
| 749 |
+
renderFields();
|
| 750 |
+
updateUI();
|
| 751 |
+
updateFieldStatus();
|
| 752 |
+
updateActionButtons();
|
| 753 |
+
showNotification('Harvest Complete', `You harvested ${yieldAmount} units of ${field.planted} from field ${field.id}.`);
|
| 754 |
+
}, 2000);
|
| 755 |
+
}
|
| 756 |
+
});
|
| 757 |
+
|
| 758 |
+
sellBtn.addEventListener('click', () => {
|
| 759 |
+
// Calculate total value
|
| 760 |
+
let totalValue = 0;
|
| 761 |
+
let soldItems = [];
|
| 762 |
+
|
| 763 |
+
for (const [crop, amount] of Object.entries(gameState.inventory)) {
|
| 764 |
+
if (amount > 0) {
|
| 765 |
+
const value = amount * gameState.prices[crop];
|
| 766 |
+
totalValue += value;
|
| 767 |
+
soldItems.push(`${amount} ${crop} for $${value.toLocaleString()}`);
|
| 768 |
+
gameState.inventory[crop] = 0;
|
| 769 |
+
}
|
| 770 |
+
}
|
| 771 |
+
|
| 772 |
+
if (totalValue === 0) {
|
| 773 |
+
showNotification('Nothing to Sell', 'Your inventory is empty.');
|
| 774 |
+
return;
|
| 775 |
+
}
|
| 776 |
+
|
| 777 |
+
gameState.money += totalValue;
|
| 778 |
+
gameState.stats.totalSold += totalValue;
|
| 779 |
+
|
| 780 |
+
updateUI();
|
| 781 |
+
updateActionButtons();
|
| 782 |
+
showNotification('Sale Complete', `You sold ${soldItems.join(', ')} for a total of $${totalValue.toLocaleString()}.`);
|
| 783 |
+
});
|
| 784 |
+
|
| 785 |
+
// Buy/sell field
|
| 786 |
+
buyFieldBtn.addEventListener('click', () => {
|
| 787 |
+
if (gameState.money >= gameState.prices.field) {
|
| 788 |
+
const newFieldId = gameState.fields.length + 1;
|
| 789 |
+
gameState.fields.push({
|
| 790 |
+
id: newFieldId,
|
| 791 |
+
size: 1,
|
| 792 |
+
plowed: false,
|
| 793 |
+
planted: null,
|
| 794 |
+
growth: 0,
|
| 795 |
+
ready: false
|
| 796 |
+
});
|
| 797 |
+
gameState.money -= gameState.prices.field;
|
| 798 |
+
gameState.stats.fieldsOwned++;
|
| 799 |
+
renderFields();
|
| 800 |
+
updateUI();
|
| 801 |
+
showNotification('Field Purchased', `You bought a new field (ID: ${newFieldId}) for $${gameState.prices.field.toLocaleString()}.`);
|
| 802 |
+
} else {
|
| 803 |
+
showNotification('Not Enough Money', `You need $${gameState.prices.field.toLocaleString()} to buy a new field.`);
|
| 804 |
+
}
|
| 805 |
+
});
|
| 806 |
+
|
| 807 |
+
sellFieldBtn.addEventListener('click', () => {
|
| 808 |
+
if (!gameState.selectedField) {
|
| 809 |
+
showNotification('No Field Selected', 'Please select a field to sell.');
|
| 810 |
+
return;
|
| 811 |
+
}
|
| 812 |
+
|
| 813 |
+
if (gameState.fields.length <= 1) {
|
| 814 |
+
showNotification('Cannot Sell', 'You must keep at least one field.');
|
| 815 |
+
return;
|
| 816 |
+
}
|
| 817 |
+
|
| 818 |
+
const fieldIndex = gameState.fields.findIndex(f => f.id === gameState.selectedField);
|
| 819 |
+
if (fieldIndex === -1) return;
|
| 820 |
+
|
| 821 |
+
const field = gameState.fields[fieldIndex];
|
| 822 |
+
|
| 823 |
+
// Check if field has crops
|
| 824 |
+
if (field.planted) {
|
| 825 |
+
showNotification('Field Has Crops', 'You cannot sell a field with growing crops.');
|
| 826 |
+
return;
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
if (confirm(`Sell field ${field.id} for $${gameState.prices.fieldSell.toLocaleString()}?`)) {
|
| 830 |
+
gameState.money += gameState.prices.fieldSell;
|
| 831 |
+
gameState.fields.splice(fieldIndex, 1);
|
| 832 |
+
gameState.selectedField = null;
|
| 833 |
+
gameState.stats.fieldsOwned--;
|
| 834 |
+
renderFields();
|
| 835 |
+
updateUI();
|
| 836 |
+
updateFieldStatus();
|
| 837 |
+
showNotification('Field Sold', `You sold field ${field.id} for $${gameState.prices.fieldSell.toLocaleString()}.`);
|
| 838 |
+
}
|
| 839 |
+
});
|
| 840 |
+
|
| 841 |
+
// Next day button
|
| 842 |
+
nextDayBtn.addEventListener('click', () => {
|
| 843 |
+
gameState.day++;
|
| 844 |
+
gameState.stats.daysPlayed++;
|
| 845 |
+
|
| 846 |
+
// Grow crops
|
| 847 |
+
gameState.fields.forEach(field => {
|
| 848 |
+
if (field.planted && !field.ready) {
|
| 849 |
+
field.growth += 10;
|
| 850 |
+
if (field.growth >= 100) {
|
| 851 |
+
field.growth = 100;
|
| 852 |
+
field.ready = true;
|
| 853 |
+
}
|
| 854 |
+
}
|
| 855 |
+
});
|
| 856 |
+
|
| 857 |
+
renderFields();
|
| 858 |
+
updateUI();
|
| 859 |
+
updateFieldStatus();
|
| 860 |
+
showNotification('New Day', `Day ${gameState.day} begins. Your crops have grown.`);
|
| 861 |
+
});
|
| 862 |
+
|
| 863 |
+
// Notification close
|
| 864 |
+
notificationClose.addEventListener('click', () => {
|
| 865 |
+
notificationModal.classList.add('hidden');
|
| 866 |
+
});
|
| 867 |
+
}
|
| 868 |
+
|
| 869 |
+
// Start the game
|
| 870 |
+
initGame();
|
| 871 |
+
</script>
|
| 872 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ToIik/farming" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 873 |
+
</html>
|