|
import random |
|
|
|
# Constants for game messages, roles, events, and outcomes |
|
ROLE_ENGINEER = "Engineer" |
|
ROLE_MEDIC = "Medic" |
|
ROLE_SCOUT = "Scout" |
|
|
|
ROLE_CHOICES = [ROLE_ENGINEER, ROLE_MEDIC, ROLE_SCOUT] |
|
|
|
INTRO = "Welcome to Space Expedition!" |
|
INTRO_DESC = "Your mission: travel to a distant exoplanet and ensure your survival in deep space.\nAlong the way, you'll face various challenges. Will you survive the voyage?" |
|
STARTING_MESSAGE = "Let's prepare your crew for the long journey through the stars!" |
|
HEALTH_STATUS = "You have {health}% health, {supplies} supplies, and ${money} credits." |
|
DAY_STATUS = "\nMonth {day}: {status}" |
|
|
|
# Define events with their descriptions and handling logic |
|
EVENTS = { |
|
"ASTEROID": { |
|
"description": "A field of asteroids approaches! Do you try to navigate through it or avoid it?", |
|
"choices": { |
|
"yes": { |
|
"text": "You skillfully navigate through the field, but your ship is damaged and you lose some fuel.", |
|
"health": -5, |
|
"supplies": -3 |
|
}, |
|
"no": { |
|
"text": "You decide to take a detour, avoiding the risk but losing time and some supplies.", |
|
"supplies": -2 |
|
} |
|
} |
|
}, |
|
"SUNFLARE": { |
|
"description": "A massive sunflare is detected! Do you shelter in the ship or keep moving?", |
|
"choices": { |
|
"yes": { |
|
"text": "You shelter in place, avoiding the sunflare’s effects, but your supplies are slightly depleted.", |
|
"supplies": -2 |
|
}, |
|
"no": { |
|
"text": "You push forward through the flare, but it damages your ship, causing some fuel loss and health depletion.", |
|
"supplies": -5, |
|
"health": -10 |
|
} |
|
} |
|
}, |
|
"SPACEWALK": { |
|
"description": "You need to perform a spacewalk to fix the hull. Do you risk it?", |
|
"choices": { |
|
"yes": { |
|
"text": "The spacewalk is successful, but it takes a toll on your health. A hard-earned victory.", |
|
"health": -10 |
|
}, |
|
"no": { |
|
"text": "You decide against the spacewalk and find an alternative repair method, but it costs you valuable time.", |
|
} |
|
} |
|
}, |
|
"ALIEN_ENCOUNTER": { |
|
"description": "An unidentified object approaches your ship. Do you investigate?", |
|
"choices": { |
|
"yes": { |
|
"text": "The object turns out to be an alien craft. They offer you strange technology in exchange for supplies.", |
|
"supplies": -5 |
|
}, |
|
"no": { |
|
"text": "You decide not to investigate and continue your journey, uncertain of what could have been." |
|
} |
|
} |
|
}, |
|
"RESOURCE_HARVEST": { |
|
"description": "You detect a nearby asteroid rich in resources. Do you mine it?", |
|
"choices": { |
|
"yes": { |
|
"text": "You successfully mine valuable minerals, gaining more supplies and money.", |
|
"supplies": 10, |
|
"money": 50 |
|
}, |
|
"no": { |
|
"text": "You decide not to mine and continue your journey, knowing the risks involved." |
|
} |
|
} |
|
}, |
|
"MALFUNCTION": { |
|
"description": "Your ship's navigation system has malfunctioned! Do you try to fix it yourself or call for help?", |
|
"choices": { |
|
"fix": { |
|
"text": "You manage to fix the navigation system, but it costs you valuable resources and time.", |
|
"supplies": -5, |
|
"health": -5 |
|
}, |
|
"call": { |
|
"text": "You call for help, but the team is not quick enough, and you lose valuable time.", |
|
"supplies": -3 |
|
} |
|
} |
|
}, |
|
"SHIP_WRECK": { |
|
"description": "A debris field is detected ahead, and your ship is damaged. Do you proceed cautiously or full speed ahead?", |
|
"choices": { |
|
"cautious": { |
|
"text": "You navigate cautiously through the debris, but your ship still takes minor damage.", |
|
"health": -5 |
|
}, |
|
"speed": { |
|
"text": "You speed through the wreckage, but the ship takes significant damage, and you lose resources.", |
|
"health": -15, |
|
"supplies": -10 |
|
} |
|
} |
|
}, |
|
"METEOR_SHOWER": { |
|
"description": "A meteor shower is coming your way. Do you try to dodge it or hide under the ship's shields?", |
|
"choices": { |
|
"dodge": { |
|
"text": "You skillfully dodge the meteors, but the ship takes minor damage.", |
|
"health": -3 |
|
}, |
|
"shield": { |
|
"text": "You hide under the ship's shields, avoiding the meteors. Your supplies are slightly affected.", |
|
"supplies": -2 |
|
} |
|
} |
|
}, |
|
"CREW_DISCUSSION": { |
|
"description": "The crew is becoming uneasy. Do you address the crew's concerns or ignore them?", |
|
"choices": { |
|
"address": { |
|
"text": "You calm the crew down and reassure them. Their morale increases, which helps improve your efficiency.", |
|
"health": 10 |
|
}, |
|
"ignore": { |
|
"text": "You ignore the crew’s concerns, and their morale suffers. This affects your ability to work efficiently.", |
|
"health": -5 |
|
} |
|
} |
|
}, |
|
"RADIATION_LEAK": { |
|
"description": "A radiation leak is detected in the engine room! Do you risk entering to fix it or seal the area?", |
|
"choices": { |
|
"enter": { |
|
"text": "You brave the radiation and fix the leak, but your health is affected by the radiation exposure.", |
|
"health": -20 |
|
}, |
|
"seal": { |
|
"text": "You seal the area and avoid exposure, but the ship's functionality is compromised for a while.", |
|
"supplies": -5 |
|
} |
|
} |
|
}, |
|
"GRAVITY_WELL": { |
|
"description": "A nearby gravity well is causing disturbances. Do you try to escape or ride it out?", |
|
"choices": { |
|
"escape": { |
|
"text": "You manage to escape the gravity well, but it drains a significant amount of fuel.", |
|
"supplies": -5 |
|
}, |
|
"ride": { |
|
"text": "You ride the gravity well, losing some supplies and health due to the unpredictable gravitational forces.", |
|
"health": -10, |
|
"supplies": -10 |
|
} |
|
} |
|
}, |
|
"BLACK_HOLE": { |
|
"description": "A black hole looms ahead! Do you risk passing close or take a longer route around?", |
|
"choices": { |
|
"pass": { |
|
"text": "You attempt to pass close, but the intense gravitational pull causes severe damage to your ship and loss of supplies.", |
|
"health": -25, |
|
"supplies": -15 |
|
}, |
|
"route": { |
|
"text": "You take a longer route, avoiding the black hole's influence but losing precious time and fuel.", |
|
"supplies": -10 |
|
} |
|
} |
|
}, |
|
"SPACE_STORM": { |
|
"description": "A violent space storm is approaching! Do you attempt to outrun it or seek shelter?", |
|
"choices": { |
|
"outrun": { |
|
"text": "You push the ship to its limits, narrowly outrunning the storm. However, the effort costs you health and supplies.", |
|
"health": -10, |
|
"supplies": -5 |
|
}, |
|
"shelter": { |
|
"text": "You find shelter behind an asteroid and wait out the storm. Your supplies are used, but you stay safe.", |
|
"supplies": -8 |
|
} |
|
} |
|
}, |
|
"ALIEN_ABDUCTION": { |
|
"description": "A strange vessel pulls you into its tractor beam. Do you cooperate or resist?", |
|
"choices": { |
|
"cooperate": { |
|
"text": "You cooperate with the aliens and gain valuable information about their technology, but lose some supplies in the process.", |
|
"supplies": -5, |
|
"money": 30 |
|
}, |
|
"resist": { |
|
"text": "You resist, leading to a conflict with the aliens. They damage your ship, and you lose health and resources.", |
|
"health": -15, |
|
"supplies": -10 |
|
} |
|
} |
|
}, |
|
"MYSTERIOUS_SIGNAL": { |
|
"description": "You detect a mysterious distress signal. Do you investigate?", |
|
"choices": { |
|
"yes": { |
|
"text": "You investigate and find a stranded crew, who offer you supplies in gratitude.", |
|
"supplies": 10 |
|
}, |
|
"no": { |
|
"text": "You decide to ignore the signal, uncertain of its source. The journey continues uneventfully." |
|
} |
|
} |
|
}, |
|
"SHIP_REPAIR": { |
|
"description": "Your ship’s hull is damaged. Do you attempt a repair yourself or wait for help?", |
|
"choices": { |
|
"repair": { |
|
"text": "You manage to patch the hull, but it costs you valuable supplies and time.", |
|
"supplies": -8, |
|
"time": -2 |
|
}, |
|
"wait": { |
|
"text": "You wait for help, but the damage worsens and your ship becomes harder to manage.", |
|
"health": -5, |
|
"supplies": -3 |
|
} |
|
} |
|
}, |
|
"SPACE_PIRATES": { |
|
"description": "Pirates have boarded your ship! Do you fight them off or surrender?", |
|
"choices": { |
|
"fight": { |
|
"text": "You successfully fend off the pirates, but your ship suffers considerable damage and your crew is shaken.", |
|
"health": -15, |
|
"supplies": -10 |
|
}, |
|
"surrender": { |
|
"text": "You surrender to the pirates, losing supplies and money, but avoiding more serious damage to the ship.", |
|
"supplies": -20, |
|
"money": -50 |
|
} |
|
} |
|
}, |
|
"TERRAFORMING": { |
|
"description": "A planet is in the process of being terraformed. Do you investigate the project or continue on your path?", |
|
"choices": { |
|
"investigate": { |
|
"text": "You investigate the terraforming process, learning valuable data but losing some time and supplies.", |
|
"supplies": -5, |
|
"time": -3 |
|
}, |
|
"continue": { |
|
"text": "You decide to keep your distance and continue your journey, avoiding unnecessary delays." |
|
} |
|
} |
|
}, |
|
"TECHNOLOGY_MALFUNCTION": { |
|
"description": "One of your key systems malfunctions. Do you attempt to fix it or replace it?", |
|
"choices": { |
|
"fix": { |
|
"text": "You fix the malfunction, but it takes a toll on your supplies and health.", |
|
"supplies": -10, |
|
"health": -5 |
|
}, |
|
"replace": { |
|
"text": "You replace the system, but it costs you money and time.", |
|
"money": -100, |
|
"time": -5 |
|
} |
|
} |
|
}, |
|
"WORMHOLE": { |
|
"description": "A wormhole appears ahead! Do you enter it or avoid it?", |
|
"choices": { |
|
"enter": { |
|
"text": "You enter the wormhole and are transported to an unknown part of space, losing valuable resources in the process.", |
|
"supplies": -20 |
|
}, |
|
"avoid": { |
|
"text": "You decide to avoid the wormhole, but it means missing out on potential opportunities for exploration." |
|
} |
|
} |
|
}, |
|
"SPACE_RADIATION": { |
|
"description": "The ship is passing through a dangerous radiation field. Do you reroute the power or push through?", |
|
"choices": { |
|
"reroute": { |
|
"text": "You reroute the power, preventing significant damage but depleting some of your resources.", |
|
"supplies": -5 |
|
}, |
|
"push": { |
|
"text": "You push through the radiation field, causing damage to the ship’s electronics and some crew members.", |
|
"health": -15, |
|
"supplies": -10 |
|
} |
|
} |
|
}, |
|
"VIRAL_OUTBREAK": { |
|
"description": "A viral outbreak has spread among the crew! Do you quarantine the affected members or attempt to treat them?", |
|
"choices": { |
|
"quarantine": { |
|
"text": "You quarantine the affected crew members, preventing the virus from spreading, but losing some time and supplies.", |
|
"supplies": -5 |
|
}, |
|
"treat": { |
|
"text": "You attempt to treat the infected crew, but it takes a toll on your resources and health.", |
|
"supplies": -10, |
|
"health": -5 |
|
} |
|
} |
|
}, |
|
"WEAPONS_TEST": { |
|
"description": "You stumble upon an old weapons testing facility. Do you explore it or leave it alone?", |
|
"choices": { |
|
"explore": { |
|
"text": "You explore the facility and find valuable tech but trigger some security defenses, damaging the ship.", |
|
"supplies": 10, |
|
"health": -10 |
|
}, |
|
"leave": { |
|
"text": "You leave the facility untouched, avoiding the risk but missing the potential rewards.", |
|
} |
|
} |
|
}, |
|
"DIPLOMATIC_MISSION": { |
|
"description": "A diplomatic mission requires your assistance. Do you take part in the mission or continue your journey?", |
|
"choices": { |
|
"take_part": { |
|
"text": "You successfully assist with the mission, improving relations with a nearby faction and gaining some supplies.", |
|
"supplies": 10, |
|
"money": 20 |
|
}, |
|
"continue": { |
|
"text": "You continue on your way, avoiding the responsibility but losing the chance for potential rewards.", |
|
} |
|
} |
|
}, |
|
"BANDIT_ATTACK": { |
|
"description": "A group of bandits is attacking your supply ship. Do you intervene or leave them be?", |
|
"choices": { |
|
"intervene": { |
|
"text": "You engage with the bandits, successfully defeating them but suffering some damage to your own ship.", |
|
"health": -10, |
|
"supplies": -5 |
|
}, |
|
"leave": { |
|
"text": "You decide to ignore the attack and keep your distance, but lose some of your supplies.", |
|
"supplies": -5 |
|
} |
|
} |
|
}, |
|
"STAR_EXPLOSION": { |
|
"description": "A nearby star is about to explode! Do you try to escape or take the risk of collecting data?", |
|
"choices": { |
|
"escape": { |
|
"text": "You narrowly escape the star's explosion, but the event causes a loss in fuel and supplies.", |
|
"supplies": -5 |
|
}, |
|
"collect": { |
|
"text": "You decide to collect data, gaining scientific knowledge but suffering health and equipment damage from the explosion.", |
|
"health": -15, |
|
"supplies": -10 |
|
} |
|
} |
|
}, |
|
"COSMIC_STORM": { |
|
"description": "A cosmic storm is raging in your path. Do you attempt to navigate through it or wait it out?", |
|
"choices": { |
|
"navigate": { |
|
"text": "You successfully navigate through the storm, avoiding major damage but consuming a lot of fuel.", |
|
"supplies": -10 |
|
}, |
|
"wait": { |
|
"text": "You wait out the storm, losing valuable time and supplies, but your ship stays intact.", |
|
"supplies": -5 |
|
} |
|
} |
|
}, |
|
"TRADING_POST": { |
|
"description": "You encounter a friendly trading post. They offer you supplies in exchange for some of your resources. Do you trade?", |
|
"choices": { |
|
"yes": { |
|
"text": "You trade some of your supplies for useful items, gaining fuel and food.", |
|
"supplies": 5 |
|
}, |
|
"no": { |
|
"text": "You decline the trade and continue on your journey. While you lose nothing, you miss out on helpful resources." |
|
} |
|
} |
|
}, |
|
"SPACE_QUIZ": { |
|
"description": "You stumble upon a space station holding a quiz competition. If you win, they’ll reward you with resources. Do you participate?", |
|
"choices": { |
|
"yes": { |
|
"text": "You participate in the quiz and win! The space station rewards you with some supplies and money.", |
|
"supplies": 5, |
|
"money": 20 |
|
}, |
|
"no": { |
|
"text": "You decide not to participate and continue on your way. No rewards, but you avoid the risk of failure." |
|
} |
|
} |
|
}, |
|
"ANCIENT_ARTIFACT": { |
|
"description": "You discover an ancient artifact while exploring an abandoned space station. It’s worth quite a bit of money. Do you keep it?", |
|
"choices": { |
|
"yes": { |
|
"text": "You keep the artifact, and later sell it for a nice sum. You gain money.", |
|
"money": 50 |
|
}, |
|
"no": { |
|
"text": "You leave the artifact behind, but feel at peace knowing you did the right thing." |
|
} |
|
} |
|
}, |
|
"HELPFUL_CREW_MEMBER": { |
|
"description": "One of your crew members has developed a new skill that can assist with ship repairs or boost morale. Do you promote them?", |
|
"choices": { |
|
"yes": { |
|
"text": "The crew member’s new skills help improve efficiency, giving a small boost to health and morale.", |
|
"health": 5 |
|
}, |
|
"no": { |
|
"text": "You decide to keep the crew member in their current role, but their potential remains untapped." |
|
} |
|
} |
|
}, |
|
"RESOURCE_GRANT": { |
|
"description": "A nearby friendly fleet offers you a small grant of resources to help with your journey. Do you accept?", |
|
"choices": { |
|
"yes": { |
|
"text": "You accept the grant and gain valuable supplies and fuel.", |
|
"supplies": 10 |
|
}, |
|
"no": { |
|
"text": "You politely decline the offer and continue on your journey, but the gesture is appreciated." |
|
} |
|
} |
|
}, |
|
"SPACE_HOSPITAL": { |
|
"description": "You encounter a space hospital offering free treatment for any crew members in need. Do you stop for treatment?", |
|
"choices": { |
|
"yes": { |
|
"text": "Your crew receives free treatment, improving their health and boosting morale.", |
|
"health": 10 |
|
}, |
|
"no": { |
|
"text": "You decide to move on without stopping, but your crew remains in good health." |
|
} |
|
} |
|
}, |
|
"WELL_OILED_MACHINE": { |
|
"description": "Your ship is running smoothly, and your crew is working well together. Do you take the opportunity to improve efficiency?", |
|
"choices": { |
|
"yes": { |
|
"text": "You take the opportunity to improve efficiency, slightly boosting your resources and morale.", |
|
"supplies": 5 |
|
}, |
|
"no": { |
|
"text": "You decide to continue as is, avoiding unnecessary risks or changes." |
|
} |
|
} |
|
}, |
|
"QUIET_SPACE": { |
|
"description": "You find a quiet, calm part of space with no immediate threats or disturbances. Do you take a break?", |
|
"choices": { |
|
"yes": { |
|
"text": "The peaceful break helps your crew relax and regain some morale and health.", |
|
"health": 5 |
|
}, |
|
"no": { |
|
"text": "You continue on your journey without rest, pushing ahead without significant effects." |
|
} |
|
} |
|
}, |
|
"FRIENDLY_SHIP": { |
|
"description": "A friendly ship passes by and offers you some supplies. Do you accept their offer?", |
|
"choices": { |
|
"yes": { |
|
"text": "The friendly ship gives you some extra supplies and fuel to continue your journey.", |
|
"supplies": 10 |
|
}, |
|
"no": { |
|
"text": "You politely decline and continue on your journey, knowing that you’re fine without additional help." |
|
} |
|
} |
|
}, |
|
"CLEAN_UP": { |
|
"description": "You find a small debris field of discarded tech and ship parts. Do you scavenge for useful items?", |
|
"choices": { |
|
"yes": { |
|
"text": "You find some useful parts that can be traded or used for repairs, gaining a small amount of supplies.", |
|
"supplies": 5 |
|
}, |
|
"no": { |
|
"text": "You decide not to scavenge, avoiding potential risks, but miss out on useful resources." |
|
} |
|
} |
|
}, |
|
} |
|
|
|
ENGINEER_QUESTS = [ |
|
("The engine room needs an upgrade. Do you invest your resources to improve it?", 10, 10, 100, 0.2), |
|
("A panel is malfunctioning. Do you try to fix it or leave it?", 5, -2, 50, 0.3), |
|
("Your tools need better calibration. Do you spend time fixing them?", 0, 5, 30, 0.1), |
|
("You find an old blueprint for a more efficient engine. Do you build it?", 15, 20, 200, 0.25), |
|
("A critical power outage occurs. Do you attempt to restore power?", 20, -5, 75, 0.4), |
|
("The ship's exhaust system is clogged. Do you fix it now or wait?", 10, 10, 80, 0.15), |
|
("A mechanical arm breaks down. Do you try to fix it yourself?", 10, 0, 50, 0.3), |
|
("A strange humming sound is coming from the reactor. Investigate?", 20, -10, 150, 0.25), |
|
("The oxygen filter needs recalibration. Do you handle it?", 5, 5, 40, 0.2), |
|
("The power grid is unstable. Do you reroute the energy?", 25, 10, 200, 0.35), |
|
("You discover a mysterious malfunction in the propulsion system. Do you investigate?", 20, 15, 250, 0.3), |
|
("The ship's hull has developed a crack. Do you attempt a repair?", 15, -5, 100, 0.4), |
|
("A plasma leak is detected. Do you risk fixing it yourself?", 30, -10, 150, 0.5), |
|
("You find an alien tech upgrade hidden in the storage. Do you integrate it?", 25, 25, 300, 0.2), |
|
("The ship's heat shields are malfunctioning. Do you repair them?", 20, 10, 150, 0.3), |
|
("A cooling unit fails. Do you try to repair it yourself?", 15, 0, 50, 0.3), |
|
("A malfunction in the artificial gravity system occurs. Do you investigate?", 25, 10, 200, 0.4), |
|
("The main engine has overheated. Do you cool it down manually?", 30, -15, 200, 0.4), |
|
("A wiring issue in the power distribution system is causing instability. Do you fix it?", 20, -5, 100, 0.3), |
|
("The ship's communication array is malfunctioning. Do you repair it?", 10, 10, 80, 0.25), |
|
("A rogue AI is disrupting the engine controls. Do you try to disable it?", 35, -20, 250, 0.5), |
|
("You find an unused, older engine model. Do you restore it?", 15, 30, 150, 0.2), |
|
("The cooling pumps are breaking down. Do you try to repair them?", 10, 10, 75, 0.35), |
|
("The ship's reactor core is running unstable. Do you stabilize it?", 30, -10, 250, 0.4), |
|
("A strange energy signature is detected near the reactor. Investigate?", 20, 0, 100, 0.3), |
|
("You find a hidden compartment in the engine bay. Do you open it?", 25, 15, 200, 0.2), |
|
("The turbo boosters are malfunctioning. Do you fix them?", 20, 10, 150, 0.25), |
|
("The thrusters are misaligned. Do you realign them?", 15, -5, 100, 0.3), |
|
("A small fire has broken out in the engine room. Do you try to extinguish it?", 10, 5, 50, 0.4), |
|
("The coolant levels are dangerously low. Do you replenish them?", 15, 0, 50, 0.2), |
|
("A massive overload is imminent in the reactor. Do you attempt a shutdown?", 35, -20, 300, 0.5), |
|
("You notice irregular vibrations from the reactor. Investigate?", 20, 10, 200, 0.3), |
|
("The fuel supply system is showing signs of leakage. Do you repair it?", 10, 10, 80, 0.35), |
|
("You discover an alien alloy. Do you test its properties?", 25, 20, 250, 0.3), |
|
("A malfunctioning valve is causing the engine to sputter. Do you repair it?", 10, 5, 60, 0.25), |
|
("A space-time distortion is causing electrical issues. Do you investigate?", 20, 15, 250, 0.4), |
|
("A coolant pipe is about to burst. Do you replace it?", 15, -5, 100, 0.3), |
|
("The ship’s radar system is down. Do you attempt to fix it?", 20, 10, 150, 0.2), |
|
("A small explosion occurs in the engine room. Do you repair the damage?", 25, -10, 200, 0.45), |
|
("A missing part has left the engine incomplete. Do you find a replacement?", 30, 5, 100, 0.3), |
|
("A major sensor malfunction is affecting navigation. Do you repair it?", 20, 10, 150, 0.35), |
|
("The main engines are low on fuel. Do you refuel them?", 10, 15, 50, 0.25), |
|
("The hull is taking on space debris. Do you reinforce it?", 15, 10, 100, 0.4), |
|
("A critical valve is malfunctioning. Do you attempt to fix it?", 25, 0, 150, 0.3), |
|
("You find a potential new fuel source. Do you test it in the engine?", 20, 20, 200, 0.3), |
|
("A malfunction in the cargo bay is preventing repairs. Do you clear it?", 15, 5, 100, 0.25), |
|
("The artificial intelligence is overloading the engine systems. Do you override it?", 30, -10, 250, 0.4), |
|
("The ship’s power relays are failing. Do you replace them?", 25, 5, 150, 0.35), |
|
("You discover a malfunctioning sensor array. Do you fix it?", 20, 0, 100, 0.2), |
|
("A stray asteroid impacts the ship’s engines. Do you repair the damage?", 30, -10, 200, 0.5), |
|
("The ion thrusters are misfiring. Do you fix them?", 15, 10, 100, 0.3), |
|
("You find an alien power core. Do you integrate it into the ship?", 35, 20, 300, 0.25), |
|
("The ship's antimatter reactor is unstable. Do you attempt to stabilize it?", 40, -15, 500, 0.4), |
|
("A critical pipeline is clogged. Do you clear it?", 10, 5, 75, 0.3), |
|
("The magnetic field stabilizers are malfunctioning. Do you fix them?", 15, 5, 100, 0.25), |
|
("A laser communication device is failing. Do you repair it?", 10, 10, 60, 0.35), |
|
("You find an unknown device in the engine room. Do you investigate?", 25, 15, 200, 0.3), |
|
("The ion shields are depleting faster than usual. Do you repair them?", 15, 10, 120, 0.3), |
|
("You find a corrupted control chip in the engine system. Do you replace it?", 20, 5, 150, 0.3), |
|
("A cargo drone is stuck in the engine room. Do you release it?", 5, 10, 50, 0.25), |
|
("A nearby star's radiation is affecting the engine. Do you protect it?", 25, 0, 200, 0.35), |
|
("You find an abandoned storage unit in the engine bay. Do you open it?", 15, 10, 100, 0.2), |
|
("The reactor’s core temperature is rising. Do you cool it down?", 25, -10, 200, 0.3) |
|
] |
|
SCOUT_QUESTS = [ |
|
("You detect an unexplored planet. Do you land and explore?", 20, 10, 150, 0.1), |
|
("You find a hidden cave on a nearby asteroid. Do you investigate?", 10, 5, 50, 0.2), |
|
("You come across an unknown signal. Do you investigate?", 5, 10, 100, 0.3), |
|
("You discover a vast asteroid field. Do you attempt to map it?", 15, 15, 200, 0.2), |
|
("A strange artifact is found on a deserted planet. Do you examine it?", 25, 20, 300, 0.25), |
|
("You find a group of survivors on an unknown moon. Do you offer help?", 30, 10, 250, 0.3), |
|
("A nebula blocks your navigation system. Do you try to navigate through?", 10, 10, 150, 0.2), |
|
("You stumble upon a crashed spaceship. Do you investigate?", 20, 10, 200, 0.3), |
|
("A distress signal leads to an unknown location. Do you follow it?", 15, 5, 100, 0.15), |
|
("You find a hidden alien outpost. Do you attempt to enter?", 30, 20, 500, 0.35), |
|
("You find a dangerous, unexplored asteroid belt. Do you chart it?", 15, 5, 150, 0.25), |
|
("A rare celestial event occurs. Do you study it?", 10, 15, 200, 0.2), |
|
("You encounter a hostile alien species. Do you try to negotiate?", 25, -10, 400, 0.4), |
|
("You uncover a black hole on the edge of the galaxy. Do you explore?", 30, 10, 500, 0.35), |
|
("You find a spaceship wreck with valuable resources. Do you salvage?", 15, 10, 150, 0.3), |
|
("You detect an anomaly in the nearby star system. Do you investigate?", 20, 10, 250, 0.2), |
|
("You encounter a space station with strange signals. Do you investigate?", 10, 5, 200, 0.25), |
|
("You discover an ancient alien ruin. Do you explore?", 25, 15, 350, 0.3), |
|
("You come across a giant asteroid with unknown resources. Do you mine it?", 15, 10, 200, 0.25), |
|
("You detect an unknown fleet in deep space. Do you investigate?", 20, 10, 300, 0.3), |
|
("You discover a secret hideout on a remote moon. Do you enter?", 30, 25, 400, 0.4), |
|
("You come across an unusual celestial formation. Do you study it?", 10, 10, 150, 0.2), |
|
("You encounter a rogue satellite. Do you inspect it?", 15, 5, 100, 0.3), |
|
("You find a drifting derelict ship. Do you explore it?", 10, 10, 250, 0.35), |
|
("A nearby star is about to go supernova. Do you attempt to study it?", 30, -15, 500, 0.4), |
|
("You discover a hidden planet with unusual life forms. Do you explore?", 20, 15, 350, 0.3), |
|
("You find a strange signal originating from a distant star. Do you follow it?", 25, 10, 400, 0.25), |
|
("A rogue comet is heading towards a nearby colony. Do you warn them?", 15, 5, 200, 0.3), |
|
("You find a remote asteroid base. Do you attempt to contact them?", 20, 15, 300, 0.25), |
|
("You come across a rare cosmic phenomenon. Do you study it?", 10, 5, 150, 0.2), |
|
("You detect a temporal anomaly. Do you attempt to investigate?", 25, 20, 400, 0.35), |
|
("You stumble upon a group of space pirates. Do you negotiate with them?", 30, -10, 300, 0.3), |
|
("You find a deserted research station. Do you investigate?", 15, 5, 250, 0.2), |
|
("You detect a strange energy pulse coming from a nearby moon. Do you explore?", 20, 10, 300, 0.25), |
|
("You find a rare mineral on a distant planet. Do you collect it?", 10, 5, 100, 0.2), |
|
("A massive storm is heading towards a colony. Do you warn them?", 15, -5, 150, 0.2), |
|
("You find a crashed alien ship. Do you explore it?", 20, 15, 250, 0.3), |
|
("A solar flare disrupts communication. Do you try to fix the signal?", 5, 10, 100, 0.15), |
|
("You discover a strange alien structure on a nearby moon. Do you explore?", 25, 20, 350, 0.35), |
|
("You find a massive asteroid with valuable metals. Do you mine it?", 20, 10, 300, 0.3), |
|
("You detect a massive gravitational anomaly. Do you investigate?", 30, 5, 400, 0.3), |
|
("You discover a hidden signal from an ancient civilization. Do you trace it?", 25, 15, 500, 0.35), |
|
("You encounter a space storm. Do you navigate through it?", 15, -10, 200, 0.4), |
|
("You discover an alien artifact with unknown technology. Do you examine it?", 30, 10, 500, 0.3), |
|
("You find a new species of space fauna. Do you study it?", 20, 10, 300, 0.25), |
|
("You find a remote outpost with unknown technology. Do you investigate?", 25, 10, 400, 0.35), |
|
("You discover an abandoned colony. Do you explore?", 10, 5, 150, 0.3), |
|
("You come across a mysterious planet. Do you investigate?", 20, 10, 200, 0.2), |
|
("A strange anomaly is detected near a space station. Do you investigate?", 25, 15, 300, 0.25), |
|
("You find an uncharted moon. Do you explore it?", 10, 5, 100, 0.2), |
|
("You find a powerful ancient relic. Do you study it?", 30, 20, 400, 0.35), |
|
("You discover a hidden alien colony. Do you make contact?", 20, 10, 250, 0.3) |
|
] |
|
MEDIC_QUESTS = [ |
|
("A crew member has an injury. Do you treat it?", 10, 0, 50, 0.15), |
|
("A crew member has a fever. Do you create a cure?", 5, 5, 30, 0.2), |
|
("You find an uncharted medical plant. Do you experiment with it?", 15, 0, 100, 0.25), |
|
("A vital medicine supply is running low. Do you try to craft more?", 20, -5, 60, 0.3), |
|
("You come across an injured alien. Do you attempt to treat them?", 25, 10, 150, 0.4), |
|
("A plague is spreading. Do you try to contain it?", 10, 20, 100, 0.2), |
|
("A vital organ transplant is needed. Do you take the risk?", 30, -10, 200, 0.35), |
|
("A strange medical anomaly occurs. Do you investigate it?", 10, 10, 50, 0.15), |
|
("You come across a crew member suffering from radiation poisoning. Do you treat them?", 20, 5, 100, 0.25), |
|
("A rare disease is spreading in the crew. Do you attempt to cure it?", 30, -5, 200, 0.4), |
|
("You find an alien species with unknown anatomy. Do you study them?", 15, 10, 100, 0.3), |
|
("A crew member is suffering from extreme dehydration. Do you help?", 10, 10, 75, 0.2), |
|
("A new type of bacteria is discovered in the ship's water supply. Do you clean it?", 5, 10, 50, 0.15), |
|
("The crew is suffering from extreme mental stress. Do you perform a psychological intervention?", 20, 10, 150, |
|
0.3), |
|
("You find a cure for a viral infection. Do you share it with the crew?", 25, 10, 200, 0.4), |
|
("A crew member suffers a severe allergic reaction. Do you administer an antidote?", 15, 5, 100, 0.25), |
|
("A dangerous toxin is contaminating the air supply. Do you purify it?", 30, -5, 150, 0.35), |
|
("A crew member has been poisoned. Do you try to neutralize the poison?", 20, 10, 100, 0.3), |
|
("A wounded crew member requires a blood transfusion. Do you assist?", 10, 5, 50, 0.2), |
|
("A ship-wide virus is making rounds. Do you develop a vaccine?", 25, 0, 150, 0.4), |
|
("A crew member has an unknown disease. Do you attempt to diagnose it?", 20, 10, 75, 0.25), |
|
("A mysterious rash is spreading. Do you investigate the cause?", 10, 5, 50, 0.3), |
|
("The medbay’s equipment is malfunctioning. Do you try to fix it?", 15, -5, 100, 0.2), |
|
("You find a powerful herb that can heal wounds. Do you use it on a crew member?", 10, 0, 75, 0.3), |
|
("A crew member has been infected by an alien pathogen. Do you attempt a cure?", 25, 15, 200, 0.4), |
|
("You’re running low on medical supplies. Do you scavenge for more?", 15, -5, 50, 0.3), |
|
("A sudden outbreak of sleep disorders has affected the crew. Do you try to fix it?", 10, 10, 80, 0.25), |
|
("You notice a mutation in a medical plant. Do you experiment with it?", 30, 5, 150, 0.3), |
|
("A crew member is suffering from severe burns. Do you treat them?", 20, 10, 100, 0.25), |
|
("You discover a hidden medical facility. Do you investigate it?", 25, 5, 200, 0.3), |
|
("A vaccine you developed is showing side effects. Do you recall it?", 15, -10, 100, 0.2), |
|
("A deadly parasite is infecting a crew member. Do you remove it?", 30, 10, 150, 0.4), |
|
("You come across a non-human lifeform infected with an unknown disease. Do you treat it?", 25, 15, 150, 0.35), |
|
("A crew member has broken a bone. Do you help them heal?", 10, 5, 50, 0.2), |
|
("A new virus is spreading rapidly. Do you quarantine the crew?", 20, 10, 150, 0.25), |
|
("You discover that the crew's diet is affecting their health. Do you change it?", 15, 10, 100, 0.3), |
|
("You find a mysterious artifact that causes strange symptoms. Do you study it?", 20, 10, 150, 0.4), |
|
("A vital organ donor is needed. Do you search for one?", 30, -5, 200, 0.35), |
|
("A crew member is suffering from extreme anxiety. Do you offer therapy?", 10, 5, 75, 0.25), |
|
("A crew member's health is deteriorating rapidly. Do you perform a risky procedure?", 35, -10, 200, 0.4), |
|
("A rare disease spreads across the crew. Do you create an antidote?", 25, 15, 200, 0.45), |
|
("The medbay is under repair. Do you try to treat patients manually?", 15, 5, 50, 0.2), |
|
("A viral infection is resistant to your medicines. Do you try new treatments?", 30, 0, 150, 0.4), |
|
("You find a book detailing ancient medical practices. Do you read it?", 10, 5, 50, 0.1), |
|
("A crew member needs psychological therapy. Do you assist?", 20, 5, 100, 0.25), |
|
("The ship's air is filled with toxins. Do you filter it?", 25, 10, 150, 0.3), |
|
("You find a rare herb that could speed up healing. Do you use it?", 15, 5, 75, 0.3), |
|
("The water supply has been contaminated. Do you clean it?", 20, 0, 100, 0.2), |
|
("A crew member has gone missing. Do you search for them?", 20, 10, 150, 0.35), |
|
("You find a strange crystal that seems to have medicinal properties. Do you study it?", 25, 5, 150, 0.3), |
|
("The crew has developed a strange mutation. Do you try to reverse it?", 30, -10, 250, 0.45), |
|
("A dangerous pathogen is in the air. Do you purify it?", 20, 10, 150, 0.4), |
|
( |
|
"A crew member has an infection that isn’t responding to treatment. Do you try a different method?", 25, 0, |
|
100, |
|
0.3), |
|
("You find a rare resource that could improve the medbay. Do you use it?", 15, 10, 75, 0.3), |
|
("A new medical technology could help improve the crew’s health. Do you develop it?", 20, 15, 200, 0.35), |
|
("A crew member suffers from a critical condition. Do you operate?", 30, -5, 200, 0.4), |
|
("You come across an ancient healing device. Do you activate it?", 25, 10, 150, 0.25), |
|
("A crew member has a chronic illness. Do you attempt a permanent cure?", 20, 5, 100, 0.3), |
|
("The medbay's power is going out. Do you repair it?", 10, 5, 50, 0.2), |
|
("A patient has developed an infection resistant to all known treatments. Do you try a radical approach?", 35, |
|
10, 250, 0.5), |
|
("You find a dangerous medical anomaly in the ship’s systems. Do you investigate?", 30, 5, 200, 0.4) |
|
] |
|
|
|
|
|
class SpaceExpeditionGame: |
|
def __init__(self): |
|
self.player_name = "" |
|
self.n_months = 42 |
|
self.role = "" |
|
self.health = 0 |
|
self.supplies = 0 |
|
self.money = 0 |
|
self.month = 1 |
|
|
|
def introduction(self): |
|
print(INTRO) |
|
print(INTRO_DESC) |
|
print(STARTING_MESSAGE) |
|
|
|
self.player_name = input("What's your name, brave astronaut?\n> ") |
|
print(f"Ah, {self.player_name}. A fine name! Now, let's choose your role for this mission.") |
|
|
|
print("1. Engineer: You start with more resources and better skills at repairing the ship.") |
|
print("2. Medic: You can heal the crew better and start with additional health.") |
|
print("3. Scout: You can gather resources more efficiently but start with fewer supplies.") |
|
|
|
role_choice = input("Choose your role (1, 2, or 3): ") |
|
self.role = ROLE_CHOICES[int(role_choice) - 1] |
|
|
|
print(f"You chose to be a {self.role}. The {self.n_months} months mission is about to begin!") |
|
|
|
def start_role(self): |
|
if self.role == ROLE_ENGINEER: |
|
self.health, self.supplies, self.money = 100, self.n_months, 300 |
|
elif self.role == ROLE_MEDIC: |
|
self.health, self.supplies, self.money = 120, self.n_months - 10, 150 |
|
elif self.role == ROLE_SCOUT: |
|
self.health, self.supplies, self.money = 90, self.n_months - 15, 200 |
|
|
|
def random_event(self): |
|
event_key = random.choice(list(EVENTS.keys())) |
|
event = EVENTS[event_key] |
|
print(event["description"]) |
|
return event_key |
|
|
|
def handle_event(self, event_key): |
|
event = EVENTS[event_key] |
|
choice = input(f"Choose an option: {', '.join(event['choices'].keys())}: ").lower() |
|
|
|
if choice in event['choices']: |
|
action = event['choices'][choice] |
|
print(action['text']) |
|
|
|
# Update stats based on the choice |
|
self.health += action.get("health", 0) |
|
self.supplies += action.get("supplies", 0) |
|
self.money += action.get("money", 0) |
|
|
|
def check_health(self): |
|
if self.health <= 0: |
|
print("Oh no! Your health has deteriorated to zero. You did not survive the journey.") |
|
return False |
|
return True |
|
|
|
def side_quest(self): |
|
if self.role == ROLE_ENGINEER: |
|
return self._side_quest(ENGINEER_QUESTS) |
|
elif self.role == ROLE_MEDIC: |
|
return self._side_quest(MEDIC_QUESTS) |
|
elif self.role == ROLE_SCOUT: |
|
return self._side_quest(SCOUT_QUESTS) |
|
return 0, 0, 0 |
|
|
|
def chance_of_failure(self, failure_rate): |
|
return random.random() < failure_rate |
|
|
|
def _side_quest(self, side_quests): |
|
quest = random.choice(side_quests) |
|
print(quest[0]) |
|
choice = input("Do you take the challenge? (yes/no): ") |
|
if choice.lower() == "yes": |
|
if self.chance_of_failure(quest[4]): |
|
print(f"Failure! You lost {quest[1]} health, {quest[2]} supplies, and ${quest[3]}.") |
|
return -quest[1], -quest[2], -quest[3] |
|
else: |
|
print(f"Success! You gained {quest[1]} health, {quest[2]} supplies, and ${quest[3]}!") |
|
return quest[1], quest[2], quest[3] |
|
else: |
|
print("You decide not to pursue this. No gains or losses.") |
|
return 0, 0, 0 |
|
|
|
def main(self): |
|
self.introduction() |
|
self.start_role() |
|
|
|
while True: |
|
if self.supplies <= 0: |
|
print(DAY_STATUS.format(day=self.month, status="Out of supplies")) |
|
self.health -= 2 |
|
self.health = max(self.health, 0) |
|
print("There is nothing to eat. Health decreased") |
|
if self.health <= 0: |
|
print("You died of starvation") |
|
break |
|
else: |
|
print(DAY_STATUS.format(day=self.month, status="All is well")) |
|
# Consume resources (supplies and health) |
|
self.supplies -= 1 # Example: 1 supply consumed each day |
|
print("Resources consumed. Supplies decreased.") |
|
|
|
self.supplies = max(self.supplies, 0) |
|
|
|
# Show status and prompt for action |
|
print(HEALTH_STATUS.format(health=self.health, supplies=self.supplies, money=self.money)) |
|
|
|
# Random events |
|
if random.randint(1, 50) % 2 == 0: |
|
event = self.random_event() |
|
self.handle_event(event) |
|
|
|
# Check health and decide whether the player survives |
|
if not self.check_health(): |
|
break |
|
|
|
# Trigger side quest |
|
if random.randint(1, 50) % 3 == 0: |
|
health_bonus, supplies_bonus, money_bonus = self.side_quest() |
|
self.health += health_bonus |
|
self.supplies += supplies_bonus |
|
self.money += money_bonus |
|
self.health = min(self.health, 100) |
|
|
|
self.month += 1 |
|
if self.month > self.n_months: |
|
print("The mission has been completed successfully!") |
|
break |
|
|
|
|
|
# Start the game |
|
if __name__ == "__main__": |
|
game = SpaceExpeditionGame() |
|
game.main() |