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

+54 -10
View File
@@ -58,15 +58,47 @@ window.Zombie = class Zombie {
this.baseSpeed = 24;
break;
case 'flag':
this.maxHealth = 110;
this.maxHealth = 140;
this.baseSpeed = 26;
break;
case 'normal':
default:
this.maxHealth = 100;
this.helmetHealth = 0;
break;
}
// Apply Zombie Lab Mutations (if in I, Zombie mode or if mutation level passed)
this.mutationLevel = 1;
if (window._pvzEngine && window._pvzEngine.zombieLab && window._pvzEngine.currentMode === 'izombie') {
this.mutationLevel = window._pvzEngine.zombieLab.getZombieLevel(type) || 1;
}
if (this.mutationLevel >= 2) {
if (type === 'normal') this.baseSpeed *= 1.35;
if (type === 'conehead') this.helmetHealth += 150;
if (type === 'polevaulter') this.maxVaults = 2;
if (type === 'buckethead') this.helmetHealth += 250;
if (type === 'football') this.helmetHealth += 250;
}
if (this.mutationLevel >= 3) {
if (type === 'normal') this.isVampire = true;
if (type === 'conehead') { this.helmetHealth += 150; this.reflectDmg = 0.25; }
if (type === 'polevaulter') { this.maxVaults = 2; this.turboSprint = true; }
if (type === 'buckethead') { this.helmetHealth += 300; this.iceImmune = true; }
if (type === 'football') { this.helmetHealth += 300; this.mineImmune = true; }
}
if (window.PvZConfig) {
const hpMult = window.PvZConfig.getZombieHpMult();
const speedMult = window.PvZConfig.getZombieSpeedMult();
const dmgMult = window.PvZConfig.getZombieDamageMult();
this.maxHealth = Math.round(this.maxHealth * hpMult);
if (this.helmetHealth) this.helmetHealth = Math.round(this.helmetHealth * hpMult);
this.baseSpeed = this.baseSpeed * speedMult;
this.eatingDps = this.eatingDps * dmgMult;
}
this.speed = this.baseSpeed;
this.health = this.maxHealth;
}
@@ -128,8 +160,13 @@ window.Zombie = class Zombie {
this.x -= 150 * dt;
if (this.vaultTimer >= 0.6) {
this.isVaulting = false;
this.baseSpeed = 22; // Normal speed after jumping
this.speed = 22;
if (this.maxVaults && this.maxVaults > 1) {
this.maxVaults--;
this.hasPole = true; // Can vault second time!
}
const postSpeed = this.turboSprint ? 35 : 22;
this.baseSpeed = postSpeed;
this.speed = postSpeed;
}
return;
}
@@ -156,6 +193,9 @@ window.Zombie = class Zombie {
if (this.eatTimer >= 0.35) {
this.eatTimer = 0;
this.targetPlant.takeDamage(this.eatingDps * 0.35);
if (this.isVampire) {
this.health = Math.min(this.maxHealth, this.health + 45);
}
if (window.PvZAudio) window.PvZAudio.playChomp();
if (this.targetPlant && this.targetPlant.type === 'wallnut' && gameState && gameState.achievements) {
gameState.achievements.trigger('nut_wall');
@@ -176,11 +216,14 @@ window.Zombie = class Zombie {
}
}
takeDamage(amount, slows = false) {
takeDamage(amount, slows = false, source = null) {
this.hitFlashTimer = 0.08;
if (slows) {
if (slows && !this.iceImmune) {
this.slowTimer = 4.0;
}
if (this.reflectDmg && source && source.takeDamage) {
source.takeDamage(amount * this.reflectDmg);
}
// Newspaper mechanics
if (this.type === 'newspaper' && this.hasPaper) {
@@ -511,8 +554,6 @@ window.Zombie = class Zombie {
ctx.fill();
}
ctx.restore();
// Frost Crystals visual effect around slowed / frozen zombie
if (isSlow && !isHit) {
this.drawFrostCrystals(ctx);
@@ -530,13 +571,16 @@ window.Zombie = class Zombie {
ctx.restore();
}
// Health bar if damaged
// Health bar if damaged (drawn directly above zombie head)
if (this.health < this.maxHealth) {
const pct = Math.max(0, this.health / this.maxHealth);
ctx.fillStyle = 'rgba(0,0,0,0.6)';
ctx.fillStyle = 'rgba(0, 0, 0, 0.65)';
ctx.fillRect(-20, -56, 40, 5);
ctx.fillStyle = pct > 0.4 ? '#8bc34a' : '#f44336';
ctx.fillRect(-20, -56, 40 * pct, 5);
ctx.strokeStyle = '#222';
ctx.lineWidth = 0.8;
ctx.strokeRect(-20, -56, 40, 5);
}
ctx.restore();