przebudowa app, dodanie funkcji stats
This commit is contained in:
parent
a29e8338bf
commit
2ca910d2eb
6 changed files with 136 additions and 72 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -8,3 +8,7 @@ __pycache__
|
|||
auto-save-list
|
||||
.\#*
|
||||
.kateproject
|
||||
|
||||
#### project
|
||||
db/
|
||||
dev/
|
||||
|
|
61
app.py
61
app.py
|
@ -1,13 +1,10 @@
|
|||
from engine import Engine
|
||||
from game import Game
|
||||
from player import Player
|
||||
from enemy import Enemy
|
||||
|
||||
# ENGINE SECTION
|
||||
eng = Engine()
|
||||
|
||||
# GAME SECTION
|
||||
game = Game()
|
||||
STATs = game.stats()
|
||||
|
||||
# PLAYER SECTION
|
||||
player = Player("キーウィ")
|
||||
|
@ -30,26 +27,42 @@ def logo():
|
|||
print(logo)
|
||||
|
||||
|
||||
loop = True
|
||||
while loop is True:
|
||||
def menu():
|
||||
running = True
|
||||
while running:
|
||||
if player is False:
|
||||
print("--- CREATE CHARACTER ___")
|
||||
game.create_character()
|
||||
else:
|
||||
print(f"--- HELLO {player.name} ___")
|
||||
print("--- WARNING, TEST MODE ___")
|
||||
print("? What you would like to do today?")
|
||||
print("戦う [f]ight mode")
|
||||
print("顔 show [c]haracter")
|
||||
|
||||
timetochoose = input(">___ ")
|
||||
|
||||
if timetochoose == "Q" or timetochoose == "q":
|
||||
running = False
|
||||
break
|
||||
elif timetochoose == "F" or timetochoose == "f":
|
||||
breakpoint()
|
||||
game.clean_screen()
|
||||
winorloose = game.figth_mode(player, dummykid)
|
||||
if winorloose == 0:
|
||||
print("### BRAK WALKI ###")
|
||||
else:
|
||||
print("LET'S FIGHT")
|
||||
elif timetochoose == "C" or timetochoose == "c":
|
||||
game.clean_screen()
|
||||
player.show_stats(stats=STATs)
|
||||
|
||||
|
||||
def main():
|
||||
game.clean_screen()
|
||||
logo()
|
||||
if player is False:
|
||||
print("--- CREATE CHARACTER ___")
|
||||
game.create_character()
|
||||
else:
|
||||
print(f"--- HELLO {player.name} ___")
|
||||
print("--- WARNING, TEST MODE ___")
|
||||
print("? What you would like to do today?")
|
||||
print("戦う [f]ight mode")
|
||||
print("顔 show [c]haracter")
|
||||
menu()
|
||||
|
||||
# breakpoint()
|
||||
timetochoose = input(">___ ")
|
||||
|
||||
if timetochoose == "Q" or timetochoose == "q":
|
||||
loop = False
|
||||
elif timetochoose == "F" or timetochoose == "f":
|
||||
print("### tutaj będzie fight mode ###")
|
||||
# game.figth_mode()
|
||||
elif timetochoose == 'C' or timetochoose == 'c':
|
||||
player.show_stats()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
6
enemy.py
6
enemy.py
|
@ -1,11 +1,7 @@
|
|||
|
||||
|
||||
class Enemy:
|
||||
|
||||
def __init__(self):
|
||||
self.name = "Dummy"
|
||||
self.hp = 10
|
||||
self.mp = 0
|
||||
self.HP = 10
|
||||
|
||||
def show_dummy(self):
|
||||
print(f"Name: {self.name}")
|
||||
|
|
13
engine.py
13
engine.py
|
@ -1,13 +0,0 @@
|
|||
import random
|
||||
from os import system
|
||||
|
||||
|
||||
class Engine:
|
||||
def roll_d20(self):
|
||||
return random.randint(1, 20)
|
||||
|
||||
def roll_d10(self):
|
||||
return random.randint(1, 10)
|
||||
|
||||
def roll_d6(self):
|
||||
return random.randint(1, 6)
|
89
game.py
89
game.py
|
@ -1,28 +1,95 @@
|
|||
# from engine import Engine
|
||||
from os import system, name
|
||||
from random import randint
|
||||
from player import Player
|
||||
from enemy import Enemy
|
||||
|
||||
|
||||
class Game:
|
||||
def roll_d20(self):
|
||||
return randint(1, 20)
|
||||
|
||||
def roll_d10(self):
|
||||
return randint(1, 10)
|
||||
|
||||
def roll_d6(self):
|
||||
return randint(1, 6)
|
||||
|
||||
def clean_screen(self):
|
||||
if name == "nt":
|
||||
_ = system("cls")
|
||||
else:
|
||||
_ = system("clear")
|
||||
|
||||
def figth_mode(self, player: Player, enemy: Enemy):
|
||||
"""
|
||||
--- FIGHT MODE ___
|
||||
player: Player Class
|
||||
enemy: Enemy Class
|
||||
|
||||
Funkcja wykorzystywana w przypadku gdy gracz napotka na przeciwnika.
|
||||
Jest to bardzo wczesna funkcja do rozbudowania.
|
||||
"""
|
||||
STATUS = None
|
||||
FIGHT = True
|
||||
MA = [1, 1]
|
||||
|
||||
print("--- FIGHT MODE ___")
|
||||
print(f"{player.name} vs. {enemy.name}")
|
||||
while FIGHT:
|
||||
print("### FIGHT MODE ###")
|
||||
print(f"{player.name} vs. {enemy.name}")
|
||||
|
||||
INIT_PLAYER = self.roll_d10()
|
||||
INIT_ENEMY = self.roll_d10()
|
||||
INIT_PLAYER = self.roll_d10 + player.STATs["REF"]
|
||||
INIT_ENEMY = self.roll_d10()
|
||||
|
||||
PLAYER_HP = player.HP
|
||||
ENEMY_HP = enemy.HP
|
||||
|
||||
if INIT_PLAYER > INIT_ENEMY:
|
||||
print(f"PLAYER ROLL: {INIT_PLAYER}")
|
||||
print(f"ENEMY ROLL: {INIT_ENEMY}")
|
||||
print("FIGHT OFF, CHICKEN")
|
||||
else:
|
||||
print("YOU GOT SOME TROUBLE, MATE")
|
||||
|
||||
def create_character(self):
|
||||
pass
|
||||
if INIT_PLAYER > INIT_ENEMY:
|
||||
print("FIGHT OFF, CHICKEN")
|
||||
STATUS = 0 # brak walki
|
||||
else:
|
||||
self.clean_screen()
|
||||
print("YOU GOT SOME TROUBLE, MATE")
|
||||
STATUS = 1 # walka
|
||||
|
||||
count = MA.count(1)
|
||||
if count > 0:
|
||||
count_left = count
|
||||
print(f"You have {count}/{count_left} AP")
|
||||
print(f"Your HP: {player.hp}")
|
||||
print(f"Enemy HP: {enemy.hp}")
|
||||
print("What to do?")
|
||||
choose = input(">___")
|
||||
|
||||
if choose == "h":
|
||||
player_hit = self.roll_d6()
|
||||
print(f"{player.name} hits {player_hit}")
|
||||
|
||||
return STATUS
|
||||
|
||||
def stats(self):
|
||||
"""
|
||||
stats: playerClass
|
||||
Funkcja uzywania do wygenerowania statystyk dla gracza badz
|
||||
jakiegos zbira (test)
|
||||
"""
|
||||
|
||||
STATs = {
|
||||
"INT": 0,
|
||||
"REF": 0,
|
||||
"DEX": 0,
|
||||
"TECH": 0,
|
||||
"COOL": 0,
|
||||
"WILL": 0,
|
||||
"LUCK": 0,
|
||||
"MOVE": 0,
|
||||
"BODY": 0,
|
||||
"EMP": 0
|
||||
}
|
||||
|
||||
for k, v in STATs.items():
|
||||
STATs[k] = randint(1, 10)
|
||||
|
||||
return STATs
|
||||
|
|
35
player.py
35
player.py
|
@ -1,31 +1,28 @@
|
|||
|
||||
|
||||
class Player:
|
||||
STATs = {
|
||||
"INT": 5,
|
||||
"REF": 7,
|
||||
"DEX": 7,
|
||||
"TECH": 7,
|
||||
"COOL": 7,
|
||||
"WILL": 5,
|
||||
"LUCK": 8,
|
||||
"MOVE": 6,
|
||||
"BODY": 5,
|
||||
"EMP": 5
|
||||
|
||||
"""
|
||||
Zmienna BODY - wykorzystywana do ubioru bohatera, trzymania broni etc.
|
||||
"""
|
||||
BODY = {
|
||||
"HEAD": 0,
|
||||
"CHEST": 0,
|
||||
"LEFT_HAND": 0,
|
||||
"RIGHT_HAND": 0,
|
||||
"LEFT_LEG": 0,
|
||||
"RIGHT_LEG": 0
|
||||
}
|
||||
|
||||
HP = 0
|
||||
HP_MAX = 0
|
||||
|
||||
|
||||
def __init__(self, name):
|
||||
self.HP = 35
|
||||
self.HP_MAX = 35
|
||||
self.name = name
|
||||
|
||||
def show_stats(self):
|
||||
|
||||
def show_stats(self, stats=None):
|
||||
print(f"Name: {self.name}")
|
||||
print(f"HP: {self.HP}/{self.HP_MAX}")
|
||||
|
||||
for k, v in self.STATs.items():
|
||||
print(f"{k}: {v}")
|
||||
|
||||
for k, v in stats.items():
|
||||
print(k, v)
|
||||
|
|
Loading…
Add table
Reference in a new issue