add # 新增经验获取方式

This commit is contained in:
2026-10-20 14:13:31 +08:00
parent 38f4b84cf0
commit 0d3b5f41e0
11 changed files with 146 additions and 16 deletions
+9 -1
View File
@@ -120,11 +120,14 @@ class FarmService:
repository.save_plot(start_growth(replace(
plot, plant=plant, mature_at=mature_at, harvest_count=0,
), now))
experience = integer(amount * 2)
repository.asset(Asset.EXPERIENCE, experience)
return self._result(
repository, name=plant.name, plant_id=plant.plant_id,
quantity=amount,
slots=[p.slot for p in empty[:amount]],
seeds=repository.item(plant).seeds,
experience=experience,
)
return await self._execute(
@@ -200,8 +203,11 @@ class FarmService:
growth_updated_at=None, next_pest_at=None,
maturity_pests=0,
))
experience = integer(len(withered) * 2)
repository.asset(Asset.EXPERIENCE, experience)
return self._result(
repository, slots=[p.slot for p in withered],
experience=experience,
)
return await self._execute(
@@ -221,9 +227,11 @@ class FarmService:
repository.save_plot(advance_plot(updated, now))
if not cleared:
raise FarmError("nothing_to_clear")
quantity = integer(sum(item['pests'] for item in cleared))
repository.asset(Asset.EXPERIENCE, quantity)
return self._result(
repository, cleared=cleared,
quantity=sum(item["pests"] for item in cleared),
quantity=quantity, experience=quantity,
)
return await self._execute(
+2
View File
@@ -19,6 +19,8 @@ def receipt_text(receipt: Receipt) -> str:
lines.append(f"实际数量:{data['quantity']}")
if "proceeds" in data:
lines.append(f"本次收入:{data['proceeds']}")
if "experience" in data:
lines.append(f"本次经验:+{data['experience']}")
for item in data.get("harvested", ()):
if item.get("yield_loss_percent", 0):
lines.append(
+1 -1
View File
@@ -224,7 +224,7 @@ class FarmRenderer:
account = scene.account
level = account.level
current = account.experience - 200 * level * (level + 1) // 2
next_total = 200 * (level + 1) * (level + 2) // 2
next_total = 200 * (level + 1)
for entry in layout['sprites']:
x, y, w, h = entry['rect']
image = self.assets.image(