Exemplo n.º 1
0
    def __init__(self, GUI, grid_size):
        GlobalLibrary.initalise(Battle.__name__)

        # INTERFACE ASSETS
        GUI.logo_image = self.image_resize("Pictures/Logo.png",
                                           int(GUI.monitor_resolution_x / 10),
                                           int(GUI.monitor_resolution_y / 10))
        GUI.ui_servant_select_stats_bg = self.image(
            "Pictures/UI/ServantSelectStats.png")
        GUI.ui_turn_order_bg = self.image("Pictures/UI/TurnOrder.png")
        GUI.ui_move_icon = self.image_resize("Pictures/UI/MoveIcon.png",
                                             grid_size, grid_size)
        GUI.ui_attack_icon = self.image_resize("Pictures/UI/AttackIcon.png",
                                               grid_size, grid_size)

        # CLASS LOGOS
        GUI.ui_class_saber = self.image("Pictures/Classes/Saber.png")
        GUI.ui_class_archer = self.image("Pictures/Classes/Archer.png")
        GUI.ui_class_lancer = self.image("Pictures/Classes/Lancer.png")
        GUI.ui_class_caster = self.image("Pictures/Classes/Caster.png")
        GUI.ui_class_rider = self.image("Pictures/Classes/Rider.png")
        GUI.ui_class_assassin = self.image("Pictures/Classes/Assassin.png")
        GUI.ui_class_ruler = self.image("Pictures/Classes/Ruler.png")
        GUI.ui_class_shielder = self.image("Pictures/Classes/Shielder.png")
        GUI.ui_class_berserker = self.image("Pictures/Classes/Berserker.png")

        GlobalLibrary.notice("Battle Graphical Assets Imported")
 def __init__(self, grid_amount, grid_size, GUI, turn_tracker):
     GlobalLibrary.initalise(Main.__name__)
     self.GUI = GUI
     self.grid_size = int(grid_size)
     self.grid_amount = int(grid_amount)
     self.grid = []
     self.turn_tracker = turn_tracker
     for i in range(0, grid_amount):
         self.grid.append(["#"] * self.grid_amount)
 def __init__(self, player_stats):
     GlobalLibrary.initalise(Main.__name__)
     self.enemy_AI = None
     self.grid_manager = None
     self.player_stats = player_stats
     self.GUI = None
     self.CurrentTurnCounter = 0
     self.OverallTurnCounter = 0
     self.TurnCounterList = []
 def __init__(self, servant_database):
     GlobalLibrary.initalise(Main.__name__)
     self.servant_1 = servant_database['Servants'][int(
         servant_database['ActiveServants'][0])]
     self.servant_2 = servant_database['Servants'][int(
         servant_database['ActiveServants'][1])]
     self.servant_3 = servant_database['Servants'][int(
         servant_database['ActiveServants'][2])]
     self.set_servant_references(servant_database)
Exemplo n.º 5
0
 def __init__(self):
     GlobalLibrary.initalise(ServantDatabase.__name__)
     GlobalLibrary.notice("Connecting to Mongo Server!")
     try:
         self.server_ref = pymongo.MongoClient(
             "mongodb+srv://FateGameClient:[email protected]/test?retryWrites=true&w"
             "=majority")
     except pymongo.errors.AutoReconnect:
         GlobalLibrary.error("Connection Failed, Reconnecting!")
     except pymongo.errors.ConnectionFailure:
         GlobalLibrary.error("Connection Failed!")
     self.collection_ref = self.server_ref[
         'fate']  # Open the Collection "fate"
     self.database_servants = self.collection_ref[
         'servants']  # Open the Database "servants"
Exemplo n.º 6
0
    def __init__(self, GUI):
        GlobalLibrary.initalise(Cover.__name__)

        image_reference = Image.open(
            str("Pictures/Wallpapers/" +
                random.choice(os.listdir("Pictures/Wallpapers"))))
        image_reference = image_reference.resize(
            (GUI.monitor_resolution_x, GUI.monitor_resolution_y),
            Image.ANTIALIAS)
        GUI.wallpaper = ImageTk.PhotoImage(image_reference)
        GUI.logo_image = self.image_resize("Pictures/Logo.png",
                                           int(GUI.monitor_resolution_x / 4),
                                           int(GUI.monitor_resolution_y / 4))
        GUI.ui_click_to_start = self.image_scale(
            "Pictures/UI/ClickToStart.png", 0.5)
        GlobalLibrary.notice("Menu Graphical Assets Imported")
Exemplo n.º 7
0
    def __init__(self, GUI):
        GlobalLibrary.initalise(Menu.__name__)

        # INTERFACE ASSETS
        GUI.logo_image = self.image_resize("Pictures/Logo.png",
                                           int(GUI.monitor_resolution_x / 10),
                                           int(GUI.monitor_resolution_y / 10))
        GUI.ui_servant_list = self.image("Pictures/UI/ServantList.png")
        GUI.ui_servant_list_button = self.image(
            "Pictures/UI/ServantListButton.png")
        GUI.ui_servant_list_title = self.image(
            "Pictures/UI/ServantListTitle.png")
        GUI.ui_servant_bio = self.image("Pictures/UI/ServantBio.png")
        GUI.ui_fight_button = self.image("Pictures/UI/FightButton.png")
        GUI.ui_team_list = self.image("Pictures/UI/TeamList.png")

        # GENERIC ICONS
        GUI.ui_right_arrow = self.image_resize("Pictures/UI/RightArrow.png",
                                               20, 20)
        GUI.ui_left_arrow = self.image_resize("Pictures/UI/LeftArrow.png", 20,
                                              20)
        GUI.ui_refresh = self.image_resize("Pictures/UI/Refresh.png", 20, 20)

        # CLASS LOGOS
        GUI.ui_class_saber = self.image_scale("Pictures/Classes/Saber.png",
                                              0.7)
        GUI.ui_class_archer = self.image_scale("Pictures/Classes/Archer.png",
                                               0.7)
        GUI.ui_class_lancer = self.image_scale("Pictures/Classes/Lancer.png",
                                               0.7)
        GUI.ui_class_caster = self.image_scale("Pictures/Classes/Caster.png",
                                               0.7)
        GUI.ui_class_rider = self.image_scale("Pictures/Classes/Rider.png",
                                              0.7)
        GUI.ui_class_assassin = self.image_scale(
            "Pictures/Classes/Assassin.png", 0.7)
        GUI.ui_class_ruler = self.image_scale("Pictures/Classes/Ruler.png",
                                              0.7)
        GUI.ui_class_shielder = self.image_scale(
            "Pictures/Classes/Shielder.png", 0.7)
        GUI.ui_class_berserker = self.image_scale(
            "Pictures/Classes/Berserker.png", 0.7)

        GlobalLibrary.notice("Menu Graphical Assets Imported")
Exemplo n.º 8
0
import json
import os
import sys

import pymongo

from Scripts import GlobalLibrary

GlobalLibrary.initalise(__file__)


class ServantDatabase:
    def __init__(self):
        GlobalLibrary.initalise(ServantDatabase.__name__)
        GlobalLibrary.notice("Connecting to Mongo Server!")
        try:
            self.server_ref = pymongo.MongoClient(
                "mongodb+srv://FateGameClient:[email protected]/test?retryWrites=true&w"
                "=majority")
        except pymongo.errors.AutoReconnect:
            GlobalLibrary.error("Connection Failed, Reconnecting!")
        except pymongo.errors.ConnectionFailure:
            GlobalLibrary.error("Connection Failed!")
        self.collection_ref = self.server_ref[
            'fate']  # Open the Collection "fate"
        self.database_servants = self.collection_ref[
            'servants']  # Open the Database "servants"

    def find_servant(self, servant_name):
        search_query = {"Name": servant_name}
        search_result = self.database_servants.find_one(search_query)
Exemplo n.º 9
0
 def __init__(self, grid_manager, GUI):
     GlobalLibrary.initalise(Main.__name__)
     self.grid_manager = grid_manager
     self.GUI = GUI
    def __init__(self, window, user_IP, grid_amount, grid_size, turn_tracker,
                 player_stats):
        GlobalLibrary.initalise(Main.__name__)
        self.window = window
        # Set ""Global"" Variables
        self.user_IP = user_IP
        self.grid_amount = grid_amount  # Number of Boxes
        self.grid_size = grid_size  # Box Size
        self.grid_manager = None
        self.grid_clicked_x = int
        self.grid_clicked_y = int
        self.turn_tracker = turn_tracker
        self.player_stats = player_stats
        self.servant_has_moved = False
        self.image_array = []
        self.image_ref_array = []
        self.selection_array = []
        self.monitor_resolution_x = window.winfo_screenwidth()
        self.monitor_resolution_y = window.winfo_screenheight()
        self.grid_origin_x = self.monitor_resolution_x / 2 + (
            -int(self.grid_amount / 2) * self.grid_size)
        self.grid_origin_y = self.monitor_resolution_y / 2 + (
            -int(self.grid_amount / 2) * self.grid_size)
        self.selected_servant = object
        if not hasattr(self, 'canvas'):
            UIAssetImport.Battle(self, grid_size)
        # Create main Canvas
        self.canvas = tkinter.Canvas(window,
                                     width=self.monitor_resolution_x,
                                     height=self.monitor_resolution_y,
                                     bg="#333337",
                                     bd=0,
                                     highlightthickness=0,
                                     relief='ridge')
        self.canvas.pack()
        self.canvas.create_image(10,
                                 0,
                                 image=self.logo_image,
                                 anchor="nw",
                                 tags="logo_image")
        self.canvas.tag_bind("logo_image", "<Button-1>", self.open_main_menu)

        # Set Mouse Binds
        self.canvas.bind("<Button-1>", self.click)

        self.turn_counter_bg = self.canvas.create_image(
            self.monitor_resolution_x,
            self.monitor_resolution_y,
            image=self.ui_turn_order_bg,
            anchor="se")
        self.turn_counter_text = (self.canvas.create_text(
            self.monitor_resolution_x - 65,
            self.monitor_resolution_y - 88,
            text="DEBUG",
            fill="#ffffff",
            font=("Coolvetica Rg", 20),
            anchor="c",
            justify="center"))
        self.turn_counter_image = []
        self.turn_counter_image.append(
            self.canvas.create_image(self.monitor_resolution_x - 275,
                                     self.monitor_resolution_y - 30,
                                     image=self.logo_image,
                                     anchor="c"))
        self.turn_counter_image.append(
            self.canvas.create_image(self.monitor_resolution_x - 175,
                                     self.monitor_resolution_y - 30,
                                     image=self.logo_image,
                                     anchor="c"))
        self.turn_counter_image.append(
            self.canvas.create_image(self.monitor_resolution_x - 75,
                                     self.monitor_resolution_y - 30,
                                     image=self.logo_image,
                                     anchor="c"))