User prompt
Añade la música y el sonido al juego
User prompt
Crea música apropiada para el menú principal, la partida, el game over y efectos de sonido
User prompt
Crea un menú principal
User prompt
Haz cartas negativas, si el jugador pasa el turno las cartas negativas de ese turno se activan, para desactivar las cartas negativas hay que comprarlas
User prompt
Elimina la carta "God mode" Ya que es demasiado buena
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'name')' in or related to this line: 'return {' Line Number: 636
User prompt
Haz que por cada turno el jugador obtenga más monedas por cada turno. Crea una nueva mecánica para poder hacer combos de cartas y haz cartas nuevas relacionadas a esta nueva mecánica
User prompt
Haz que cada 5 turnos en vez de perder los puntos el jugador los mantenga y además cada 5 turnos aparezcan mejores cartas (Haz más cartas con mejoras más complejas)
User prompt
Haz que haya más cartas con diferentes mecánicas (Ejemplos: multiplicar, reducir coste de futuras cartas, sumar puntos cuantas más cartas de un tipo específico hayan sido compradas, etc.)
User prompt
Haz las cartas el doble de grande repartidas en dos columnas verticales
User prompt
Haz las cartas más pequeñas y separadas entre ellas, y haz que la habilidad de las cartas se vea, porque el botón de comprar la carta tapa la habilidad
User prompt
En vez de que las cartas estén en una fila horizontal, repártelas por toda la pantalla y hazlas el tripe de grande
User prompt
Haz que las cartas y los textos sean más grandes para que se lean mejor
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'toGlobal')' in or related to this line: 'var localPos = game.toLocal(obj.parent.toGlobal(obj.position));' Line Number: 347
Code edit (1 edits merged)
Please save this source code
User prompt
Card Collector: Score Rush
Initial prompt
Este juego trata de conseguir los mayores puntos posibles, el juego se va a dividir en turnos, en cada turno el jugador va consiguiendo monedas, al comienzo del turno van a aparecer 5 cartas diferentes aleatorias, cada carta da al jugador puntos de formas diferentes y cada una cuesta monedas dependiendo de lo buena que sea, cada 5 turnos el juego reclama una cantidad cierta cantidad de puntos, si el jugador no tiene esa cantidad de puntos el jugador pierde.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Card = Container.expand(function (cardData) { var self = Container.call(this); self.cardData = cardData; self.purchased = false; // Card border var border = self.attachAsset('cardBorder', { anchorX: 0.5, anchorY: 0.5 }); // Card background var background = self.attachAsset('cardBackground', { anchorX: 0.5, anchorY: 0.5 }); // Card title self.titleText = new Text2(cardData.name, { size: 56, fill: 0xFFFFFF }); self.titleText.anchor.set(0.5, 0); self.titleText.x = 0; self.titleText.y = -160; self.addChild(self.titleText); // Card description self.descText = new Text2(cardData.description, { size: 40, fill: 0xECF0F1 }); self.descText.anchor.set(0.5, 0); self.descText.x = 0; self.descText.y = -100; self.addChild(self.descText); // Points text self.pointsText = new Text2("+" + cardData.points + " pts", { size: 48, fill: 0xE74C3C }); self.pointsText.anchor.set(0.5, 0); self.pointsText.x = 0; self.pointsText.y = -40; self.addChild(self.pointsText); // Cost and buy button self.buyButton = self.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 }); self.buyButton.y = 120; self.costText = new Text2("Buy: " + cardData.cost + " coins", { size: 36, fill: 0xFFFFFF }); self.costText.anchor.set(0.5, 0.5); self.costText.x = 0; self.costText.y = 120; self.addChild(self.costText); self.updateVisual = function () { if (self.purchased) { background.tint = 0x27ae60; self.buyButton.visible = false; self.costText.visible = false; } else { var actualCost = godModeActive ? 1 : Math.max(1, self.cardData.cost - nextCardCostReduction); if (godModeActive) { self.costText.setText("Buy: 1 coin (GOD MODE!)"); } else if (nextCardCostReduction > 0) { self.costText.setText("Buy: " + actualCost + " coins (was " + self.cardData.cost + ")"); } else { self.costText.setText("Buy: " + actualCost + " coins"); } if (coins < actualCost) { background.tint = 0x7f8c8d; self.buyButton.tint = 0x7f8c8d; } else { background.tint = 0x2c3e50; self.buyButton.tint = 0x27ae60; } } }; self.down = function (x, y, obj) { if (!self.purchased && coins >= self.cardData.cost) { self.purchase(); } }; self.purchase = function () { if (self.purchased || coins < self.cardData.cost) return; var actualCost = godModeActive ? 1 : Math.max(1, self.cardData.cost - nextCardCostReduction); coins -= actualCost; nextCardCostReduction = 0; self.purchased = true; // Track card types if (!purchasedCardTypes[self.cardData.type]) { purchasedCardTypes[self.cardData.type] = 0; } purchasedCardTypes[self.cardData.type]++; // Apply card abilities var pointsToAdd = self.cardData.points; if (self.cardData.ability) { pointsToAdd = applyCardAbility(self.cardData, pointsToAdd); } // Apply global multiplier pointsToAdd = Math.floor(pointsToAdd * globalPointMultiplier); points += pointsToAdd; self.updateVisual(); updateUI(); LK.getSound('cardBuy').play(); tween(self, { scaleX: 1.1, scaleY: 1.1 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeOut }); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x0f1419 }); /**** * Game Code ****/ // Game state variables var coins = 10; var points = 0; var turn = 1; var checkpoint = 1; var requiredPoints = 20; var currentCards = []; var gamePhase = 'playing'; // 'playing', 'checkpoint', 'gameOver' // Game mechanics tracking var purchasedCardTypes = {}; var nextCardCostReduction = 0; var permanentCoinBonus = 0; var globalPointMultiplier = 1; var skipNextCheckpoint = false; var godModeActive = false; // Card templates organized by checkpoint level var cardTemplatesByLevel = { 1: [{ // Basic cards for checkpoint 1 name: "Basic Card", description: "Simple points", points: 5, cost: 3, type: "basic" }, { name: "Coin Card", description: "Steady income", points: 3, cost: 2, type: "economy" }, { name: "Power Card", description: "High value", points: 12, cost: 8, type: "power" }, { name: "Lucky Card", description: "Bonus points", points: 8, cost: 5, type: "luck" }, { name: "Quick Card", description: "Fast points", points: 4, cost: 2, type: "quick" }], 2: [{ // Advanced cards for checkpoint 2+ name: "Mega Card", description: "Massive points", points: 20, cost: 15, type: "mega" }, { name: "Super Card", description: "Great value", points: 15, cost: 10, type: "super" }, { name: "Bonus Card", description: "Extra boost", points: 6, cost: 4, type: "bonus" }, { name: "Multiplier Card", description: "x2 next card points", points: 2, cost: 4, type: "multiplier", ability: "nextCardMultiplier" }, { name: "Discount Card", description: "Next card costs 50% less", points: 1, cost: 3, type: "discount", ability: "costReduction" }], 3: [{ // Expert cards for checkpoint 3+ name: "Economy Synergy", description: "+3 pts per Economy card", points: 1, cost: 5, type: "synergy", ability: "economySynergy" }, { name: "Power Synergy", description: "+5 pts per Power card", points: 2, cost: 7, type: "synergy", ability: "powerSynergy" }, { name: "Collection Bonus", description: "+2 pts per unique type", points: 3, cost: 6, type: "collection", ability: "typeBonus" }, { name: "Lucky Streak", description: "+1 pt per Lucky card", points: 2, cost: 3, type: "streak", ability: "luckySynergy" }, { name: "Coin Generator", description: "+2 coins next turn", points: 1, cost: 2, type: "generator", ability: "coinBonus" }], 4: [{ // Master cards for checkpoint 4+ name: "Point Doubler", description: "Double current points", points: 0, cost: 12, type: "doubler", ability: "doublePoints" }, { name: "Chain Multiplier", description: "Each purchased card +10% pts", points: 5, cost: 8, type: "chain", ability: "chainMultiplier" }, { name: "Compound Engine", description: "Points grow exponentially", points: 3, cost: 10, type: "compound", ability: "compoundGrowth" }, { name: "Universal Synergy", description: "+1 pt per ANY card owned", points: 2, cost: 6, type: "universal", ability: "universalSynergy" }, { name: "Mega Coin Bank", description: "+5 coins per turn forever", points: 5, cost: 15, type: "bank", ability: "megaCoinBonus" }], 5: [{ // Legendary cards for checkpoint 5+ name: "Infinity Engine", description: "Triple all future points", points: 10, cost: 20, type: "infinity", ability: "tripleMultiplier" }, { name: "Checkpoint Keeper", description: "+50% req points for easier pass", points: 15, cost: 25, type: "keeper", ability: "easierCheckpoint" }, { name: "Card Recycler", description: "Get 50% coin refund on all cards", points: 8, cost: 18, type: "recycler", ability: "coinRefund" }, { name: "Time Manipulator", description: "Skip next checkpoint req", points: 20, cost: 30, type: "time", ability: "skipCheckpoint" }, { name: "God Mode", description: "All cards cost 1 coin", points: 25, cost: 50, type: "god", ability: "godMode" }] }; // Legacy compatibility - combine all templates var cardTemplates = []; for (var level in cardTemplatesByLevel) { cardTemplates = cardTemplates.concat(cardTemplatesByLevel[level]); } // UI Elements var board = game.attachAsset('gameBoard', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 }); // Coins display var coinsText = new Text2("Coins: " + coins, { size: 48, fill: 0xF1C40F }); coinsText.anchor.set(0, 0); coinsText.x = 100; coinsText.y = 150; LK.gui.topLeft.addChild(coinsText); // Points display var pointsText = new Text2("Points: " + points, { size: 48, fill: 0xE74C3C }); pointsText.anchor.set(0, 0); pointsText.x = 100; pointsText.y = 220; LK.gui.topLeft.addChild(pointsText); // Turn display var turnText = new Text2("Turn: " + turn, { size: 36, fill: 0x3498DB }); turnText.anchor.set(0, 0); turnText.x = 100; turnText.y = 290; LK.gui.topLeft.addChild(turnText); // Required points display var requiredText = new Text2("Need: " + requiredPoints + " pts", { size: 36, fill: 0xE67E22 }); requiredText.anchor.set(0, 0); requiredText.x = 100; requiredText.y = 340; LK.gui.topLeft.addChild(requiredText); // Progress bar var progressBarBg = game.attachAsset('progressBar', { anchorX: 0.5, anchorY: 0, x: 1024, y: 200 }); var progressBarFill = game.attachAsset('progressFill', { anchorX: 0, anchorY: 0, x: 224, y: 200 }); // Next turn button var nextTurnButton = game.attachAsset('nextTurnButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2500 }); var nextTurnText = new Text2("Next Turn", { size: 44, fill: 0xFFFFFF }); nextTurnText.anchor.set(0.5, 0.5); nextTurnText.x = 1024; nextTurnText.y = 2500; game.addChild(nextTurnText); function applyCardAbility(cardData, basePoints) { var bonusPoints = 0; switch (cardData.ability) { case "nextCardMultiplier": // This will be handled when the next card is purchased return basePoints; case "costReduction": nextCardCostReduction = Math.floor(cardData.cost * 0.5); return basePoints; case "economySynergy": bonusPoints = (purchasedCardTypes["economy"] || 0) * 3; return basePoints + bonusPoints; case "powerSynergy": bonusPoints = (purchasedCardTypes["power"] || 0) * 5; return basePoints + bonusPoints; case "luckySynergy": bonusPoints = (purchasedCardTypes["luck"] || 0) * 1; return basePoints + bonusPoints; case "typeBonus": var uniqueTypes = Object.keys(purchasedCardTypes).length; bonusPoints = uniqueTypes * 2; return basePoints + bonusPoints; case "coinBonus": coins += 2; return basePoints; case "doublePoints": points = points * 2; return 0; case "chainMultiplier": var totalCards = 0; for (var type in purchasedCardTypes) { totalCards += purchasedCardTypes[type]; } bonusPoints = Math.floor(totalCards * 0.1 * basePoints); return basePoints + bonusPoints; case "compoundGrowth": bonusPoints = Math.floor(points * 0.1); return basePoints + bonusPoints; case "universalSynergy": var totalCards = 0; for (var type in purchasedCardTypes) { totalCards += purchasedCardTypes[type]; } bonusPoints = totalCards; return basePoints + bonusPoints; case "megaCoinBonus": // Add permanent income bonus if (!permanentCoinBonus) permanentCoinBonus = 0; permanentCoinBonus += 5; return basePoints; case "tripleMultiplier": if (!globalPointMultiplier) globalPointMultiplier = 1; globalPointMultiplier *= 3; return basePoints; case "easierCheckpoint": requiredPoints = Math.floor(requiredPoints * 0.5); return basePoints; case "coinRefund": coins += Math.floor(cardData.cost * 0.5); return basePoints; case "skipCheckpoint": // Skip next checkpoint requirement skipNextCheckpoint = true; return basePoints; case "godMode": godModeActive = true; return basePoints; // Don't add base points since we doubled existing default: return basePoints; } } function generateRandomCard() { // Get available card templates based on current checkpoint var availableTemplates = []; for (var level = 1; level <= Math.min(checkpoint, 5); level++) { if (cardTemplatesByLevel[level]) { availableTemplates = availableTemplates.concat(cardTemplatesByLevel[level]); } } // Higher checkpoints have better chance of getting advanced cards var template; if (checkpoint >= 3 && Math.random() < 0.6) { // 60% chance for advanced cards in checkpoint 3+ var advancedTemplates = []; for (var level = Math.max(2, checkpoint - 1); level <= Math.min(checkpoint, 5); level++) { if (cardTemplatesByLevel[level]) { advancedTemplates = advancedTemplates.concat(cardTemplatesByLevel[level]); } } template = advancedTemplates[Math.floor(Math.random() * advancedTemplates.length)]; } else { template = availableTemplates[Math.floor(Math.random() * availableTemplates.length)]; } var scaleFactor = 1 + (checkpoint - 1) * 0.2; return { name: template.name, description: template.description, points: Math.floor(template.points * scaleFactor), cost: Math.floor(template.cost * scaleFactor), type: template.type, ability: template.ability }; } function generateCards() { // Clear existing cards for (var i = 0; i < currentCards.length; i++) { currentCards[i].destroy(); } currentCards = []; // Generate 5 new cards in two vertical columns with doubled size var cardPositions = [{ x: 700, y: 600 }, { x: 1348, y: 600 }, { x: 700, y: 1200 }, { x: 1348, y: 1200 }, { x: 700, y: 1800 }]; for (var i = 0; i < 5; i++) { var cardData = generateRandomCard(); var card = new Card(cardData); card.x = cardPositions[i].x; card.y = cardPositions[i].y; currentCards.push(card); game.addChild(card); } updateCardsVisual(); } function updateCardsVisual() { for (var i = 0; i < currentCards.length; i++) { currentCards[i].updateVisual(); } } function updateUI() { coinsText.setText("Coins: " + coins); pointsText.setText("Points: " + points); turnText.setText("Turn: " + turn); requiredText.setText("Need: " + requiredPoints + " pts"); // Update progress bar var progress = Math.min(points / requiredPoints, 1); progressBarFill.width = 1600 * progress; if (points >= requiredPoints) { progressBarFill.tint = 0x2ecc71; } else { progressBarFill.tint = 0xe74c3c; } updateCardsVisual(); } function nextTurn() { if (gamePhase !== 'playing') return; turn++; coins += 3 + Math.floor(checkpoint / 2) + permanentCoinBonus; // Check for checkpoint every 5 turns if (turn % 5 === 1 && turn > 1) { checkCheckpoint(); } else { generateCards(); updateUI(); } } function checkCheckpoint() { if (points >= requiredPoints) { // Pass checkpoint checkpoint++; requiredPoints = Math.floor(requiredPoints * 1.8); // Points are now maintained between checkpoints LK.getSound('checkpoint').play(); // Flash screen green LK.effects.flashScreen(0x2ecc71, 1000); generateCards(); updateUI(); LK.setScore(checkpoint - 1); } else { // Fail checkpoint - game over gamePhase = 'gameOver'; LK.getSound('gameOver').play(); LK.effects.flashScreen(0xe74c3c, 1500); LK.setTimeout(function () { LK.showGameOver(); }, 1500); } } // Event handlers nextTurnButton.down = function (x, y, obj) { nextTurn(); }; game.down = function (x, y, obj) { // Use direct x, y coordinates instead of trying to convert positions // Check if clicked on next turn button if (x >= nextTurnButton.x - 200 && x <= nextTurnButton.x + 200 && y >= nextTurnButton.y - 40 && y <= nextTurnButton.y + 40) { nextTurn(); } }; // Initialize the game generateCards(); updateUI();
===================================================================
--- original.js
+++ change.js
@@ -66,10 +66,12 @@
background.tint = 0x27ae60;
self.buyButton.visible = false;
self.costText.visible = false;
} else {
- var actualCost = Math.max(1, self.cardData.cost - nextCardCostReduction);
- if (nextCardCostReduction > 0) {
+ var actualCost = godModeActive ? 1 : Math.max(1, self.cardData.cost - nextCardCostReduction);
+ if (godModeActive) {
+ self.costText.setText("Buy: 1 coin (GOD MODE!)");
+ } else if (nextCardCostReduction > 0) {
self.costText.setText("Buy: " + actualCost + " coins (was " + self.cardData.cost + ")");
} else {
self.costText.setText("Buy: " + actualCost + " coins");
}
@@ -88,9 +90,9 @@
}
};
self.purchase = function () {
if (self.purchased || coins < self.cardData.cost) return;
- var actualCost = Math.max(1, self.cardData.cost - nextCardCostReduction);
+ var actualCost = godModeActive ? 1 : Math.max(1, self.cardData.cost - nextCardCostReduction);
coins -= actualCost;
nextCardCostReduction = 0;
self.purchased = true;
// Track card types
@@ -102,8 +104,10 @@
var pointsToAdd = self.cardData.points;
if (self.cardData.ability) {
pointsToAdd = applyCardAbility(self.cardData, pointsToAdd);
}
+ // Apply global multiplier
+ pointsToAdd = Math.floor(pointsToAdd * globalPointMultiplier);
points += pointsToAdd;
self.updateVisual();
updateUI();
LK.getSound('cardBuy').play();
@@ -147,114 +151,197 @@
var gamePhase = 'playing'; // 'playing', 'checkpoint', 'gameOver'
// Game mechanics tracking
var purchasedCardTypes = {};
var nextCardCostReduction = 0;
-// Card templates
-var cardTemplates = [{
- name: "Basic Card",
- description: "Simple points",
- points: 5,
- cost: 3,
- type: "basic"
-}, {
- name: "Coin Card",
- description: "Steady income",
- points: 3,
- cost: 2,
- type: "economy"
-}, {
- name: "Power Card",
- description: "High value",
- points: 12,
- cost: 8,
- type: "power"
-}, {
- name: "Lucky Card",
- description: "Bonus points",
- points: 8,
- cost: 5,
- type: "luck"
-}, {
- name: "Mega Card",
- description: "Massive points",
- points: 20,
- cost: 15,
- type: "mega"
-}, {
- name: "Quick Card",
- description: "Fast points",
- points: 4,
- cost: 2,
- type: "quick"
-}, {
- name: "Super Card",
- description: "Great value",
- points: 15,
- cost: 10,
- type: "super"
-}, {
- name: "Bonus Card",
- description: "Extra boost",
- points: 6,
- cost: 4,
- type: "bonus"
-}, {
- name: "Multiplier Card",
- description: "x2 next card points",
- points: 2,
- cost: 4,
- type: "multiplier",
- ability: "nextCardMultiplier"
-}, {
- name: "Discount Card",
- description: "Next card costs 50% less",
- points: 1,
- cost: 3,
- type: "discount",
- ability: "costReduction"
-}, {
- name: "Economy Synergy",
- description: "+3 pts per Economy card",
- points: 1,
- cost: 5,
- type: "synergy",
- ability: "economySynergy"
-}, {
- name: "Power Synergy",
- description: "+5 pts per Power card",
- points: 2,
- cost: 7,
- type: "synergy",
- ability: "powerSynergy"
-}, {
- name: "Collection Bonus",
- description: "+2 pts per unique type",
- points: 3,
- cost: 6,
- type: "collection",
- ability: "typeBonus"
-}, {
- name: "Lucky Streak",
- description: "+1 pt per Lucky card",
- points: 2,
- cost: 3,
- type: "streak",
- ability: "luckySynergy"
-}, {
- name: "Coin Generator",
- description: "+2 coins next turn",
- points: 1,
- cost: 2,
- type: "generator",
- ability: "coinBonus"
-}, {
- name: "Point Doubler",
- description: "Double current points",
- points: 0,
- cost: 12,
- type: "doubler",
- ability: "doublePoints"
-}];
+var permanentCoinBonus = 0;
+var globalPointMultiplier = 1;
+var skipNextCheckpoint = false;
+var godModeActive = false;
+// Card templates organized by checkpoint level
+var cardTemplatesByLevel = {
+ 1: [{
+ // Basic cards for checkpoint 1
+ name: "Basic Card",
+ description: "Simple points",
+ points: 5,
+ cost: 3,
+ type: "basic"
+ }, {
+ name: "Coin Card",
+ description: "Steady income",
+ points: 3,
+ cost: 2,
+ type: "economy"
+ }, {
+ name: "Power Card",
+ description: "High value",
+ points: 12,
+ cost: 8,
+ type: "power"
+ }, {
+ name: "Lucky Card",
+ description: "Bonus points",
+ points: 8,
+ cost: 5,
+ type: "luck"
+ }, {
+ name: "Quick Card",
+ description: "Fast points",
+ points: 4,
+ cost: 2,
+ type: "quick"
+ }],
+ 2: [{
+ // Advanced cards for checkpoint 2+
+ name: "Mega Card",
+ description: "Massive points",
+ points: 20,
+ cost: 15,
+ type: "mega"
+ }, {
+ name: "Super Card",
+ description: "Great value",
+ points: 15,
+ cost: 10,
+ type: "super"
+ }, {
+ name: "Bonus Card",
+ description: "Extra boost",
+ points: 6,
+ cost: 4,
+ type: "bonus"
+ }, {
+ name: "Multiplier Card",
+ description: "x2 next card points",
+ points: 2,
+ cost: 4,
+ type: "multiplier",
+ ability: "nextCardMultiplier"
+ }, {
+ name: "Discount Card",
+ description: "Next card costs 50% less",
+ points: 1,
+ cost: 3,
+ type: "discount",
+ ability: "costReduction"
+ }],
+ 3: [{
+ // Expert cards for checkpoint 3+
+ name: "Economy Synergy",
+ description: "+3 pts per Economy card",
+ points: 1,
+ cost: 5,
+ type: "synergy",
+ ability: "economySynergy"
+ }, {
+ name: "Power Synergy",
+ description: "+5 pts per Power card",
+ points: 2,
+ cost: 7,
+ type: "synergy",
+ ability: "powerSynergy"
+ }, {
+ name: "Collection Bonus",
+ description: "+2 pts per unique type",
+ points: 3,
+ cost: 6,
+ type: "collection",
+ ability: "typeBonus"
+ }, {
+ name: "Lucky Streak",
+ description: "+1 pt per Lucky card",
+ points: 2,
+ cost: 3,
+ type: "streak",
+ ability: "luckySynergy"
+ }, {
+ name: "Coin Generator",
+ description: "+2 coins next turn",
+ points: 1,
+ cost: 2,
+ type: "generator",
+ ability: "coinBonus"
+ }],
+ 4: [{
+ // Master cards for checkpoint 4+
+ name: "Point Doubler",
+ description: "Double current points",
+ points: 0,
+ cost: 12,
+ type: "doubler",
+ ability: "doublePoints"
+ }, {
+ name: "Chain Multiplier",
+ description: "Each purchased card +10% pts",
+ points: 5,
+ cost: 8,
+ type: "chain",
+ ability: "chainMultiplier"
+ }, {
+ name: "Compound Engine",
+ description: "Points grow exponentially",
+ points: 3,
+ cost: 10,
+ type: "compound",
+ ability: "compoundGrowth"
+ }, {
+ name: "Universal Synergy",
+ description: "+1 pt per ANY card owned",
+ points: 2,
+ cost: 6,
+ type: "universal",
+ ability: "universalSynergy"
+ }, {
+ name: "Mega Coin Bank",
+ description: "+5 coins per turn forever",
+ points: 5,
+ cost: 15,
+ type: "bank",
+ ability: "megaCoinBonus"
+ }],
+ 5: [{
+ // Legendary cards for checkpoint 5+
+ name: "Infinity Engine",
+ description: "Triple all future points",
+ points: 10,
+ cost: 20,
+ type: "infinity",
+ ability: "tripleMultiplier"
+ }, {
+ name: "Checkpoint Keeper",
+ description: "+50% req points for easier pass",
+ points: 15,
+ cost: 25,
+ type: "keeper",
+ ability: "easierCheckpoint"
+ }, {
+ name: "Card Recycler",
+ description: "Get 50% coin refund on all cards",
+ points: 8,
+ cost: 18,
+ type: "recycler",
+ ability: "coinRefund"
+ }, {
+ name: "Time Manipulator",
+ description: "Skip next checkpoint req",
+ points: 20,
+ cost: 30,
+ type: "time",
+ ability: "skipCheckpoint"
+ }, {
+ name: "God Mode",
+ description: "All cards cost 1 coin",
+ points: 25,
+ cost: 50,
+ type: "god",
+ ability: "godMode"
+ }]
+};
+// Legacy compatibility - combine all templates
+var cardTemplates = [];
+for (var level in cardTemplatesByLevel) {
+ cardTemplates = cardTemplates.concat(cardTemplatesByLevel[level]);
+}
// UI Elements
var board = game.attachAsset('gameBoard', {
anchorX: 0.5,
anchorY: 0.5,
@@ -352,15 +439,74 @@
return basePoints;
case "doublePoints":
points = points * 2;
return 0;
+ case "chainMultiplier":
+ var totalCards = 0;
+ for (var type in purchasedCardTypes) {
+ totalCards += purchasedCardTypes[type];
+ }
+ bonusPoints = Math.floor(totalCards * 0.1 * basePoints);
+ return basePoints + bonusPoints;
+ case "compoundGrowth":
+ bonusPoints = Math.floor(points * 0.1);
+ return basePoints + bonusPoints;
+ case "universalSynergy":
+ var totalCards = 0;
+ for (var type in purchasedCardTypes) {
+ totalCards += purchasedCardTypes[type];
+ }
+ bonusPoints = totalCards;
+ return basePoints + bonusPoints;
+ case "megaCoinBonus":
+ // Add permanent income bonus
+ if (!permanentCoinBonus) permanentCoinBonus = 0;
+ permanentCoinBonus += 5;
+ return basePoints;
+ case "tripleMultiplier":
+ if (!globalPointMultiplier) globalPointMultiplier = 1;
+ globalPointMultiplier *= 3;
+ return basePoints;
+ case "easierCheckpoint":
+ requiredPoints = Math.floor(requiredPoints * 0.5);
+ return basePoints;
+ case "coinRefund":
+ coins += Math.floor(cardData.cost * 0.5);
+ return basePoints;
+ case "skipCheckpoint":
+ // Skip next checkpoint requirement
+ skipNextCheckpoint = true;
+ return basePoints;
+ case "godMode":
+ godModeActive = true;
+ return basePoints;
// Don't add base points since we doubled existing
default:
return basePoints;
}
}
function generateRandomCard() {
- var template = cardTemplates[Math.floor(Math.random() * cardTemplates.length)];
+ // Get available card templates based on current checkpoint
+ var availableTemplates = [];
+ for (var level = 1; level <= Math.min(checkpoint, 5); level++) {
+ if (cardTemplatesByLevel[level]) {
+ availableTemplates = availableTemplates.concat(cardTemplatesByLevel[level]);
+ }
+ }
+ // Higher checkpoints have better chance of getting advanced cards
+ var template;
+ if (checkpoint >= 3 && Math.random() < 0.6) {
+ // 60% chance for advanced cards in checkpoint 3+
+ var advancedTemplates = [];
+ for (var level = Math.max(2, checkpoint - 1); level <= Math.min(checkpoint, 5); level++) {
+ if (cardTemplatesByLevel[level]) {
+ advancedTemplates = advancedTemplates.concat(cardTemplatesByLevel[level]);
+ }
+ }
+ template = advancedTemplates[Math.floor(Math.random() * advancedTemplates.length)];
+ } else {
+ template = availableTemplates[Math.floor(Math.random() * availableTemplates.length)];
+ }
var scaleFactor = 1 + (checkpoint - 1) * 0.2;
return {
name: template.name,
description: template.description,
@@ -425,9 +571,9 @@
}
function nextTurn() {
if (gamePhase !== 'playing') return;
turn++;
- coins += 3 + Math.floor(checkpoint / 2);
+ coins += 3 + Math.floor(checkpoint / 2) + permanentCoinBonus;
// Check for checkpoint every 5 turns
if (turn % 5 === 1 && turn > 1) {
checkCheckpoint();
} else {
@@ -439,9 +585,9 @@
if (points >= requiredPoints) {
// Pass checkpoint
checkpoint++;
requiredPoints = Math.floor(requiredPoints * 1.8);
- points = 0; // Reset points for next checkpoint
+ // Points are now maintained between checkpoints
LK.getSound('checkpoint').play();
// Flash screen green
LK.effects.flashScreen(0x2ecc71, 1000);
generateCards();