import {Content} from "ui"; import {ArgsTable, Meta, Story} from "@storybook/addon-docs"; <Meta title="Components/Text/Content/old" component={Content}/> export const Template = (args) => <Content {...args} />; # Content This component renders a styled `<span>` for the main text content. ## Props <ArgsTable story="Default"/> ## Examples <Story name="Default" args={{text: "Example"}}> {Template.bind({})} </Story>
import {ErrorText} from "ui"; import {ArgsTable, Meta, Story} from "@storybook/addon-docs"; <Meta title="Components/Text/ErrorText/old" component={ErrorText}/> export const Template = (args) => <ErrorText {...args} />; # ErrorText This component renders a styled `<span>` for any error text. ## Props <ArgsTable story="Default"/> ## Examples <Story name="Default" args={{text: "Example"}}> {Template.bind({})} </Story>
import {Heading} from "ui"; import {ArgsTable, Meta, Story} from "@storybook/addon-docs"; <Meta title="Components/Text/Heading/old" component={Heading}/> export const Template = (args) => <Heading {...args} />; # Heading This component renders a styled `<H2>` and should be used for the most important headings on the page. ## Props <ArgsTable story="Default"/> ## Examples <Story name="Default" args={{text: "Example"}}> {Template.bind({})} </Story>
import {HeadingLink} from "ui"; import {ArgsTable, Meta, Story} from "@storybook/addon-docs"; <Meta title="Components/Text/HeadingLink/old" component={HeadingLink}/> export const Template = (args) => <HeadingLink {...args} />; # HeadingLink This component renders a styled `<H2>` and should be used for the most important headings on the page. ## Props <ArgsTable story="Default"/> ## Examples <Story name="Default" args={{ icon: "home", text: "Example", href: "https://www.spot-ship.com", removeHover: false, background: "Info", fullWidth: false, }} > {Template.bind({})} </Story>
import {Keyboard} from "ui"; import {ArgsTable, Meta, Story} from "@storybook/addon-docs"; <Meta title="Components/Text/Keyboard/old" component={Keyboard}/> export const Template = (args) => <Keyboard {...args} />; # Keyboard This component renders a styled `<kbd>` for Keyboard items. ## Props <ArgsTable story="Default"/> ## Examples <Story name="Default" args={{text: "ctrl"}}> {Template.bind({})} </Story>
import {PageHeading} from "ui"; import {ArgsTable, Meta, Story} from "@storybook/addon-docs"; <Meta title="Components/Text/PageHeading/old" component={PageHeading}/> export const Template = (args) => <PageHeading {...args} />; # PageHeading This component renders a styled `<H1>` for the PageHeading. There should be 1 of these on every page! ## Props <ArgsTable story="Default"/> ## Examples <Story name="Default" args={{text: "Example"}}> {Template.bind({})} </Story>
import {Subheading} from "ui"; import {ArgsTable, Meta, Story} from "@storybook/addon-docs"; <Meta title="Components/Text/Subheading/old" component={Subheading}/> export const Template = (args) => <Subheading {...args} />; # Subheading This component renders a styled `<H3>` for subheadings. ## Props <ArgsTable story="Default"/> ## Examples <Story name="Default" args={{text: "Example"}}> {Template.bind({})} </Story>
select advertiser, advertiser_id,'Adjust' as MMP, outcome_ltag from advertiser_lookup where outcome_ltag in ( select distinct(l_tag) from new_pixel where user_agent ='adjust.com' and date = '2024-03-22') union select advertiser, advertiser_id, 'AppsFlyer' as MMP, outcome_ltag from advertiser_lookup where outcome_ltag in ( select distinct(l_tag) from new_pixel where user_agent ='http-kit/2.0' and date = '2024-03-22') union select advertiser, advertiser_id, 'Singular' as MMP, outcome_ltag from advertiser_lookup where outcome_ltag in ( select distinct(l_tag) from new_pixel where user_agent ='Apsalar-Postback' and date = '2024-03-22') union select advertiser, advertiser_id, 'Kochava' as MMP, outcome_ltag from advertiser_lookup where outcome_ltag in ( select distinct(l_tag) from new_pixel where u11_tag ='Kochava' and date = '2024-03-22') order by MMP
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>Cashapp-hack-unlimited-money-adder-hack-software</id> <version>1.0.0</version> <title>Cash app hack unlimited money $$ cash app money adder hack software</title> <authors>Alex</authors> <owners></owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Cash app hack unlimited money $$ cash app money adder hack software: VISIT HERE TO HACK >>>>> https://gamedips.xyz/cashapp-new Cash App free money is one of the very searched terms in Google and users are looking to locate techniques for getting free profit their Cash App balance with limited additional effort.Observe that there are numerous different survey and rewards sites that you can participate and get paid in Cash App balance using a number of methods. These easy ways can put balance in your account with a few work.Ways to get free money on Cash App, you can find survey and opinion rewards sites that will help you out. You can get free Cash App money sent to your Cash App wallet if you're using the Cash App payment option. Redeem your points for Cash App.Alternatively, you can even receive a telephone call from someone who claimed to be a Cash App representative. They then sent a text with an url to update your Cash App password. After you enter your real password on the form, the hackers gained full use of your Cash App account. Cash App Hack,cash app hack apk ios,cash app hacked,cash app hack apk,cash app hack 2021,cash app hacks 2020,cash app hack no human verification,cash app hacks that really work,cash app hack wrc madison,cash app hack apk download,cash app hack august 2020,cash app hack april 2020,cash app hack activation code,cash app hack apk 2021,cash app hack april 2021,cash app bitcoin hack,cash app boost hack,big cash app hack,big cash app hack version,big cash app hack mod apk download,big cash app hack 2020,big cash app hack 2019,free bitcoin cash app hack</description> </metadata> </package>
if (config('app.debug')) { dump(''); $this->info(''); } config('app.debug') ? info('One liner') : null;
import {Caption, Content, ErrorText, Heading, PageHeading, Subheading,} from "ui"; import {ArgsTable, Meta, Story} from "@storybook/addon-docs"; <Meta title="Components/Text/Typography/old" component={PageHeading}/> export const Template = (args) => ( <> <PageHeading {...args} /> <Heading {...args} /> <Subheading {...args} /> <Content {...args} /> <Caption {...args} /> <ErrorText {...args} /> </> ); # Test This component renders all Typography levels. ## Props <ArgsTable story="Default"/> ## Examples <Story name="Default" args={{text: "Example", icon: "alarm"}}> {Template.bind({})} </Story>
var grScReqItem = new GlideRecord('sc_req_item'); grScReqItem.addEncodedQuery("opened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe^number<=RITM127151"); grScReqItem.orderByDesc('number'); grScReqItem.setLimit(250); grScReqItem.query(); while (grScReqItem.next()) { gs.info('number: ' + grScReqItem.getValue('number')); // gs.info(grScReqItem.deleteMultiple()); }
var table = 'sc_req_item' var condition = "opened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe^number<=RITM127170"; var grScReqItem = new GlideRecord(table); grScReqItem.addEncodedQuery(condition); grScReqItem.orderByDesc('number'); grScReqItem.setLimit(250); grScReqItem.query(); while (grScReqItem.next()) { gs.info('number: ' + grScReqItem.getValue('number')); // gs.info(grScReqItem.deleteMultiple()); }
<img alt="" src="2024/03/160224_Infinite_Elite_E_AppHeroImage_W750xH489px.jpg?$staticlink$" /> <img alt="" src="2024/03/0703_Infinite_Elite_E_AppHeroImage_W750xH489px.jpg?$staticlink$" /> <img alt="" src="2024/03/020224_New_Arrivals_E_AppHeroImage_W750xH489px.jpg?$staticlink$" />
<?php function create_gamingguru() { $labels = array( 'name' => _x('Gaminggurus', 'Post Type General Name', 'textdomain'), 'singular_name' => _x('Gamingguru', 'Post Type Singular Name', 'textdomain'), 'menu_name' => _x('Gaminggurus', 'Admin Menu text', 'textdomain'), 'name_admin_bar' => _x('Gaminggurus', 'Add New on Toolbar', 'textdomain'), 'archives' => __('Gaminggurus Archives', 'textdomain'), 'attributes' => __('Gaminggurus Attributes', 'textdomain'), 'parent_item_colon' => __('Parent Gaminggurus:', 'textdomain'), 'all_items' => __('All Gaminggurus', 'textdomain'), 'add_new_item' => __('Add New Gamingguru', 'textdomain'), 'add_new' => __('Add New', 'textdomain'), 'new_item' => __('New Gamingguru', 'textdomain'), 'edit_item' => __('Edit Gamingguru', 'textdomain'), 'update_item' => __('Update Gamingguru', 'textdomain'), 'view_item' => __('View Gamingguru', 'textdomain'), 'view_items' => __('View Gaminggurus', 'textdomain'), 'search_items' => __('Search Gaminggurus', 'textdomain'), 'not_found' => __('Not found', 'textdomain'), 'not_found_in_trash' => __('Not found in Trash', 'textdomain'), 'featured_image' => __('Featured Image', 'textdomain'), 'set_featured_image' => __('Set featured image', 'textdomain'), 'remove_featured_image' => __('Remove featured image', 'textdomain'), 'use_featured_image' => __('Use as featured image', 'textdomain'), 'insert_into_item' => __('Insert into Gamingguru', 'textdomain'), 'uploaded_to_this_item' => __('Uploaded to this Gamingguru', 'textdomain'), 'items_list' => __('Gaminggurus list', 'textdomain'), 'items_list_navigation' => __('Gaminggurus list navigation', 'textdomain'), 'filter_items_list' => __('Filter Gaminggurus list', 'textdomain'), ); $rewrite = array( 'slug' => 'gamingguru', 'with_front' => true, 'pages' => true, 'feeds' => true, ); $args = array( 'label' => __('Gamingguru', 'textdomain'), 'description' => '', 'labels' => $labels, 'menu_icon' => 'dashicons-format-chat', 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'page-attributes', 'post-formats', 'custom-fields'), 'taxonomies' => array('gamingguru_category'), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'hierarchical' => true, 'exclude_from_search' => true, 'show_in_rest' => true, 'publicly_queryable' => true, 'capability_type' => 'post', 'rewrite' => $rewrite, ); register_post_type('gamingguru', $args); register_taxonomy('gamingguru_category', 'gamingguru', array( 'hierarchical' => true, 'label' => 'Category', 'query_var' => true, 'rewrite' => array('slug' => 'gamingguru-category'), ) ); } add_action('init', 'create_gamingguru', 0); ?>
Circle.java public class Circle{ private double radius; public Circle(double radius){ if(radius > 0){ this.radius = radius; } else{ System.out.println("Invalid radius value.Radius value must be greater than 0."); } } public double getRadius(){ return radius; } public void setRadius(double radius){ if(radius > 0){ this.radius = radius; } else{ System.out.println("Invalid radius value.Radius value must be greater than 0."); } } public double calculateArea(){ return Math.PI * radius * radius; } public double calculatePerimeter(){ return 2 * Math.PI * radius; } } ///////////////////////////////////////////// //////////////////////////////////////////// TestCircle.java public class TestCircle{ public static void main(String args[]){ Circle circle = new Circle(5); System.out.println("Radius: " + circle.getRadius()); System.out.printf("Area: %.2f\n" , circle.calculateArea()); System.out.printf("Perimeter: %.2f\n" , circle.calculatePerimeter()); circle.setRadius(8); System.out.println("Updated Radius: " + circle.getRadius()); System.out.printf("Updated Area: %.2f\n" , circle.calculateArea()); System.out.printf("Updated Perimeter: %.2f\n" , circle.calculatePerimeter()); circle.setRadius(-3); } }
const [touchStart, setTouchStart] = useState(null) const [touchEnd, setTouchEnd] = useState(null) // the required distance between touchStart and touchEnd to be detected as a swipe const minSwipeDistance = 50 const onTouchStart = (e) => { setTouchEnd(null) // otherwise the swipe is fired even with usual touch events setTouchStart(e.targetTouches[0].clientX) } const onTouchMove = (e) => setTouchEnd(e.targetTouches[0].clientX) const onTouchEnd = () => { if (!touchStart || !touchEnd) return const distance = touchStart - touchEnd const isLeftSwipe = distance > minSwipeDistance const isRightSwipe = distance < -minSwipeDistance if (isLeftSwipe || isRightSwipe) console.log('swipe', isLeftSwipe ? 'left' : 'right') // add your conditional logic here }
#!/bin/bash apt update apt install -y apache2 # Get the instance ID using the instance metadata INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) # Install the AWS CLI apt install -y awscli # Download the images from S3 bucket #aws s3 cp s3://myterraformprojectbucket2023/project.webp /var/www/html/project.png --acl public-read # Create a simple HTML file with the portfolio content and display the images cat <<EOF > /var/www/html/index.html <!DOCTYPE html> <html> <head> <title>My Portfolio</title> <style> /* Add animation and styling for the text */ @keyframes colorChange { 0% { color: red; } 50% { color: green; } 100% { color: blue; } } h1 { animation: colorChange 2s infinite; } </style> </head> <body> <h1>Terraform Project Server 1</h1> <h2>Instance ID: <span style="color:green">$INSTANCE_ID</span></h2> <p>Welcome to Demo project using terraform </p> </body> </html> EOF # Start Apache and enable it on boot systemctl start apache2 systemctl enable apache2
resource "aws_lb" "myalb" { name = "myalb" internal = false load_balancer_type = "application" security_groups = [aws_security_group.sg1.id] subnets = [aws_subnet.sub1.id, aws_subnet.sub2.id] } resource "aws_lb_target_group" "tg" { name = "myTG" port = 80 protocol = "HTTP" vpc_id = aws_vpc.myvpc.id health_check { path = "/" port = "traffic-port" } } resource "aws_lb_target_group_attachment" "attach1" { target_group_arn = aws_lb_target_group.tg.arn target_id = aws_instance.instance-1.id port = 80 } resource "aws_lb_target_group_attachment" "attach2" { target_group_arn = aws_lb_target_group.tg.arn target_id = aws_instance.instance-2.id port = 80 } resource "aws_lb_listener" "listener" { load_balancer_arn = aws_lb.myalb.arn port = 80 protocol = "HTTP" default_action { target_group_arn = aws_lb_target_group.tg.arn type = "forward" } } output "loadbalancerdns" { value = aws_lb.myalb.dns_name }
resource "aws_instance" "instance-1" { ami = "ami-080e1f13689e07408" instance_type = "t2.micro" vpc_security_group_ids = [aws_security_group.sg1.id] subnet_id = aws_subnet.sub1.id user_data = base64encode(file("userdata.sh")) } resource "aws_instance" "instance-2" { ami = "ami-080e1f13689e07408" instance_type = "t2.micro" vpc_security_group_ids = [aws_security_group.sg1.id] subnet_id = aws_subnet.sub2.id user_data = base64encode(file("userdata1.sh")) }
using System; using System.Net.Http; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; class Program { // Async main method static async Task Main(string[] args) { // Call the API and create a `Todo` object named "todo" Todo todo = await GetTodoAsync(); // Log the object's properties to the console Console.WriteLine($"Todo ID: {todo.Id}"); Console.WriteLine($"Todo Title: {todo.Title}"); Console.WriteLine($"Todo Completed: {todo.Completed}"); } // Async method to get a `Todo` object static async Task<Todo> GetTodoAsync() { // Create the HTTP client using (HttpClient client = new HttpClient()) { // Make the async GET request and save the response in "response" HttpResponseMessage response = await client.GetAsync("https://jsonplaceholder.typicode.com/todos/1"); // If we got a 200 status code if (response.IsSuccessStatusCode) { // Serialize the HTTP content of the response into a C# string object named "json" string json = await response.Content.ReadAsStringAsync(); // Deserialize the "json" string into a `Todo` object named "todo" Todo todo = JsonSerializer.Deserialize<Todo>(json); return todo; } else { // Throw an exception with a custom message that prints the bad status code throw new HttpRequestException($"Failed to get todo. Status code: {response.StatusCode}"); } } } } // A class that represents each object in the JSON response class Todo { [JsonPropertyName("userId")] // The field's name in the JSON response public int UserId { get; set; } // How we'll refer to that property in the C# code (userId becomes UserId) [JsonPropertyName("id")] public int Id { get; set; } [JsonPropertyName("title")] public string Title { get; set; } [JsonPropertyName("completed")] public bool Completed { get; set; } }
resource "aws_security_group" "sg1" { name = "sg1" description = "Allow inbound rule" vpc_id = aws_vpc.myvpc.id ingress { description = "allow incoming traffic to instance-1" from_port = 80 to_port = 80 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } ingress { description = "allow incoming traffic to instance-1" from_port = 22 to_port = 22 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } tags = { name = "sg1" } }
terraform { backend "s3" { bucket = "example-demo-terra-ankey-231" key = "path/vivek" region = "us-east-1" } }
resource "aws_route_table_association" "rta1" { subnet_id = aws_subnet.sub1.id route_table_id = aws_route_table.RT.id } resource "aws_route_table_association" "rta2" { subnet_id = aws_subnet.sub2.id route_table_id = aws_route_table.RT.id } resource "aws_s3_bucket" "s3_bucket" { bucket = "example-demo-terra-ankey-231" }
resource "aws_internet_gateway" "igw" { vpc_id = aws_vpc.myvpc.id } resource "aws_route_table" "RT" { vpc_id = aws_vpc.myvpc.id route { cidr_block = "0.0.0.0/0" gateway_id = aws_internet_gateway.igw.id } }
resource "aws_subnet" "sub2" { vpc_id = aws_vpc.myvpc.id cidr_block = "10.0.1.0/24" availability_zone = "us-east-1b" map_public_ip_on_launch = true }
resource "aws_vpc" "myvpc" { cidr_block = var.cidr } resource "aws_subnet" "sub1" { vpc_id = aws_vpc.myvpc.id cidr_block = "10.0.0.0/24" availability_zone = "us-east-1a" map_public_ip_on_launch = true }
terraform { required_providers { aws = { source = "hashicorp/aws" version = "5.42.0" } } } provider "aws" { # Configuration options region = "us-east-1" }
terraform { required_providers { aws = { source = "hashicorp/aws" version = "5.42.0" } } } provider "aws" { # Configuration options region = "us-east-1" }
<p><span id="docs-internal-guid-b2dfb759-7fff-95c0-55f4-a389659e72db"> <p style="text-align: center;" dir="ltr"><a href="https://fubar.com/help.php"><span><span><img src="https://lh7-us.googleusercontent.com/AS_6ErgLyAZjO-cyJJusu2OXmo9Uc78P-2VV1KdhsOHvCF_4709z4Ndjm_NjzeY92DYfA4cSqTWIxfL-I6S-WtVc6UZuvLsByhuHWVnoRw34PISliFGTrazcoD7E0cYv0o67mUqzLGUNaGxTc0Qluuo" alt="" width="167" height="29" /></span></span></a><a href="https://fubar.com/bible.php"><span><span><img src="https://lh7-us.googleusercontent.com/7VYukQZVgvTWczLF6IX42CS31wgjCeQ-AIVtKPhQ6bSQPAAKRnMsl9Kyn7ACOZ9LUtdMcaX75dgQNAJgJBVkUhUG6e3g_B9_gSk66x1GaINmEBPYDA-taaZryvgcMqgsmO6i6oK_q8Zm3RkAbVZrWjM" alt="" width="123" height="29" /></span></span></a><a href="https://www.fubar.com/tos.php"><span><span><img src="https://lh7-us.googleusercontent.com/zvPg--LpxDfbbruKbhy9NvaOo7jN5Z79P9LsT467si5JRw2A2cX69NUa012Yedv6jZIGspw7DfF-lwO28FrWQ_GHACuzNnwRCsQ7uFY_aM21xeiSMBEJvhFcVYLDCdYbMDQU6cwX-PdBQnn38FnxBto" alt="" width="118" height="29" /></span></span></a><span><span><img src="https://lh7-us.googleusercontent.com/R1-CexrNv6-1VWqnPe5eEmYkz2KJmMz0WUCQjdHC8v1nsKK0RrtlcfkXrc5MHS0BquyCKdIgq957pKCtdc8RUUPEbfZfU2yZelEhQKsXk96LQVIvORiV39Z4KBfqn8y-ImCFOHJGO6T9_EAiX73tst0" alt="" width="133" height="29" /></span></span><a href="http://www.fubar.com/emotes.php"><span><span><img src="https://lh7-us.googleusercontent.com/1EbUT6D5e67f2G1LooAWr0Y_gMCh42VMKArtKqjKWOC8oZdrX6XmBNNf_OJhKqV9t3oRInOY6CioKVE_1m0xTeTpakamgA8zdSgbn5AqPuSHSu3alcGNcxR-l6lephRN7olNBhifn31ZUblw0ecdS_U" alt="" width="140" height="29" /></span></span></a><a href="https://fubar.com/bling.php?sent=1"><span><span><img src="https://lh7-us.googleusercontent.com/cLLESvDim8BLI6riyLKF_Wyqq4NbuC2wV29lrfq9fNIHk5788qm_AfIqq1QxDJg4pmp-E2_f-0LfvzenYd9Q6zRn2GyRAVr4Ttb8KkfON8xwL_HyoUxfAkJN4RJ4uTFk0zkU9gF__p-40jFpkhhCc-k" alt="" width="157" height="29" /></span></span></a><a href="http://fubar.com/marriage.php"><span><span><img src="https://lh7-us.googleusercontent.com/--Y5gdWGEvFN9vLuzw8XJ4aguq-5haohE1M626iGXmuRTtVw2LchNYf-W0NLRVFO7877Jt98eI5NbRy5M9e05MEO2mKdwNnKq-2pmumSd3zwIbBzrWmm6oyu7vB-Io87MhnxYmNyjYaH1nZLmHhiMYU" alt="" width="115" height="29" /></span></span></a><a href="https://fubarswag.myspreadshop.com/"><span><span><img src="https://lh7-us.googleusercontent.com/afwJ4ZVl7H8v-ZhiunHWT5y3DckLdxmfA5DQcCXYkxQzngd11Xnh3CxLo-YVqyCDg2Cxmee_gPZZausdFQlC6cBvXowdkFEbaNyPg63oMmf7fUayu0bhZ0aP9lqY9qjUzD4wPd0BbiY27Fr_NMF4yCY" alt="" width="126" height="29" /></span></span></a><a href="https://fubar.com/vip.php"><span><span><img src="https://lh7-us.googleusercontent.com/QZ2OcjIYSmjzTLYTG3pycapeeNCO3ybGbaZFGetiwMFCZY5EfbaV9ybJD3LiYkG6M5Eqq1K5JF1rcse9Utm0KD4Nm6O8S2e86GaqIBkk20YlLSQvrMAnWZDxQgcoqkIsC9ocNGPjC_x0ecyYOgZusj0" alt="" width="98" height="29" /></span></span></a><a href="https://fubar.com/quick-like-polish-list/b373141"><span><span><img src="https://lh7-us.googleusercontent.com/XHWZmdYJdCrmraq0l09WsCGutvgReRZMLngyw9f7l4NOcCdU2uEHjrcEFpB_NbF0_pROdgsVK4eaWJrOv0qODJb4mcgPetQ9hQ0f9VFoEXCW7hAUjR0uFg_rZX5VeIsx7vZ1Dih_bKL0Yd-AS0h-jkI" alt="" width="195" height="29" /></span></span></a><a href="https://fubar.com/help-blogs/b361314-1318694"><span><span><img src="https://lh7-us.googleusercontent.com/HASoCfybVQLD3CUnVuD2ZDhrHy-y0MXlS8W-f0eo4gDOOxGstLG8uMpyuDyyCAZsUz9Nj7JsoDtVQs2nOb2apV20mi0lWO1zxX33Z_netYjOmSyMD48ISZXd-Qo2ntloX6gjC_T02sR6qBQXkINfeck" alt="" width="170" height="29" /></span></span></a><a href="https://fubar.com/blogs.php?u=22"><span><span><img src="https://lh7-us.googleusercontent.com/sosnogzSd52Q-Shgz4oEVXV04COAAb8dUTrjBoCtxXsePmGoyOJRbb3joVu9n1kzGF0Kv1MkElN74OdArwo1arpcVZ2CcueKRFfiHiiuSTLnV-tt246ydtX6WbbXl6E3TzT1Xl37g213fF_G-nlqI5c" alt="" width="150" height="29" /></span></span></a><a href="https://fubar.com/lounge/support"><span><span><img src="https://lh7-us.googleusercontent.com/6bM3PRvSAfry8L40lqpI5h0r2H2JW77wzBrCgYPki3ntb8afITOkiiiDW4NDIpGTZom3OS9kwkdIkXQkFrIifFMKQtqrKamOi0P1W_pPgGz1qcE_PFVIM7EPy58tnvNN3bXP05nr2q-qhyG0UMARGeE" alt="" width="197" height="29" /></span></span></a></p> </span></p>
<p><span id="docs-internal-guid-c063cc90-7fff-c052-f69f-c65bde1a5198"> <p style="text-align: center;" dir="ltr"><a href="https://fubar.com/help.php"><span><span><img src="https://lh7-us.googleusercontent.com/eoIKjq8Lj5vGXYr23C603edvGjuizwVU3dhnsRjpnXq5ZPahYaDBeJ4gvpa0wB4vBOaZEa90yjFwAZ6jFKOai3lEULc7mNK7yg8i4GF8x6MAFTb7nVigVrCBrXmleKcakTvrMAMfbKx4v2o0dRy46_4" alt="" width="171" height="31" /></span></span></a><a href="http://www.fubar.com/bible.php"><span><span><img src="https://lh7-us.googleusercontent.com/Sa1oMFB8nR3hoVf8TQjPPOYvGcc45ilQy6FIEJGHcW2eAIJ3hY0JunNmNTGvYZHV3PrdKZ284lVTdxvua4bpDgOFFtw7R2Ik0jYmUYmeDamg1J7I1H-XYNOkGdDaIbqnQK0sGmaMznJBLpNtvYreyS4" alt="" width="124" height="31" /></span></span></a><a href="http://www.fubar.com/emotes.php"><span><span><img src="https://lh7-us.googleusercontent.com/jpBeqNHNVeyb6KOH2-grCsV1HxSH1S3nas6NWlBOvvIvL4zrvs8Wh-e8D3Hr7T4T3yXQ9OR4eAzR0l3ipy5bAUxlyydaKdVjVf2ZBAirh8IDZJIoYQwhXArfI5I5k-osqVX_qkzr2cODSfRCacMiuno" alt="" width="139" height="31" /></span></span></a><a href="http://fubar.com/blast_list.php"><span><span><img src="https://lh7-us.googleusercontent.com/4DKP_aQccqU9boUV1AfD9n9P8m1JMOkDMild_FeS_S_ZJeZOHvzTgwQdE74pryagiJzC5I0wNPMcKcGK4OhWif4CmuYuXdhh5Kng49gjtWaounHg9pMTLNz1iVWJrzfiQ0y20R_RvqKiFqDLF0iBHxw" alt="" width="136" height="31" /></span></span></a><a href="https://fubar.com/blogs.php?u=22"><span><span><img src="https://lh7-us.googleusercontent.com/sFpB4jDty-47vvlFYp0331mBeBfEJScVvQwClFGfJITalCL3M3Y_qg3gSlK9EKYlrrtwqrnujtL98Z_eZ_JC3TsZzEunVq34OTMjsCTGZFC6snL5_w4iOMw9eEfEpmUOP833d4NNiy7zDkmL64Aakhg" alt="" width="148" height="31" /></span></span></a><a href="https://fubar.com/quick-like-polish-list/b373141"><span><span><img src="https://lh7-us.googleusercontent.com/HxZOuTXtQg4aaPsXNnCUKtdUq3XoRYS0jDKBWXEKf2GsxSFCKZRCdClVc0SJHsG5tHqoY8hXTkBUt0PYmTV2sqBnHNtn1ODh9x49oyhWCmlFd6B9GwS01oNu0_EFJYL1gc4XQ9wa2MB-qruNCjh71pU" alt="" width="193" height="31" /></span></span></a><a href="https://fubar.com/help-blogs/b361314-1318694"><span><span><img src="https://lh7-us.googleusercontent.com/JmCFewX5mvobxPVLjXuF2fPZsiVHPq6ZRwVhjUm2_BHban3LtviKsAMYsOvFe4B5N5FzgA_FkVkw6YvOZrYrb02B6axfntOYz38TxXPX2vT46IH3NIbBlHoeHC89x0RwY1bo5PEwHNCUAqTOkxezLPs" alt="" width="170" height="31" /></span></span></a><a href="https://fubar.com/bling.php?sent=1"><span><span><img src="https://lh7-us.googleusercontent.com/XFavoQjj9JND-PeSPLZFjuyNM3LCgZFXZQdU8C8vCXA1RrT3YE842GViZgbzd2YMOYVeCTX_MjxySoSTWhYbQncPQu-nkSOW0dPgkECujCMeL_wV0_vVGP2Nt3fhfzmAklb0I0fdmDDiN-mDxbe6gco" alt="" width="153" height="31" /></span></span></a><a href="http://fubar.com/marriage.php"><span><span><img src="https://lh7-us.googleusercontent.com/22zHjcoLhGl_sHimgLyyX-GdbILDnmFZrBNw2oCCiNusItGB-uRaH9hnpYgNbYg2Ur6F9hV0GoAw1b-jW2i4rLBoEl8pCxoUYGGkAM20ArHUbvEwwiwwbxh4iqiiVM7nvuWOwxpBieyZSpEeE-5kQhE" alt="" width="112" height="31" /></span></span></a><a href="https://fubar.com/vip.php"><span><span><img src="https://lh7-us.googleusercontent.com/OvJdmvNrB1BmGOWFnDDIgAbxu3XPhqRhsMsQEPfJ4MjpZOPjAGKrOXBOKdZyBBmfwKx8KT7wzqW2t-7giDZ_vkpwqkNW6ye35WH7Aj3fN9MkJbwacevvkgzvg5ifWNffoMrBmUbnu3GUcZL3nFDJO18" alt="" width="97" height="31" /></span></span></a><a href="https://shop.spreadshirt.com/fubarswag"><span><span><img src="https://lh7-us.googleusercontent.com/86mBNobTJHjKTT0V22Q4KFOXLnUaqIG1lraAXkzNMyLWZ1UxFogkgektlsVbUaA_RnK14xQ_Rzia8M7iNgGI5ltEw2FQDxR8EiRAKv6radwQlG9AXAUfLwIgyvbWpPiKii_zytxf8P4iSHAGnxsHsnQ" alt="" width="125" height="31" /></span></span></a><a href="https://www.fubar.com/tos.php"><span><span><img src="https://lh7-us.googleusercontent.com/QBjLrz2Rvx1stYPQIJozGlupNI-otWGnSokByObd2LOK_jM3pqWDkUP0YCiXvgM29K4JqVsSJ1CW3_F1S-7mpJilFfTJ5pc39vLhiLw2yUPoMTPQj5ESWiXzIb4RMKgTGJp3nsyAcSZLcqTpqBA9w2E" alt="" width="122" height="31" /></span></span></a><a href="https://fubar.com/lounge/support"><span><span><img src="https://lh7-us.googleusercontent.com/Bu8JXCpfUccduNZTZpqAcmPhZu0VQCJXJM2G_dJJ6NkaMJQxl-e7DLKZwKXhdvAa597708Q4jMsEtecFRc-wQSwTZxxkERo6J5Fx1dJM0DJ7LCoTjjieJRkD3enrDwBkM8IFZse3fyU1ei5ie0EoN9c" alt="" width="195" height="31" /></span></span></a></p> </span></p>
<p><span id="docs-internal-guid-e7a2c036-7fff-ede2-9112-77f8a244da27"> <p style="text-align: center;" dir="ltr"><a href="http://www.fubar.com/tos.php"><span><span><img src="https://lh7-us.googleusercontent.com/4RirJqOPJvJ7EdZy_SexPV9MOGqsXBDYV1mwesdJKl8Ze6n4Bl2nWNnWO8PXJDjXjXC5u1tr8u4zB99Ctt0TaM1mQhnDYuLsr1u_yQOA_7V-KemDuKSGNwPVTtMd9RuvR2tqWrN6i4DlbucEG-HfO-s" alt="" width="125" height="37" /></span></span></a><a href="https://fubarswag.myspreadshop.com/"><span><span><img src="https://lh7-us.googleusercontent.com/RRywQ3rLCK7G_4PTLAz2nM6pC8uz_5cQGmVSqOs6opp8J19sfA4QumvzkMtMFf7qH5p8AQQ2FlmgHTGs7Zf4M_tXIJXQA9satGe8ghq8B_iSLqDrwWzdWA8m-ntGuT4Iqr_RhwW6_viGNFXfYgr9130" alt="" width="125" height="37" /></span></span></a><a href="https://fubar.com/vip.php"><span><span><img src="https://lh7-us.googleusercontent.com/zbR3bC1TevfMrv7AY_qKd9MLXfZ_KWUCyON8aIOWu8TtNyipcCVD9DSn9NwR_8HSod7eP9nk1dhGbcPGi80RwuwDZFqJpnQHM1UuFdettaTa2hc6qcmB2OCUZ3ODQjeBfqZCe93qxUjOWRO3U4ze8-Q" alt="" width="103" height="37" /></span></span></a><a href="http://fubar.com/marriage.php"><span><span><img src="https://lh7-us.googleusercontent.com/spmTuK0_jOKnKGPGkk8M_j4PO7oGMM1OtWpzN2IlfIAy4GMzr679_BRglunlvBzncHrfwb0MBuPvB7IUG369fRxi4BXFiORXZSbnn_YZDarAvX_qUtCES7nYYiX3g5j6UfqeoM6PBH_b82q4emaaTJ8" alt="" width="118" height="37" /></span></span></a><a href="https://fubar.com/bling.php?sent=1"><span><span><img src="https://lh7-us.googleusercontent.com/6NQ2e7ibtvUkvsEwjX27My4qUgHK5aIXbeOSB5nyDeYuffZiF7FrsJ1k1tCJ1457hOeOd6zXRIvEU0OzDr3CT1-_HvyFFG0yvHOl0Y5dcul3Y04ya1TLJaa_J6Mg45fUf4eZFG5fSR5e5fOrOjenHAQ" alt="" width="131" height="37" /></span></span></a><a href="https://fubar.com/help-blogs/b361314-1318694"><span><span><img src="https://lh7-us.googleusercontent.com/WNjhT7srwLjoFtQvh3LrbTLK2fIp8zDwfsEevhMFx5Ec6YkBKo-4b3SUeUPh0hnBnm9E1f_aOwxKmRNdtvf-3l4kVkpqyFEZE7P9gIwCryu95xy3Jfb3E6RxtCimWy2PfpHYPHDi179LeIQsh2F_-9o" alt="" width="161" height="37" /></span></span></a><a href="https://fubar.com/quick-like-polish-list/b373141"><span><span><img src="https://lh7-us.googleusercontent.com/MrJYWY4WUDa-T0yiHxT81NzKoUWRpZ76kERJGgj47mLED9T050M_DqNSmjAlQ1MYrWiefwvUzVihSfVrJ2ot_ahldLho-ixNHNrfl4CkMFfIwnaXIlWgkJ0kIGJbRgHMhFsu_R-_OoVpFmCisyYZ3CU" alt="" width="181" height="37" /></span></span></a><a href="https://fubar.com/blogs.php?u=22"><span><span><img src="https://lh7-us.googleusercontent.com/bChBtxk6d9nC3BEXlMzvtgRuBu6siJjCICiU0Hct_FEKkZNl4TWAtmdqsF5zDyiNWSv8UfQhM7Ro_XsEdpZVMz-Ri0m4R1s60sH-Kurkutud8QDM-mEX4Xl_PlrV1SVi1d4sHVefrlFhWMHQIdc8pls" alt="" width="157" height="37" /></span></span></a><a href="https://fubar.com/lounge/support"><span><span><img src="https://lh7-us.googleusercontent.com/83kwO-pC849VWYH0G4pD7oQu1cWC-OLGXFSOYJeiPp98aJ1RFFC9Mq1noJ7PAwMq3fIc3iA23vOfT1Hj4_ZbqnAcufqqmB1eXVt3COtLnAqpcgzRf-5rkeqNvxSJH1zG0aFnv3FMAVCYcoDVMe6ITAs" alt="" width="174" height="35" /></span></span></a><a href="http://fubar.com/blast_list.php"><span><span><img src="https://lh7-us.googleusercontent.com/pEsGFlKNo8kKNNLlYhfcrqFNguYMIDcKskwbT51G5bZx6AZKUAI2rdBehgh5qIiK9xdkiwO3MG0L5jYwKQNHc8nh3JpBfU5L3HOSL9PMEL7UkQooCheE0pphAoQZjoNK5olGdqHGJWtK3C-GxLeC7OY" alt="" width="143" height="37" /></span></span></a><a href="http://www.fubar.com/emotes.php"><span><span><img src="https://lh7-us.googleusercontent.com/0C6MFFMtR4m8qKZONkwWpqMX8YE5wmRAf-TQLeuV7gX7SDs-NV18C-CIF1A3m-l3DleHQ1gqTILjQ9hkBloiS4gvutZK6oH6ic8pS6irih1TjxxsrfxfzcLr236YaC-GsmF0ZxiNMREtDKFkR3C6GuU" alt="" width="140" height="37" /></span></span></a><a href="https://fubar.com/bible.php"><span><span><img src="https://lh7-us.googleusercontent.com/Zr-aHl3LM-BOE02tnt0qAWs5oYGmhL0dNie06gkAQaH14GA7pMG2gWXOc2ujiuyGjZLMfV64F5Dj5bvDVyeDQqGScqt__n9ZGXcdohAaifGOEI027eGIylaFL27qLkvD2ovSRg9vsPXWsBNfk23ojGY" alt="" width="134" height="37" /></span></span></a></p> </span></p>
import random import os import time class Character: def __init__(self, name, hp, attack): self.name = name self.hp = hp self.max_hp = hp self.attack = attack self.curses = 0 self.burned = False self.critical = False self.piercing = False def is_alive(self): return self.hp > 0 def take_damage(self, damage): self.hp -= damage self.hp = max(0, self.hp) def attack_enemy(self, enemy): damage = random.randint(1, self.attack) print(f"{self.name} attacks {enemy.name} for {damage} damage!") enemy.take_damage(damage) if random.random() < 0.25: # 25% chance to apply debuffs enemy.inflict_debuff() def apply_curse(self): if self.curses < 5: self.curses += 1 print(f"{self.name} is cursed! Curse level: {self.curses}") else: print("Curse maxed out!") def remove_curse(self): if self.curses > 0: self.curses -= 1 print(f"{self.name} removes a curse. Curse level: {self.curses}") else: print("No curses to remove.") def inflict_debuff(self): debuffs = ["Burned", "Critical", "Piercing"] debuff = random.choice(debuffs) if debuff == "Burned": if not self.burned: self.burned = True print(f"{self.name} is burned!") else: print(f"{self.name} is already burned!") elif debuff == "Critical": if not self.critical: self.critical = True print(f"{self.name} receives a critical hit!") else: print(f"{self.name} is already under the effect of a critical hit!") elif debuff == "Piercing": if not self.piercing: self.piercing = True print(f"{self.name} ignores defenses!") else: print(f"{self.name} is already ignoring defenses!") def display_health_bar(self): bar_length = 20 filled_length = int(round(bar_length * self.hp / self.max_hp)) curses_display = "^" * self.curses bar = '♥' * filled_length + '-' * (bar_length - filled_length) print(f"{self.name} Hearts: [{bar}] {self.hp}/{self.max_hp} {curses_display}") class Enemy(Character): def __init__(self, name, hp, attack): super().__init__(name, hp, attack) def attack_enemy(self, player): damage = random.randint(1, self.attack) print(f"{self.name} attacks {player.name} for {damage} damage!") if random.random() < 0.25: # 25% chance to apply debuffs player.inflict_debuff() player.take_damage(damage) class Boss(Character): def __init__(self, name, hp, attack): super().__init__(name, hp, attack) def display_health_bar(self): bar_length = 20 filled_length = int(round(bar_length * self.hp / self.max_hp)) bar = '♥' * filled_length + '-' * (bar_length - filled_length) print(f"{self.name} Hearts: [{bar}] {self.hp}/{self.max_hp}") def attack_enemy(self, player): damage = random.randint(1, self.attack) print(f"{self.name} attacks {player.name} for {damage} damage!") if random.random() < 0.25: # 25% chance to apply debuffs player.inflict_debuff() player.take_damage(damage) import os import time def battle(player, enemy): print(f"A wild {enemy.name} appears!") while player.is_alive() and enemy.is_alive(): os.system('clear') # Clear the screen player.display_health_bar() enemy.display_health_bar() print("\nYour Turn") print("1. Attack") choice = input("Enter your choice: ") if choice == "1": player.attack_enemy(enemy) if not enemy.is_alive(): print(f"{enemy.name} has been defeated!") player.inventory.append(f"{enemy.name}'s loot") gold_dropped = 0 # Calculate gold dropped based on enemy type if isinstance(enemy, Boss): gold_dropped = random.randint(150, 400) else: gold_chance = random.random() if gold_chance < 0.7: gold_dropped = random.randint(15, 15) elif gold_chance < 0.9: gold_dropped = random.randint(20, 20) else: gold_dropped = random.randint(25, 25) player.gold += gold_dropped print(f"{enemy.name} dropped {gold_dropped} gold!") time.sleep(2) # Wait for 2 seconds to display the loot message os.system('clear') # Clear the screen after loot message break else: time.sleep(1) # Wait for 1 second before clearing the screen else: print("Invalid choice. Try again.") # Enemy's turn if enemy.is_alive(): os.system('clear') # Clear the screen before enemy's turn print("\nEnemy Turn") enemy.attack_enemy(player) time.sleep(1) # Wait for 1 second before clearing the screen os.system('clear') # Clear the screen after enemy's attack if player.burned: print(f"{player.name} is burned!") player.burned = False # Remove the burned debuff after displaying it elif player.critical: print(f"{player.name} is under the effect of a critical hit!") player.critical = False # Remove the critical debuff after displaying it elif player.piercing: print(f"{player.name} ignores defenses!") player.piercing = False # Remove the piercing debuff after displaying it if player.is_alive(): print("You win!") if not player.is_alive(): print("Game over!") time.sleep(2) # Wait for 2 seconds before clearing the screen os.system('clear') # Clear the screen after game over print(""" ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⡀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⠀⠀⠀⢀⣴⣿⡶⠀⣾⣿⣿⡿⠟⠛⠁ ⠀⠀⠀⠀⠀⠀⣀⣀⣄⣀⠀⠀⠀⠀⣶⣶⣦⠀⠀⠀⠀⣼⣿⣿⡇⠀⣠⣿⣿⣿⠇⣸⣿⣿⣧⣤⠀⠀⠀ ⠀⠀⢀⣴⣾⣿⡿⠿⠿⠿⠇⠀⠀⣸⣿⣿⣿⡆⠀⠀⢰⣿⣿⣿⣷⣼⣿⣿⣿⡿⢀⣿⣿⡿⠟⠛⠁⠀⠀ ⠀⣴⣿⡿⠋⠁⠀⠀⠀⠀⠀⠀⢠⣿⣿⣹⣿⣿⣿⣿⣿⣿⡏⢻⣿⣿⢿⣿⣿⠃⣼⣿⣯⣤⣴⣶⣿⡤⠀ ⣼⣿⠏⠀⣀⣠⣤⣶⣾⣷⠄⣰⣿⣿⡿⠿⠻⣿⣯⣸⣿⡿⠀⠀⠀⠁⣾⣿⡏⢠⣿⣿⠿⠛⠋⠉⠀⠀⠀ ⣿⣿⠲⢿⣿⣿⣿⣿⡿⠋⢰⣿⣿⠋⠀⠀⠀⢻⣿⣿⣿⠇⠀⠀⠀⠀⠙⠛⠀⠀⠉⠁⠀⠀⠀⠀⠀⠀⠀ ⠹⢿⣷⣶⣿⣿⠿⠋⠀⠀⠈⠙⠃⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠈⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣤⣴⣶⣦⣤⡀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠀⠀⠀⠀⠀⣠⡇⢰⣶⣶⣾⡿⠷⣿⣿⣿⡟⠛⣉⣿⣿⣿⠆ ⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⡎⣿⣿⣦⠀⠀⠀⢀⣤⣾⠟⢀⣿⣿⡟⣁⠀⠀⣸⣿⣿⣤⣾⣿⡿⠛⠁⠀ ⠀⠀⠀⠀⣠⣾⣿⡿⠛⠉⢿⣦⠘⣿⣿⡆⠀⢠⣾⣿⠋⠀⣼⣿⣿⣿⠿⠷⢠⣿⣿⣿⠿⢻⣿⣧⠀⠀⠀ ⠀⠀⠀⣴⣿⣿⠋⠀⠀⠀⢸⣿⣇⢹⣿⣷⣰⣿⣿⠃⠀⢠⣿⣿⢃⣀⣤⣤⣾⣿⡟⠀⠀⠀⢻⣿⣆⠀⠀ ⠀⠀⠀⣿⣿⡇⠀⠀⢀⣴⣿⣿⡟⠀⣿⣿⣿⣿⠃⠀⠀⣾⣿⣿⡿⠿⠛⢛⣿⡟⠀⠀⠀⠀⠀⠻⠿⠀⠀ ⠀⠀⠀⠹⣿⣿⣶⣾⣿⣿⣿⠟⠁⠀⠸⢿⣿⠇⠀⠀⠀⠛⠛⠁⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠈⠙⠛⠛⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ """) exit() # Exit the game after displaying the game over message import platform class Player(Character): def __init__(self, name): super().__init__(name, hp=100, attack=10) self.inventory = [] self.stunned = False # Initialize stunned attribute self.defense = 5 self.resistance = 0 self.gold = 0 # Initialize gold currency self.experience = 0 self.level = 15 self.exp_required = 100 # Initial experience required to level up self.max_hp_increase_per_level = 30 self.attack_increase_per_level = 0.004 # 0.4% self.defense_increase_per_level = 0.005 # 0.5% self.resistance_increase_per_level = 0.0015 # 0.15% def gain_experience(self, amount): self.experience += amount while self.experience >= self.exp_required: self.level_up() def level_up(self): self.level += 1 self.experience -= self.exp_required self.exp_required += 50 # Increase experience required for next level self.max_hp += self.max_hp_increase_per_level # Increase maximum health upon leveling up self.hp = self.max_hp # Heal player to full health upon leveling up self.attack = int(self.attack * (1 + self.attack_increase_per_level)) # Increase attack power upon leveling up self.defense = int(self.defense * (1 + self.defense_increase_per_level)) # Increase defense upon leveling up self.resistance = int(self.resistance * (1 + self.resistance_increase_per_level)) # Increase resistance upon leveling up print(f"Congratulations! You've reached level {self.level}!") def display_stats(self): print(f"Character Name: {self.name}") print(f"Level: {self.level}") print(f"Experience: {self.experience}/{self.exp_required}") print(f"Health: {self.hp}/{self.max_hp}") print(f"Attack: {self.attack}") print(f"Defense: {self.defense} ({self.defense * 0.2}%)") print(f"Resistance: {self.resistance} ({self.resistance * 0.2}%)") print(f"Curses: {self.curses}") if self.burned: print("Burned!") if self.critical: print("Critical!") if self.piercing: print("Piercing!") print(f"Gold: {self.gold}") while True: print("\nPlayer Menu:") print("1. Back to Game") print("2. Shop") print("3. Inventory") choice = input("Enter your choice: ") if choice == "1": os.system('clear') # Clear the screen after choosing to go back to the game break elif choice == "2": print("Welcome to the Shop!") # Implement shop functionality here elif choice == "3": print("Inventory:") for item in self.inventory: print(item) print("End of Inventory") else: print("Invalid choice. Please enter a valid option.") import os def main(): while True: print("\nWelcome to BeaVenture!") print("1. Start") print("2. Exit") choice = input("Enter your choice: ") if choice == "1": os.system('clear') # Clear the screen after pressing "Start" player_name = input("Enter your character's name: ") os.system('clear') # Clear the screen after entering the player's name player = Player(player_name) print(f"\nWelcome, {player.name}!") player.display_stats() while True: print("How do you want to start?") print("\n1. Continue") print("2. Back") choice = input("Enter your choice: ") if choice == "1": enemies = [ Enemy("Goblin", 50, 5), Enemy("Orc", 70, 10), Enemy("Dragon", 100, 20), Enemy("Skeleton", 40, 7), Enemy("Witch", 60, 12), Boss("Red Leaf", 300, 40), # Boss enemy type starts here Boss("Lubricant", 500, 60), Boss("The OverSeer", 700, 80), Boss("The Insight", 1000, 100), Boss("Surgeragon", 1500, 150) # Last boss enemy ] while player.is_alive(): enemy = random.choice(enemies) if isinstance(enemy, Boss): # Check if the enemy is a boss print("Doomed!") print("The Boss Is1 Approaching!") battle(player, enemy) if input("Do you want to play again? (yes/no): ").lower() != "yes": break break elif choice == "2": break else: print("Invalid choice. Please enter 1 or 2.") elif choice == "2": print("Exiting the game. Goodbye!") break else: print("Invalid choice. Please enter 1 or 2.") if __name__ == "__main__": main()
import os import time import sys class Player: def __init__(self, name, difficulty): self.name = name self.difficulty = difficulty self.attack = 10 self.defense = 5 self.dodge = 2 self.speed = 3 self.gold = 100 self.diamonds = 0 self.experience = 0 self.level = 1 self.exp_required = 100 self.exp_multiplier = 0.75 # 75% increase for experience requirement per level self.inventory = { # Initialize inventory "Weapons": [], "Armors": [], "Shields": [], "Footwear": [], "Usable Items": [] # Add Usable Items category } self.equipped_items = { # Initialize equipped items "Weapons": None, "Armors": None, "Shields": None, "Footwear": None } self.max_inventory_slots = 30 self.cleared_chapters = ["The Cave of Loir"] # Chapter 1 is unlocked by default self.chapter_stages = { "The Cave of Loir": ["⚔️"] + ["X"] * 9, # First stage unlocked "The Forest Of Azure": ["X"] * 10, # Locked "The Cursed Lake": ["X"] * 10, # Locked "The Baptisted Temple": ["X"] * 10, # Locked "Dungeon": ["X"] * 10, # Locked "Dragon Lair": ["X"] * 10 # Locked } # Existing methods... def visit_inventory(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Inventory:") print("=" * 40) print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.display_items("Weapons") elif choice == "2": self.display_items("Armors") elif choice == "3": self.display_items("Shields") elif choice == "4": self.display_items("Footwear") elif choice == "5": self.display_items("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_items(self, item_type): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): print(f"{idx}. {item['name']}: {item['description']}") print("0. Back to Inventory Menu") print("Enter the number to equip the item or 0 to go back.") choice = input("") if choice == "0": break # Break out of the inner loop to return to the previous menu elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("No items in this category.") print("Press < to go back") choice = input("") if choice == "<": break # Break out of the inner loop to return to the previous menu def equip_item(self, item_type, index): item = self.inventory[item_type].pop(index) if item_type in ["Weapons", "Armors", "Shields", "Footwear"]: self.remove_equipped_item(item_type) # Remove any previously equipped item of the same type self.equipped_items[item_type] = item # Equip the new item self.update_stats() # Update player stats with the new equipment print(f"{item['name']} equipped.") time.sleep(1) else: # Handle equipping usable items pass self.visit_inventory() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def update_stats(self): # Reset base stats self.attack = 10 self.defense = 5 self.dodge = 2 self.speed = 3 # Add bonuses from equipped items for item_type, item in self.equipped_items.items(): if item: self.attack += item.get('attack', 0) self.defense += item.get('defense', 0) self.dodge += item.get('dodge', 0) self.speed += item.get('speed', 0) def display_status(self): os.system('cls' if os.name == 'nt' else 'clear') print("Player Status:\n") print("="*40) print(f"Name: {self.get_name_display()}") print(f"Difficulty: {self.get_difficulty_display()}") print("-"*40) print("Stats:") print(f"HP :❤️{self.attack}") print(f"Defense :🛡️{self.defense}") print(f"Attack :⚔️{self.attack}") print(f"Dodge :🤺{self.dodge}") print(f"Speed :🏃{self.speed}") print("-"*40) print(f"Level: {self.level}") print(f"Experience: {self.experience}/{self.exp_required}") print("-"*40) print(f"Gold: {self.gold} 💰") print(f"Diamonds: {self.diamonds} 💎") print("="*40) print("Game Options:") print("1. Visit Shop") print("2. Inventory") print("3. Play Game") print("4. Delete this Character") print("5. Add 50 Experience Points") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.visit_shop() elif choice == "2": self.visit_inventory() elif choice == "3": self.play_game() elif choice == "4": return elif choice == "5": self.add_experience(50) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_status() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def get_chapter_name_by_number(self, number): chapters = { "1": "The Cave of Loir", "2": "The Forest Of Azure", "3": "The Cursed Lake", "4": "The Baptisted Temple", "5": "Dungeon", "6": "Dragon Lair" } return chapters.get(number) def play_game(self): while True: clear_screen() print("Select Chapter to Play:") for i, (chapter_name, stages) in enumerate(self.chapter_stages.items(), start=1): if "✔️" in stages: print(f"< ✅ {i} > {chapter_name}") # Display cleared chapters with a checkmark elif "⚔️" in stages: print(f"< {'⚔️'} {i} > {chapter_name}") # Display unlocked chapters with a sword symbol else: print(f"< 🔒 {i} > {chapter_name}") # Display locked chapters with a lock symbol print("< < Back to Player Status") choice = input("Enter the number to select a chapter or < to go back: ") if choice == "<": self.display_status() # Fixed: Go back to player status menu elif choice.isdigit(): chapter_index = int(choice) - 1 if 0 <= chapter_index < len(self.chapter_stages): chapter_name = list(self.chapter_stages.keys())[chapter_index] stages = self.chapter_stages[chapter_name] if "⚔️" in stages: self.play_chapter(chapter_name) elif "✔️" in stages: print("You have already cleared this chapter. Select another chapter to play.") time.sleep(1) else: print("This chapter is locked. Please clear the previous chapters first.") time.sleep(1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) def play_chapter(self, chapter_name): while True: clear_screen() print(f"Chapter: {chapter_name}") print("Stages:") for i, stage in enumerate(self.chapter_stages[chapter_name], start=1): print(f"Stage {i}: {'⚔️' if stage == '⚔️' else '🔒' if stage == 'X' else '✅'}") print("< < Back to Chapter Selection") choice = input("Enter the number to select a stage or < to go back: ") if choice == "<": break elif choice.isdigit(): stage_index = int(choice) - 1 if 0 <= stage_index < len(self.chapter_stages[chapter_name]): if self.chapter_stages[chapter_name][stage_index] == "⚔️": self.play_stage(chapter_name, stage_index) elif self.chapter_stages[chapter_name][stage_index] == "X": print("This stage is locked. Please clear the previous stages first.") time.sleep(2) else: print("You have already cleared this stage.") time.sleep(1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) def play_stage(self, chapter_name, stage_index): clear_screen() print(f"Chapter: {chapter_name}") print(f"Stage: {stage_index + 1}") print("Placeholder for gameplay") # Placeholder for actual gameplay if stage_index < len(self.chapter_stages[chapter_name]) - 1: self.chapter_stages[chapter_name][stage_index + 1] = "⚔️" # Unlock next stage else: self.chapter_stages[chapter_name] = ["✔️"] * 10 # All stages cleared, lock the chapter next_chapter_index = list(self.chapter_stages.keys()).index(chapter_name) + 1 if next_chapter_index < len(self.chapter_stages): next_chapter_name = list(self.chapter_stages.keys())[next_chapter_index] self.chapter_stages[next_chapter_name][0] = "⚔️" # Unlock next chapter print(f"You cleared {chapter_name}! \nNext chapter unlocked: {next_chapter_name}") time.sleep(3) else: print(f"You cleared {chapter_name} and completed all chapters!") time.sleep(3) self.chapter_stages[chapter_name][stage_index] = "✅" # Mark stage as cleared time.sleep(2) def display_locked_message(self, chapter_name): clear_screen() if self.chapter_stages[chapter_name][0] == "✔️": print("You have played for:", self.get_play_time()) else: print("This chapter is locked. Please clear the previous chapters first.") input("Press Enter to go back to the selecting chapter.") def get_play_time(self): return "10 hours 30 minutes" def add_experience(self, amount): self.experience += amount if self.experience >= self.exp_required: self.level_up() self.display_status() def level_up(self): self.level += 1 self.exp_required = int(self.exp_required * (1 + self.exp_multiplier)) # Increase by 75% self.attack += 0.5 self.defense += 0.5 self.dodge += 0.5 self.speed += 0.5 def get_name_display(self): symbol = "" if self.difficulty == "Basic": symbol = "🛡️" elif self.difficulty == "Exemplar": symbol = "⚔️" elif self.difficulty == "Templar": symbol = "☠️" return f"{symbol} {self.name}" def get_difficulty_display(self): return self.difficulty def visit_shop(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Welcome to the Shop!") print("=" * 40) print("Shop Sections:") print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select a shop section.") choice = input("") if choice == "1": self.display_shop_section("Weapons") elif choice == "2": self.display_shop_section("Armors") elif choice == "3": self.display_shop_section("Shields") elif choice == "4": self.display_shop_section("Footwear") elif choice == "5": self.display_shop_section("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_shop_section(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"Shop - {item_type}:") print("=" * 40) if item_type in items_groups: for idx, item in enumerate(items_groups[item_type], 1): print(f"{idx}. {item['name']}: {item['description']} - Cost: {item['cost']} gold") print("0. Back to Shop Sections") print("Enter the number to purchase the item or 0 to go back.") choice = input("") if choice == "0": self.visit_shop() elif choice.isdigit() and 0 < int(choice) <= len(items_groups[item_type]): self.purchase_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_shop_section(item_type) else: print("Invalid shop section.") time.sleep(1) self.visit_shop() def purchase_item(self, item_type, index): item = items_groups[item_type][index] cost = item['cost'] if self.gold >= cost: self.gold -= cost self.inventory[item_type].append(item) print(f"You have purchased {item['name']} for {cost} gold.") time.sleep(1) else: print("Insufficient gold to purchase this item.") time.sleep(1) self.display_shop_section(item_type) items_groups = { "Usable Items": [ {"name": "Small Healing Potion", "description": "+15 hp", "cost": 20}, {"name": "Self Healing Potion", "description": "+20 hp", "cost": 50}, {"name": "Moderated Potion", "description": "+25 hp", "cost": 75}, {"name": "Regen Potion", "description": "+15%", "cost": 100}, {"name": "Hammerhead Crocker", "description": "+7% attack for 7 turns", "cost": 55}, {"name": "Warhammer Crocker", "description": "+15% attack for 7 turns", "cost": 75}, {"name": "Barhog", "description": "+7% Defense for 7 turns", "cost": 45}, {"name": "Warhog", "description": "+15% defense for 7 turns", "cost": 60}, {"name": "Non applicable scroll", "description": "+2 Speed for 7 turns", "cost": 40}, {"name": "Applicable scroll", "description": "+4 speed for 7 turns", "cost": 55}, {"name": "Ransacked Shield", "description": "+12% Dodge chance for 3 turns", "cost": 60}, {"name": "Unbuilded Shield", "description": "+23% Dodge Chance for 5 turns", "cost": 90}, {"name": "Mystic Scroll", "description": "25% chance to negate all debuffs on player for 4 turns", "cost": 60}, {"name": "Mystic Beurau", "description": "50% chance to negate all debuffs on player for 4 turns", "cost": 120}, {"name": "Variant Bs", "description": "Increase all stats up to 25% for 10 turns", "cost": 200}, {"name": "Variant Ex", "description": "Increase all stats up to 50% for 10 turns", "cost": 400}, {"name": "Hide cloak", "description": "40% chance to dodge the battle against enemies when exploring", "cost": 50}, {"name": "Invisible potion", "description": "60% chance to dodge the battle against enemies when exploring", "cost": 75}, {"name": "Exp Moneter", "description": "Give you 20 exp points", "cost": 50}, {"name": "Exp Vitalis", "description": "Give you 50 exp points", "cost": 100}, {"name": "Exp For enhancer", "description": "Give you 100 points", "cost": 150} ], "Weapons": [ {"name": "Stone Sword", "description": "+12 attack", "cost": 150}, {"name": "Copper Sword", "description": "+15 attack", "cost": 275}, {"name": "Sickanum Sword", "description": "+17 attack", "cost": 400}, {"name": "Arivanum Sword", "description": "+23 attack", "cost": 600}, {"name": "Viranium Sword", "description": "+25 attack", "cost": 850}, {"name": "Titanium sword", "description": "+35 attack", "cost": 1250} ], "Armors": [ {"name": "Jungle sets", "description": "+7 Defense", "cost": 90}, {"name": "Byzantine sets", "description": "+12 Defense", "cost": 140}, {"name": "Nikel Sets", "description": "+15 Defense", "cost": 350}, {"name": "Warhead Sets", "description": "+25 Defense", "cost": 560}, {"name": "Titanium Sets", "description": "+40 Defense", "cost": 850} ], "Shields": [ {"name": "Wooden Ob", "description": "+2 dodge", "cost": 80}, {"name": "Long Ob", "description": "+3 dodge, +2 Defense", "cost": 120}, {"name": "Cob Ob", "description": "+5 dodge, +4 Defense", "cost": 300}, {"name": "Knock Ob", "description": "+7 dodge, +5 Defense, +3 Attack", "cost": 550}, {"name": "Neb Ob", "description": "+12 dodge, +7 Defense, +5 Attack", "cost": 760} ], "Footwear": [ {"name": "Jungle Foot", "description": "+3 speeds", "cost": 45}, {"name": "Iron Foot", "description": "+5 Speed", "cost": 75}, {"name": "Metal WarFoot", "description": "+8 Speeds", "cost": 120}, {"name": "Diamond Boots", "description": "+12 Speeds", "cost": 230}, {"name": "Noble Boots", "description": "+19 Speeds", "cost": 450}, {"name": "Lizable Boots", "description": "+25 Speeds", "cost": 700} ] } def create_character(): clear_screen() print("Character Creation") name = input("Enter your character's name: ") clear_screen() print(f"Character Name: {name}\n") while True: print("Select Difficulty:") print("1. Basic 🛡️") print("2. Exemplar ⚔️") print("3. Templar ☠️") difficulty_choice = input("Enter the number to select difficulty: ") if difficulty_choice == "1": difficulty = "Basic" description = "Enemies are powerful in their origins." elif difficulty_choice == "2": difficulty = "Exemplar" description = "Enemies are harder and more immortalized." elif difficulty_choice == "3": difficulty = "Templar" description = "Enemies are evils." else: print("Invalid difficulty choice. Please choose a valid option.") time.sleep(1) clear_screen() continue clear_screen() print("Selected Difficulty:") print(f"Name: {name}") print(f"Difficulty: {difficulty}") print(f"Description: {description}\n") print("1. Confirm") print("2. Back") confirm_choice = input("Enter your choice: ") if confirm_choice == "1": break elif confirm_choice == "2": clear_screen() continue else: print("Invalid choice. Please enter 1 to confirm or 2 to go back.") time.sleep(1) clear_screen() return Player(name, difficulty) def clear_screen(): """Clears the console screen.""" os.system('cls' if os.name == 'nt' else 'clear') def main_menu(): clear_screen() print("BeaVenture\n") print("1. Create Character") print("2. Exit") print("\nEnter the number to select an option.") def main(): while True: main_menu() try: choice = int(input("")) if choice == 1: player = create_character() player.display_status() elif choice == 2: clear_screen() print("Exiting BeaVenture. Goodbye!") time.sleep(2) clear_screen() print("Game Was Ended") input("Press Enter to exit...") clear_screen() break else: print("Invalid option. Please enter a valid number.") time.sleep(2) except ValueError: print("Invalid input. Please enter a number.") if __name__ == "__main__": main()
import os import time import sys class Player: def __init__(self, name, difficulty): self.name = name self.difficulty = difficulty self.attack = 10 self.defense = 5 self.dodge = 2 self.speed = 3 self.gold = 100 self.diamonds = 0 self.experience = 0 self.level = 1 self.exp_required = 100 self.exp_multiplier = 0.75 # 75% increase for experience requirement per level self.inventory = { # Initialize inventory "Weapons": [], "Armors": [], "Shields": [], "Footwear": [], "Usable Items": [] # Add Usable Items category } self.equipped_items = { # Initialize equipped items "Weapons": None, "Armors": None, "Shields": None, "Footwear": None } self.max_inventory_slots = 30 self.cleared_chapters = ["The Cave of Loir"] # Chapter 1 is unlocked by default self.chapter_stages = { "The Cave of Loir": ["⚔️"] + ["X"] * 9, # First stage unlocked "The Forest Of Azure": ["X"] * 10, # Locked "The Cursed Lake": ["X"] * 10, # Locked "The Baptisted Temple": ["X"] * 10, # Locked "Dungeon": ["X"] * 10, # Locked "Dragon Lair": ["X"] * 10 # Locked } # Existing methods... def visit_inventory(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Inventory:") print("=" * 40) print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.display_items("Weapons") elif choice == "2": self.display_items("Armors") elif choice == "3": self.display_items("Shields") elif choice == "4": self.display_items("Footwear") elif choice == "5": self.display_items("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_items(self, item_type): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): print(f"{idx}. {item['name']}: {item['description']}") print("0. Back to Inventory Menu") print("Enter the number to equip the item or 0 to go back.") choice = input("") if choice == "0": break # Break out of the inner loop to return to the previous menu elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("No items in this category.") print("Press < to go back") choice = input("") if choice == "<": break # Break out of the inner loop to return to the previous menu def equip_item(self, item_type, index): item = self.inventory[item_type].pop(index) if item_type in ["Weapons", "Armors", "Shields", "Footwear"]: self.remove_equipped_item(item_type) # Remove any previously equipped item of the same type self.equipped_items[item_type] = item # Equip the new item self.update_stats() # Update player stats with the new equipment print(f"{item['name']} equipped.") time.sleep(1) else: # Handle equipping usable items pass self.visit_inventory() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def update_stats(self): # Reset base stats self.attack = 10 self.defense = 5 self.dodge = 2 self.speed = 3 # Add bonuses from equipped items for item_type, item in self.equipped_items.items(): if item: self.attack += item.get('attack', 0) self.defense += item.get('defense', 0) self.dodge += item.get('dodge', 0) self.speed += item.get('speed', 0) def display_status(self): os.system('cls' if os.name == 'nt' else 'clear') print("Player Status:\n") print("="*40) print(f"Name: {self.get_name_display()}") print(f"Difficulty: {self.get_difficulty_display()}") print("-"*40) print("Stats:") print(f"HP :❤️{self.attack}") print(f"Defense :🛡️{self.defense}") print(f"Attack :⚔️{self.attack}") print(f"Dodge :🤺{self.dodge}") print(f"Speed :🏃{self.speed}") print("-"*40) print(f"Level: {self.level}") print(f"Experience: {self.experience}/{self.exp_required}") print("-"*40) print(f"Gold: {self.gold} 💰") print(f"Diamonds: {self.diamonds} 💎") print("="*40) print("Game Options:") print("1. Visit Shop") print("2. Inventory") print("3. Play Game") print("4. Delete this Character") print("5. Add 50 Experience Points") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.visit_shop() elif choice == "2": self.visit_inventory() elif choice == "3": self.play_game() elif choice == "4": return elif choice == "5": self.add_experience(50) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_status() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def get_chapter_name_by_number(self, number): chapters = { "1": "The Cave of Loir", "2": "The Forest Of Azure", "3": "The Cursed Lake", "4": "The Baptisted Temple", "5": "Dungeon", "6": "Dragon Lair" } return chapters.get(number) def play_game(self): while True: clear_screen() print("Select Chapter to Play:") for i, (chapter_name, stages) in enumerate(self.chapter_stages.items(), start=1): print(f"< {'⚔️' if stages[0] == '⚔️' else '🔒' if stages[0] == 'X' else '✔️'} {i} > {chapter_name}") # Display chapter with appropriate symbol print("< < Back to Player Status") choice = input("Enter the number to select a chapter or < to go back: ") if choice == "<": self.display_status() break elif choice.isdigit(): chapter_index = int(choice) - 1 if 0 <= chapter_index < len(self.chapter_stages): chapter_name = list(self.chapter_stages.keys())[chapter_index] stages = self.chapter_stages[chapter_name] if stages[0] == "⚔️": self.play_chapter(chapter_name) else: print("This chapter is locked. Please clear the previous chapters first.") time.sleep(2) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) def play_chapter(self, chapter_name): while True: clear_screen() print(f"Chapter: {chapter_name}") print("Stages:") for i, stage in enumerate(self.chapter_stages[chapter_name], start=1): print(f"Stage {i}: {'⚔️' if stage == '⚔️' else '🔒' if stage == 'X' else '✅'}") print("< < Back to Chapter Selection") choice = input("Enter the number to select a stage or < to go back: ") if choice == "<": break elif choice.isdigit(): stage_index = int(choice) - 1 if 0 <= stage_index < len(self.chapter_stages[chapter_name]): if self.chapter_stages[chapter_name][stage_index] == "⚔️": self.play_stage(chapter_name, stage_index) elif self.chapter_stages[chapter_name][stage_index] == "X": print("This stage is locked. Please clear the previous stages first.") time.sleep(2) else: print("You have already cleared this stage.") time.sleep(2) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) def play_stage(self, chapter_name, stage_index): clear_screen() print(f"Chapter: {chapter_name}") print(f"Stage: {stage_index + 1}") print("Placeholder for gameplay") # Placeholder for actual gameplay if stage_index < len(self.chapter_stages[chapter_name]) - 1: self.chapter_stages[chapter_name][stage_index + 1] = "⚔️" # Unlock next stage else: print("You cleared all stages in this chapter!") time.sleep(2) self.chapter_stages.pop(chapter_name) # Remove the chapter if self.chapter_stages: # Check if there are more chapters left next_chapter_name = list(self.chapter_stages.keys())[0] self.chapter_stages[next_chapter_name][0] = "⚔️" # Unlock next chapter print(f"Next chapter unlocked: {next_chapter_name}") time.sleep(3) else: print("Congratulations! You cleared all chapters!") time.sleep(3) self.chapter_stages[chapter_name][stage_index] = "✅" # Mark stage as cleared time.sleep(2) def display_locked_message(self): clear_screen() print("This chapter is locked. Please clear the previous chapters first.") input("Press Enter to go back to the selecting chapter.") def add_experience(self, amount): self.experience += amount if self.experience >= self.exp_required: self.level_up() self.display_status() def level_up(self): self.level += 1 self.exp_required = int(self.exp_required * (1 + self.exp_multiplier)) # Increase by 75% self.attack += 0.5 self.defense += 0.5 self.dodge += 0.5 self.speed += 0.5 def get_name_display(self): symbol = "" if self.difficulty == "Basic": symbol = "🛡️" elif self.difficulty == "Exemplar": symbol = "⚔️" elif self.difficulty == "Templar": symbol = "☠️" return f"{symbol} {self.name}" def get_difficulty_display(self): return self.difficulty def visit_shop(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Welcome to the Shop!") print("=" * 40) print("Shop Sections:") print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select a shop section.") choice = input("") if choice == "1": self.display_shop_section("Weapons") elif choice == "2": self.display_shop_section("Armors") elif choice == "3": self.display_shop_section("Shields") elif choice == "4": self.display_shop_section("Footwear") elif choice == "5": self.display_shop_section("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_shop_section(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"Shop - {item_type}:") print("=" * 40) if item_type in items_groups: for idx, item in enumerate(items_groups[item_type], 1): print(f"{idx}. {item['name']}: {item['description']} - Cost: {item['cost']} gold") print("0. Back to Shop Sections") print("Enter the number to purchase the item or 0 to go back.") choice = input("") if choice == "0": self.visit_shop() elif choice.isdigit() and 0 < int(choice) <= len(items_groups[item_type]): self.purchase_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_shop_section(item_type) else: print("Invalid shop section.") time.sleep(1) self.visit_shop() def purchase_item(self, item_type, index): item = items_groups[item_type][index] cost = item['cost'] if self.gold >= cost: self.gold -= cost self.inventory[item_type].append(item) print(f"You have purchased {item['name']} for {cost} gold.") time.sleep(1) else: print("Insufficient gold to purchase this item.") time.sleep(1) self.display_shop_section(item_type) items_groups = { "Usable Items": [ {"name": "Small Healing Potion", "description": "+15 hp", "cost": 20}, {"name": "Self Healing Potion", "description": "+20 hp", "cost": 50}, {"name": "Moderated Potion", "description": "+25 hp", "cost": 75}, {"name": "Regen Potion", "description": "+15%", "cost": 100}, {"name": "Hammerhead Crocker", "description": "+7% attack for 7 turns", "cost": 55}, {"name": "Warhammer Crocker", "description": "+15% attack for 7 turns", "cost": 75}, {"name": "Barhog", "description": "+7% Defense for 7 turns", "cost": 45}, {"name": "Warhog", "description": "+15% defense for 7 turns", "cost": 60}, {"name": "Non applicable scroll", "description": "+2 Speed for 7 turns", "cost": 40}, {"name": "Applicable scroll", "description": "+4 speed for 7 turns", "cost": 55}, {"name": "Ransacked Shield", "description": "+12% Dodge chance for 3 turns", "cost": 60}, {"name": "Unbuilded Shield", "description": "+23% Dodge Chance for 5 turns", "cost": 90}, {"name": "Mystic Scroll", "description": "25% chance to negate all debuffs on player for 4 turns", "cost": 60}, {"name": "Mystic Beurau", "description": "50% chance to negate all debuffs on player for 4 turns", "cost": 120}, {"name": "Variant Bs", "description": "Increase all stats up to 25% for 10 turns", "cost": 200}, {"name": "Variant Ex", "description": "Increase all stats up to 50% for 10 turns", "cost": 400}, {"name": "Hide cloak", "description": "40% chance to dodge the battle against enemies when exploring", "cost": 50}, {"name": "Invisible potion", "description": "60% chance to dodge the battle against enemies when exploring", "cost": 75}, {"name": "Exp Moneter", "description": "Give you 20 exp points", "cost": 50}, {"name": "Exp Vitalis", "description": "Give you 50 exp points", "cost": 100}, {"name": "Exp For enhancer", "description": "Give you 100 points", "cost": 150} ], "Weapons": [ {"name": "Stone Sword", "description": "+12 attack", "cost": 150}, {"name": "Copper Sword", "description": "+15 attack", "cost": 275}, {"name": "Sickanum Sword", "description": "+17 attack", "cost": 400}, {"name": "Arivanum Sword", "description": "+23 attack", "cost": 600}, {"name": "Viranium Sword", "description": "+25 attack", "cost": 850}, {"name": "Titanium sword", "description": "+35 attack", "cost": 1250} ], "Armors": [ {"name": "Jungle sets", "description": "+7 Defense", "cost": 90}, {"name": "Byzantine sets", "description": "+12 Defense", "cost": 140}, {"name": "Nikel Sets", "description": "+15 Defense", "cost": 350}, {"name": "Warhead Sets", "description": "+25 Defense", "cost": 560}, {"name": "Titanium Sets", "description": "+40 Defense", "cost": 850} ], "Shields": [ {"name": "Wooden Ob", "description": "+2 dodge", "cost": 80}, {"name": "Long Ob", "description": "+3 dodge, +2 Defense", "cost": 120}, {"name": "Cob Ob", "description": "+5 dodge, +4 Defense", "cost": 300}, {"name": "Knock Ob", "description": "+7 dodge, +5 Defense, +3 Attack", "cost": 550}, {"name": "Neb Ob", "description": "+12 dodge, +7 Defense, +5 Attack", "cost": 760} ], "Footwear": [ {"name": "Jungle Foot", "description": "+3 speeds", "cost": 45}, {"name": "Iron Foot", "description": "+5 Speed", "cost": 75}, {"name": "Metal WarFoot", "description": "+8 Speeds", "cost": 120}, {"name": "Diamond Boots", "description": "+12 Speeds", "cost": 230}, {"name": "Noble Boots", "description": "+19 Speeds", "cost": 450}, {"name": "Lizable Boots", "description": "+25 Speeds", "cost": 700} ] } def create_character(): clear_screen() print("Character Creation") name = input("Enter your character's name: ") clear_screen() print(f"Character Name: {name}\n") while True: print("Select Difficulty:") print("1. Basic 🛡️") print("2. Exemplar ⚔️") print("3. Templar ☠️") difficulty_choice = input("Enter the number to select difficulty: ") if difficulty_choice == "1": difficulty = "Basic" description = "Enemies are powerful in their origins." elif difficulty_choice == "2": difficulty = "Exemplar" description = "Enemies are harder and more immortalized." elif difficulty_choice == "3": difficulty = "Templar" description = "Enemies are evils." else: print("Invalid difficulty choice. Please choose a valid option.") time.sleep(1) clear_screen() continue clear_screen() print("Selected Difficulty:") print(f"Name: {name}") print(f"Difficulty: {difficulty}") print(f"Description: {description}\n") print("1. Confirm") print("2. Back") confirm_choice = input("Enter your choice: ") if confirm_choice == "1": break elif confirm_choice == "2": clear_screen() continue else: print("Invalid choice. Please enter 1 to confirm or 2 to go back.") time.sleep(1) clear_screen() return Player(name, difficulty) def clear_screen(): """Clears the console screen.""" os.system('cls' if os.name == 'nt' else 'clear') def main_menu(): clear_screen() print("BeaVenture\n") print("1. Create Character") print("2. Exit") print("\nEnter the number to select an option.") def main(): while True: main_menu() try: choice = int(input("")) if choice == 1: player = create_character() player.display_status() elif choice == 2: clear_screen() print("Exiting BeaVenture. Goodbye!") time.sleep(2) clear_screen() print("Game Was Ended") input("Press Enter to exit...") clear_screen() break else: print("Invalid option. Please enter a valid number.") time.sleep(2) except ValueError: print("Invalid input. Please enter a number.") if __name__ == "__main__": main()
import os import time import sys class Player: def __init__(self, name, difficulty): self.name = name self.difficulty = difficulty self.attack = 10 self.defense = 5 self.dodge = 2 self.speed = 3 self.gold = 100 self.diamonds = 0 self.experience = 0 self.level = 1 self.exp_required = 100 self.exp_multiplier = 0.75 # 75% increase for experience requirement per level self.inventory = { # Initialize inventory "Weapons": [], "Armors": [], "Shields": [], "Footwear": [], "Usable Items": [] # Add Usable Items category } self.equipped_items = { # Initialize equipped items "Weapons": None, "Armors": None, "Shields": None, "Footwear": None } self.max_inventory_slots = 30 self.cleared_chapters = ["The Cave of Loir"] # Chapter 1 is unlocked by default self.chapter_stages = { "The Cave of Loir": ["⚔️"] + ["X"] * 9, # First stage unlocked "The Forest Of Azure": ["X"] * 10, # Locked "The Cursed Lake": ["X"] * 10, # Locked "The Baptisted Temple": ["X"] * 10, # Locked "Dungeon": ["X"] * 10, # Locked "Dragon Lair": ["X"] * 10 # Locked } # Existing methods... def visit_inventory(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Inventory:") print("=" * 40) print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.display_items("Weapons") elif choice == "2": self.display_items("Armors") elif choice == "3": self.display_items("Shields") elif choice == "4": self.display_items("Footwear") elif choice == "5": self.display_items("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_items(self, item_type): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): print(f"{idx}. {item['name']}: {item['description']}") print("0. Back to Inventory Menu") print("Enter the number to equip the item or 0 to go back.") choice = input("") if choice == "0": break # Break out of the inner loop to return to the previous menu elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("No items in this category.") print("Press < to go back") choice = input("") if choice == "<": break # Break out of the inner loop to return to the previous menu def equip_item(self, item_type, index): item = self.inventory[item_type].pop(index) if item_type in ["Weapons", "Armors", "Shields", "Footwear"]: self.remove_equipped_item(item_type) # Remove any previously equipped item of the same type self.equipped_items[item_type] = item # Equip the new item self.update_stats() # Update player stats with the new equipment print(f"{item['name']} equipped.") time.sleep(1) else: # Handle equipping usable items pass self.visit_inventory() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def update_stats(self): # Reset base stats self.attack = 10 self.defense = 5 self.dodge = 2 self.speed = 3 # Add bonuses from equipped items for item_type, item in self.equipped_items.items(): if item: self.attack += item.get('attack', 0) self.defense += item.get('defense', 0) self.dodge += item.get('dodge', 0) self.speed += item.get('speed', 0) def display_status(self): os.system('cls' if os.name == 'nt' else 'clear') print("Player Status:\n") print("="*40) print(f"Name: {self.get_name_display()}") print(f"Difficulty: {self.get_difficulty_display()}") print("-"*40) print("Stats:") print(f"HP :❤️{self.attack}") print(f"Defense :🛡️{self.defense}") print(f"Attack :⚔️{self.attack}") print(f"Dodge :🤺{self.dodge}") print(f"Speed :🏃{self.speed}") print("-"*40) print(f"Level: {self.level}") print(f"Experience: {self.experience}/{self.exp_required}") print("-"*40) print(f"Gold: {self.gold} 💰") print(f"Diamonds: {self.diamonds} 💎") print("="*40) print("Game Options:") print("1. Visit Shop") print("2. Inventory") print("3. Play Game") print("4. Delete this Character") print("5. Add 50 Experience Points") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.visit_shop() elif choice == "2": self.visit_inventory() elif choice == "3": self.play_game() elif choice == "4": return elif choice == "5": self.add_experience(50) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_status() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def get_chapter_name_by_number(self, number): chapters = { "1": "The Cave of Loir", "2": "The Forest Of Azure", "3": "The Cursed Lake", "4": "The Baptisted Temple", "5": "Dungeon", "6": "Dragon Lair" } return chapters.get(number) def play_game(self): while True: clear_screen() print("Select Chapter to Play:") for i, (chapter_name, stages) in enumerate(self.chapter_stages.items(), start=1): print(f"< {'⚔️' if stages[0] == '⚔️' else '🔒' if stages[0] == 'X' else '✔️'} {i} > {chapter_name}") # Display chapter with appropriate symbol print("< < Back to Player Status") choice = input("Enter the number to select a chapter or < to go back: ") if choice == "<": self.display_status() break elif choice.isdigit(): chapter_index = int(choice) - 1 if 0 <= chapter_index < len(self.chapter_stages): chapter_name = list(self.chapter_stages.keys())[chapter_index] stages = self.chapter_stages[chapter_name] if stages[0] == "⚔️": self.play_chapter(chapter_name) else: print("This chapter is locked. Please clear the previous chapters first.") time.sleep(2) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) def play_chapter(self, chapter_name): while True: clear_screen() print(f"Chapter: {chapter_name}") print("Stages:") for i, stage in enumerate(self.chapter_stages[chapter_name], start=1): print(f"Stage {i}: {'⚔️' if stage == '⚔️' else '🔒' if stage == 'X' else '✅'}") print("< < Back to Chapter Selection") choice = input("Enter the number to select a stage or < to go back: ") if choice == "<": break elif choice.isdigit(): stage_index = int(choice) - 1 if 0 <= stage_index < len(self.chapter_stages[chapter_name]): if self.chapter_stages[chapter_name][stage_index] == "⚔️": self.play_stage(chapter_name, stage_index) elif self.chapter_stages[chapter_name][stage_index] == "X": print("This stage is locked. Please clear the previous stages first.") time.sleep(2) else: print("You have already cleared this stage.") time.sleep(2) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) def play_stage(self, chapter_name, stage_index): clear_screen() print(f"Chapter: {chapter_name}") print(f"Stage: {stage_index + 1}") print("Placeholder for gameplay") # Placeholder for actual gameplay if stage_index < len(self.chapter_stages[chapter_name]) - 1: self.chapter_stages[chapter_name][stage_index + 1] = "⚔️" # Unlock next stage else: print("You cleared all stages in this chapter!") time.sleep(2) self.chapter_stages.pop(chapter_name) # Remove the chapter if self.chapter_stages: # Check if there are more chapters left next_chapter_name = list(self.chapter_stages.keys())[0] self.chapter_stages[next_chapter_name][0] = "⚔️" # Unlock next chapter print(f"Next chapter unlocked: {next_chapter_name}") time.sleep(3) else: print("Congratulations! You cleared all chapters!") time.sleep(3) self.chapter_stages[chapter_name][stage_index] = "✅" # Mark stage as cleared time.sleep(2) def display_locked_message(self): clear_screen() print("This chapter is locked. Please clear the previous chapters first.") input("Press Enter to go back to the selecting chapter.") def add_experience(self, amount): self.experience += amount if self.experience >= self.exp_required: self.level_up() self.display_status() def level_up(self): self.level += 1 self.exp_required = int(self.exp_required * (1 + self.exp_multiplier)) # Increase by 75% self.attack += 0.5 self.defense += 0.5 self.dodge += 0.5 self.speed += 0.5 def get_name_display(self): symbol = "" if self.difficulty == "Basic": symbol = "🛡️" elif self.difficulty == "Exemplar": symbol = "⚔️" elif self.difficulty == "Templar": symbol = "☠️" return f"{symbol} {self.name}" def get_difficulty_display(self): return self.difficulty def visit_shop(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Welcome to the Shop!") print("=" * 40) print("Shop Sections:") print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select a shop section.") choice = input("") if choice == "1": self.display_shop_section("Weapons") elif choice == "2": self.display_shop_section("Armors") elif choice == "3": self.display_shop_section("Shields") elif choice == "4": self.display_shop_section("Footwear") elif choice == "5": self.display_shop_section("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_shop_section(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"Shop - {item_type}:") print("=" * 40) if item_type in items_groups: for idx, item in enumerate(items_groups[item_type], 1): print(f"{idx}. {item['name']}: {item['description']} - Cost: {item['cost']} gold") print("0. Back to Shop Sections") print("Enter the number to purchase the item or 0 to go back.") choice = input("") if choice == "0": self.visit_shop() elif choice.isdigit() and 0 < int(choice) <= len(items_groups[item_type]): self.purchase_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_shop_section(item_type) else: print("Invalid shop section.") time.sleep(1) self.visit_shop() def purchase_item(self, item_type, index): item = items_groups[item_type][index] cost = item['cost'] if self.gold >= cost: self.gold -= cost self.inventory[item_type].append(item) print(f"You have purchased {item['name']} for {cost} gold.") time.sleep(1) else: print("Insufficient gold to purchase this item.") time.sleep(1) self.display_shop_section(item_type) items_groups = { "Usable Items": [ {"name": "Small Healing Potion", "description": "+15 hp", "cost": 20}, {"name": "Self Healing Potion", "description": "+20 hp", "cost": 50}, {"name": "Moderated Potion", "description": "+25 hp", "cost": 75}, {"name": "Regen Potion", "description": "+15%", "cost": 100}, {"name": "Hammerhead Crocker", "description": "+7% attack for 7 turns", "cost": 55}, {"name": "Warhammer Crocker", "description": "+15% attack for 7 turns", "cost": 75}, {"name": "Barhog", "description": "+7% Defense for 7 turns", "cost": 45}, {"name": "Warhog", "description": "+15% defense for 7 turns", "cost": 60}, {"name": "Non applicable scroll", "description": "+2 Speed for 7 turns", "cost": 40}, {"name": "Applicable scroll", "description": "+4 speed for 7 turns", "cost": 55}, {"name": "Ransacked Shield", "description": "+12% Dodge chance for 3 turns", "cost": 60}, {"name": "Unbuilded Shield", "description": "+23% Dodge Chance for 5 turns", "cost": 90}, {"name": "Mystic Scroll", "description": "25% chance to negate all debuffs on player for 4 turns", "cost": 60}, {"name": "Mystic Beurau", "description": "50% chance to negate all debuffs on player for 4 turns", "cost": 120}, {"name": "Variant Bs", "description": "Increase all stats up to 25% for 10 turns", "cost": 200}, {"name": "Variant Ex", "description": "Increase all stats up to 50% for 10 turns", "cost": 400}, {"name": "Hide cloak", "description": "40% chance to dodge the battle against enemies when exploring", "cost": 50}, {"name": "Invisible potion", "description": "60% chance to dodge the battle against enemies when exploring", "cost": 75}, {"name": "Exp Moneter", "description": "Give you 20 exp points", "cost": 50}, {"name": "Exp Vitalis", "description": "Give you 50 exp points", "cost": 100}, {"name": "Exp For enhancer", "description": "Give you 100 points", "cost": 150} ], "Weapons": [ {"name": "Stone Sword", "description": "+12 attack", "cost": 150}, {"name": "Copper Sword", "description": "+15 attack", "cost": 275}, {"name": "Sickanum Sword", "description": "+17 attack", "cost": 400}, {"name": "Arivanum Sword", "description": "+23 attack", "cost": 600}, {"name": "Viranium Sword", "description": "+25 attack", "cost": 850}, {"name": "Titanium sword", "description": "+35 attack", "cost": 1250} ], "Armors": [ {"name": "Jungle sets", "description": "+7 Defense", "cost": 90}, {"name": "Byzantine sets", "description": "+12 Defense", "cost": 140}, {"name": "Nikel Sets", "description": "+15 Defense", "cost": 350}, {"name": "Warhead Sets", "description": "+25 Defense", "cost": 560}, {"name": "Titanium Sets", "description": "+40 Defense", "cost": 850} ], "Shields": [ {"name": "Wooden Ob", "description": "+2 dodge", "cost": 80}, {"name": "Long Ob", "description": "+3 dodge, +2 Defense", "cost": 120}, {"name": "Cob Ob", "description": "+5 dodge, +4 Defense", "cost": 300}, {"name": "Knock Ob", "description": "+7 dodge, +5 Defense, +3 Attack", "cost": 550}, {"name": "Neb Ob", "description": "+12 dodge, +7 Defense, +5 Attack", "cost": 760} ], "Footwear": [ {"name": "Jungle Foot", "description": "+3 speeds", "cost": 45}, {"name": "Iron Foot", "description": "+5 Speed", "cost": 75}, {"name": "Metal WarFoot", "description": "+8 Speeds", "cost": 120}, {"name": "Diamond Boots", "description": "+12 Speeds", "cost": 230}, {"name": "Noble Boots", "description": "+19 Speeds", "cost": 450}, {"name": "Lizable Boots", "description": "+25 Speeds", "cost": 700} ] } def create_character(): clear_screen() print("Character Creation") name = input("Enter your character's name: ") clear_screen() print(f"Character Name: {name}\n") while True: print("Select Difficulty:") print("1. Basic 🛡️") print("2. Exemplar ⚔️") print("3. Templar ☠️") difficulty_choice = input("Enter the number to select difficulty: ") if difficulty_choice == "1": difficulty = "Basic" description = "Enemies are powerful in their origins." elif difficulty_choice == "2": difficulty = "Exemplar" description = "Enemies are harder and more immortalized." elif difficulty_choice == "3": difficulty = "Templar" description = "Enemies are evils." else: print("Invalid difficulty choice. Please choose a valid option.") time.sleep(1) clear_screen() continue clear_screen() print("Selected Difficulty:") print(f"Name: {name}") print(f"Difficulty: {difficulty}") print(f"Description: {description}\n") print("1. Confirm") print("2. Back") confirm_choice = input("Enter your choice: ") if confirm_choice == "1": break elif confirm_choice == "2": clear_screen() continue else: print("Invalid choice. Please enter 1 to confirm or 2 to go back.") time.sleep(1) clear_screen() return Player(name, difficulty) def clear_screen(): """Clears the console screen.""" os.system('cls' if os.name == 'nt' else 'clear') def main_menu(): clear_screen() print("BeaVenture\n") print("1. Create Character") print("2. Exit") print("\nEnter the number to select an option.") def main(): while True: main_menu() try: choice = int(input("")) if choice == 1: player = create_character() player.display_status() elif choice == 2: clear_screen() print("Exiting BeaVenture. Goodbye!") time.sleep(2) clear_screen() print("Game Was Ended") input("Press Enter to exit...") clear_screen() break else: print("Invalid option. Please enter a valid number.") time.sleep(2) except ValueError: print("Invalid input. Please enter a number.") if __name__ == "__main__": main()
for (int i = 0; i < 100; i++) myString += ...blah...
import os import time import sys class Player: def __init__(self, name, difficulty): self.name = name self.difficulty = difficulty Attack = 0 Defense = 0 Dodge = 0 Speed = 0 self.gold = 10000 self.diamonds = 0 self.experience = 0 self.level = 1 self.exp_required = 100 self.exp_multiplier = 0.75 # 75% increase for experience requirement per level self.inventory = { # Initialize inventory "Weapons" : [], "Armors" : [], "Shields" : [], "Footwear" : [], "Usable Items": [] # Add Usable Items category } self.equipped_items = { # Initialize equipped items "Weapons" : {"name": "Broken Sword", "description": "+10 Damage", "Attack": 10}, "Armors" : {"name": "Broken Armor", "description": "+5 Defense", "Defense": 5}, "Shields" : {"name": "Broken Shield", "description": "+2 Dodge", "Dodge": 2}, "Footwear" : {"name": "Broken Footwear", "description": "+3 Speed", "Speed": 3}, "Accessories" : None, "Bag" : None } self.base_stats = { "HP": 100, "Defense": 0, "Attack": 0, "Dodge": 0, "Speed": 0 } self.max_inventory_slots = 30 self.update_stats() # Update player stats based on equipped items def visit_inventory(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Inventory:") print("=" * 40) print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.display_items("Weapons") elif choice == "2": self.display_items("Armors") elif choice == "3": self.display_items("Shields") elif choice == "4": self.display_items("Footwear") elif choice == "5": self.display_items("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_items(self, item_type): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): print(f"{idx}. {item['name']}: {item['description']}") print("0. Back to Inventory Menu") print("Enter the number to equip the item or 0 to go back.") choice = input("") if choice == "0": break # Break out of the inner loop to return to the previous menu elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("No items in this category.") print("Press < to go back") choice = input("") if choice == "<": break # Break out of the inner loop to return to the previous menu def equip_item(self, item_type, index): if item_type in self.equipped_items: if 0 <= index < len(self.inventory[item_type]): item = self.inventory[item_type].pop(index) if self.equipped_items[item_type]: old_item = self.equipped_items[item_type] self.inventory[item_type].append(old_item) self.equipped_items[item_type] = item self.update_stats() # Update stats after equipping any item print(f"{item['name']} equipped.") time.sleep(1) self.display_equipped_items() # Display equipped items after equipping return # Added to exit the method and prevent further execution else: print("Invalid item index.") time.sleep(1) else: print("Invalid item type.") time.sleep(1) def update_stats(self): # Reset stats to base values for stat in self.base_stats: setattr(self, stat.lower(), self.base_stats[stat]) # Apply bonuses from equipped items equipped = False # Flag to track if any item is equipped for item_type, item in self.equipped_items.items(): if item: equipped = True self.when_equipped(item) # If no items are equipped, set all stats (except HP) to 0 if not equipped: for stat in self.base_stats: if stat != "HP": setattr(self, stat.lower(), 0) def when_equipped(self, item): for stat in item: if stat in self.base_stats: setattr(self, stat.lower(), self.base_stats[stat] + item[stat]) def display_equipped_items(self): os.system('cls' if os.name == 'nt' else 'clear') print("Equipped Items:") print("=" * 40) for item_type, item in self.equipped_items.items(): if item: print(f"{item_type}: {item['name']} - {item['description']}") else: print(f"{item_type}: None") def display_status(self): clear_screen() print("Player Status:") print("=" * 40) print(f"Name: {self.name}") print(f"Difficulty: {self.difficulty}") print("-" * 40) print("Stats:") print(f"HP :❤️{self.base_stats['HP']}") print(f"Defense :🛡️{self.defense}") print(f"Attack :⚔️{self.attack}") print(f"Dodge :🤺{self.dodge}") print(f"Speed :🏃{self.speed}") print("-"*40) print(f"Level: {self.level}") print(f"Experience: {self.experience}/{self.exp_required}") print("-"*40) print(f"Gold: {self.gold} 💰") print(f"Diamonds: {self.diamonds} 💎") print("="*40) print("Game Options:") print("1. Visit Shop") print("2. Inventory") print("3. Equipped Items") print("4. Play Game") print("5. Add 50 Experience Points") print("< Back to Main Menu") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.visit_shop() elif choice == "2": self.visit_inventory() elif choice == "3": self.display_equipped_items() elif choice == "4": self.play_game() elif choice == "5": self.add_experience(50) elif choice == "<": return else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_status() def calculate_stat(self, stat_name): base_stat = getattr(self, stat_name) bonus_stat = sum(item.get(stat_name, 0) for item in self.equipped_items.values() if item) return base_stat + bonus_stat def display_items(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): if item: # Check if item is not None print(f"{idx}. {item['name']}: {item['description']}") else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.visit_inventory() elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_items(item_type) else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.visit_inventory() else: print("Invalid option. Please enter < to go back.") time.sleep(1) self.visit_inventory() def equip_item(self, item_type, index): if item_type in self.equipped_items: if 0 <= index < len(self.inventory[item_type]): item = self.inventory[item_type].pop(index) if self.equipped_items[item_type]: old_item = self.equipped_items[item_type] self.inventory[item_type].append(old_item) self.equipped_items[item_type] = item self.update_stats() # Update stats after equipping any item print(f"{item['name']} equipped.") time.sleep(1) else: print("Invalid item index.") time.sleep(1) else: print("Invalid item type.") time.sleep(1) def apply_item_stats(self, item): if 'Attack' in item: self.attack += item['Attack'] if 'Defense' in item: self.defense += item['Defense'] if 'Dodge' in item: self.dodge += item['Dodge'] if 'Speed' in item: self.speed += item['Speed'] def unequip_item(self, item_type_to_swap): if self.equipped_items[item_type_to_swap]: self.swap_item(item_type_to_swap) else: print("No item equipped.") time.sleep(1) self.display_equipped_items() def unequip_menu(self, item_type_to_swap): os.system('cls' if os.name == 'nt' else 'clear') print(f"Swap {item_type_to_swap}:") print("=" * 40) if self.equipped_items[item_type_to_swap]: equipped_item = self.equipped_items[item_type_to_swap] if 'description' in equipped_item: print(f"1. {equipped_item['name']} - {equipped_item['description']}") else: print(f"1. {equipped_item['name']}") print("Enter 1 to swap or press < to cancel.") choice = input("") if choice == "1": self.swap_item(item_type_to_swap) elif choice == "<": self.display_equipped_items() else: print("Invalid option. Please enter a valid option.") time.sleep(1) self.unequip_menu(item_type_to_swap) else: print(f"No {item_type_to_swap} equipped.") time.sleep(1) self.display_equipped_items() def swap_item(self, item_type_to_swap): os.system('cls' if os.name == 'nt' else 'clear') print(f"Swap {item_type_to_swap}:") print("=" * 40) if self.inventory[item_type_to_swap]: for idx, item in enumerate(self.inventory[item_type_to_swap], 1): if item: # Check if item is not None print(f"{idx}. {item['name']}: {item['description']}") else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.unequip_menu(item_type_to_swap) elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type_to_swap]): self.equip_item(item_type_to_swap, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_equipped_items() # Add this line to return to the "Equipped Items" section else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.unequip_menu(item_type_to_swap) else: print("Invalid option. Please enter < to go back.") time.sleep(1) self.unequip_menu(item_type_to_swap) def display_equipped_items(self): clear_screen() print("Equipped Items:") print("=" * 40) for item_type, item in self.equipped_items.items(): if item: name = item.get('name', 'Unknown') description = item.get('description', 'No description') print(f"{item_type}: {name} - {description}") else: print(f"{item_type}: None") print("\nSwap Items:") print("=" * 40) for i, (item_type, item) in enumerate(self.equipped_items.items(), start=1): if item: name = item.get('name', 'Unknown') description = item.get('description', 'No description') print(f"{i}. {item_type}: {name} - {description}") else: print(f"{i}. {item_type}: None") print("Press < to go back to the player status menu.") choice = input("") if choice == "<": self.display_status() elif choice.isdigit(): index = int(choice) - 1 if 0 <= index < len(self.equipped_items): item_type_to_unequip = list(self.equipped_items.keys())[index] self.unequip_menu(item_type_to_unequip) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_equipped_items() else: print("Invalid option. Please enter a valid option.") time.sleep(1) self.display_equipped_items() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def play_game(self): clear_screen() # Placeholder for play game functionality input("Play game functionality is under construction. Press Enter to return to the player status menu...") self.display_status() def add_experience(self, amount): self.experience += amount if self.experience >= self.exp_required: self.level_up() self.display_status() def level_up(self): self.level += 1 self.experience = 0 self.attack += 0.5 self.defense += 0.5 self.dodge += 0.5 self.speed += 0.5 self.exp_multiplier = 0.25 self.exp_required = int(self.exp_required * (1 + self.exp_multiplier)) # Update exp required with new multiplier def equip_item_level_up(self, item): if 'Attack' in item: self.attack += item['Attack'] if 'Defense' in item: self.defense += item['Defense'] if 'Dodge' in item: self.dodge += item['Dodge'] if 'Speed' in item: self.speed += item['Speed'] def get_name_display(self): symbol = "" if self.difficulty == "Basic": symbol = "🛡️" elif self.difficulty == "Exemplar": symbol = "⚔️" elif self.difficulty == "Templar": symbol = "☠️" return f"{symbol} {self.name}" def get_difficulty_display(self): return self.difficulty def visit_shop(self): clear_screen() while True: os.system('cls' if os.name == 'nt' else 'clear') print("Welcome to the Shop!") print("=" * 40) print("Shop Sections:") print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select a shop section.") choice = input("") if choice == "1": self.display_shop_section("Weapons") elif choice == "2": self.display_shop_section("Armors") elif choice == "3": self.display_shop_section("Shields") elif choice == "4": self.display_shop_section("Footwear") elif choice == "5": self.display_shop_section("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_shop_section(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"Shop - {item_type}:") print("=" * 40) if item_type in items_groups: for idx, item in enumerate(items_groups[item_type], 1): print(f"{idx}. {item['name']}: {item['description']} - Cost: {item['cost']} gold") print("0. Back to Shop Sections") print("Enter the number to purchase the item or 0 to go back.") choice = input("") if choice == "0": self.visit_shop() elif choice.isdigit() and 0 < int(choice) <= len(items_groups[item_type]): self.purchase_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_shop_section(item_type) else: print("Invalid shop section.") time.sleep(1) self.visit_shop() def purchase_item(self, item_type, index): item = items_groups[item_type][index] cost = item['cost'] if self.gold >= cost: self.gold -= cost self.inventory[item_type].append(item) print(f"You have purchased {item['name']} for {cost} gold.") time.sleep(1) else: print("Insufficient gold to purchase this item.") time.sleep(1) self.display_shop_section(item_type) items_groups = { "Usable Items": [ {"name": "Small Healing Potion", "description": "+15 hp", "cost": 20}, {"name": "Self Healing Potion", "description": "+20 hp", "cost": 50}, {"name": "Moderated Potion", "description": "+25 hp", "cost": 75}, {"name": "Regen Potion", "description": "+15%", "cost": 100}, {"name": "Hammerhead Crocker", "description": "+7% attack for 7 turns", "cost": 55, "Attack": 0.07}, {"name": "Warhammer Crocker", "description": "+15% attack for 7 turns", "cost": 75, "Attack": 0.15}, {"name": "Barhog", "description": "+7% Defense for 7 turns", "cost": 45, "Defense": 0.07}, {"name": "Warhog", "description": "+15% defense for 7 turns", "cost": 60, "Defense": 0.15}, {"name": "Non applicable scroll", "description": "+2 Speed for 7 turns", "cost": 40, "Speed": 2}, {"name": "Applicable scroll", "description": "+4 speed for 7 turns", "cost": 55, "Speed": 4}, {"name": "Ransacked Shield", "description": "+12% Dodge chance for 3 turns", "cost": 60, "Dodge": 0.12}, {"name": "Unbuilded Shield", "description": "+23% Dodge Chance for 5 turns", "cost": 90, "Dodge": 0.23}, {"name": "Mystic Scroll", "description": "25% chance to negate all debuffs on player for 4 turns", "cost": 60}, {"name": "Mystic Beurau", "description": "50% chance to negate all debuffs on player for 4 turns", "cost": 120}, {"name": "Variant Bs", "description": "Increase all stats up to 25% for 10 turns", "cost": 200}, {"name": "Variant Ex", "description": "Increase all stats up to 50% for 10 turns", "cost": 400}, {"name": "Hide cloak", "description": "40% chance to dodge the battle against enemies when exploring", "cost": 50, "Dodge": 0.4}, {"name": "Invisible potion", "description": "60% chance to dodge the battle against enemies when exploring", "cost": 75, "Dodge": 0.6}, {"name": "Exp Moneter", "description": "Give you 20 exp points", "cost": 50}, {"name": "Exp Vitalis", "description": "Give you 50 exp points", "cost": 100}, {"name": "Exp For enhancer", "description": "Give you 100 points", "cost": 150} ], "Weapons": [ {"name": "Stone Sword", "description": "+12 attack", "cost": 150, "Attack": 12}, {"name": "Copper Sword", "description": "+15 attack", "cost": 275, "Attack": 15}, {"name": "Sickanum Sword", "description": "+17 attack", "cost": 400, "Attack": 17}, {"name": "Arivanum Sword", "description": "+23 attack", "cost": 600, "Attack": 23}, {"name": "Viranium Sword", "description": "+25 attack", "cost": 850, "Attack": 25}, {"name": "Titanium sword", "description": "+35 attack", "cost": 1250, "Attack": 35} ], "Armors": [ {"name": "Jungle sets", "description": "+7 Defense", "cost": 90, "Defense": 7}, {"name": "Byzantine sets", "description": "+12 Defense", "cost": 140, "Defense": 12}, {"name": "Nikel Sets", "description": "+15 Defense", "cost": 350, "Defense": 15}, {"name": "Warhead Sets", "description": "+25 Defense", "cost": 560, "Defense": 25}, {"name": "Titanium Sets", "description": "+40 Defense", "cost": 850, "Defense": 40} ], "Shields": [ {"name": "Wooden Ob", "description": "+2 dodge", "cost": 80, "Dodge": 2}, {"name": "Long Ob", "description": "+3 dodge, +2 Defense", "cost": 120, "Dodge": 3, "Defense": 2}, {"name": "Cob Ob", "description": "+5 dodge, +4 Defense", "cost": 300, "Dodge": 5, "Defense": 4}, {"name": "Knock Ob", "description": "+7 dodge, +5 Defense, +3 Attack", "cost": 550, "Dodge": 7, "Defense": 5, "Attack": 3}, {"name": "Neb Ob", "description": "+12 dodge, +7 Defense, +5 Attack", "cost": 760, "Dodge": 12, "Defense": 7, "Attack": 5} ], "Footwear": [ {"name": "Jungle Foot", "description": "+3 speeds", "cost": 45, "Speed": 3}, {"name": "Iron Foot", "description": "+5 Speed", "cost": 75, "Speed": 5}, {"name": "Metal WarFoot", "description": "+8 Speeds", "cost": 120, "Speed": 8}, {"name": "Diamond Boots", "description": "+12 Speeds", "cost": 230, "Speed": 12}, {"name": "Noble Boots", "description": "+19 Speeds", "cost": 450, "Speed": 19}, {"name": "Lizable Boots", "description": "+25 Speeds", "cost": 700, "Speed": 25} ], "Weapons None": [ {"name": "None", "description": "No Weapons Used", "cost" : 0, "Attack": 0} ], "Armors None": [ {"name": "None", "description": "Armors Used", "cost" : 0, "Attack": 0} ], "Shields None": [ {"name": "None", "description": "No Shields Used", "cost" : 0, "Attack": 0} ], "Footwear None": [ {"name": "None", "description": "No Footwears Used", "cost" : 0, "Attack": 0} ], } def create_character(): clear_screen() print("Character Creation") name = input("Enter your character's name: ") clear_screen() print(f"Character Name: {name}\n") while True: print("Select Difficulty:") print("1. Basic 🛡️") print("2. Exemplar ⚔️") print("3. Templar ☠️") difficulty_choice = input("Enter the number to select difficulty: ") if difficulty_choice == "1": difficulty = "Basic" description = "Enemies are powerful in their origins." elif difficulty_choice == "2": difficulty = "Exemplar" description = "Enemies are harder and more immortalized." elif difficulty_choice == "3": difficulty = "Templar" description = "Enemies are evils." else: print("Invalid difficulty choice. Please choose a valid option.") time.sleep(1) clear_screen() continue clear_screen() print("Selected Difficulty:") print(f"Name: {name}") print(f"Difficulty: {difficulty}") print(f"Description: {description}\n") print("1. Confirm") print("2. Back") confirm_choice = input("Enter your choice: ") if confirm_choice == "1": break elif confirm_choice == "2": clear_screen() continue else: print("Invalid choice. Please enter 1 to confirm or 2 to go back.") time.sleep(1) clear_screen() player = Player(name, difficulty) player.equipped_items["Weapons"] = {"name": "Broken Sword", "description": "+10 Damage", "attack": 10} player.equipped_items["Armors"] = {"name": "Broken Armor", "description": "+5 Defense", "defense": 5} player.equipped_items["Shields"] = {"name": "Broken Shield", "description": "+2 Dodge", "dodge": 2} player.equipped_items["Footwear"] = {"name": "Broken Footwear", "description": "+3 Speed", "speed": 3} return Player(name, difficulty) def clear_screen(): """Clears the console screen.""" os.system('cls' if os.name == 'nt' else 'clear') def main_menu(): clear_screen() print("BeaVenture\n") print("1. Create Character") print("2. Exit") print("\nEnter the number to select an option.") def main(): while True: main_menu() try: choice = int(input("")) if choice == 1: player = create_character() player.display_status() elif choice == 2: clear_screen() print("Exiting BeaVenture. Goodbye!") time.sleep(2) clear_screen() print("Game Was Ended") input("Press Enter to exit...") clear_screen() break else: print("Invalid option. Please enter a valid number.") time.sleep(2) except ValueError: print("Invalid input. Please enter a number.") if __name__ == "__main__": main()
import os import time import sys class Player: def __init__(self, name, difficulty): self.name = name self.difficulty = difficulty Attack = 0 Defense = 0 Dodge = 0 Speed = 0 self.gold = 10000 self.diamonds = 0 self.experience = 0 self.level = 1 self.exp_required = 100 self.exp_multiplier = 0.75 # 75% increase for experience requirement per level self.inventory = { # Initialize inventory "Weapons": [], "Armors": [], "Shields": [], "Footwear": [], "Usable Items": [] # Add Usable Items category } self.equipped_items = { # Initialize equipped items "Weapons": {"name": "Broken Sword", "description": "+10 Damage", "Attack": 10}, "Armors": {"name": "Broken Armor", "description": "+5 Defense", "Defense": 5}, "Shields": {"name": "Broken Shield", "description": "+2 Dodge", "Dodge": 2}, "Footwear": {"name": "Broken Footwear", "description": "+3 Speed", "Speed": 3}, "Accessories": None, "Bag": None } self.base_stats = { "HP": 100, "Defense": 0, "Attack": 0, "Dodge": 0, "Speed": 0 } self.max_inventory_slots = 30 self.update_stats() # Update player stats based on equipped items def visit_inventory(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Inventory:") print("=" * 40) print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.display_items("Weapons") elif choice == "2": self.display_items("Armors") elif choice == "3": self.display_items("Shields") elif choice == "4": self.display_items("Footwear") elif choice == "5": self.display_items("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_items(self, item_type): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): print(f"{idx}. {item['name']}: {item['description']}") print("0. Back to Inventory Menu") print("Enter the number to equip the item or 0 to go back.") choice = input("") if choice == "0": break # Break out of the inner loop to return to the previous menu elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("No items in this category.") print("Press < to go back") choice = input("") if choice == "<": break # Break out of the inner loop to return to the previous menu def equip_item(self, item_type, index): if item_type in self.equipped_items: if 0 <= index < len(self.inventory[item_type]): item = self.inventory[item_type].pop(index) if self.equipped_items[item_type]: old_item = self.equipped_items[item_type] self.inventory[item_type].append(old_item) self.equipped_items[item_type] = item self.update_stats() # Update stats after equipping any item print(f"{item['name']} equipped.") time.sleep(1) self.display_equipped_items() # Display equipped items after equipping return # Added to exit the method and prevent further execution else: print("Invalid item index.") time.sleep(1) else: print("Invalid item type.") time.sleep(1) def update_stats(self): # Reset stats to base values for stat in self.base_stats: setattr(self, stat.lower(), self.base_stats[stat]) # Apply bonuses from equipped items equipped = False # Flag to track if any item is equipped for item_type, item in self.equipped_items.items(): if item: equipped = True self.when_equipped(item) # If no items are equipped, set all stats (except HP) to 0 if not equipped: for stat in self.base_stats: if stat != "HP": setattr(self, stat.lower(), 0) def when_equipped(self, item): for stat in item: if stat in self.base_stats: setattr(self, stat.lower(), self.base_stats[stat] + item[stat]) def display_equipped_items(self): os.system('cls' if os.name == 'nt' else 'clear') print("Equipped Items:") print("=" * 40) for item_type, item in self.equipped_items.items(): if item: print(f"{item_type}: {item['name']} - {item['description']}") else: print(f"{item_type}: None") def display_status(self): clear_screen() print("Player Status:") print("=" * 40) print(f"Name: {self.name}") print(f"Difficulty: {self.difficulty}") print("-" * 40) print("Stats:") print(f"HP :❤️{self.base_stats['HP']}") print(f"Defense :🛡️{self.defense}") print(f"Attack :⚔️{self.attack}") print(f"Dodge :🤺{self.dodge}") print(f"Speed :🏃{self.speed}") print("-"*40) print(f"Level: {self.level}") print(f"Experience: {self.experience}/{self.exp_required}") print("-"*40) print(f"Gold: {self.gold} 💰") print(f"Diamonds: {self.diamonds} 💎") print("="*40) print("Game Options:") print("1. Visit Shop") print("2. Inventory") print("3. Equipped Items") print("4. Play Game") print("5. Delete this Character") print("6. Add 50 Experience Points") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.visit_shop() elif choice == "2": self.visit_inventory() elif choice == "3": self.display_equipped_items() elif choice == "4": self.play_game() elif choice == "5": return elif choice == "6": self.add_experience(50) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_status() def calculate_stat(self, stat_name): base_stat = getattr(self, stat_name) bonus_stat = sum(item.get(stat_name, 0) for item in self.equipped_items.values() if item) return base_stat + bonus_stat def display_items(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): if item: # Check if item is not None print(f"{idx}. {item['name']}: {item['description']}") else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.visit_inventory() elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_items(item_type) else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.visit_inventory() else: print("Invalid option. Please enter < to go back.") time.sleep(1) self.visit_inventory() def equip_item(self, item_type, index): if item_type in self.equipped_items: if 0 <= index < len(self.inventory[item_type]): item = self.inventory[item_type].pop(index) if self.equipped_items[item_type]: old_item = self.equipped_items[item_type] self.inventory[item_type].append(old_item) self.equipped_items[item_type] = item self.update_stats() # Update stats after equipping any item print(f"{item['name']} equipped.") time.sleep(1) else: print("Invalid item index.") time.sleep(1) else: print("Invalid item type.") time.sleep(1) def apply_item_stats(self, item): if 'Attack' in item: self.attack += item['Attack'] if 'Defense' in item: self.defense += item['Defense'] if 'Dodge' in item: self.dodge += item['Dodge'] if 'Speed' in item: self.speed += item['Speed'] def unequip_item(self, item_type_to_swap): if self.equipped_items[item_type_to_swap]: self.swap_item(item_type_to_swap) else: print("No item equipped.") time.sleep(1) self.display_equipped_items() def unequip_menu(self, item_type_to_swap): os.system('cls' if os.name == 'nt' else 'clear') print(f"Swap {item_type_to_swap}:") print("=" * 40) if self.equipped_items[item_type_to_swap]: equipped_item = self.equipped_items[item_type_to_swap] if 'description' in equipped_item: print(f"1. {equipped_item['name']} - {equipped_item['description']}") else: print(f"1. {equipped_item['name']}") print("Enter 1 to swap or press < to cancel.") choice = input("") if choice == "1": self.swap_item(item_type_to_swap) elif choice == "<": self.display_equipped_items() else: print("Invalid option. Please enter a valid option.") time.sleep(1) self.unequip_menu(item_type_to_swap) else: print(f"No {item_type_to_swap} equipped.") time.sleep(1) self.display_equipped_items() def swap_item(self, item_type_to_swap): os.system('cls' if os.name == 'nt' else 'clear') print(f"Swap {item_type_to_swap}:") print("=" * 40) if self.inventory[item_type_to_swap]: for idx, item in enumerate(self.inventory[item_type_to_swap], 1): if item: # Check if item is not None print(f"{idx}. {item['name']}: {item['description']}") else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.unequip_menu(item_type_to_swap) elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type_to_swap]): self.equip_item(item_type_to_swap, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_equipped_items() # Add this line to return to the "Equipped Items" section else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.unequip_menu(item_type_to_swap) else: print("Invalid option. Please enter < to go back.") time.sleep(1) self.unequip_menu(item_type_to_swap) def display_equipped_items(self): clear_screen() print("Equipped Items:") print("=" * 40) for item_type, item in self.equipped_items.items(): if item: name = item.get('name', 'Unknown') description = item.get('description', 'No description') print(f"{item_type}: {name} - {description}") else: print(f"{item_type}: None") print("\nUnequip Items:") print("=" * 40) for i, (item_type, item) in enumerate(self.equipped_items.items(), start=1): if item: name = item.get('name', 'Unknown') description = item.get('description', 'No description') print(f"{i}. {item_type}: {name} - {description}") else: print(f"{i}. {item_type}: None") print("Press < to go back to the player status menu.") choice = input("") if choice == "<": self.display_status() elif choice.isdigit(): index = int(choice) - 1 if 0 <= index < len(self.equipped_items): item_type_to_unequip = list(self.equipped_items.keys())[index] self.unequip_menu(item_type_to_unequip) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_equipped_items() else: print("Invalid option. Please enter a valid option.") time.sleep(1) self.display_equipped_items() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def play_game(self): clear_screen() # Placeholder for play game functionality input("Play game functionality is under construction. Press Enter to return to the player status menu...") self.display_status() def add_experience(self, amount): self.experience += amount if self.experience >= self.exp_required: self.level_up() self.display_status() def level_up(self): self.level += 1 self.experience = 0 self.attack += 0.5 self.defense += 0.5 self.dodge += 0.5 self.speed += 0.5 self.exp_multiplier = 0.25 self.exp_required = int(self.exp_required * (1 + self.exp_multiplier)) # Update exp required with new multiplier def equip_item_level_up(self, item): if 'Attack' in item: self.attack += item['Attack'] if 'Defense' in item: self.defense += item['Defense'] if 'Dodge' in item: self.dodge += item['Dodge'] if 'Speed' in item: self.speed += item['Speed'] def get_name_display(self): symbol = "" if self.difficulty == "Basic": symbol = "🛡️" elif self.difficulty == "Exemplar": symbol = "⚔️" elif self.difficulty == "Templar": symbol = "☠️" return f"{symbol} {self.name}" def get_difficulty_display(self): return self.difficulty def visit_shop(self): clear_screen() while True: os.system('cls' if os.name == 'nt' else 'clear') print("Welcome to the Shop!") print("=" * 40) print("Shop Sections:") print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select a shop section.") choice = input("") if choice == "1": self.display_shop_section("Weapons") elif choice == "2": self.display_shop_section("Armors") elif choice == "3": self.display_shop_section("Shields") elif choice == "4": self.display_shop_section("Footwear") elif choice == "5": self.display_shop_section("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_shop_section(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"Shop - {item_type}:") print("=" * 40) if item_type in items_groups: for idx, item in enumerate(items_groups[item_type], 1): print(f"{idx}. {item['name']}: {item['description']} - Cost: {item['cost']} gold") print("0. Back to Shop Sections") print("Enter the number to purchase the item or 0 to go back.") choice = input("") if choice == "0": self.visit_shop() elif choice.isdigit() and 0 < int(choice) <= len(items_groups[item_type]): self.purchase_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_shop_section(item_type) else: print("Invalid shop section.") time.sleep(1) self.visit_shop() def purchase_item(self, item_type, index): item = items_groups[item_type][index] cost = item['cost'] if self.gold >= cost: self.gold -= cost self.inventory[item_type].append(item) print(f"You have purchased {item['name']} for {cost} gold.") time.sleep(1) else: print("Insufficient gold to purchase this item.") time.sleep(1) self.display_shop_section(item_type) items_groups = { "Usable Items": [ {"name": "Small Healing Potion", "description": "+15 hp", "cost": 20}, {"name": "Self Healing Potion", "description": "+20 hp", "cost": 50}, {"name": "Moderated Potion", "description": "+25 hp", "cost": 75}, {"name": "Regen Potion", "description": "+15%", "cost": 100}, {"name": "Hammerhead Crocker", "description": "+7% attack for 7 turns", "cost": 55, "Attack": 0.07}, {"name": "Warhammer Crocker", "description": "+15% attack for 7 turns", "cost": 75, "Attack": 0.15}, {"name": "Barhog", "description": "+7% Defense for 7 turns", "cost": 45, "Defense": 0.07}, {"name": "Warhog", "description": "+15% defense for 7 turns", "cost": 60, "Defense": 0.15}, {"name": "Non applicable scroll", "description": "+2 Speed for 7 turns", "cost": 40, "Speed": 2}, {"name": "Applicable scroll", "description": "+4 speed for 7 turns", "cost": 55, "Speed": 4}, {"name": "Ransacked Shield", "description": "+12% Dodge chance for 3 turns", "cost": 60, "Dodge": 0.12}, {"name": "Unbuilded Shield", "description": "+23% Dodge Chance for 5 turns", "cost": 90, "Dodge": 0.23}, {"name": "Mystic Scroll", "description": "25% chance to negate all debuffs on player for 4 turns", "cost": 60}, {"name": "Mystic Beurau", "description": "50% chance to negate all debuffs on player for 4 turns", "cost": 120}, {"name": "Variant Bs", "description": "Increase all stats up to 25% for 10 turns", "cost": 200}, {"name": "Variant Ex", "description": "Increase all stats up to 50% for 10 turns", "cost": 400}, {"name": "Hide cloak", "description": "40% chance to dodge the battle against enemies when exploring", "cost": 50, "Dodge": 0.4}, {"name": "Invisible potion", "description": "60% chance to dodge the battle against enemies when exploring", "cost": 75, "Dodge": 0.6}, {"name": "Exp Moneter", "description": "Give you 20 exp points", "cost": 50}, {"name": "Exp Vitalis", "description": "Give you 50 exp points", "cost": 100}, {"name": "Exp For enhancer", "description": "Give you 100 points", "cost": 150} ], "Weapons": [ {"name": "Stone Sword", "description": "+12 attack", "cost": 150, "Attack": 12}, {"name": "Copper Sword", "description": "+15 attack", "cost": 275, "Attack": 15}, {"name": "Sickanum Sword", "description": "+17 attack", "cost": 400, "Attack": 17}, {"name": "Arivanum Sword", "description": "+23 attack", "cost": 600, "Attack": 23}, {"name": "Viranium Sword", "description": "+25 attack", "cost": 850, "Attack": 25}, {"name": "Titanium sword", "description": "+35 attack", "cost": 1250, "Attack": 35} ], "Armors": [ {"name": "Jungle sets", "description": "+7 Defense", "cost": 90, "Defense": 7}, {"name": "Byzantine sets", "description": "+12 Defense", "cost": 140, "Defense": 12}, {"name": "Nikel Sets", "description": "+15 Defense", "cost": 350, "Defense": 15}, {"name": "Warhead Sets", "description": "+25 Defense", "cost": 560, "Defense": 25}, {"name": "Titanium Sets", "description": "+40 Defense", "cost": 850, "Defense": 40} ], "Shields": [ {"name": "Wooden Ob", "description": "+2 dodge", "cost": 80, "Dodge": 2}, {"name": "Long Ob", "description": "+3 dodge, +2 Defense", "cost": 120, "Dodge": 3, "Defense": 2}, {"name": "Cob Ob", "description": "+5 dodge, +4 Defense", "cost": 300, "Dodge": 5, "Defense": 4}, {"name": "Knock Ob", "description": "+7 dodge, +5 Defense, +3 Attack", "cost": 550, "Dodge": 7, "Defense": 5, "Attack": 3}, {"name": "Neb Ob", "description": "+12 dodge, +7 Defense, +5 Attack", "cost": 760, "Dodge": 12, "Defense": 7, "Attack": 5} ], "Footwear": [ {"name": "Jungle Foot", "description": "+3 speeds", "cost": 45, "Speed": 3}, {"name": "Iron Foot", "description": "+5 Speed", "cost": 75, "Speed": 5}, {"name": "Metal WarFoot", "description": "+8 Speeds", "cost": 120, "Speed": 8}, {"name": "Diamond Boots", "description": "+12 Speeds", "cost": 230, "Speed": 12}, {"name": "Noble Boots", "description": "+19 Speeds", "cost": 450, "Speed": 19}, {"name": "Lizable Boots", "description": "+25 Speeds", "cost": 700, "Speed": 25} ], "Weapons None": [ {"name": "None", "description": "No Weapons Used", "cost" : 0, "Attack": 0} ], "Armors None": [ {"name": "None", "description": "Armors Used", "cost" : 0, "Attack": 0} ], "Shields None": [ {"name": "None", "description": "No Shields Used", "cost" : 0, "Attack": 0} ], "Footwear None": [ {"name": "None", "description": "No Footwears Used", "cost" : 0, "Attack": 0} ], } def create_character(): clear_screen() print("Character Creation") name = input("Enter your character's name: ") clear_screen() print(f"Character Name: {name}\n") while True: print("Select Difficulty:") print("1. Basic 🛡️") print("2. Exemplar ⚔️") print("3. Templar ☠️") difficulty_choice = input("Enter the number to select difficulty: ") if difficulty_choice == "1": difficulty = "Basic" description = "Enemies are powerful in their origins." elif difficulty_choice == "2": difficulty = "Exemplar" description = "Enemies are harder and more immortalized." elif difficulty_choice == "3": difficulty = "Templar" description = "Enemies are evils." else: print("Invalid difficulty choice. Please choose a valid option.") time.sleep(1) clear_screen() continue clear_screen() print("Selected Difficulty:") print(f"Name: {name}") print(f"Difficulty: {difficulty}") print(f"Description: {description}\n") print("1. Confirm") print("2. Back") confirm_choice = input("Enter your choice: ") if confirm_choice == "1": break elif confirm_choice == "2": clear_screen() continue else: print("Invalid choice. Please enter 1 to confirm or 2 to go back.") time.sleep(1) clear_screen() player = Player(name, difficulty) player.equipped_items["Weapons"] = {"name": "Broken Sword", "description": "+10 Damage", "attack": 10} player.equipped_items["Armors"] = {"name": "Broken Armor", "description": "+5 Defense", "defense": 5} player.equipped_items["Shields"] = {"name": "Broken Shield", "description": "+2 Dodge", "dodge": 2} player.equipped_items["Footwear"] = {"name": "Broken Footwear", "description": "+3 Speed", "speed": 3} return Player(name, difficulty) def clear_screen(): """Clears the console screen.""" os.system('cls' if os.name == 'nt' else 'clear') def main_menu(): clear_screen() print("BeaVenture\n") print("1. Create Character") print("2. Exit") print("\nEnter the number to select an option.") def main(): while True: main_menu() try: choice = int(input("")) if choice == 1: player = create_character() player.display_status() elif choice == 2: clear_screen() print("Exiting BeaVenture. Goodbye!") time.sleep(2) clear_screen() print("Game Was Ended") input("Press Enter to exit...") clear_screen() break else: print("Invalid option. Please enter a valid number.") time.sleep(2) except ValueError: print("Invalid input. Please enter a number.") if __name__ == "__main__": main()
import os import time import sys class Player: def __init__(self, name, difficulty): self.name = name self.difficulty = difficulty Attack = 0 Defense = 0 Dodge = 0 Speed = 0 self.gold = 10000 self.diamonds = 0 self.experience = 0 self.level = 1 self.exp_required = 100 self.exp_multiplier = 0.75 # 75% increase for experience requirement per level self.inventory = { # Initialize inventory "Weapons": [], "Armors": [], "Shields": [], "Footwear": [], "Usable Items": [] # Add Usable Items category } self.equipped_items = { # Initialize equipped items "Weapons": {"name": "Broken Sword", "description": "+10 Damage", "Attack": 10}, "Armors": {"name": "Broken Armor", "description": "+5 Defense", "Defense": 5}, "Shields": {"name": "Broken Shield", "description": "+2 Dodge", "Dodge": 2}, "Footwear": {"name": "Broken Footwear", "description": "+3 Speed", "Speed": 3}, "Accessories": None, "Bag": None } self.base_stats = { "HP": 100, "Defense": 0, "Attack": 0, "Dodge": 0, "Speed": 0 } self.max_inventory_slots = 30 self.update_stats() # Update player stats based on equipped items def visit_inventory(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Inventory:") print("=" * 40) print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.display_items("Weapons") elif choice == "2": self.display_items("Armors") elif choice == "3": self.display_items("Shields") elif choice == "4": self.display_items("Footwear") elif choice == "5": self.display_items("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_items(self, item_type): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): print(f"{idx}. {item['name']}: {item['description']}") print("0. Back to Inventory Menu") print("Enter the number to equip the item or 0 to go back.") choice = input("") if choice == "0": break # Break out of the inner loop to return to the previous menu elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("No items in this category.") print("Press < to go back") choice = input("") if choice == "<": break # Break out of the inner loop to return to the previous menu def equip_item(self, item_type, index): item = self.inventory[item_type].pop(index) if item_type in ["Weapons", "Armors", "Shields", "Footwear"]: self.remove_equipped_item(item_type) # Remove any previously equipped item of the same type self.equipped_items[item_type] = item # Equip the new item self.update_stats() # Update player stats with the new equipment print(f"{item['name']} equipped.") time.sleep(1) else: # Handle equipping usable items pass self.visit_inventory() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def update_stats(self): # Reset stats to base values for stat in self.base_stats: setattr(self, stat.lower(), self.base_stats[stat]) # Apply bonuses from equipped items equipped = False # Flag to track if any item is equipped for item_type, item in self.equipped_items.items(): if item: equipped = True self.when_equipped(item) # If no items are equipped, set all stats (except HP) to 0 if not equipped: for stat in self.base_stats: if stat != "HP": setattr(self, stat.lower(), 0) def when_equipped(self, item): for stat in item: if stat in self.base_stats: setattr(self, stat.lower(), self.base_stats[stat] + item[stat]) def display_equipped_items(self): os.system('cls' if os.name == 'nt' else 'clear') print("Equipped Items:") print("=" * 40) for item_type, item in self.equipped_items.items(): if item: print(f"{item_type}: {item['name']} - {item['description']}") else: print(f"{item_type}: None") def display_status(self): clear_screen() print("Player Status:") print("=" * 40) print(f"Name: {self.name}") print(f"Difficulty: {self.difficulty}") print("-" * 40) print("Stats:") print(f"HP :❤️{self.base_stats['HP']}") print(f"Defense :🛡️{self.defense}") print(f"Attack :⚔️{self.attack}") print(f"Dodge :🤺{self.dodge}") print(f"Speed :🏃{self.speed}") print("-"*40) print(f"Level: {self.level}") print(f"Experience: {self.experience}/{self.exp_required}") print("-"*40) print(f"Gold: {self.gold} 💰") print(f"Diamonds: {self.diamonds} 💎") print("="*40) print("Game Options:") print("1. Visit Shop") print("2. Inventory") print("3. Equipped Items") print("4. Play Game") print("5. Delete this Character") print("6. Add 50 Experience Points") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.visit_shop() elif choice == "2": self.visit_inventory() elif choice == "3": self.display_equipped_items() elif choice == "4": self.play_game() elif choice == "5": return elif choice == "6": self.add_experience(50) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_status() def calculate_stat(self, stat_name): base_stat = getattr(self, stat_name) bonus_stat = sum(item.get(stat_name, 0) for item in self.equipped_items.values() if item) return base_stat + bonus_stat def display_items(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): if item: # Check if item is not None print(f"{idx}. {item['name']}: {item['description']}") else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.visit_inventory() elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_items(item_type) else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.visit_inventory() else: print("Invalid option. Please enter < to go back.") time.sleep(1) self.visit_inventory() def equip_item(self, item_type, index): if item_type in self.equipped_items: if 0 <= index < len(self.inventory[item_type]): item = self.inventory[item_type].pop(index) if self.equipped_items[item_type]: old_item = self.equipped_items[item_type] self.inventory[item_type].append(old_item) self.equipped_items[item_type] = item self.update_stats() # Update stats after equipping any item print(f"{item['name']} equipped.") time.sleep(1) else: print("Invalid item index.") time.sleep(1) else: print("Invalid item type.") time.sleep(1) def apply_item_stats(self, item): if 'Attack' in item: self.attack += item['Attack'] if 'Defense' in item: self.defense += item['Defense'] if 'Dodge' in item: self.dodge += item['Dodge'] if 'Speed' in item: self.speed += item['Speed'] def unequip_item(self, item_type_to_swap): if self.equipped_items[item_type_to_swap]: self.swap_item(item_type_to_swap) else: print("No item equipped.") time.sleep(1) self.display_equipped_items() def unequip_menu(self, item_type_to_swap): os.system('cls' if os.name == 'nt' else 'clear') print(f"Swap {item_type_to_swap}:") print("=" * 40) if self.equipped_items[item_type_to_swap]: equipped_item = self.equipped_items[item_type_to_swap] if 'description' in equipped_item: print(f"1. {equipped_item['name']} - {equipped_item['description']}") else: print(f"1. {equipped_item['name']}") print("Enter 1 to swap or press < to cancel.") choice = input("") if choice == "1": self.swap_item(item_type_to_swap) elif choice == "<": self.display_equipped_items() else: print("Invalid option. Please enter a valid option.") time.sleep(1) self.unequip_menu(item_type_to_swap) else: print(f"No {item_type_to_swap} equipped.") time.sleep(1) self.display_equipped_items() def swap_item(self, item_type_to_swap): os.system('cls' if os.name == 'nt' else 'clear') print(f"Swap {item_type_to_swap}:") print("=" * 40) if self.inventory[item_type_to_swap]: for idx, item in enumerate(self.inventory[item_type_to_swap], 1): if item: # Check if item is not None print(f"{idx}. {item['name']}: {item['description']}") else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.unequip_menu(item_type_to_swap) elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type_to_swap]): self.equip_item(item_type_to_swap, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.swap_item(item_type_to_swap) else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.unequip_menu(item_type_to_swap) else: print("Invalid option. Please enter < to go back.") time.sleep(1) self.unequip_menu(item_type_to_swap) def display_equipped_items(self): clear_screen() print("Equipped Items:") print("=" * 40) for item_type, item in self.equipped_items.items(): if item: name = item.get('name', 'Unknown') description = item.get('description', 'No description') print(f"{item_type}: {name} - {description}") else: print(f"{item_type}: None") print("\nUnequip Items:") print("=" * 40) for i, (item_type, item) in enumerate(self.equipped_items.items(), start=1): if item: name = item.get('name', 'Unknown') description = item.get('description', 'No description') print(f"{i}. {item_type}: {name} - {description}") else: print(f"{i}. {item_type}: None") print("Press < to go back to the player status menu.") choice = input("") if choice == "<": self.display_status() elif choice.isdigit(): index = int(choice) - 1 if 0 <= index < len(self.equipped_items): item_type_to_unequip = list(self.equipped_items.keys())[index] self.unequip_menu(item_type_to_unequip) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_equipped_items() else: print("Invalid option. Please enter a valid option.") time.sleep(1) self.display_equipped_items() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def play_game(self): clear_screen() # Placeholder for play game functionality input("Play game functionality is under construction. Press Enter to return to the player status menu...") self.display_status() def add_experience(self, amount): self.experience += amount if self.experience >= self.exp_required: self.level_up() self.display_status() def level_up(self): self.level += 1 self.experience = 0 self.attack += 0.5 self.defense += 0.5 self.dodge += 0.5 self.speed += 0.5 self.exp_multiplier = 0.25 self.exp_required = int(self.exp_required * (1 + self.exp_multiplier)) # Update exp required with new multiplier def equip_item_level_up(self, item): if 'Attack' in item: self.attack += item['Attack'] if 'Defense' in item: self.defense += item['Defense'] if 'Dodge' in item: self.dodge += item['Dodge'] if 'Speed' in item: self.speed += item['Speed'] def get_name_display(self): symbol = "" if self.difficulty == "Basic": symbol = "🛡️" elif self.difficulty == "Exemplar": symbol = "⚔️" elif self.difficulty == "Templar": symbol = "☠️" return f"{symbol} {self.name}" def get_difficulty_display(self): return self.difficulty def visit_shop(self): clear_screen() while True: os.system('cls' if os.name == 'nt' else 'clear') print("Welcome to the Shop!") print("=" * 40) print("Shop Sections:") print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select a shop section.") choice = input("") if choice == "1": self.display_shop_section("Weapons") elif choice == "2": self.display_shop_section("Armors") elif choice == "3": self.display_shop_section("Shields") elif choice == "4": self.display_shop_section("Footwear") elif choice == "5": self.display_shop_section("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_shop_section(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"Shop - {item_type}:") print("=" * 40) if item_type in items_groups: for idx, item in enumerate(items_groups[item_type], 1): print(f"{idx}. {item['name']}: {item['description']} - Cost: {item['cost']} gold") print("0. Back to Shop Sections") print("Enter the number to purchase the item or 0 to go back.") choice = input("") if choice == "0": self.visit_shop() elif choice.isdigit() and 0 < int(choice) <= len(items_groups[item_type]): self.purchase_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_shop_section(item_type) else: print("Invalid shop section.") time.sleep(1) self.visit_shop() def purchase_item(self, item_type, index): item = items_groups[item_type][index] cost = item['cost'] if self.gold >= cost: self.gold -= cost self.inventory[item_type].append(item) print(f"You have purchased {item['name']} for {cost} gold.") time.sleep(1) else: print("Insufficient gold to purchase this item.") time.sleep(1) self.display_shop_section(item_type) items_groups = { "Usable Items": [ {"name": "Small Healing Potion", "description": "+15 hp", "cost": 20}, {"name": "Self Healing Potion", "description": "+20 hp", "cost": 50}, {"name": "Moderated Potion", "description": "+25 hp", "cost": 75}, {"name": "Regen Potion", "description": "+15%", "cost": 100}, {"name": "Hammerhead Crocker", "description": "+7% attack for 7 turns", "cost": 55, "Attack": 0.07}, {"name": "Warhammer Crocker", "description": "+15% attack for 7 turns", "cost": 75, "Attack": 0.15}, {"name": "Barhog", "description": "+7% Defense for 7 turns", "cost": 45, "Defense": 0.07}, {"name": "Warhog", "description": "+15% defense for 7 turns", "cost": 60, "Defense": 0.15}, {"name": "Non applicable scroll", "description": "+2 Speed for 7 turns", "cost": 40, "Speed": 2}, {"name": "Applicable scroll", "description": "+4 speed for 7 turns", "cost": 55, "Speed": 4}, {"name": "Ransacked Shield", "description": "+12% Dodge chance for 3 turns", "cost": 60, "Dodge": 0.12}, {"name": "Unbuilded Shield", "description": "+23% Dodge Chance for 5 turns", "cost": 90, "Dodge": 0.23}, {"name": "Mystic Scroll", "description": "25% chance to negate all debuffs on player for 4 turns", "cost": 60}, {"name": "Mystic Beurau", "description": "50% chance to negate all debuffs on player for 4 turns", "cost": 120}, {"name": "Variant Bs", "description": "Increase all stats up to 25% for 10 turns", "cost": 200}, {"name": "Variant Ex", "description": "Increase all stats up to 50% for 10 turns", "cost": 400}, {"name": "Hide cloak", "description": "40% chance to dodge the battle against enemies when exploring", "cost": 50, "Dodge": 0.4}, {"name": "Invisible potion", "description": "60% chance to dodge the battle against enemies when exploring", "cost": 75, "Dodge": 0.6}, {"name": "Exp Moneter", "description": "Give you 20 exp points", "cost": 50}, {"name": "Exp Vitalis", "description": "Give you 50 exp points", "cost": 100}, {"name": "Exp For enhancer", "description": "Give you 100 points", "cost": 150} ], "Weapons": [ {"name": "Stone Sword", "description": "+12 attack", "cost": 150, "Attack": 12}, {"name": "Copper Sword", "description": "+15 attack", "cost": 275, "Attack": 15}, {"name": "Sickanum Sword", "description": "+17 attack", "cost": 400, "Attack": 17}, {"name": "Arivanum Sword", "description": "+23 attack", "cost": 600, "Attack": 23}, {"name": "Viranium Sword", "description": "+25 attack", "cost": 850, "Attack": 25}, {"name": "Titanium sword", "description": "+35 attack", "cost": 1250, "Attack": 35} ], "Armors": [ {"name": "Jungle sets", "description": "+7 Defense", "cost": 90, "Defense": 7}, {"name": "Byzantine sets", "description": "+12 Defense", "cost": 140, "Defense": 12}, {"name": "Nikel Sets", "description": "+15 Defense", "cost": 350, "Defense": 15}, {"name": "Warhead Sets", "description": "+25 Defense", "cost": 560, "Defense": 25}, {"name": "Titanium Sets", "description": "+40 Defense", "cost": 850, "Defense": 40} ], "Shields": [ {"name": "Wooden Ob", "description": "+2 dodge", "cost": 80, "Dodge": 2}, {"name": "Long Ob", "description": "+3 dodge, +2 Defense", "cost": 120, "Dodge": 3, "Defense": 2}, {"name": "Cob Ob", "description": "+5 dodge, +4 Defense", "cost": 300, "Dodge": 5, "Defense": 4}, {"name": "Knock Ob", "description": "+7 dodge, +5 Defense, +3 Attack", "cost": 550, "Dodge": 7, "Defense": 5, "Attack": 3}, {"name": "Neb Ob", "description": "+12 dodge, +7 Defense, +5 Attack", "cost": 760, "Dodge": 12, "Defense": 7, "Attack": 5} ], "Footwear": [ {"name": "Jungle Foot", "description": "+3 speeds", "cost": 45, "Speed": 3}, {"name": "Iron Foot", "description": "+5 Speed", "cost": 75, "Speed": 5}, {"name": "Metal WarFoot", "description": "+8 Speeds", "cost": 120, "Speed": 8}, {"name": "Diamond Boots", "description": "+12 Speeds", "cost": 230, "Speed": 12}, {"name": "Noble Boots", "description": "+19 Speeds", "cost": 450, "Speed": 19}, {"name": "Lizable Boots", "description": "+25 Speeds", "cost": 700, "Speed": 25} ], "Weapons None": [ {"name": "None", "description": "No Weapons Used", "cost" : 0, "Attack": 0} ], "Armors None": [ {"name": "None", "description": "Armors Used", "cost" : 0, "Attack": 0} ], "Shields None": [ {"name": "None", "description": "No Shields Used", "cost" : 0, "Attack": 0} ], "Footwear None": [ {"name": "None", "description": "No Footwears Used", "cost" : 0, "Attack": 0} ], } def create_character(): clear_screen() print("Character Creation") name = input("Enter your character's name: ") clear_screen() print(f"Character Name: {name}\n") while True: print("Select Difficulty:") print("1. Basic 🛡️") print("2. Exemplar ⚔️") print("3. Templar ☠️") difficulty_choice = input("Enter the number to select difficulty: ") if difficulty_choice == "1": difficulty = "Basic" description = "Enemies are powerful in their origins." elif difficulty_choice == "2": difficulty = "Exemplar" description = "Enemies are harder and more immortalized." elif difficulty_choice == "3": difficulty = "Templar" description = "Enemies are evils." else: print("Invalid difficulty choice. Please choose a valid option.") time.sleep(1) clear_screen() continue clear_screen() print("Selected Difficulty:") print(f"Name: {name}") print(f"Difficulty: {difficulty}") print(f"Description: {description}\n") print("1. Confirm") print("2. Back") confirm_choice = input("Enter your choice: ") if confirm_choice == "1": break elif confirm_choice == "2": clear_screen() continue else: print("Invalid choice. Please enter 1 to confirm or 2 to go back.") time.sleep(1) clear_screen() player = Player(name, difficulty) player.equipped_items["Weapons"] = {"name": "Broken Sword", "description": "+10 Damage", "attack": 10} player.equipped_items["Armors"] = {"name": "Broken Armor", "description": "+5 Defense", "defense": 5} player.equipped_items["Shields"] = {"name": "Broken Shield", "description": "+2 Dodge", "dodge": 2} player.equipped_items["Footwear"] = {"name": "Broken Footwear", "description": "+3 Speed", "speed": 3} return Player(name, difficulty) def clear_screen(): """Clears the console screen.""" os.system('cls' if os.name == 'nt' else 'clear') def main_menu(): clear_screen() print("BeaVenture\n") print("1. Create Character") print("2. Exit") print("\nEnter the number to select an option.") def main(): while True: main_menu() try: choice = int(input("")) if choice == 1: player = create_character() player.display_status() elif choice == 2: clear_screen() print("Exiting BeaVenture. Goodbye!") time.sleep(2) clear_screen() print("Game Was Ended") input("Press Enter to exit...") clear_screen() break else: print("Invalid option. Please enter a valid number.") time.sleep(2) except ValueError: print("Invalid input. Please enter a number.") if __name__ == "__main__": main()
import os import time import sys class Player: def __init__(self, name, difficulty): self.name = name self.difficulty = difficulty self.attack = 0 self.defense = 0 self.dodge = 0 self.speed = 0 self.gold = 0 self.diamonds = 0 self.experience = 0 self.level = 1 self.exp_required = 100 self.exp_multiplier = 0.75 # 75% increase for experience requirement per level self.inventory = { # Initialize inventory "Weapons": [], "Armors": [], "Shields": [], "Footwear": [], "Usable Items": [] # Add Usable Items category } self.equipped_items = { # Initialize equipped items "Weapons": {"name": "Broken Sword", "description": "+10 Damage", "Attack": 10}, "Armors": {"name": "Broken Armor", "description": "+5 Defense", "Defense": 5}, "Shields": {"name": "Broken Shield", "description": "+2 Dodge", "Dodge": 2}, "Footwear": {"name": "Broken Footwear", "description": "+3 Speed", "Speed": 3}, "Accessories": None, "Bag": None } self.base_stats = { "HP": 100, "Defense": 0, "Attack": 0, "Dodge": 0, "Speed": 0 } self.max_inventory_slots = 30 self.update_stats() # Update player stats based on equipped items def visit_inventory(self): while True: os.system('cls' if os.name == 'nt' else 'clear') print("Inventory:") print("=" * 40) print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.display_items("Weapons") elif choice == "2": self.display_items("Armors") elif choice == "3": self.display_items("Shields") elif choice == "4": self.display_items("Footwear") elif choice == "5": self.display_items("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_items(self, item_type): while True: os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): print(f"{idx}. {item['name']}: {item['description']}") print("0. Back to Inventory Menu") print("Enter the number to equip the item or 0 to go back.") choice = input("") if choice == "0": break # Break out of the inner loop to return to the previous menu elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) else: print("No items in this category.") print("Press < to go back") choice = input("") if choice == "<": break # Break out of the inner loop to return to the previous menu def equip_item(self, item_type, index): item = self.inventory[item_type].pop(index) if item_type in ["Weapons", "Armors", "Shields", "Footwear"]: self.remove_equipped_item(item_type) # Remove any previously equipped item of the same type self.equipped_items[item_type] = item # Equip the new item self.update_stats() # Update player stats with the new equipment print(f"{item['name']} equipped.") time.sleep(1) else: # Handle equipping usable items pass self.visit_inventory() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def update_stats(self): # Reset stats to base values for stat in self.base_stats: setattr(self, stat.lower(), self.base_stats[stat]) # Apply bonuses from equipped items equipped = False # Flag to track if any item is equipped for item_type, item in self.equipped_items.items(): if item: equipped = True self.when_equipped(item) # If no items are equipped, set all stats (except HP) to 0 if not equipped: for stat in self.base_stats: if stat != "HP": setattr(self, stat.lower(), 0) def when_equipped(self, item): for stat in item: if stat in self.base_stats: setattr(self, stat.lower(), self.base_stats[stat] + item[stat]) def display_equipped_items(self): os.system('cls' if os.name == 'nt' else 'clear') print("Equipped Items:") print("=" * 40) for item_type, item in self.equipped_items.items(): if item: print(f"{item_type}: {item['name']} - {item['description']}") else: print(f"{item_type}: None") def display_status(self): clear_screen() print("Player Status:") print("=" * 40) print(f"Name: {self.name}") print(f"Difficulty: {self.difficulty}") print("-" * 40) print("Stats:") print(f"HP :❤️{self.base_stats['HP']}") print(f"Defense :🛡️{self.defense}") print(f"Attack :⚔️{self.attack}") print(f"Dodge :🤺{self.dodge}") print(f"Speed :🏃{self.speed}") print("-"*40) print(f"Level: {self.level}") print(f"Experience: {self.experience}/{self.exp_required}") print("-"*40) print(f"Gold: {self.gold} 💰") print(f"Diamonds: {self.diamonds} 💎") print("="*40) print("Game Options:") print("1. Visit Shop") print("2. Inventory") print("3. Equipped Items") print("4. Play Game") print("5. Delete this Character") print("6. Add 50 Experience Points") print("\nEnter the number to select an option.") choice = input("") if choice == "1": self.visit_shop() elif choice == "2": self.visit_inventory() elif choice == "3": self.display_equipped_items() elif choice == "4": self.play_game() elif choice == "5": return elif choice == "6": self.add_experience(50) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_status() def calculate_stat(self, stat_name): base_stat = getattr(self, stat_name) bonus_stat = sum(item.get(stat_name, 0) for item in self.equipped_items.values() if item) return base_stat + bonus_stat def display_items(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"{item_type}:") print("=" * 40) if self.inventory[item_type]: for idx, item in enumerate(self.inventory[item_type], 1): if item: # Check if item is not None print(f"{idx}. {item['name']}: {item['description']}") else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.visit_inventory() elif choice.isdigit() and 0 < int(choice) <= len(self.inventory[item_type]): self.equip_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_items(item_type) else: print("No items in this category.") print("You need to press < to go back.") choice = input("") if choice == "<": self.visit_inventory() else: print("Invalid option. Please enter < to go back.") time.sleep(1) self.visit_inventory() def equip_item(self, item_type, index): if item_type in self.equipped_items: if 0 <= index < len(self.inventory[item_type]): item = self.inventory[item_type].pop(index) if self.equipped_items[item_type]: old_item = self.equipped_items[item_type] self.inventory[item_type].append(old_item) self.equipped_items[item_type] = item self.update_stats() # Update stats after equipping any item print(f"{item['name']} equipped.") time.sleep(1) else: print("Invalid item index.") time.sleep(1) else: print("Invalid item type.") time.sleep(1) def apply_item_stats(self, item): if 'Attack' in item: self.attack += item['Attack'] if 'Defense' in item: self.defense += item['Defense'] if 'Dodge' in item: self.dodge += item['Dodge'] if 'Speed' in item: self.speed += item['Speed'] def unequip_item(self, item_type_to_unequip): if self.equipped_items[item_type_to_unequip]: self.inventory[item_type_to_unequip].append(self.equipped_items[item_type_to_unequip]) self.equipped_items[item_type_to_unequip] = None print(f"{item_type_to_unequip}: None") time.sleep(1) self.unequip_menu(item_type_to_unequip) else: print("No item equipped.") time.sleep(1) self.display_equipped_items() def unequip_menu(self, item_type_to_unequip): os.system('cls' if os.name == 'nt' else 'clear') print(f"Unequip {item_type_to_unequip}:") print("=" * 40) if self.equipped_items[item_type_to_unequip]: print(f"1. {self.equipped_items[item_type_to_unequip]['name']} - {self.equipped_items[item_type_to_unequip]['description']}") print("Enter 1 to unequip or press < to cancel.") choice = input("") if choice == "1": self.unequip_item(item_type_to_unequip) elif choice == "<": self.display_equipped_items() else: print("Invalid option. Please enter a valid option.") time.sleep(1) self.unequip_menu(item_type_to_unequip) else: print(f"No {item_type_to_unequip} equipped.") time.sleep(1) self.display_equipped_items() def display_equipped_items(self): clear_screen() print("Equipped Items:") print("=" * 40) for item_type, item in self.equipped_items.items(): if item: print(f"{item_type}: {item['name']} - {item['description']}") else: print(f"{item_type}: None") print("\nUnequip Items:") print("=" * 40) for i, (item_type, item) in enumerate(self.equipped_items.items(), start=1): if item: print(f"{i}. {item_type}: {item['name']} - {item['description']}") else: print(f"{i}. {item_type}: None") print("Press < to go back to the player status menu.") choice = input("") if choice == "<": self.display_status() elif choice.isdigit(): index = int(choice) - 1 if 0 <= index < len(self.equipped_items): item_type_to_unequip = list(self.equipped_items.keys())[index] self.unequip_menu(item_type_to_unequip) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_equipped_items() else: print("Invalid option. Please enter a valid option.") time.sleep(1) self.display_equipped_items() def remove_equipped_item(self, item_type): if item_type in self.equipped_items: item = self.equipped_items.pop(item_type) self.inventory[item_type].append(item) def play_game(self): clear_screen() # Placeholder for play game functionality input("Play game functionality is under construction. Press Enter to return to the player status menu...") self.display_status() def add_experience(self, amount): self.experience += amount if self.experience >= self.exp_required: self.level_up() self.display_status() def level_up(self): self.level += 1 self.experience = 0 self.attack += 0.5 self.defense += 0.5 self.dodge += 0.5 self.speed += 0.5 self.exp_multiplier = 0.25 self.exp_required = int(self.exp_required * (1 + self.exp_multiplier)) # Update exp required with new multiplier def equip_item_level_up(self, item): if 'Attack' in item: self.attack += item['Attack'] if 'Defense' in item: self.defense += item['Defense'] if 'Dodge' in item: self.dodge += item['Dodge'] if 'Speed' in item: self.speed += item['Speed'] def get_name_display(self): symbol = "" if self.difficulty == "Basic": symbol = "🛡️" elif self.difficulty == "Exemplar": symbol = "⚔️" elif self.difficulty == "Templar": symbol = "☠️" return f"{symbol} {self.name}" def get_difficulty_display(self): return self.difficulty def visit_shop(self): clear_screen() while True: os.system('cls' if os.name == 'nt' else 'clear') print("Welcome to the Shop!") print("=" * 40) print("Shop Sections:") print("1. Weapons") print("2. Armors") print("3. Shields") print("4. Footwear") print("5. Usable Items") print("6. Back to Player Status") print("\nEnter the number to select a shop section.") choice = input("") if choice == "1": self.display_shop_section("Weapons") elif choice == "2": self.display_shop_section("Armors") elif choice == "3": self.display_shop_section("Shields") elif choice == "4": self.display_shop_section("Footwear") elif choice == "5": self.display_shop_section("Usable Items") elif choice == "6": self.display_status() else: print("Invalid option. Please enter a valid number.") time.sleep(1) def display_shop_section(self, item_type): os.system('cls' if os.name == 'nt' else 'clear') print(f"Shop - {item_type}:") print("=" * 40) if item_type in items_groups: for idx, item in enumerate(items_groups[item_type], 1): print(f"{idx}. {item['name']}: {item['description']} - Cost: {item['cost']} gold") print("0. Back to Shop Sections") print("Enter the number to purchase the item or 0 to go back.") choice = input("") if choice == "0": self.visit_shop() elif choice.isdigit() and 0 < int(choice) <= len(items_groups[item_type]): self.purchase_item(item_type, int(choice) - 1) else: print("Invalid option. Please enter a valid number.") time.sleep(1) self.display_shop_section(item_type) else: print("Invalid shop section.") time.sleep(1) self.visit_shop() def purchase_item(self, item_type, index): item = items_groups[item_type][index] cost = item['cost'] if self.gold >= cost: self.gold -= cost self.inventory[item_type].append(item) print(f"You have purchased {item['name']} for {cost} gold.") time.sleep(1) else: print("Insufficient gold to purchase this item.") time.sleep(1) self.display_shop_section(item_type) items_groups = { "Usable Items": [ {"name": "Small Healing Potion", "description": "+15 hp", "cost": 20}, {"name": "Self Healing Potion", "description": "+20 hp", "cost": 50}, {"name": "Moderated Potion", "description": "+25 hp", "cost": 75}, {"name": "Regen Potion", "description": "+15%", "cost": 100}, {"name": "Hammerhead Crocker", "description": "+7% attack for 7 turns", "cost": 55, "Attack": 0.07}, {"name": "Warhammer Crocker", "description": "+15% attack for 7 turns", "cost": 75, "Attack": 0.15}, {"name": "Barhog", "description": "+7% Defense for 7 turns", "cost": 45, "Defense": 0.07}, {"name": "Warhog", "description": "+15% defense for 7 turns", "cost": 60, "Defense": 0.15}, {"name": "Non applicable scroll", "description": "+2 Speed for 7 turns", "cost": 40, "Speed": 2}, {"name": "Applicable scroll", "description": "+4 speed for 7 turns", "cost": 55, "Speed": 4}, {"name": "Ransacked Shield", "description": "+12% Dodge chance for 3 turns", "cost": 60, "Dodge": 0.12}, {"name": "Unbuilded Shield", "description": "+23% Dodge Chance for 5 turns", "cost": 90, "Dodge": 0.23}, {"name": "Mystic Scroll", "description": "25% chance to negate all debuffs on player for 4 turns", "cost": 60}, {"name": "Mystic Beurau", "description": "50% chance to negate all debuffs on player for 4 turns", "cost": 120}, {"name": "Variant Bs", "description": "Increase all stats up to 25% for 10 turns", "cost": 200}, {"name": "Variant Ex", "description": "Increase all stats up to 50% for 10 turns", "cost": 400}, {"name": "Hide cloak", "description": "40% chance to dodge the battle against enemies when exploring", "cost": 50, "Dodge": 0.4}, {"name": "Invisible potion", "description": "60% chance to dodge the battle against enemies when exploring", "cost": 75, "Dodge": 0.6}, {"name": "Exp Moneter", "description": "Give you 20 exp points", "cost": 50}, {"name": "Exp Vitalis", "description": "Give you 50 exp points", "cost": 100}, {"name": "Exp For enhancer", "description": "Give you 100 points", "cost": 150} ], "Weapons": [ {"name": "Stone Sword", "description": "+12 attack", "cost": 150, "Attack": 12}, {"name": "Copper Sword", "description": "+15 attack", "cost": 275, "Attack": 15}, {"name": "Sickanum Sword", "description": "+17 attack", "cost": 400, "Attack": 17}, {"name": "Arivanum Sword", "description": "+23 attack", "cost": 600, "Attack": 23}, {"name": "Viranium Sword", "description": "+25 attack", "cost": 850, "Attack": 25}, {"name": "Titanium sword", "description": "+35 attack", "cost": 1250, "Attack": 35} ], "Armors": [ {"name": "Jungle sets", "description": "+7 Defense", "cost": 90, "Defense": 7}, {"name": "Byzantine sets", "description": "+12 Defense", "cost": 140, "Defense": 12}, {"name": "Nikel Sets", "description": "+15 Defense", "cost": 350, "Defense": 15}, {"name": "Warhead Sets", "description": "+25 Defense", "cost": 560, "Defense": 25}, {"name": "Titanium Sets", "description": "+40 Defense", "cost": 850, "Defense": 40} ], "Shields": [ {"name": "Wooden Ob", "description": "+2 dodge", "cost": 80, "Dodge": 2}, {"name": "Long Ob", "description": "+3 dodge, +2 Defense", "cost": 120, "Dodge": 3, "Defense": 2}, {"name": "Cob Ob", "description": "+5 dodge, +4 Defense", "cost": 300, "Dodge": 5, "Defense": 4}, {"name": "Knock Ob", "description": "+7 dodge, +5 Defense, +3 Attack", "cost": 550, "Dodge": 7, "Defense": 5, "Attack": 3}, {"name": "Neb Ob", "description": "+12 dodge, +7 Defense, +5 Attack", "cost": 760, "Dodge": 12, "Defense": 7, "Attack": 5} ], "Footwear": [ {"name": "Jungle Foot", "description": "+3 speeds", "cost": 45, "Speed": 3}, {"name": "Iron Foot", "description": "+5 Speed", "cost": 75, "Speed": 5}, {"name": "Metal WarFoot", "description": "+8 Speeds", "cost": 120, "Speed": 8}, {"name": "Diamond Boots", "description": "+12 Speeds", "cost": 230, "Speed": 12}, {"name": "Noble Boots", "description": "+19 Speeds", "cost": 450, "Speed": 19}, {"name": "Lizable Boots", "description": "+25 Speeds", "cost": 700, "Speed": 25} ] } def create_character(): clear_screen() print("Character Creation") name = input("Enter your character's name: ") clear_screen() print(f"Character Name: {name}\n") while True: print("Select Difficulty:") print("1. Basic 🛡️") print("2. Exemplar ⚔️") print("3. Templar ☠️") difficulty_choice = input("Enter the number to select difficulty: ") if difficulty_choice == "1": difficulty = "Basic" description = "Enemies are powerful in their origins." elif difficulty_choice == "2": difficulty = "Exemplar" description = "Enemies are harder and more immortalized." elif difficulty_choice == "3": difficulty = "Templar" description = "Enemies are evils." else: print("Invalid difficulty choice. Please choose a valid option.") time.sleep(1) clear_screen() continue clear_screen() print("Selected Difficulty:") print(f"Name: {name}") print(f"Difficulty: {difficulty}") print(f"Description: {description}\n") print("1. Confirm") print("2. Back") confirm_choice = input("Enter your choice: ") if confirm_choice == "1": break elif confirm_choice == "2": clear_screen() continue else: print("Invalid choice. Please enter 1 to confirm or 2 to go back.") time.sleep(1) clear_screen() player = Player(name, difficulty) player.equipped_items["Weapons"] = {"name": "Broken Sword", "description": "+10 Damage", "attack": 10} player.equipped_items["Armors"] = {"name": "Broken Armor", "description": "+5 Defense", "defense": 5} player.equipped_items["Shields"] = {"name": "Broken Shield", "description": "+2 Dodge", "dodge": 2} player.equipped_items["Footwear"] = {"name": "Broken Footwear", "description": "+3 Speed", "speed": 3} return Player(name, difficulty) def clear_screen(): """Clears the console screen.""" os.system('cls' if os.name == 'nt' else 'clear') def main_menu(): clear_screen() print("BeaVenture\n") print("1. Create Character") print("2. Exit") print("\nEnter the number to select an option.") def main(): while True: main_menu() try: choice = int(input("")) if choice == 1: player = create_character() player.display_status() elif choice == 2: clear_screen() print("Exiting BeaVenture. Goodbye!") time.sleep(2) clear_screen() print("Game Was Ended") input("Press Enter to exit...") clear_screen() break else: print("Invalid option. Please enter a valid number.") time.sleep(2) except ValueError: print("Invalid input. Please enter a number.") if __name__ == "__main__": main()
/*! * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. */ (() => { 'use strict'; const storedTheme = localStorage.getItem('theme'); const getPreferredTheme = () => { if (storedTheme) { return storedTheme; } return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; }; const setTheme = function (theme) { if ( theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches ) { document.documentElement.setAttribute('data-bs-theme', 'dark'); } else { document.documentElement.setAttribute('data-bs-theme', theme); } }; setTheme(getPreferredTheme()); const showActiveTheme = (theme, focus = false) => { const themeSwitcher = document.querySelector('#bd-theme'); if (!themeSwitcher) { return; } const themeSwitcherText = document.querySelector('#bd-theme-text'); const activeThemeIcon = document.querySelector('.theme-icon-active use'); const btnToActive = document.querySelector( `[data-bs-theme-value="${theme}"]` ); const svgOfActiveBtn = btnToActive .querySelector('svg use') .getAttribute('href'); document.querySelectorAll('[data-bs-theme-value]').forEach((element) => { element.classList.remove('active'); element.setAttribute('aria-pressed', 'false'); }); btnToActive.classList.add('active'); btnToActive.setAttribute('aria-pressed', 'true'); activeThemeIcon.setAttribute('href', svgOfActiveBtn); const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`; themeSwitcher.setAttribute('aria-label', themeSwitcherLabel); if (focus) { themeSwitcher.focus(); } }; window .matchMedia('(prefers-color-scheme: dark)') .addEventListener('change', () => { if (storedTheme !== 'light' || storedTheme !== 'dark') { setTheme(getPreferredTheme()); } }); window.addEventListener('DOMContentLoaded', () => { showActiveTheme(getPreferredTheme()); document.querySelectorAll('[data-bs-theme-value]').forEach((toggle) => { toggle.addEventListener('click', () => { const theme = toggle.getAttribute('data-bs-theme-value'); localStorage.setItem('theme', theme); setTheme(theme); showActiveTheme(theme, true); }); }); }); })();
<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel"> <div class="carousel-inner"> <div class="carousel-item active"> <img src="..." class="d-block w-100" alt="..."> </div> <div class="carousel-item"> <img src="..." class="d-block w-100" alt="..."> </div> <div class="carousel-item"> <img src="..." class="d-block w-100" alt="..."> </div> </div> <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="visually-hidden">Previous</span> </button> <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="visually-hidden">Next</span> </button> </div>
<!-- Navbar --> <nav class="navbar navbar-expand-lg bg-light navbar-light"> <!-- Container wrapper --> <div class="container-fluid"> <!-- Navbar brand --> <a class="navbar-brand" href="#">Brand</a> <!-- Toggle button --> <button class="navbar-toggler" type="button" data-mdb-toggle="collapse" data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" > <i class="fas fa-bars"></i> </button> <!-- Collapsible wrapper --> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav me-auto mb-2 mb-lg-0"> <!-- Link --> <li class="nav-item"><a class="nav-link" href="#">Link</a></li> <!-- Dropdown --> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-mdb-toggle="dropdown" aria-expanded="false" > Dropdown </a> <ul class="dropdown-menu" aria-labelledby="navbarDropdown"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li><hr class="dropdown-divider" /></li> <li><a class="dropdown-item" href="#">Something else here</a></li> </ul> </li> </ul> <!-- Icons --> <ul class="navbar-nav d-flex flex-row me-1"> <li class="nav-item me-3 me-lg-0"> <a class="nav-link" href="#"><i class="fas fa-shopping-cart"></i></a> </li> <li class="nav-item me-3 me-lg-0"> <a class="nav-link" href="#"><i class="fab fa-twitter"></i></a> </li> </ul> <!-- Search --> <form class="w-auto"> <input type="search" class="form-control" placeholder="Type query" aria-label="Search" /> </form> </div> </div> <!-- Container wrapper --> </nav> <!-- Navbar -->
“I want you to write a [NUMBER]-word [WRITING TYPE] about [THIS SPECIFIC TOPIC] for me, written in a tone that is [DESCRIBE TONE]. The text should be tailored to [SPECIFIC TARGET READER, GIVE CONTEXT]. It should be formatted with [PROVIDE FORMATTING INSTRUCTIONS] Like this: [EXAMPLE FORMAT] The purpose of this text is to [WHAT THE TARGET OUTCOME IS FOR YOU]. For context, I am a [WHAT YOU DO, GIVE CONTEXT] looking to [YOUR GOAL].”
<p>Copyright © <script>document.write(new Date().getFullYear())</script> Your Name All Rights Reserved</p>
curl --request POST \ --url 'https://api.apyhub.com/convert/word-file/pdf-file?output=test-sample.pdf&landscape=false' \ --header 'apy-token: APY0BOODK2plpXgxRjezmBOXqID51DGpFq8QnHJeBQrrzuIBc25UIglN93bbwvnkBWlUia1' \ --header 'content-type: multipart/form-data' \ --form 'file=@"test.doc"'
<div class="text-center"> <img src="..." class="rounded" alt="..."> </div>
Sun Mar 24 2024 03:20:38 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/18561424/using-for-strings-in-a-loop-is-it-bad-practice
Sat Mar 23 2024 21:49:49 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/dark-light-mode-toggle-javascript-javascript/6512e47034967700139f79ad
Sat Mar 23 2024 21:46:11 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/bootstrap-4-6-0-the-default-breakpoints-css/64bba96cef21fa0013a53a7d
Sat Mar 23 2024 21:43:32 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/carousel-bootstrap-v5-2/6366e1c243f3120015119587
Sat Mar 23 2024 21:41:55 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/150-bootstrap-navbar-examples-free-generator-creator-html/639e04f3a245070015bd15ac
Sat Mar 23 2024 20:54:01 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/dynamic-copyright-footer/65faf918999e0a001433ac25
Sat Mar 23 2024 20:51:53 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/doc-to-pdf-conversion-api-data/65fdb54b05080e0014aed7ba
Sat Mar 23 2024 20:32:16 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/images-bootstrap-center/638e2bcf80f66300158ca522