feat(gameplay): add crazy dave casino and bank, and zombie mutation lab

This commit is contained in:
Antigravity committed 2026-09-22 09:25:08 +00:00
1 parent d8be8f4366
commit b8db5a123d
16 files changed
+2365 -135

No files matched your search

+17 -10
View File
@@ -21,7 +21,7 @@ window.PLANT_CATALOGUE = [
// Economy, Sun, Coin Drops & Crazy Dave's Shop System
window.EconomySystem = class EconomySystem {
constructor() {
this.sun = 50;
this.sun = window.PvZConfig ? window.PvZConfig.getStartingSun() : 50;
this.suns = [];
this.coins = [];
this.skySunTimer = 0;
@@ -42,7 +42,7 @@ window.EconomySystem = class EconomySystem {
this.allCards = window.PLANT_CATALOGUE.map(p => ({
id: p.id,
name: p.name,
cost: p.cost,
cost: window.PvZConfig ? window.PvZConfig.getPlantSunCost(p.id, p.cost) : p.cost,
cooldown: p.cooldown,
timer: 0
}));
@@ -69,7 +69,7 @@ window.EconomySystem = class EconomySystem {
if (!p) return { success: false, message: 'Растение не найдено' };
if (this.isPlantUnlocked(plantId)) return { success: false, message: 'Растение уже куплено' };
const price = p.price || 0;
const price = window.PvZConfig ? window.PvZConfig.getPlantShopPrice(plantId) : (p.price || 0);
if (this.totalCoins < price) {
return { success: false, message: `Недостаточно монет! Требуется ${price} 💰 (у вас: ${this.totalCoins} 💰)` };
}
@@ -270,7 +270,7 @@ window.EconomySystem = class EconomySystem {
}
reset() {
let baseSun = this.isConveyor ? 0 : (this.isIZombie ? 200 : 50);
let baseSun = this.isConveyor ? 0 : (this.isIZombie ? 200 : (window.PvZConfig ? window.PvZConfig.getStartingSun() : 50));
if (!this.isConveyor && !this.isIZombie && this.workshop) {
baseSun += this.workshop.getPerkLevel('startSun') * 50;
}
@@ -330,11 +330,13 @@ window.EconomySystem = class EconomySystem {
}
spawnSun(x, y, value = 25, isFalling = false, targetY = null) {
const sunMult = window.PvZConfig ? window.PvZConfig.getSunMultiplier() : 1.0;
const finalVal = Math.max(5, Math.round(value * sunMult));
this.suns.push({
x,
y,
targetY: targetY !== null ? targetY : y,
value,
value: finalVal,
isFalling,
fallSpeed: 90,
radius: 26,
@@ -346,12 +348,14 @@ window.EconomySystem = class EconomySystem {
}
spawnCoin(x, y, type = 'silver') {
const val = type === 'diamond' ? 200 : (type === 'gold' ? 50 : 10);
const dropMult = window.PvZConfig ? window.PvZConfig.getCoinDropRate() : 1.0;
const baseVal = type === 'diamond' ? 200 : (type === 'gold' ? 50 : 10);
const finalVal = Math.max(1, Math.round(baseVal * dropMult));
this.coins.push({
x,
y,
type,
value: val,
value: finalVal,
radius: 16,
life: 12.0,
collecting: false,
@@ -363,9 +367,10 @@ window.EconomySystem = class EconomySystem {
update(dt) {
this.animTime += dt;
// Cooldown timers with fastCool perk bonus
// Cooldown timers with fastCool perk bonus and PvZConfig
const fastCoolLvl = this.workshop ? this.workshop.getPerkLevel('fastCool') : 0;
const cooldownMultiplier = 1 + fastCoolLvl * 0.15;
const cfgCooldownMult = window.PvZConfig ? (1 / Math.max(0.1, window.PvZConfig.getPlantCooldownMult())) : 1.0;
const cooldownMultiplier = (1 + fastCoolLvl * 0.15) * cfgCooldownMult;
for (const card of this.cards) {
if (card.timer > 0) {
card.timer = Math.max(0, card.timer - dt * cooldownMultiplier);
@@ -375,7 +380,9 @@ window.EconomySystem = class EconomySystem {
// Sky sun spawner (disabled at night and in conveyor mode)
if (!this.isNight && !this.isConveyor) {
this.skySunTimer += dt;
if (this.skySunTimer >= this.skySunInterval) {
const sunDropMult = window.PvZConfig ? window.PvZConfig.getSunDropRate() : 1.0;
const effectiveInterval = this.skySunInterval / Math.max(0.2, sunDropMult);
if (this.skySunTimer >= effectiveInterval) {
this.skySunTimer = 0;
const spawnX = 140 + Math.random() * 640;
const targetY = 140 + Math.random() * 380;