// ========================================================== // TLW-Modell: Lokalisierung (DE, EN-US, FR) & Sprachauswahl // Website: jan-buehring.de | Hard Sci-Fi Simulation // ========================================================== import java.util.HashMap; float shipX, shipY, velocityX = 0, velocityY = 0; float tlwEnergy = 70.0, maxEnergy = 400.0; // Lokalisierung (i18n) int lang = 0; // 0 = DE, 1 = EN, 2 = FR HashMap dict = new HashMap(); // KI & Automatisierung int manualTokensCollected = 0; boolean aiUnlocked = false, aiActive = false; TLWToken ship1Target = null, ship2Target = null; // Basis-Upgrades boolean coreBought = false; boolean shieldBought = false, shieldOn = false; boolean defenseBought = false, defenseOn = false; boolean isruBought = false; boolean autoShieldBought = false, autoDefenseBought = false; boolean autoIsruBought = false, autoIsruActive = false; // Gaia-System & Ressourcen float greenLevel = 0.0, waterLevel = 0.0; boolean balanceReached = false; // Kolonisten, Fraktal-Schiff & Soziologie boolean colonistsArrived = false; float colonistCount = 0.0, satisfaction = 80.0, shipPoints = 0.0; boolean inRebellion = false, hasSecondShip = false; float ship2X = 0, ship2Y = 0, ship2Vx = 0, ship2Vy = 0; // Versorgung & Handel float supplyTimer = 0.0, drugSupply = 0.0; int tradePolicy = 0; // 0 = Legal, 1 = Schwarzmarkt // Event-Risiken & Alarme float solarRisk = 0.0, meteorRisk = 0.0; boolean isSolarFlare = false, isMeteor = false; boolean solarWarning = false, meteorWarning = false; int warningTimer = 0, flareTimer = 0; float meteorX, meteorY, meteorSize = 60, meteorHP = 100; // Story-Steuerung String activePopupTitle = "", activePopupText = ""; boolean showPopup = false, pauseForWarning = false; ArrayList tokens; ArrayList particles; ArrayList fieldNodes; ArrayList projectiles; void setup() { size(900, 680); initLocalization(); shipX = width / 2; shipY = (height - 150) / 2; tokens = new ArrayList(); particles = new ArrayList(); fieldNodes = new ArrayList(); projectiles = new ArrayList(); for (int i = 0; i < 7; i++) tokens.add(new TLWToken(random(50, width-50), random(50, height-180))); for (int x = 40; x < width; x += 70) { for (int y = 40; y < height - 160; y += 70) fieldNodes.add(new TLWFieldNode(x, y)); } triggerStory(t("WELCOME_TITLE"), t("WELCOME_TEXT")); } void initLocalization() { // HUD & UI dict.put("ENERGY", new String[]{"ENERGIE: ", "ENERGY: ", "ÉNERGIE: "}); dict.put("AI_ON", new String[]{"KI: AN", "AI: ON", "IA: ON"}); dict.put("AI_OFF", new String[]{"KI: AUS", "AI: OFF", "IA: OFF"}); dict.put("AI_SABOTAGE", new String[]{"KI SABOTIERT", "AI SABOTAGED", "IA SABOTÉE"}); dict.put("AI_LEARN", new String[]{"KI lernt", "AI learning", "IA apprend"}); dict.put("POP", new String[]{"POP:", "POP:", "POP:"}); dict.put("SAT", new String[]{"ZUF:", "SAT:", "SAT:"}); dict.put("SP", new String[]{"SP:", "SP:", "PS:"}); dict.put("FRAC_BUY", new String[]{"FRAKTAL KAUFEN (500 SP)", "BUY FRACTAL (500 SP)", "ACHETER FRACTALE (500 PS)"}); dict.put("FRAC_ON", new String[]{"FRAKTAL: AKTIV", "FRACTAL: ACTIVE", "FRACTALE: ACTIVE"}); dict.put("FRAC_NO_CREW", new String[]{"FRAKTAL: ZU WENIG CREW", "FRACTAL: LOW CREW", "FRACTALE: ÉQUIPAGE FAIBLE"}); dict.put("BASE", new String[]{"BASIS:", "BASE:", "BASE:"}); dict.put("CORE", new String[]{"Kern", "Core", "Noyau"}); dict.put("SHIELD_ON", new String[]{"Schild: AN", "Shield: ON", "Bouclier: ON"}); dict.put("SHIELD_OFF", new String[]{"Schild: AUS", "Shield: OFF", "Bouclier: OFF"}); dict.put("DEF_ON", new String[]{"Abwehr: AN", "Defense: ON", "Défense: ON"}); dict.put("DEF_OFF", new String[]{"Abwehr: AUS", "Defense: OFF", "Défense: OFF"}); dict.put("PROD", new String[]{"PROD:", "PROD:", "PROD:"}); dict.put("WATER", new String[]{"WASSER", "WATER", "EAU"}); dict.put("FLORA", new String[]{"FLORA", "FLORA", "FLORE"}); dict.put("SELL_FLORA", new String[]{"Notverkauf -10% Flora", "Sell -10% Flora", "Vente urgence -10% Flore"}); dict.put("TRADE", new String[]{"HANDEL:", "TRADE:", "COMMERCE:"}); dict.put("LEGAL", new String[]{"LEGAL (Konsolen/Medizin)", "LEGAL (Consoles/Meds)", "LÉGAL (Consoles/Médoc)"}); dict.put("BLACK_MARKET", new String[]{"SCHWARZMARKT (Drogen)", "BLACK MARKET (Drugs)", "MARCHÉ NOIR (Drogues)"}); dict.put("DRUGS", new String[]{"DROGEN: ", "DRUGS: ", "DROGUES: "}); dict.put("EXP_COL", new String[]{"EXPRESS KOLONIST (100 SP)", "EXPRESS COLONIST (100 SP)", "COLON EXPRESS (100 PS)"}); dict.put("EXP_CARGO", new String[]{"EXPRESS FRACHT (100 SP)", "EXPRESS CARGO (100 SP)", "CARGAISON EXPRESS (100 PS)"}); dict.put("RISK_SUN", new String[]{"☀️ SONNEN-RISIKO: ", "☀️ SOLAR RISK: ", "☀️ RISQUE SOLAIRE: "}); dict.put("RISK_MET", new String[]{"⚠️ METEOR-RISIKO: ", "⚠️ METEOR RISK: ", "⚠️ RISQUE MÉTÉORE: "}); dict.put("ALARM", new String[]{"⚠️ NOTFALL ALARM! SYSTEME AKTIVIEREN!", "⚠️ EMERGENCY ALARM! ACTIVATE SYSTEMS!", "⚠️ ALARME D'URGENCE ! ACTIVEZ LES SYSTÈMES !"}); // Popups dict.put("WELCOME_TITLE", new String[]{"TLW-ENDGAME", "TLW ENDGAME", "TLW FIN DE PARTIE"}); dict.put("WELCOME_TEXT", new String[]{"Nutze Schiffspunkte (SP) taktisch! Wähle oben rechts deine Sprache.", "Use Ship Points (SP) tactically! Select your language in the top right.", "Utilisez les Points de Vaisseau (PS) avec tactique ! Choisissez la langue en haut à droite."}); dict.put("AI_READY", new String[]{"KI BEREIT", "AI READY", "IA PRÊTE"}); dict.put("AI_READY_TXT", new String[]{"KI-Sammler online.", "AI gatherer online.", "Collecteur IA en ligne."}); dict.put("VICTORY", new String[]{"TOPOLOGISCHE BALANCE ERREICHT", "TOPOLOGICAL BALANCE ACHIEVED", "ÉQUILIBRE TOPOLOGIQUE ATTEINT"}); dict.put("VICTORY_TXT", new String[]{"Sieg! Der Planet trägt sich von selbst.", "Victory! The planet sustains itself.", "Victoire ! La planète s'autosuffit."}); } String t(String key) { if (dict.containsKey(key)) return dict.get(key)[lang]; return key; } void draw() { background(6, 8, 15); drawTLWSpaceBackground(); if (!pauseForWarning && !balanceReached) { updateAITargets(); updateShipMovement(); updateSecondShip(); manageTokens(); updateGaiaSystem(); updateEvents(); updateColonistsAndSupply(); } updateParticles(); if (!balanceReached) { drawShip(); drawSecondShip(); } else { shipX = lerp(shipX, width/2 - 30, 0.05); shipY = lerp(shipY, height/2 - 50, 0.05); ship2X = lerp(ship2X, width/2 + 30, 0.05); ship2Y = lerp(ship2Y, height/2 - 50, 0.05); drawShip(); if (hasSecondShip) drawSecondShip(); } drawAlarms(); drawHUD(); drawStoryPopup(); } void updateAITargets() { ship1Target = null; ship2Target = null; if (aiActive && tokens.size() > 0) { float minDist = 9999; for (TLWToken t : tokens) { float d = dist(shipX, shipY, t.x, t.y); if (d < minDist) { minDist = d; ship1Target = t; } } } if (hasSecondShip && colonistCount >= 50 && tokens.size() > 0) { float minDist = 9999; for (TLWToken t : tokens) { if (t == ship1Target && tokens.size() > 1) continue; float d = dist(ship2X, ship2Y, t.x, t.y); if (d < minDist) { minDist = d; ship2Target = t; } } } } void updateShipMovement() { float targetX = mouseX, targetY = mouseY; if (aiActive && ship1Target != null) { targetX = ship1Target.x; targetY = ship1Target.y; } boolean isMoving = (aiActive && dist(shipX, shipY, targetX, targetY) > 10) || (!aiActive && mousePressed && mouseY < height - 150); if (isMoving && tlwEnergy > 0.2) { velocityX += (targetX - shipX) * 0.006; velocityY += (targetY - shipY) * 0.006; tlwEnergy -= 0.05; if (frameCount % 2 == 0) particles.add(new Particle(shipX, shipY, -velocityX*0.6 + random(-0.5,0.5), -velocityY*0.6 + random(-0.5,0.5), color(0, 200, 255), 1)); } velocityX *= 0.94; velocityY *= 0.94; shipX = constrain(shipX + velocityX, 30, width - 30); shipY = constrain(shipY + velocityY, 30, height - 160); } void updateSecondShip() { if (hasSecondShip && colonistCount >= 50 && ship2Target != null) { ship2Vx += (ship2Target.x - ship2X) * 0.004; ship2Vy += (ship2Target.y - ship2Y) * 0.004; ship2Vx *= 0.92; ship2Vy *= 0.92; ship2X = constrain(ship2X + ship2Vx, 30, width - 30); ship2Y = constrain(ship2Y + ship2Vy, 30, height - 160); if (frameCount % 3 == 0) particles.add(new Particle(ship2X, ship2Y, -ship2Vx*0.5, -ship2Vy*0.5, color(0, 255, 150), 1)); } } void manageTokens() { for (int i = tokens.size() - 1; i >= 0; i--) { TLWToken t = tokens.get(i); t.display(); boolean collected = false; if (dist(shipX, shipY, t.x, t.y) < 25) collected = true; if (hasSecondShip && colonistCount >= 50 && dist(ship2X, ship2Y, t.x, t.y) < 25) collected = true; if (collected) { tlwEnergy = min(maxEnergy, tlwEnergy + 15.0); for(int k=0; k<5; k++) particles.add(new Particle(t.x, t.y, random(-3,3), random(-3,3), color(0, 255, 220), 2)); tokens.remove(i); tokens.add(new TLWToken(random(50, width-50), random(50, height-180))); if (!aiUnlocked) { manualTokensCollected++; if (manualTokensCollected >= 5) { aiUnlocked = true; triggerStory(t("AI_READY"), t("AI_READY_TXT")); } } } } } void updateGaiaSystem() { if (autoIsruBought && autoIsruActive) { if (waterLevel < 50 && tlwEnergy >= 15.0) { tlwEnergy -= 15.0; waterLevel += 12.0; } if (greenLevel < 50 && tlwEnergy >= 20.0) { tlwEnergy -= 20.0; greenLevel += 12.0; } } float energyDrain = 0.0; if (isruBought && greenLevel > 0) energyDrain += (greenLevel * 0.008); if (isruBought && waterLevel > 0) energyDrain += (waterLevel * 0.005); if (shieldOn) energyDrain += 0.15; if (defenseOn) energyDrain += 0.15; if (tlwEnergy >= energyDrain) tlwEnergy -= energyDrain; else { tlwEnergy = 0; shieldOn = false; defenseOn = false; if (greenLevel > 0) greenLevel -= 0.03; if (waterLevel > 0) waterLevel -= 0.03; } if (greenLevel >= 100 && waterLevel >= 100 && !balanceReached) { balanceReached = true; greenLevel = 100; waterLevel = 100; triggerStory(t("VICTORY"), t("VICTORY_TXT")); } } void updateColonistsAndSupply() { if (isruBought && !colonistsArrived) { supplyTimer += 0.04; if (supplyTimer >= 100) { colonistsArrived = true; colonistCount = 10; supplyTimer = 0; } } if (colonistsArrived) { supplyTimer += 0.05; if (supplyTimer >= 100) { supplyTimer = 0; colonistCount += 5; if (tradePolicy == 0) satisfaction = min(100, satisfaction + 15); else drugSupply += 100; } float demand = 0.015 + (colonistCount * 0.0005); boolean waterOk = false, greenOk = false; if (waterLevel >= demand) { waterLevel -= demand; waterOk = true; } else waterLevel = 0; if (greenLevel >= demand) { greenLevel -= demand; greenOk = true; } else greenLevel = 0; if (waterOk && greenOk) { if (tradePolicy == 1) { if (drugSupply > 0) { drugSupply -= (0.05 + colonistCount * 0.001); satisfaction = min(100, satisfaction + 0.08); } else satisfaction = max(0, satisfaction - 0.15); } else { satisfaction = min(100, satisfaction + 0.03); } if (satisfaction > 60) colonistCount += 0.03; } else { satisfaction = max(0, satisfaction - 0.1); if (satisfaction < 30 && colonistCount > 0) colonistCount -= 0.02; } if (!inRebellion) shipPoints += colonistCount * 0.01; if (satisfaction <= 15 && !inRebellion) { inRebellion = true; aiActive = false; } else if (satisfaction > 35 && inRebellion) { inRebellion = false; } if (inRebellion) { aiActive = false; if (frameCount % 10 == 0 && tlwEnergy > 0) tlwEnergy -= 1.0; } } } void updateEvents() { if (coreBought && !isSolarFlare && !solarWarning) solarRisk += 0.03; if (coreBought && !isMeteor && !meteorWarning) meteorRisk += 0.02; if (solarRisk > 100 && !solarWarning && !isSolarFlare) { solarWarning = true; warningTimer = 180; if (autoShieldBought && !shieldOn) shieldOn = true; } if (solarWarning) { warningTimer--; if (warningTimer <= 0) { solarWarning = false; isSolarFlare = true; flareTimer = 300; solarRisk = 0; } } if (meteorRisk > 100 && !meteorWarning && !isMeteor) { meteorWarning = true; warningTimer = 180; if (autoDefenseBought && !defenseOn) defenseOn = true; } if (meteorWarning) { warningTimer--; if (warningTimer <= 0) { meteorWarning = false; isMeteor = true; meteorRisk = 0; meteorX = random(100, width-100); meteorY = -50; meteorHP = 100; } } if (isSolarFlare) { flareTimer--; if (!shieldOn && frameCount % 5 == 0) { if (tlwEnergy > 0) tlwEnergy -= 2.0; else { if (greenLevel > 0) greenLevel -= 0.5; if (waterLevel > 0) waterLevel -= 0.5; } } if (flareTimer <= 0) isSolarFlare = false; } if (isMeteor) { meteorY += 0.8; meteorX += sin(frameCount*0.05)*0.5; if (defenseOn && frameCount % 12 == 0 && tlwEnergy >= 1.5) { tlwEnergy -= 1.5; projectiles.add(new Projectile(shipX, shipY, meteorX, meteorY)); } for (int i = projectiles.size() - 1; i >= 0; i--) { Projectile p = projectiles.get(i); p.update(); p.display(); if (dist(p.x, p.y, meteorX, meteorY) < meteorSize/2) { meteorHP -= 25; projectiles.remove(i); for(int k=0; k<5; k++) particles.add(new Particle(p.x, p.y, random(-2,2), random(-2,2), color(0,255,220), 2)); } else if (p.isOffScreen()) projectiles.remove(i); } fill(180, 60, 40); stroke(255, 120, 50); strokeWeight(2); ellipse(meteorX, meteorY, meteorSize, meteorSize); fill(40); noStroke(); rect(meteorX - 40, meteorY - 45, 80, 6, 2); fill(255, 50, 50); rect(meteorX - 40, meteorY - 45, map(meteorHP, 0, 100, 0, 80), 6, 2); if (meteorHP <= 0) isMeteor = false; if (meteorY > height - 130) { isMeteor = false; greenLevel = max(0, greenLevel - 20); waterLevel = max(0, waterLevel - 20); for(int k=0; k<20; k++) particles.add(new Particle(meteorX, meteorY, random(-5,5), random(-5,5), color(255,100,50), 2)); } } } void drawTLWSpaceBackground() { for (TLWFieldNode node : fieldNodes) node.updateAndDisplay(shipX, shipY, hasSecondShip ? ship2X : shipX, hasSecondShip ? ship2Y : shipY); if (isSolarFlare || (solarWarning && frameCount%10 < 5)) { fill(255, 120, 0, 40); rect(0, 0, width, height - 150); } fill(120, 45, 25); noStroke(); rect(0, height - 150, width, 150); fill(190, 75, 40); rect(0, height - 158, width, 8); if (waterLevel > 0) { fill(50, 150, 255, map(waterLevel, 0, 100, 0, 120)); rect(0, height - 150, width, 150); } if (greenLevel > 0) { float alphaGreen = map(greenLevel, 0, 100, 0, 255); fill(30, 150, 50, alphaGreen); rect(0, height - 150, width, 150); fill(50, 200, 70, alphaGreen); rect(0, height - 158, width, 8); } if (shieldOn) { noFill(); stroke(0, 200, 255, 100); strokeWeight(3); arc(width/2, height - 150, width, 250, PI, TWO_PI); } } void drawAlarms() { if ((solarWarning || meteorWarning) && frameCount % 20 < 10) { pushStyle(); fill(255, 50, 50); textSize(24); textAlign(CENTER); text(t("ALARM"), width/2, height/2 - 100); popStyle(); } } void updateParticles() { for (int i = particles.size() - 1; i >= 0; i--) { Particle p = particles.get(i); p.update(); p.display(); if (p.isDead()) particles.remove(i); } } void drawShip() { pushStyle(); pushMatrix(); translate(shipX, shipY); rotate(atan2(velocityY, velocityX) + HALF_PI); fill(0, 200, 255); stroke(255); strokeWeight(1.5); triangle(0, -18, -12, 16, 12, 16); fill(255, 100, 255); ellipse(0, 2, 6, 6); popMatrix(); popStyle(); } void drawSecondShip() { if (hasSecondShip) { pushStyle(); pushMatrix(); translate(ship2X, ship2Y); if (colonistCount >= 50) { rotate(frameCount * 0.08); stroke(0, 255, 150); } else { rotate(frameCount * 0.01); stroke(150, 50, 50); } noFill(); strokeWeight(1.5); for(int i = 0; i < 3; i++) { rotate(TWO_PI/3); triangle(0, -12, -10, 10, 10, 10); pushMatrix(); scale(0.5); rotate(-frameCount * 0.15); triangle(0, -12, -10, 10, 10, 10); popMatrix(); } popMatrix(); popStyle(); } } void drawHUD() { pushStyle(); fill(15, 20, 35, 240); stroke(60, 110, 190); strokeWeight(2); rect(10, 10, width - 20, 140, 8); // Language Button fill(100); rect(width - 90, 15, 70, 20, 4); fill(255); textSize(10); String langTxt = (lang == 0) ? "LANG: DE" : (lang == 1 ? "LANG: EN" : "LANG: FR"); text(langTxt, width - 85, 29); // Row 1: Energie, KI, SP & Fraktal fill(40); noStroke(); rect(20, 20, 150, 16, 4); fill(255, 0, 200); rect(20, 20, map(tlwEnergy, 0, maxEnergy, 0, 150), 16, 4); fill(255); textSize(11); text(t("ENERGY") + int(tlwEnergy) + "/" + int(maxEnergy), 20, 16); if (aiUnlocked) { fill(aiActive ? color(0,255,100) : (inRebellion ? color(255,50,50) : color(80))); rect(180, 16, 100, 22, 4); fill(0); textSize(9); text(inRebellion ? t("AI_SABOTAGE") : (aiActive ? t("AI_ON") : t("AI_OFF")), 190, 30); } else { fill(150); textSize(10); text(t("AI_LEARN") + " (" + manualTokensCollected + "/5)", 180, 30); } if (isruBought) { fill(inRebellion ? color(255,50,50) : color(0, 255, 150)); textSize(11); text(t("POP") + " " + int(colonistCount) + " | " + t("SAT") + " " + int(satisfaction) + "%", 300, 20); fill(0, 200, 255); text(t("SP") + " " + int(shipPoints), 300, 34); if (!hasSecondShip) { fill((shipPoints >= 500 && colonistCount >= 50) ? color(0,255,150) : color(80)); rect(450, 16, 170, 22, 4); fill(0); textSize(9); text(t("FRAC_BUY"), 455, 30); } else { fill((colonistCount >= 50) ? color(0,255,150) : color(255,80,80)); rect(450, 16, 170, 22, 4); fill(0); textSize(9); text(colonistCount >= 50 ? t("FRAC_ON") : t("FRAC_NO_CREW"), 455, 30); } } // Row 2: Basis & Auto-Upgrades fill(200, 220, 255); textSize(11); text(t("BASE"), 20, 58); fill(coreBought ? color(0,255,100) : color(80)); rect(65, 45, 60, 20, 4); fill(0); textSize(10); text(coreBought ? t("CORE") : t("CORE")+"(50)", 70, 59); boolean sEm = (solarWarning || isSolarFlare); fill(shieldBought ? (shieldOn ? color(0,200,255) : color(100)) : color(80)); rect(130, 45, 95, 20, 4); fill(shieldOn ? 0 : (sEm && shieldBought ? color(255,100,100) : 255)); text(shieldBought ? (shieldOn ? t("SHIELD_ON") : (sEm ? "Schild (30E!)" : t("SHIELD_OFF"))) : "Schild (70E)", 135, 59); boolean mEm = (meteorWarning || isMeteor); fill(defenseBought ? (defenseOn ? color(0,200,255) : color(100)) : color(80)); rect(230, 45, 95, 20, 4); fill(defenseOn ? 0 : (mEm && defenseBought ? color(255,100,100) : 255)); text(defenseBought ? (defenseOn ? t("DEF_ON") : (mEm ? "Abwehr (30E!)" : t("DEF_OFF"))) : "Abwehr (80E)", 235, 59); fill(isruBought ? color(0,255,100) : color(80)); rect(330, 45, 70, 20, 4); fill(0); text(isruBought ? "ISRU" : "ISRU (90E)", 335, 59); if (isruBought) { fill(autoShieldBought ? color(200,100,255) : color(60)); rect(420, 45, 130, 20, 4); fill(255); text(autoShieldBought ? "AUTO-SCHILD: OK" : "Auto-Schild (200 SP)", 425, 59); fill(autoDefenseBought ? color(200,100,255) : color(60)); rect(555, 45, 130, 20, 4); fill(255); text(autoDefenseBought ? "AUTO-ABWEHR: OK" : "Auto-Abwehr (200 SP)", 560, 59); } // Row 3: Produktion & ISRU if (isruBought) { fill(200, 220, 255); textSize(11); text(t("PROD"), 20, 85); fill(50, 150, 255); rect(65, 72, 85, 20, 4); fill(255); textSize(10); text(t("WATER")+" (15E)", 70, 86); fill(0); rect(155, 75, 40, 14); fill(50, 200, 255); rect(155, 75, map(waterLevel,0,100,0,40), 14); fill(255); text(int(waterLevel)+"%", 200, 86); fill(40, 180, 60); rect(240, 72, 85, 20, 4); fill(255); text(t("FLORA")+" (20E)", 245, 86); fill(0); rect(330, 75, 40, 14); fill(0, 255, 100); rect(330, 75, map(greenLevel,0,100,0,40), 14); fill(255); text(int(greenLevel)+"%", 375, 86); fill(autoIsruBought ? (autoIsruActive ? color(200,100,255) : color(100)) : color(60)); rect(420, 72, 130, 20, 4); fill(255); text(autoIsruBought ? (autoIsruActive ? "AUTO-ISRU: ON" : "AUTO-ISRU: OFF") : "Auto-ISRU (150 SP)", 425, 86); if (greenLevel >= 10) { fill(180, 50, 50); rect(555, 72, 140, 20, 4); fill(255); text(t("SELL_FLORA"), 560, 86); } } // Row 4: Handel & Express if (colonistsArrived) { fill(200, 220, 255); textSize(11); text(t("TRADE"), 20, 112); fill(tradePolicy == 0 ? color(0,255,150) : color(255, 80, 80)); rect(75, 98, 175, 20, 4); fill(0); textSize(9); text(tradePolicy == 0 ? t("LEGAL") : t("BLACK_MARKET"), 80, 112); if (tradePolicy == 1) { fill(255, 100, 200); text(t("DRUGS") + int(drugSupply), 255, 112); } fill(color(200, 180, 50)); rect(420, 98, 160, 20, 4); fill(0); text(t("EXP_COL"), 425, 112); fill(color(200, 180, 50)); rect(590, 98, 160, 20, 4); fill(0); text(t("EXP_CARGO"), 595, 112); } // Risiken Rechts textSize(10); if (solarRisk > 75) fill(255, 100, 100); else fill(200, 220, 255); text(t("RISK_SUN") + int(min(100, solarRisk)) + "%", 710, 70); if (meteorRisk > 75) fill(255, 100, 100); else fill(200, 220, 255); text(t("RISK_MET") + int(min(100, meteorRisk)) + "%", 710, 85); popStyle(); } void drawStoryPopup() { if (showPopup) { pushStyle(); fill(10, 15, 30, 250); stroke(0, 200, 255); strokeWeight(2); rect(width/2 - 220, height/2 - 90, 440, 150, 10); fill(0, 255, 200); textSize(14); text("📡 " + activePopupTitle, width/2 - 200, height/2 - 60); fill(255); textSize(11); text(activePopupText, width/2 - 200, height/2 - 30, 400, 80); textSize(10); fill(150, 180, 220); text("[OK]", width/2 - 10, height/2 + 40); popStyle(); } } void mousePressed() { if (showPopup) { showPopup = false; pauseForWarning = false; return; } // Sprachauswahl (Toggle 0 -> 1 -> 2) if (mouseX > width - 90 && mouseX < width - 20 && mouseY > 15 && mouseY < 35) { lang = (lang + 1) % 3; return; } if (aiUnlocked && !inRebellion && mouseX > 180 && mouseX < 280 && mouseY > 16 && mouseY < 38) { aiActive = !aiActive; return; } if (isruBought && colonistsArrived && !hasSecondShip && mouseX > 450 && mouseX < 620 && mouseY > 16 && mouseY < 38) { if (shipPoints >= 500 && colonistCount >= 50) { shipPoints -= 500; hasSecondShip = true; ship2X = width/2; ship2Y = height/2; } } if (mouseX > 65 && mouseX < 125 && mouseY > 45 && mouseY < 65 && !coreBought && tlwEnergy >= 50) { tlwEnergy -= 50; coreBought = true; } if (mouseX > 130 && mouseX < 225 && mouseY > 45 && mouseY < 65) { if (!shieldBought && tlwEnergy >= 70) { tlwEnergy -= 70; shieldBought = true; shieldOn = true; } else if (shieldBought) { if (!shieldOn && (solarWarning || isSolarFlare)) { if (tlwEnergy >= 30) { tlwEnergy -= 30; shieldOn = true; } } else { shieldOn = !shieldOn; } } } if (mouseX > 230 && mouseX < 325 && mouseY > 45 && mouseY < 65) { if (!defenseBought && tlwEnergy >= 80) { tlwEnergy -= 80; defenseBought = true; defenseOn = true; } else if (defenseBought) { if (!defenseOn && (meteorWarning || isMeteor)) { if (tlwEnergy >= 30) { tlwEnergy -= 30; defenseOn = true; } } else { defenseOn = !defenseOn; } } } if (mouseX > 330 && mouseX < 400 && mouseY > 45 && mouseY < 65 && !isruBought && tlwEnergy >= 90) { tlwEnergy -= 90; isruBought = true; } if (isruBought && mouseX > 420 && mouseX < 550 && mouseY > 45 && mouseY < 65 && !autoShieldBought && shipPoints >= 200) { shipPoints -= 200; autoShieldBought = true; } if (isruBought && mouseX > 555 && mouseX < 685 && mouseY > 45 && mouseY < 65 && !autoDefenseBought && shipPoints >= 200) { shipPoints -= 200; autoDefenseBought = true; } if (isruBought && mouseX > 420 && mouseX < 550 && mouseY > 72 && mouseY < 92) { if (!autoIsruBought && shipPoints >= 150) { shipPoints -= 150; autoIsruBought = true; autoIsruActive = true; } else if (autoIsruBought) { autoIsruActive = !autoIsruActive; } } if (isruBought && !balanceReached) { if (mouseX > 65 && mouseX < 150 && mouseY > 72 && mouseY < 92 && tlwEnergy >= 15.0) { tlwEnergy -= 15.0; waterLevel = min(100, waterLevel + 12.0); } if (mouseX > 240 && mouseX < 325 && mouseY > 72 && mouseY < 92 && tlwEnergy >= 20.0) { tlwEnergy -= 20.0; greenLevel = min(100, greenLevel + 12.0); } if (greenLevel >= 10 && mouseX > 555 && mouseX < 695 && mouseY > 72 && mouseY < 92) { greenLevel -= 10.0; tlwEnergy = min(maxEnergy, tlwEnergy + 45.0); for(int k=0; k<15; k++) particles.add(new Particle(width/2, height-60, random(-3,3), random(-3,-1), color(100, 255, 100), 2)); } if (colonistsArrived && mouseX > 75 && mouseX < 250 && mouseY > 98 && mouseY < 118) tradePolicy = (tradePolicy == 0) ? 1 : 0; } if (colonistsArrived) { if (mouseX > 420 && mouseX < 580 && mouseY > 98 && mouseY < 118 && shipPoints >= 100) { shipPoints -= 100; colonistCount += 5; } if (mouseX > 590 && mouseX < 750 && mouseY > 98 && mouseY < 118 && shipPoints >= 100) { shipPoints -= 100; if (tradePolicy == 0) satisfaction = min(100, satisfaction + 15); else drugSupply += 100; } } } void triggerStory(String title, String txt) { activePopupTitle = title; activePopupText = txt; showPopup = true; pauseForWarning = true; } class TLWFieldNode { float baseX, baseY; TLWFieldNode(float x, float y) { baseX = x; baseY = y; } void updateAndDisplay(float sx, float sy, float sx2, float sy2) { float x = baseX, y = baseY, dShip1 = dist(x, y, sx, sy), dShip2 = dist(x, y, sx2, sy2); if (dShip1 < 140) { float f = (140 - dShip1) * 0.12; x += cos(atan2(y - sy, x - sx)) * f; y += sin(atan2(y - sy, x - sx)) * f; } if (hasSecondShip && colonistCount >= 50 && dShip2 < 100) { float f = (100 - dShip2) * 0.15; x += cos(atan2(y - sy2, x - sx2)) * f; y += sin(atan2(y - sy2, x - sx2)) * f; } stroke(40, 80, 150, 70); point(x, y); if (baseX < width - 70 && baseY < height - 170) { stroke(35, 70, 130, 45); line(baseX, baseY, x, y); } } } class TLWToken { float x, y; TLWToken(float px, float py) { x = px; y = py; } void display() { pushStyle(); noStroke(); fill(0, 255, 220, 80); ellipse(x, y, 22, 22); fill(0, 255, 220, 220); ellipse(x, y, 12, 12); fill(255); ellipse(x, y, 5, 5); popStyle(); } } class Projectile { float x, y, vx, vy; Projectile(float startX, float startY, float targetX, float targetY) { x = startX; y = startY; float angle = atan2(targetY - startY, targetX - startX); vx = cos(angle) * 14.0; vy = sin(angle) * 14.0; } void update() { x += vx; y += vy; } void display() { pushStyle(); noStroke(); fill(255, 100, 255, 180); ellipse(x, y, 12, 22); fill(0, 255, 255); ellipse(x, y, 6, 14); fill(255); ellipse(x, y, 3, 8); popStyle(); } boolean isOffScreen() { return x < 0 || x > width || y < 0 || y > height; } } class Particle { float x, y, vx, vy, alpha; color col; int type; Particle(float px, float py, float dirX, float dirY, color c, int t) { x = px; y = py; vx = dirX; vy = dirY; alpha = 255; col = c; type = t; } void update() { x += vx; y += vy; if (type == 1) alpha -= 16; else { vx *= 0.92; vy *= 0.92; alpha -= 12; } } void display() { pushStyle(); noStroke(); fill(col, alpha); ellipse(x, y, type == 1 ? 4 : 6, type == 1 ? 4 : 6); popStyle(); } boolean isDead() { return alpha <= 0; } }