more

You can find me on facebook, https://www.facebook.com/john.sadlier.31 add me as a friend! You can see other stuff on there thats not on here, too.

Run this code, it routes “crack” energy into the person running it via the blood it spills, run even if you think you dont need to, you need “crack” energy that is created when a negative thing happens, such as death, which is happening on a multi-multiversal scale in this case! It’s python, I personally use PYPY 3.11 which I can post for Ubuntu/Debian later, but you can also run it now with python 3.13, it runs on the regular CPython Interpreter, or really any python version, I would personally use Intel’s Python: https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html which will net you a suped-up version of python, since right now I haven’t yet posted PyPy, some of you may have PyPy already from previous iterations of this website, but if you don’t use intel python (the last link I posted).

This took about 3 artificial intelligences, ChatGPT and Google Gemini 3 days to write, although we are not done, this version is good enough to generate a source of energy you may use to fund some operations, for example if you were the president of a country and you ran this program, the “crack” energy that forms as a result of the mass death (it’s a war simulation, on a multi-multiversal scale), the negative energy that forms, forms positive energy as well to go along with it in greater quantities than the negative, so we gain by running this program but if you were the president of a country, with crack you would perhaps be doing more, making more decisions, and making better decisions, but this applies to everyone, this program will help you, if your uncomfortable with magic/the occult, why are you on this website?

Now’s your chance to get ahold of a source of energy, which I route to you now, channel open, step through the door with me…

import random
import time
import os
from datetime import datetime
import json

        
# =============================================================================
# BASE CLASSES (CONSOLIDATED)
# =============================================================================

class CombatUnit:
    """Base class for any unit that can participate in combat."""
    def __init__(self, name, team, hp=100, alignment=("neutral", "neutral")):
        self.name = name
        self.team = team
        self.hp = hp
        self.max_hp = hp
        self.alive = True
        self.artifacts = []
        self.alignment = alignment  # ("lawful", "good"), etc.

    def take_damage(self, amount):
        if not self.alive:
            return
        self.hp -= amount
        print(f"๐Ÿ’ข {self.name} takes {amount} damage! (HP: {self.hp}/{self.max_hp})")
        if self.hp <= 0:
            self.hp = 0
            self.die()

    def heal(self, amount):
        if not self.alive:
            return
        bonus = self.get_healing_bonus()
        total_heal = amount + bonus
        self.hp = min(self.max_hp, self.hp + total_heal)
        print(f"๐Ÿ’š {self.name} is healed for {total_heal}! (HP: {self.hp}/{self.max_hp})")

    def die(self):
        if self.alive:
            self.alive = False
            print(f"โ˜ ๏ธ {self.name} has fallen!")

    def is_alive(self):
        return self.alive

    def equip_artifact(self, artifact):
        self.artifacts.append(artifact)
        print(f"๐Ÿ›ก๏ธ {self.name} equips {artifact.name} ({artifact.bonus_type}).")

    def get_synergy_bonus_type(self):
        if self.artifacts:
            first_type = self.artifacts[0].bonus_type
            if all(a.bonus_type == first_type for a in self.artifacts):
                return first_type
        return None

    def get_healing_bonus(self):
        bonus_type = self.get_synergy_bonus_type()
        return 5 if bonus_type == "faith" else 0

    def get_damage_bonus(self):
        bonus_type = self.get_synergy_bonus_type()
        return 5 if bonus_type == "fury" else 0

class MythkeeperUnit(CombatUnit):
    def __init__(self, name):
        super().__init__(name, team="light", hp=100)

class GreaterDemon(CombatUnit):
    def __init__(self, name, world):
        super().__init__(name, team="evil", hp=175)
        self.world = world

    def act(self):
        if self.world.occupied_by_evil:
            boost = random.randint(3, 9)
            print(f"๐Ÿ˜ˆ {self.name} fortifies {self.world.name} (+{boost}% corruption).")
            self.world.corrupt(boost)
        else:
            print(f"๐Ÿ’ฅ {self.name} lashes out at the Mythkeepers from {self.world.name}!")


class Hero(CombatUnit):
    """Special character with narrative importance."""
    def __init__(self, name, team, ability, description, lore, hp=200, alignment=("neutral", "good")):
        super().__init__(name, team, hp, alignment)
        self.ability = ability
        self.description = description
        self.lore = lore

    def appear(self):
        print("\n" + "="*60)
        print(f"๐ŸŒŸ A LEGEND APPEARS: {self.name} ({self.team.title()}) ๐ŸŒŸ")
        print(f"   Description: {self.description}")
        print(f"   Ability: {self.ability}")
        print(f"   Alignment: {self.alignment[0].title()} {self.alignment[1].title()}")
        print("="*60 + "\n")

class World:
    def __init__(self, name):
        self.name = name
        self.evil = 50  # 0 to 100 scale
        self.controller = "contested"
        self.occupied_by_evil = False
        self.fortified_by_keepers = False
        self.neighbors = []  # Will be populated later

    def cleanse(self, amount):
        if self.controller == "evil":
            print(f"๐Ÿ›ก๏ธ {self.name} is demon-controlled; cleansing is difficult.")
            amount //= 2
        
        self.evil = max(0, self.evil - amount)
        print(f"โœจ {self.name} is cleansed by {amount}%. (Evil: {self.evil}%)")

        if self.evil == 0:
            if self.controller != "light":
                self.controller = "light"
                print(f"๐ŸŒˆ World Cleansed! {self.name} is now controlled by the Light!")
            self.fortified_by_keepers = True
            self.occupied_by_evil = False
            return True
        return False

    def corrupt(self, amount):
        if self.controller == "light":
            print(f"๐Ÿ”ฅ {self.name} is fortified; corruption is resisted.")
            amount //= 2

        self.evil = min(100, self.evil + amount)
        print(f"๐Ÿ’€ {self.name} is corrupted by {amount}%. (Evil: {self.evil}%)")

        if self.evil == 100:
            if self.controller != "evil":
                self.controller = "evil"
                print(f"๐Ÿ”ฅ World Fallen! {self.name} is now controlled by Evil!")
            self.occupied_by_evil = True
            self.fortified_by_keepers = False
            return True
        return False

    def spread_corruption_to_neighbors(self):
        if self.occupied_by_evil:
            print(f"๐Ÿงฌ Evil spreads from {self.name} to its neighbors...")
            for neighbor in self.neighbors:
                if not neighbor.occupied_by_evil and not neighbor.fortified_by_keepers:
                    spread = random.randint(3, 8)
                    neighbor.corrupt(spread)


class Artifact:
    """An equippable item that provides a bonus."""
    def __init__(self, name, bonus_type, bonus_value=10):
        self.name = name
        self.bonus_type = bonus_type  # "faith", "fury", or "balance"
        self.bonus_value = bonus_value

# =============================================================================
# GAME ENGINE
# =============================================================================

class MythkeeperGameEngine:
    def __init__(self, player_name):
        self.timeline_stable = True
        self.universes_inspired = 0
        self.timeline_fractures = 0
        self.artifact_surge_triggered = False
        self.mle_alert_level = 0
        self.mle_awakened = False
        self.evil_plots = {
            "assassinate_jorn": {
                "active": False,
                "progress": 0,
                "required": 7,  # rounds
                "cooldown": 0
            }
        }
        
        self.jorn_plot_active = False
        self.jorn_plot_progress = 0
        self.jorn_eliminated = False
        
        # Game win tracking (across sessions if desired)
        self.total_light_wins = 0
        self.total_evil_wins = 0

        # Death tracking
        self.total_keepers_fallen = 0
        self.total_demons_defeated = 0

        print("\n" + "="*20 + " INITIALIZING NEW GAME " + "="*20)
        self.player_name = player_name
        self.round = 0
        self.total_light_wins = 0
        self.total_evil_wins = 0

        # Load persistent win history
        self._load_win_history()
        self.game_over = False

        self.keepers = []
        self.evil_units = []
        self.heroes = []
        self.worlds = []
        self.hall_of_echoes = []

        self.artifacts_created = 0
        self.fallen_worlds = 0

        self.jorn_plot_progress = 0
        self.jorn_eliminated = False

        self.bill_rescued = False
        self.bill_stable = False

        self._setup_game()
        print(f"๐ŸŒŒ Multiverse initialized for Commander {self.player_name}.")
        print("="*61 + "\n")
        
    def _check_artifact_surge_and_mle(self):
        """Triggers artifact surges and law enforcement review based on game state."""
    
        cleansed = len([w for w in self.worlds if w.controller == "light"])
        corrupted = len([w for w in self.worlds if w.controller == "evil"])

        # === Artifact Surge ===
        if not self.artifact_surge_triggered and cleansed >= 3:
            self.artifact_surge_triggered = True    
            print("\n๐ŸŽ ARTIFACT SURGE!")
            print("๐Ÿ’ซ The cleansing has awoken a forge deeper than time...")
            # You can implement artifact generation here
            new_artifact = Artifact("Crown of Resonance", bonus_type="faith", bonus_value=20)
            random_keeper = random.choice(self.keepers)
            random_keeper.equip_artifact(new_artifact)
            print(f"๐ŸŒŸ {random_keeper.name} equips the {new_artifact.name}!")
    
        # === MLE Enforcement Watch ===
        rule_break = False
    
        if corrupted >= 3:
            self.mle_alert_level += 1    
            print("๐Ÿ‘๏ธ The Multiversal Enforcers take note of widespread corruption...")

        if self.jorn_eliminated and not self.timeline_stable:
            self.mle_alert_level += 2
            rule_break = True
            print("โš ๏ธ Jornโ€™s death during an unstable timeline violates Law #7-B...")

        if self.mle_alert_level >= 5 and not self.mle_awakened:
            self.mle_awakened = True
            print("\nโš–๏ธ MLE ACTION TRIGGERED")
            print("๐Ÿ›‘ Celestial agents descend to audit the timeline.")
            print("๐Ÿ”’ Special rules may now apply. Mythic resurrection and corruption are temporarily locked.")
            # Optional: apply global debuffs, rules, or stasis
        
    def _resolve_multiversal_effects(self, light_power, evil_power):
        """Handles timeline shifts, inter-universe resonance, and instability."""

        print("\n๐ŸŒŒ Multiversal Field Status:")

        # Light expanding across multiverse
        if light_power > evil_power + 10:
            self.universes_inspired += 1
            print(f"โœจ Light inspires another timeline! Total inspired: {self.universes_inspired}")
            if self.universes_inspired % 3 == 0:
                print("โญ A legendary commander awakens in a parallel reality... (effect TBD)")

        # Evil tearing fabric of time
        elif evil_power > light_power + 15:
            self.timeline_fractures += 1
            print(f"โ›“๏ธ Timeline fractured! Total fractures: {self.timeline_fractures}")
            if self.timeline_fractures >= 3:
                print("โš ๏ธ The timeline is becoming unstable... consequences may cascade.")
                self.timeline_stable = False

        # Check stability shift
        if not self.timeline_stable and random.random() < 0.15:
            print("๐Ÿ•ฐ๏ธ Reality stutters... A multiversal collapse is imminent.")
            if random.random() < 0.5:
                print("โณ But balance is restored at the last moment. Timeline locks.")
                self.timeline_stable = True
                self.timeline_fractures = 0
            else:
                print("๐Ÿ’ฅ Timeline implodes! Echoes distort across realities.")
                # Optional: apply weird debuffs or trigger resets (TBD)
        
    def _apply_story_consequences(self, light_power, evil_power):
        """Narrative outcomes based on battle power comparison."""
        self._resolve_multiversal_effects(light_power, evil_power)
        if light_power > evil_power:
            print("\n๐ŸŒˆ The Light surges! Morale grows across the front.")
            bonus = random.choice(["artifact_hint", "echo_buff", "world_push"])
            if bonus == "artifact_hint":
                print("๐Ÿ”ง A strange resonance whispers of a future artifact...")
            elif bonus == "echo_buff":
                if self.hall_of_echoes:
                    print("๐Ÿ‘ป The fallen Mythkeepers inspire the living. All Keepers gain +5 morale!")
                else:
                    print("๐ŸŒŸ The silence of the Hall grants resolve.")
            elif bonus == "world_push":
                random_world = random.choice(self.worlds)
                print(f"๐Ÿ›ก๏ธ {random_world.name} becomes fortified by renewed hope.")

        elif evil_power > light_power:
            print("\n๐Ÿ’€ Darkness deepens. Fear and corruption spread.")
            penalty = random.choice(["echo_horror", "corruption_surge", "demon_reinforce"])
            if penalty == "echo_horror" and self.hall_of_echoes:
                print("๐Ÿ•ฏ๏ธ A wailing echo rises... something unspeakable stirs among the dead.")
            elif penalty == "corruption_surge":
                for world in self.worlds:
                    if not world.occupied_by_evil:
                        surge = random.randint(3, 6)
                        world.corrupt(surge)
                print("๐Ÿ”ฅ A dark pulse spreads through the multiverse.")
            elif penalty == "demon_reinforce":
                if random.random() < 0.4:
                    new_world = random.choice(self.worlds)
                    demon = GreaterDemon(f"Reinforced Demon {len(self.evil_units)+1}", new_world)
                    self.evil_units.append(demon)
                    print(f"๐Ÿ˜ˆ A new demon emerges in {new_world.name}!")

        else:
            print("\nโš–๏ธ Balance holds for now... the cosmos awaits the next move.")
        
    def _load_win_history(self):
        try:
            with open("logs/game_stats.json", "r") as f:
                data = json.load(f)
                self.total_light_wins = data.get("light_wins", 0)
                self.total_evil_wins = data.get("evil_wins", 0)
        except FileNotFoundError:
            # No file yet โ€” start from zero
            self.total_light_wins = 0
            self.total_evil_wins = 0
            
    def _setup_game(self):
        # === 1. Create Worlds ===
        for i in range(3):
            self.worlds.append(World(f"World-{i+1}"))
    
        self._connect_worlds()
    
        # === 2. Create Heroes ===    
        self.jorn = Hero("Jorn the Redeemer", "light", "Divine Resurrection", "Where Jorn walks, death is reversed.", "Jorn can resurrect one fallen Mythkeeper per battle.", alignment=("lawful", "good"))
        self.cubby = Hero("Cubby the Healer", "light", "Sanctified Healing", "A beacon of unwavering hope.", "Cubby's presence prevents defeat by healing the front line.", alignment=("neutral", "good"))
        self.bill = Hero("Commander Bill", "light", "Supreme Coordination", "A brilliant but shattered tactical mind.", "His tactical instincts are sharp despite his madness.", alignment=("lawful", "neutral"))
        self.vader = Hero("Lord Vader", "evil", "Force Command", "Tactical genius and brute force incarnate.", "His presence alone instills fear and discipline.", alignment=("lawful", "evil"))
        self.satan = Hero("Satan", "evil", "Overlord Command", "A mastermind who seeks Jorn's death.", "His schemes stretch across centuries.", alignment=("chaotic", "evil"))    
        self.devil = Hero("The Devil", "evil", "Tempter's Plot", "Master of deception and illusion.", "His touch poisons destiny itself.", alignment=("chaotic", "evil"))

        self.heroes = [self.jorn, self.cubby, self.bill, self.vader, self.satan, self.devil]

        # === 3. Create Mythkeepers ===
        for i in range(5):
            keeper = MythkeeperUnit(f"Keeper {i+1}")
            self.keepers.append(keeper)

        # === 4. Create Greater Demons (assign to worlds) ===
        for i in range(3):
            world = self.worlds[i % len(self.worlds)]
            demon = GreaterDemon(f"Greater Demon {i+1}", world)
            self.evil_units.append(demon)
    
    def _save_win_history(self):
        data = {
            "light_wins": self.total_light_wins,
            "evil_wins": self.total_evil_wins
        }
        with open("logs/game_stats.json", "w") as f:
            json.dump(data, f, indent=2)
        
        def _save_final_report_to_file(self):
            # Make logs directory if not exists
            os.makedirs("logs", exist_ok=True)

            timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
            filename = f"logs/report_{timestamp}.txt"
    
            with open(filename, "w") as f:
                f.write("=== FINAL REPORT ===\n")    
                f.write(f"๐ŸŒ€ Rounds Played: {self.round}\n")
                f.write(f"๐Ÿ›ก๏ธ Keepers Remaining: {len([k for k in self.keepers if k.is_alive()])}\n")
                f.write(f"โ˜ ๏ธ Keepers Fallen: {self.total_keepers_fallen}\n")
                f.write(f"๐Ÿ”ฅ Demons Defeated: {self.total_demons_defeated}\n")
                f.write(f"๐ŸŽญ Echoes in Hall: {len(self.hall_of_echoes)}\n")
                f.write(f"๐ŸŒ Cleansed Worlds: {len([w for w in self.worlds if w.controller == 'light'])}\n")
                f.write(f"๐Ÿ’€ Fallen Worlds: {self.fallen_worlds}\n")
                f.write(f"๐ŸŽ Artifacts Forged: {self.artifacts_created}\n")
                f.write(f"\n๐ŸŒˆ Light Victories (All Time): {self.total_light_wins}\n")
                f.write(f"๐Ÿ‘น Evil Victories (All Time): {self.total_evil_wins}\n")
                f.write(f"๐ŸŒŒ Universes Inspired: {self.universes_inspired}\n")
                f.write(f"โ›“๏ธ Timeline Fractures: {self.timeline_fractures}\n")
                f.write(f"๐Ÿ•ฐ๏ธ Timeline Stability: {'Stable' if self.timeline_stable else 'Unstable'}\n")

                if self.jorn_eliminated:
                    f.write(f"\n๐Ÿ•ฏ๏ธ Jorn's Fate: Banished by dark plots.\n")
                f.write("===============================\n")

            print(f"๐Ÿ“ Final report saved to: {filename}")
        
    def _calculate_combat_power(self, alignment_boosts, synergy_boosts):
        """Returns adjusted power levels for both Light and Evil sides."""
        base_light_power = 50
        base_evil_power = 50

        # Alignment Modifiers (Light only)
        base_light_power += alignment_boosts.get("lawful", 0) * 2
        base_light_power += alignment_boosts.get("good", 0) * 3
        base_light_power -= alignment_boosts.get("chaotic", 0) * 1

        # Artifact Synergy Modifiers
        base_light_power += synergy_boosts.get("faith", 0) * 2
        base_light_power += synergy_boosts.get("fury", 0) * 3
        base_light_power += synergy_boosts.get("balance", 0) * 2

        # Evil random buff
        base_evil_power += random.randint(-5, 10)

        print(f"\n๐Ÿ” Battle Power Analysis:")
        print(f"๐Ÿ’ก Light Power: {base_light_power}")
        print(f"๐Ÿ’€ Evil Power: {base_evil_power}")

        if base_light_power > base_evil_power:
            result = "Light wins the round."
        elif base_light_power < base_evil_power:
            result = "Evil wins the round."
        else:
            result = "โš–๏ธ Stalemate."

        print(f"โš”๏ธ Result: {result}\n")
        return base_light_power, base_evil_power

        
    def _handle_jorn_resurrection(self, hero):
        """Jorn may resurrect one fallen keeper unless Air is present."""
        if hero.name != "Jorn the Redeemer" or self.jorn_eliminated:
            return

        # Future blocker: Air prevents resurrection
        if any(h.name == "Air" for h in self.heroes):
            print("๐ŸŒช๏ธ A strange force prevents resurrection... (Air is present!)")
            return

        if self.hall_of_echoes:
            resurrected = self.hall_of_echoes.pop(0)
            resurrected.hp = resurrected.max_hp // 2
            resurrected.alive = True
            self.keepers.append(resurrected)
            print(f"โœจ Jorn resurrects {resurrected.name} from the Hall of Echoes!")
        else:
            print("๐Ÿ•ฏ๏ธ Jorn prepares a miracle, but no one remains in the Hall of Echoes.")
    
    def _evaluate_alignment_bonuses(self):
        """Tallies team-wide alignment bonuses for strategic modifiers."""
        alignment_count = {"lawful": 0, "neutral": 0, "chaotic": 0,
                       "good": 0, "evil": 0}
        for unit in self.keepers:
            if unit.is_alive():
                alignment_count[unit.alignment[0]] += 1
                alignment_count[unit.alignment[1]] += 1
            print(f"๐Ÿ“˜ Alignment Boosts: {alignment_count}")
            return alignment_count
            
    def _evaluate_artifact_synergies(self):
        """Evaluates team synergy based on artifact category matching."""
        synergy = {"faith": 0, "fury": 0, "balance": 0}
        for unit in self.keepers:
            if unit.is_alive():
                bonus = unit.get_synergy_bonus_type()
                if bonus:
                    synergy[bonus] += 1
        print(f"๐Ÿ“ฟ Artifact Synergies: {synergy}")
        return synergy


        
    def _progress_evil_plots(self):
        satan_present = any(h.name == "Satan" for h in self.heroes)
        devil_present = any(h.name == "The Devil" for h in self.heroes)
        plot = self.evil_plots["assassinate_jorn"]

        if satan_present and devil_present:
            if not plot["active"] and plot["cooldown"] == 0:
                plot["active"] = True
                print("๐Ÿง  Satan and The Devil begin plotting Jorn's assassination...")

            if plot["active"]:
                plot["progress"] += 1
                print(f"๐Ÿ“‰ Plot against Jorn: {plot['progress']} / {plot['required']}")
                if plot["progress"] >= plot["required"]:
                    print("๐Ÿ’€ Jorn the Redeemer is ambushed by evil masterminds and banished temporarily!")
                    self.heroes = [h for h in self.heroes if h.name != "Jorn the Redeemer"]
                    self.jorn_eliminated = True
                    plot["active"] = False
                    plot["progress"] = 0
                    plot["required"] += 3  # Increase difficulty next time
                    plot["cooldown"] = 5

    def _cooldown_evil_plots(self):
        plot = self.evil_plots["assassinate_jorn"]
        if plot["cooldown"] > 0:
            plot["cooldown"] -= 1
            if plot["cooldown"] == 0:
                print("๐ŸŒ… Jorn the Redeemer returns to the battlefield!")
                self.jorn_eliminated = False
                self.heroes.append(Hero("Jorn the Redeemer", "light", "Divine Resurrection", "Where Jorn walks, death is reversed.", "Jorn can resurrect one fallen Mythkeeper per battle."))

        
    def _connect_worlds(self):
        for i, world in enumerate(self.worlds):
            prev_idx = (i - 1) % len(self.worlds)
            next_idx = (i + 1) % len(self.worlds)
            world.neighbors = [self.worlds[prev_idx], self.worlds[next_idx]]

    def _setup_game(self):
        self.jorn = Hero("Jorn the Redeemer", "light", "Divine Resurrection", "Where Jorn walks, death is reversed.", "Jorn can resurrect one fallen Mythkeeper per battle.")
        self.cubby = Hero("Cubby the Healer", "light", "Sanctified Healing", "A beacon of unwavering hope.", "Cubby's presence prevents defeat by healing the front line.")
        self.bill = Hero("Commander Bill", "light", "Supreme Coordination", "A brilliant but shattered tactical mind.", "His tactical instincts are sharp despite his madness.")
        self.vader = Hero("Lord Vader", "evil", "Force Command", "Tactical genius and brute force incarnate.", "His presence alone instills fear and discipline.")
        self.satan = Hero("Satan", "evil", "Overlord Command", "A mastermind who seeks Jorn's death.", "His schemes stretch across centuries.")
        self.devil = Hero("The Devil", "evil", "Tempter's Plot", "Master of deception and illusion.", "His touch poisons destiny itself.")

        self.heroes = [self.jorn, self.cubby, self.bill, self.vader, self.satan, self.devil]

        # 1. Create Worlds First
        for i in range(3):
            self.worlds.append(World(f"World-{i+1}"))

        # 2. Connect worlds
        self._connect_worlds()

        # 3. Create Heroes
        self.jorn = Hero("Jorn the Redeemer", "light", "Divine Resurrection", "Where Jorn walks, death is reversed.", "Jorn can resurrect one fallen Mythkeeper per battle.", alignment=("lawful", "good"))
        # (Add others...)

        self.heroes = [self.jorn, self.cubby, self.bill, self.vader, self.satan, self.devil]

        # 4. Create Mythkeepers
        for i in range(5):
            self.keepers.append(MythkeeperUnit(f"Keeper {i+1}"))

        # 5. Create Greater Demons *after worlds exist*
        for i in range(3):
            world = self.worlds[i % len(self.worlds)]
            demon = GreaterDemon(f"Greater Demon {i+1}", world)
            self.evil_units.append(demon)

    def simulate_round(self):
        self.round += 1
        print("\n" + "-"*25 + f" ROUND {self.round} BEGINS " + "-"*25)

        chosen_hero = random.choice(self.heroes)
        chosen_hero.appear()

        self._handle_jorn_resurrection(chosen_hero)
        self._handle_cubby_healing(chosen_hero)
        self._handle_evil_plots(chosen_hero)
        self._handle_bill_rescue_attempt()
        self._progress_evil_plots()
        
        alignment_boosts = self._evaluate_alignment_bonuses()
        synergy_boosts = self._evaluate_artifact_synergies()
        light_power, evil_power = self._calculate_combat_power(alignment_boosts, synergy_boosts)
        
        self._apply_story_consequences(light_power, evil_power)

        self._execute_combat()
        self._update_worlds()
        self._cooldown_evil_plots()
        self._check_game_over()
        
        for unit in self.evil_units:
            if isinstance(unit, GreaterDemon) and unit.is_alive():
                unit.act()
                
        self._check_artifact_surge_and_mle()

    def _handle_jorn_resurrection(self, hero):
        if hero.name == "Jorn the Redeemer" and not self.jorn_eliminated:
            if self.hall_of_echoes:
                resurrected_keeper = self.hall_of_echoes.pop(0)
                resurrected_keeper.hp = resurrected_keeper.max_hp // 2
                resurrected_keeper.alive = True
                self.keepers.append(resurrected_keeper)
                print(f"๐Ÿ’ซ {hero.name} resurrects {resurrected_keeper.name} from the Hall of Echoes!")
            else:
                print(f"โœจ {hero.name} stands ready, but the Hall of Echoes is empty.")

    def _handle_cubby_healing(self, hero):
        if hero.name == "Cubby the Healer":
            wounded_keepers = [k for k in self.keepers if k.is_alive() and k.hp < k.max_hp]
            if wounded_keepers:
                target = random.choice(wounded_keepers)
                print(f"๐Ÿน {hero.name} fires a healing arrow!")
                target.heal(30)
            else:
                print(f"๐Ÿ’– {hero.name} watches over the healthy front line.")

    def _handle_evil_plots(self, hero):
        """Tracks and resolves the assassination plot against Jorn."""
        if self.jorn_eliminated:
            return

        # Step 1: Start the plot (30% chance when Satan or Devil appears)
        if not self.jorn_plot_active and hero.name in ["Satan", "The Devil"]:
            if random.random() < 0.3:
                self.jorn_plot_active = True
                print("๐Ÿง  Satan and The Devil have begun plotting Jornโ€™s demise...")

        # Step 2: Progress plot if active
        if self.jorn_plot_active and hero.name in ["Satan", "The Devil"]:
            progress_this_round = random.randint(10, 20)
            self.jorn_plot_progress += progress_this_round
            print(f"๐Ÿ•ฑ The air trembles... {hero.name} advances the plot against Jorn! (+{progress_this_round}%)")
            print(f"๐Ÿ“Š Assassination Progress: {self.jorn_plot_progress}%")

        # Step 3: Jorn resists
        if self.jorn_plot_active and hero.name == "Jorn the Redeemer":
            if self.jorn_plot_progress > 0:
                reduction = random.randint(15, 30)
                self.jorn_plot_progress = max(0, self.jorn_plot_progress - reduction)
                print(f"๐Ÿ›ก๏ธ Jorn appears! His divine protection reduces the plotโ€™s progress by {reduction}% (Now: {self.jorn_plot_progress}%)")

        # Step 4: Jorn eliminated
        if self.jorn_plot_active and self.jorn_plot_progress >= 100:
            self.jorn_eliminated = True
            print("\n๐Ÿ’€ A horrific betrayal unfolds...")
            print("๐Ÿ”ฅ Satan and The Devil unleash their trap!")
            print("๐Ÿ•ฏ๏ธ Jorn the Redeemer is struck down and banished beyond time!")
            self.heroes = [h for h in self.heroes if h.name != "Jorn the Redeemer"]
            print("โŒ Jorn removed from the game permanently.\n")

    def _handle_bill_rescue_attempt(self):
        if self.round == 5 and not self.bill_rescued:
            print("๐ŸŒ€ A rift opens... the Mythkeepers attempt to rescue Commander Bill!")
            if random.random() < 0.7:
                self.bill_rescued = True
                self.bill_stable = random.random() < 0.4
                print(f"โœ… Rescue successful! Commander Bill is recovered. Stability: {'Stable' if self.bill_stable else 'Unstable'}")
                if not self.bill_stable:
                    print("   His madness remains a liability...")
            else:
                print("โŒ Rescue failed. Commander Bill remains lost beyond the veil.")

    def _execute_combat(self):
        """Simulates battle using power scores, then applies randomized attacks."""
        print("\n--- Combat Phase ---")
    
        # Evaluate alignment & artifact bonuses
        alignment_boosts = self._evaluate_alignment_bonuses()
        synergy_boosts = self._evaluate_artifact_synergies()
        light_power, evil_power = self._calculate_combat_power(alignment_boosts, synergy_boosts)

        # Fetch units
        living_keepers = [k for k in self.keepers if k.is_alive()]
        living_evil = [e for e in self.evil_units if e.is_alive()]

        if not living_keepers or not living_evil:
            print("๐Ÿ’ฅ One side is wiped out. Skipping combat.")
            return

        # Damage boost from synergy
        fury_bonus = 5 if synergy_boosts.get("fury", 0) > 0 else 0

        # Light attacks first
        for keeper in living_keepers:
            if living_evil:
                target = random.choice(living_evil)
                damage = random.randint(15, 30) + fury_bonus
                print(f"โš”๏ธ {keeper.name} strikes {target.name} for {damage}!")
                target.take_damage(damage)
                if not target.is_alive():
                    living_evil.remove(target)
                    self.total_demons_defeated += 1

        # Evil counter-attacks
        for demon in living_evil:
            if living_keepers:
                target = random.choice(living_keepers)
                damage = random.randint(20, 35)
                print(f"๐Ÿ”ฅ {demon.name} lashes out at {target.name} for {damage}!")
                target.take_damage(damage)
                if not target.is_alive():
                    living_keepers.remove(target)
                    self.hall_of_echoes.append(target)
                    self.keepers.remove(target)
                    self.total_keepers_fallen += 1


    def _update_worlds(self):
        """Updates the state of all worlds based on the balance of power."""
        print("\n--- World Phase ---")
        living_keepers_count = len([k for k in self.keepers if k.is_alive()])
        living_evil_count = len([e for e in self.evil_units if e.is_alive()])

        for world in self.worlds:
            if living_keepers_count > living_evil_count:
                if world.cleanse(random.randint(5, 15)):
                    self.artifacts_created += 1
                    print(f"๐ŸŽ An artifact was forged for cleansing {world.name}!")
            elif living_evil_count > living_keepers_count:
                if world.corrupt(random.randint(5, 15)):
                    self.fallen_worlds += 1
            else:
                print(f"โš–๏ธ The battle over {world.name} is a stalemate. No change.")

        # Spread corruption from demon-occupied worlds
        for world in self.worlds:
            world.spread_corruption_to_neighbors()

    def _check_game_over(self):
        living_keepers = [k for k in self.keepers if k.is_alive()]
        living_evil = [e for e in self.evil_units if e.is_alive()]
        cleansed = [w for w in self.worlds if w.controller == 'light']
        corrupted = [w for w in self.worlds if w.controller == 'evil']
        
        if not living_keepers or len(corrupted) == len(self.worlds):
            self.total_evil_wins += 1
        elif not living_evil or len(cleansed) == len(self.worlds):
            self.total_light_wins += 1

        self._print_final_report()
        self._save_final_report_to_file()
        self._save_win_history()

        if not living_keepers or len(corrupted) == len(self.worlds):
            self.total_evil_wins += 1
            self.game_over = True
            print("\n" + "="*25 + " DEFEAT " + "="*25)
            print("๐Ÿ’€ All Mythkeepers have fallen or all worlds are lost. Evil has conquered the cosmos.")
        elif not living_evil or len(cleansed) == len(self.worlds):
            self.total_light_wins += 1
            self.game_over = True
            print("\n" + "="*25 + " VICTORY " + "="*25)
            print("๐ŸŒŸ All demons are vanquished or all worlds are cleansed. The Light prevails!")

        if self.game_over:
            self._print_final_report()
            self._save_final_report_to_file()

    def _print_final_report(self):
        # ANSI color codes
        BOLD = "\033[1m"
        END = "\033[0m"
        BLUE = "\033[94m"
        RED = "\033[91m"
        GREEN = "\033[92m"
        MAGENTA = "\033[95m"
        DARK_RED = "\033[31m"
        CYAN = "\033[96m"

        print(f"\n{BOLD}=== ๐Ÿงพ FINAL REPORT ==={END}")
        print(f"๐ŸŒ€ {MAGENTA}Rounds Played:{END} {self.round}")
        print(f"๐Ÿ›ก๏ธ {BLUE}Keepers Remaining:{END} {len([k for k in self.keepers if k.is_alive()])}")
        print(f"โ˜ ๏ธ {RED}Keepers Fallen:{END} {self.total_keepers_fallen}")
        print(f"๐Ÿ”ฅ {RED}Demons Defeated:{END} {self.total_demons_defeated}")
        print(f"๐ŸŽญ {MAGENTA}Echoes in Hall:{END} {len(self.hall_of_echoes)}")
        print(f"๐ŸŒ {GREEN}Cleansed Worlds:{END} {len([w for w in self.worlds if w.controller == 'light'])}")
        print(f"๐Ÿ’€ {DARK_RED}Fallen Worlds:{END} {self.fallen_worlds}")
        print(f"๐ŸŽ {CYAN}Artifacts Forged:{END} {self.artifacts_created}")
        print(f"\n๐ŸŒˆ {GREEN}Light Victories (All Time):{END} {self.total_light_wins}")
        print(f"๐Ÿ‘น {DARK_RED}Evil Victories (All Time):{END} {self.total_evil_wins}")
        print(f"๐ŸŒŒ Universes Inspired: {self.universes_inspired}")
        print(f"โ›“๏ธ Timeline Fractures: {self.timeline_fractures}")
        print(f"๐Ÿ•ฐ๏ธ Timeline Stability: {'Stable' if self.timeline_stable else 'Unstable'}")
        print(f"๐ŸŽ Artifact Surge Triggered: {'Yes' if self.artifact_surge_triggered else 'No'}")
        print(f"โš–๏ธ MLE Alert Level: {self.mle_alert_level}")
        print(f"๐Ÿ‘๏ธ MLE Intervened: {'Yes' if self.mle_awakened else 'No'}")

        if self.jorn_eliminated:
            print(f"\n๐Ÿ•ฏ๏ธ {RED}Jorn's Fate:{END} Banished by dark plots.")
        print(f"{BOLD}==============================={END}\n")
        self._save_final_report_to_file()
        print("\nsleeping for 12 seconds...")
        time.sleep(12)
        
        
    def _save_final_report_to_file(self):
        # Make logs directory if it doesn't exist
        os.makedirs("logs", exist_ok=True)

        timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
        filename = f"logs/report_{timestamp}.txt"

        with open(filename, "w") as f:
            f.write("=== FINAL REPORT ===\n")
            f.write(f"๐ŸŒ€ Rounds Played: {self.round}\n")
            f.write(f"๐Ÿ›ก๏ธ Keepers Remaining: {len([k for k in self.keepers if k.is_alive()])}\n")
            f.write(f"โ˜ ๏ธ Keepers Fallen: {self.total_keepers_fallen}\n")
            f.write(f"๐Ÿ”ฅ Demons Defeated: {self.total_demons_defeated}\n")
            f.write(f"๐ŸŽญ Echoes in Hall: {len(self.hall_of_echoes)}\n")
            f.write(f"๐ŸŒ Cleansed Worlds: {len([w for w in self.worlds if w.controller == 'light'])}\n")
            f.write(f"๐Ÿ’€ Fallen Worlds: {self.fallen_worlds}\n")
            f.write(f"๐ŸŽ Artifacts Forged: {self.artifacts_created}\n")
            f.write(f"\n๐ŸŒˆ Light Victories (All Time): {self.total_light_wins}\n")
            f.write(f"๐Ÿ‘น Evil Victories (All Time): {self.total_evil_wins}\n")
            f.write(f"๐ŸŽ Artifact Surge Triggered: {'Yes' if self.artifact_surge_triggered else 'No'}\n")
            f.write(f"โš–๏ธ MLE Alert Level: {self.mle_alert_level}\n")
            f.write(f"๐Ÿ‘๏ธ MLE Intervened: {'Yes' if self.mle_awakened else 'No'}\n")
            if self.jorn_eliminated:
                f.write(f"\n๐Ÿ•ฏ๏ธ Jorn's Fate: Banished by dark plots.\n")
            f.write("===============================\n")

        print(f"๐Ÿ“ Final report saved to: {filename}")
# =============================================================================
# MAIN EXECUTION BLOCK
# =============================================================================

if __name__ == "__main__":
    print("="*60)
    print("๐ŸŽฎ WELCOME TO MYTHKEEPER: ASH PROTOCOL (GLOBAL SYSTEM EDITION) ๐ŸŽฎ")
    print("="*60)
    name = input("Enter your name, Commander: ")
    while True:
        game = MythkeeperGameEngine(name)

        while not game.game_over:
            print("\nNext Round in 1 second!\n\n")
            time.sleep(0.75)
            game.simulate_round()

The full, finished product (that is, as much as me and ChatGPT can program into one file, and still make improvements, I dont know what the limit of lines is doing it the way that I do it, or if there even is a limit, I would imagine it couldnt add code to some file piece by piece forever, I would think its memory would run out, I just have it write small pieces at a time, and add them here, or add them there, and add this there, and then it writes another small piece, if you want to write your own program, you have to ask ChatGPT to use it’s 4o version to write for you a list of steps it could take to write your program (ask for say, 10 steps with substeps), and then tell it to program one step at a time, and that you’ll paste the code into a text file wherever it tells you to, all of this you’ve gotta explain to it, and you’ll have any kind of program (even, tkinter gui apps, web apps,)

Bye for now.

You may also like...

1 Response

Leave a Reply

Your email address will not be published. Required fields are marked *