feat: add steal mechanic to Code Farm with 60s protection window and half-coin reward

This commit is contained in:
2026-06-22 17:33:03 +00:00
parent ebf6bf7f82
commit 412dbe3a3d
13 changed files with 302 additions and 14 deletions
+7
View File
@@ -15,6 +15,9 @@ MAX_WATERS_PER_PLOT = 3
WATER_REWARD_COINS = 6
WATER_REWARD_XP = 3
STEAL_GRACE_SECONDS = 60
STEAL_FRACTION = 0.5
@dataclass(frozen=True)
class Crop:
@@ -220,6 +223,10 @@ def effective_reward_xp(crop: Crop, xp_level: int = 0) -> int:
return round(crop.reward_xp * (1 + PERK_BY_KEY["xp"].step * xp_level))
def steal_reward_coins(crop: Crop, yield_level: int = 0, prestige: int = 0) -> int:
return max(1, round(effective_reward_coins(crop, yield_level, prestige) * STEAL_FRACTION))
def daily_reward(streak: int) -> int:
effective = min(max(streak, 1), DAILY_STREAK_CAP)
return DAILY_BASE + DAILY_STREAK_STEP * (effective - 1)