Example #1
0
 def start_char(self, id_model_char, nick):
     initial_orientation = sample([0, 90, 180, 270], 1)[0]
     if self.__n_players == 0:
         initial_x, initial_y = [1, 1]
     elif self.__n_players == 1:
         initial_x, initial_y = [13, 1]
     elif self.__n_players == 2:
         initial_x, initial_y = [1, 7]
     elif self.__n_players == 3:
         initial_x, initial_y = [13, 7]
     else:
         initial_x, initial_y = [7, 4]
     model_char = self.__model_char[id_model_char]
     char = Char(
         initial_orientation,
         [initial_x * Server.wall_factor, initial_y * Server.wall_factor],
         model_char.get_id(), [54, 54],
         255,
         nick,
         model_char.get_s_id_bomb_model(),
         model_char.get_s_speed(),
         n_bomb_max=model_char.get_s_n_bomb_max(),
         power_bomb_add=model_char.get_s_power_bomb_add())
     self.__chars[char.get_id()] = char
     self.__n_players += 1
     return char.get_id()
Example #2
0
 def setup(self):
     debug.log('Setting up!')
     self.player = Char()
     self.monsters = [
         Goblin(),
         Troll(),
         Orge(),
         Dragon()
     ]  
     self.monster = self.get_next_monster()
Example #3
0
def run_game():
    # inicia a biblioteca pygame
    pygame.init()
    pygame.mixer.music.load("menu.mp3")
    # cria o objeto surface
    screen = pygame.display.set_mode((1080, 600))
    menu = Menu(screen)
    char = Char(screen)
    score = Score(screen)
    bg = Background(screen)
    clock = pygame.time.Clock()
    inimigos = Inimigos(screen)
    contador = 0
    pygame.mixer.music.play(loops=100)
    # loop do jogo
    while True:
        get_events(screen, menu, char, bg, inimigos, score)
        if menu.on:
            contador = 0
            menu.render()
            if menu.regras_status:
                menu.show_regras()
            elif menu.creditos_status:
                menu.show_creditos()
            else:
                menu.display_info()
        else:
            inimigos.check_in_clean(char.alive)
            if char.alive:
                hit_box(char, inimigos)
                bg.blitme()
                if char.jumping:
                    if char.up:
                        up_you_go(char)
                    else:
                        down_bellow(char)
                run_motherfucker_run(char)

            else:
                bg.blitdead()
                if contador >= 50:

                    char.status = 80
                contador += 1

            score.update(str(bg.x * -1))

            score.blitall()
            inimigos.blit(char.alive)
            char.blitme()
        clock.tick(60)
        pygame.display.update()
Example #4
0
def getrandchar():
    racedata = random.choice(races).split(',')
    if len(racedata) <= 1:
        raise ValueError('races.txt file not formatted correctly. Format: race, name_filename.txt,..')
    race = racedata[0].strip()
    appearance = random.choice(appearances)
    bond = random.choice(bonds)
    flaws = random.choice(flaws_secrets)
    abilities = getrandabilities(high_abilities, low_abilities)
    high = abilities[0]
    low = abilities[1]
    ideal = random.choice(ideals)
    interaction = random.choice(interactions)
    mannerism = random.choice(mannerisms)
    talent = random.choice(talents)
    useful = random.choice(useful_knowledge)
    firstnamedata = getfilecontents(os.path.join(DATA_FOLDER, racedata[1].strip()))
    name = random.choice(firstnamedata)
    background = random.choice(backgrounds)
    if len(racedata) == 4:
        lastnamedata = getfilecontents(os.path.join(DATA_FOLDER, racedata[3].strip()))
        middlenamedata = getfilecontents(os.path.join(DATA_FOLDER, racedata[2].strip()))
        name += ' "' + random.choice(middlenamedata) + '" ' + random.choice(lastnamedata)
    if len(racedata) == 3:
        lastnamedata = getfilecontents(os.path.join(DATA_FOLDER, racedata[2].strip()))
        name += ' ' + random.choice(lastnamedata)
    char = Char(name, race, appearance, background, bond, flaws, high, low, ideal, interaction, mannerism,
                talent, useful)
    return char
Example #5
0
def find_char_in_image(image_thresh):
    image_thresh_copy = image_thresh.copy()
    _, contours, _ = cv2.findContours(image_thresh_copy, cv2.RETR_LIST,
                                      cv2.CHAIN_APPROX_NONE)
    chars = [Char(contour) for contour in contours]
    chars_valid = [char for char in chars if char.check_is_valid()]
    return chars_valid
Example #6
0
    def login(self):
        os.system('clear')
        ColourPrint.print_line("Login")
        name = raw_input("Please, enter your name: ")

        self.char = Char(name)
        result = self.char.search(name)

        if len(result) == 0:
            self.char.save_to_db()
            print("Welcome {0}! Looks like it is your first time here.".format(name))
        else:
            self.char.set(result[0])
            print("Welcome back, {}".format(name))
            # char.level_up()
            # char.save_to_db()

        self.char.logged_in = True
Example #7
0
    def __init__(self, args):
        super().__init__()
        self.wtoi, self.wvec = args.wtoi, args.wvec
        self.sur = Char(args)

        if not args.train_emb:
            self.load_state_dict(
                torch.load(os.path.dirname(__file__) + "/model.pt"))
            self = self.eval().cuda()

            es, wtoi = self.make_wvec(args, args.qws)
            self.wtoi_ = {w: i for i, w in enumerate(args.tsk_words)}
            self.wvec_ = torch.zeros(len(self.wtoi_), 300)
            for w in args.tsk_words:
                if w in self.wtoi:
                    self.wvec_[self.wtoi_[w]] = self.wvec[self.wtoi[w]]
                elif w in wtoi:
                    self.wvec_[self.wtoi_[w]] = es[wtoi[w]]
Example #8
0
class Game:
    logged_in = False
    menu_options = {
        'login': '******',
        'quit': 'Quit game'
    }
    char = None

    def __init__(self):
        self.db = TinyDB('db/database.json')

        #Game Loop
        while True:
            if self.char is None or self.char.logged_in is False:
                os.system('clear')
                GenericMenu.generic_menu("Main Menu", "What do you want to do?", self.menu_options, self)
            else:

                GenericMenu.generic_menu("Char Menu", "What do you want to do?", self.char.char_menu, self.char)


    def login(self):
        os.system('clear')
        ColourPrint.print_line("Login")
        name = raw_input("Please, enter your name: ")

        self.char = Char(name)
        result = self.char.search(name)

        if len(result) == 0:
            self.char.save_to_db()
            print("Welcome {0}! Looks like it is your first time here.".format(name))
        else:
            self.char.set(result[0])
            print("Welcome back, {}".format(name))
            # char.level_up()
            # char.save_to_db()

        self.char.logged_in = True

    def quit(self):
        ColourPrint.print_blue("Bye Bye")
        quit()
Example #9
0
    def __init__(self):

        pygame.font.init()

        self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
        pygame.display.set_caption("The amazing MacGyver !")

        self.level = None
        self.level = Maze("level.txt")
        self.level.generate()
        self.level.display(self.screen)

        self.macgyver = Char(macgyver_icon, self.level)

        self.needle = Item(img_needle, "N", self.level)
        self.needle.display(self.screen)
        self.ether = Item(img_ether, "E", self.level)
        self.ether.display(self.screen)
        self.tube = Item(img_tube, "T", self.level)
        self.tube.display(self.screen)

        self.start()
Example #10
0
class Wemb(nn.Module):
    def __init__(self, args):
        super().__init__()
        self.wtoi, self.wvec = args.wtoi, args.wvec
        self.sur = Char(args)

        if not args.train_emb:
            self.load_state_dict(
                torch.load(os.path.dirname(__file__) + "/model.pt"))
            self = self.eval().cuda()

            es, wtoi = self.make_wvec(args, args.qws)
            self.wtoi_ = {w: i for i, w in enumerate(args.tsk_words)}
            self.wvec_ = torch.zeros(len(self.wtoi_), 300)
            for w in args.tsk_words:
                if w in self.wtoi:
                    self.wvec_[self.wtoi_[w]] = self.wvec[self.wtoi[w]]
                elif w in wtoi:
                    self.wvec_[self.wtoi_[w]] = es[wtoi[w]]

    def pred(self, ws, ctxs):
        sur = self.sur.pred(ws)
        x = sur
        return x

    def train_batch(self, batch):
        ws, ctxs = zip(*batch)
        e = self.pred(ws, ctxs)
        t = self.wvec[[self.wtoi[w] for w in ws]].cuda()
        loss = -nn.functional.cosine_similarity(e, t).mean()
        return loss

    def make_wvec(self, args, qws):
        itow, es = [], []
        for batch in chunked(qws, 100):
            with torch.no_grad():
                itow.extend(batch)
                es.extend(self.pred(batch, None).cpu())
        es = torch.stack(es)
        wtoi = {w: i for i, w in enumerate(itow)}
        return es, wtoi

    def forward(self, sents):
        mask = pad_sequence(
            [torch.LongTensor([w in self.wtoi_ for w in s]) for s in sents],
            True, -1)
        e = torch.zeros(*mask.shape, 300).cuda()
        e[mask == 1] = self.wvec_[[
            self.wtoi_[w] for w in chain(sents) if w in self.wtoi_
        ]].cuda()
        return e
Example #11
0
def run_game():
    #Initialize pygame, settings, and screen object.
    pygame.init()
    link_settings = Settings()
    screen = pygame.display.set_mode(
        (link_settings.screen_width, link_settings.screen_height))
    pygame.display.set_caption("The New Adventures of Link")

    #Make a char
    char = Char(link_settings, screen)

    #Make a group to store bullets in.
    bullets = Group()

    #Set the background color.
    bg_color = (230, 230, 230)
    #Start the main loop for the game

    while True:
        #Watch for keyboard and mouse events.
        gf.check_events(link_settings, screen, char, bullets)
        char.update()
        gf.update_bullets(bullets)
        gf.update_screen(link_settings, screen, char, bullets)
Example #12
0
 def new(self):
     # initialize all variables and do all the setup for a new game
     self.all_sprites = pg.sprite.Group()
     self.walls = pg.sprite.Group()
     self.spooky_logs = pg.sprite.Group()
     self.fireballs = pg.sprite.Group()
     for tile_obj in self.map.tmx_data.objects:
         if tile_obj.name == 'spawn':
             self.mc = Char(self, tile_obj.x, tile_obj.y)
         if tile_obj.name == 'spooky_log':
             SpookyLog(self, tile_obj.x, tile_obj.y)
         if tile_obj.name == 'log' or tile_obj.name == 'rock':
             Obstacle(self, tile_obj.x, tile_obj.y, tile_obj.width,
                      tile_obj.height)
         if tile_obj.name == 'water' or tile_obj.name == 'house':
             Obstacle(self, tile_obj.x, tile_obj.y, tile_obj.width,
                      tile_obj.height)
         if tile_obj.name == 'bush' or tile_obj.name == 'border':
             Obstacle(self, tile_obj.x, tile_obj.y, tile_obj.width,
                      tile_obj.height)
     self.fov = FOV(self.map.width, self.map.height)
Example #13
0
class Game:
    def __init__(self):

        pygame.font.init()

        self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
        pygame.display.set_caption("The amazing MacGyver !")

        self.level = None
        self.level = Maze("level.txt")
        self.level.generate()
        self.level.display(self.screen)

        self.macgyver = Char(macgyver_icon, self.level)

        self.needle = Item(img_needle, "N", self.level)
        self.needle.display(self.screen)
        self.ether = Item(img_ether, "E", self.level)
        self.ether.display(self.screen)
        self.tube = Item(img_tube, "T", self.level)
        self.tube.display(self.screen)

        self.start()

    def start(self):

        win_img = pygame.image.load("images/win.png")
        lose_img = pygame.image.load("images/lose.png")

        pygame.init()

        #game loop
        running = True
        while running:

            for event in pygame.event.get():

                if event.type == QUIT:
                    running = False
                    pygame.quit()

                if event.type == KEYDOWN:
                    if event.key == K_ESCAPE:
                        running = False
                        pygame.quit()

                    if event.key == K_UP:
                        self.macgyver.move_up()
                    elif event.key == K_DOWN:
                        self.macgyver.move_down()
                    elif event.key == K_RIGHT:
                        self.macgyver.move_right()
                    elif event.key == K_LEFT:
                        self.macgyver.move_left()

            #item management
            if self.level.structure[self.macgyver.position_y][
                    self.macgyver.position_x] == self.needle.item_id:
                self.needle.remove_item()
                self.macgyver.get_item()

            if self.level.structure[self.macgyver.position_y][
                    self.macgyver.position_x] == self.ether.item_id:
                self.ether.remove_item()
                self.macgyver.get_item()

            if self.level.structure[self.macgyver.position_y][
                    self.macgyver.position_x] == self.tube.item_id:
                self.tube.remove_item()
                self.macgyver.get_item()

            #interactions with the guard
            if self.level.structure[self.macgyver.position_y][
                    self.macgyver.position_x] == "G":
                if self.macgyver.item_counter >= 3:
                    win = True
                    while win:
                        self.screen.blit(win_img, (0, 0))
                        for event in pygame.event.get():
                            if event.type == QUIT:
                                running = False
                                pygame.quit()

                            if event.type == KEYDOWN:
                                if event.key == K_ESCAPE:
                                    running = False
                                    pygame.quit()
                                if event.key == K_RETURN:
                                    win = False
                                    Game()
                        pygame.display.flip()

                else:
                    lose = 1
                    while lose:
                        self.screen.blit(lose_img, (0, 0))
                        for event in pygame.event.get():
                            if event.type == QUIT:
                                running = False
                                pygame.quit()

                            if event.type == KEYDOWN:
                                if event.key == K_ESCAPE:
                                    running = False
                                    pygame.quit()
                                if event.key == K_RETURN:
                                    lose = False
                                    Game()
                        pygame.display.flip()

            self.level.display(self.screen)
            #display the character
            self.screen.blit(self.macgyver.sprite,
                             (self.macgyver.case_x, self.macgyver.case_y))
            pygame.display.flip()
Example #14
0
class Game:
    def setup(self):
        debug.log('Setting up!')
        self.player = Char()
        self.monsters = [
            Goblin(),
            Troll(),
            Orge(),
            Dragon()
        ]  
        self.monster = self.get_next_monster()

    def get_next_monster(self):
        debug.log('Getting next monster!')
        try:
            return self.monsters.pop(0)
        except IndexError:
            return None

    def monster_turn(self):
        debug.log('Monsters Turn!')
        # Check to see if the monster attacks
        #if so tell the player
            # check if the player wants to dodge
            # if so see if dodge is successful
                # if it is move on
            # if its not, remove player hp
        # if the monster isnt attacking tell the player that to.
        if self.monster.attack():
            print("{} is attacking".format(self.monster))
            print(self.monster.battlecry())
            dodge = input("Do you want to dodge? [Y]es or [N]o").lower()
            if dodge == 'y':
                if self.player.dodge():
                    print("You dodged the attack!")
                else:
                    print("You have been hit!")
                    self.player.hp -= 1
            else:
                print("{} hit you for 1 hp".format(self.monster))
                self.player.hp -= 1
        else:
            print("{} isnt paying attention".format(self.monster))

    def player_turn(self):
        debug.log('Players Turn!')
        #let the player attack , rest or quit
        # if they attack
            # see if the attack is successful
                #if so see if monster dodges
                    # if dodged print that
                    #if not subtract right num from monster
                # if the attack is good tell the player
        # if they rest
            # call rest function
        # if they quit 
            # if they quit , quit the Game
        #rerun if anytthing else
        print("Your Turn!")
        choice = input("What would you like to do. [A]ttack, [R]est, [Q]uit").lower()
        if choice == 'a':
            print("You are attacking {}".format(self.monster))
            if self.player.attack():
                if self.monster.dodge():
                    print("Monster dodged your attack!")
                else:
                    if self.player.leveled_up():
                        self.monster.hit_points -= (self.player.dmg + 1)
                        print("You hit {} for {}".format(self.monster, (self.player.dmg + 1)))
                    else:
                        self.monster.hit_points -= self.player.dmg
                        print("You hit {} for {}".format(self.monster, self.player.dmg))
            else:
                print("You missed!")
        elif choice == 'r':
            self.player.rest()
        elif choice == 'q':
            sys.exit()
        else:
            self.player_turn()
    def cleanup(self):
        debug.log('Cleaning up!')
        # if the monster has no more hp:
            # up the players exp
            # print message
            # get new monster
        if self.monster.hit_points <= 0:
            self.player.exp += self.monster.experience
            print("You gained experience from {}!".format(self.monster))
            self.monster = self.get_next_monster()
        
    def __init__(self):
        debug.log('Game Init!')
        self.setup()

        while self.player.hp and (self.monster or self.monsters):
            print('\n'+'='*20)
            print(self.player)
            self.monster_turn()
            print('\n'+'-'*20)
            self.player_turn()
            self.cleanup()
            print('\n'+'='*20)
        if self.player.hp:
            print("You win!")
        elif self.monsters or self.monster:
            print("You lose!")
        sys.exit()
Example #15
0
from char import Char

player = Char()

    pos.pose.orientation.w = quaternion[3]

    pos_pub.publish(pos)

# Initialisation du noeud
rospy.init_node('sim_char')

# Subscriber et publisher
cmd_sub_v = rospy.Subscriber('robot/vecteur_cible', Vector3, update_cmd)
cmd_sub_u = rospy.Subscriber('cmd_vel_ramped', Twist, update_cmd2)
pos_pub = rospy.Publisher('gps/local_pose', PoseStamped, queue_size=1)

rate = rospy.Rate(20)
plt.ion()

char = Char(40, 40, 4)
# x = np.array([40, 40, 4])
dt = 0.1
u = [0, 0]

while not rospy.is_shutdown():
    # plt.cla()
    char.simulate(u)
    # x = x + fdot(x, u) * dt
    # draw_tank(x)
    # plt.axis([-30, 30, -30, 30])
    # plt.draw()
    publish_pose()
    print '-' * 10
    print 'u:', u
    print 'x', char.x, char.y, char.theta
from text import Text
from char import Char
from form import Form

class Fieldtest(object):
    def __init__(self, String, selection=[("M", "Masculino"), ("F", "Femenino")],
		 digits=2, comodel_name="model", size=5, required=False):
	self.String = String
	self.selection = selection
	self.digits = digits
	self.comodel_name = comodel_name
	self.size = size
	self.required = required

view = Form(False, "test")

for i in range(1):
    view.new_witget(Related(Fieldtest("Empleados")))
    #~ view.new_witget(Date(Fieldtest("Fecha")))
    #~ view.new_witget(Selection(Fieldtest("Genero")))
    #~ view.new_witget(Boolean(Fieldtest("Fijo")))
    #~ view.new_witget(Integer(Fieldtest("Capital")))
    #~ view.new_witget(Float(Fieldtest("Sueldo")))
    #~ view.new_witget(Time(Fieldtest("Time")))
    #~ view.new_witget(Text(Fieldtest("Nota"), **{"widget":"textbox"}))
    view.new_witget(Char(Fieldtest("Codigo", required=True)))
    view.new_witget(Datetime(Fieldtest("Entrada")))
view.show_all()
Gtk.main()

Example #18
0
""" This script moves through fm and takes screenshots of every item
in fm for later evaluation by ocr."""
import time
import pyautogui

from char import Char
import defines


# make mule
time.sleep(0.1)
pyautogui.click(400, 100)
fmmule = Char()
# fmmule.getCurrentChannel()
# fmmule.goToFm()
# fmmule.moveCharToTheLeftOfFM()
# fmmule.checkFmLudi()
fmmule.checkStoresLudi()

#while True:
#    pixel = fmmule.checkIfMapChanges()
#    if (all(i < j for i, j in zip(pixel, defines.black))):
#            print(pixel)
print("DONE")

Example #19
0
    def main(self):
        while True:
            # Equippment Bonus
            # 2x 1-Hand Weapon Bonus 3% on/off Attack2
            if len(self.Player1.getHands(
            )[0]) == 1 and len(self.Player1.getHands()[1]) == 1 and len(
                    self.Player1.getHands()[2]) == 0 and self.Player1.getHands(
                    )[1][0].getCategory() == "Weapon":
                self.switch_bonus_on_2_1hand = True
            else:
                self.switch_2_1hand = True
            if self.switch_bonus_off_2_1hand == True and self.switch_2_1hand == True:
                self.Player1.setAttack2(self.Player1.Attack2 - 3)
                print(Fore.YELLOW + "You lose your 3% bonus on 2nd attack")
                self.switch_bonus_off_2_1hand = False
                self.switch_bonus_on_2_1hand = False
            if self.switch_bonus_on_2_1hand == True and self.switch_bonus_off_2_1hand == False and self.Player1.getThe_Berserker(
            ) == True:
                self.Player1.setAttack2(self.Player1.Attack2 + 3)
                print(
                    Fore.YELLOW +
                    "By carrying 2x 1-handed weapon, you get a 3% bonus on chance for 2nd attack"
                )
                self.switch_bonus_off_2_1hand = True
                self.switch_2_1hand = False
            # -------------------------------------------------------------------------------------------------------------
            # 1x 2-Hand Weapon Bonus 7% on/off total damage
            if len(self.Player1.getHands()[2]) == 1 and self.Player1.getHands(
            )[2][0].getCategory() == "Weapon":
                self.switch_bonus_on_1_2hand = True
            else:
                self.switch_1_2hand = True
            if self.switch_bonus_off_1_2hand == True and self.switch_1_2hand == True:
                print(Fore.LIGHTRED_EX +
                      "You lose your 7% bonus on total damage")
                self.switch_bonus_off_1_2hand = False
                self.switch_bonus_on_1_2hand = False
            if self.switch_bonus_on_1_2hand == True and self.switch_bonus_off_1_2hand == False and self.Player1.getThe_Warrior(
            ) == True:
                print(
                    Fore.LIGHTRED_EX +
                    "Carrying a 2-handed weapon gives you a 7% bonus on your total damage"
                )
                self.switch_bonus_off_1_2hand = True
                self.switch_1_2hand = False
            #------------------------------------------------------------------------------------------------------------------
            # Shild Bonus reduction decrased to 8 instead of 10
            if len(self.Player1.getHands()[1]) == 1 and self.Player1.getHands(
            )[1][0].getCategory() == "Armor":
                self.switch_bonus_on_shield = True
            else:
                self.switch_shield = True
            if self.switch_bonus_off_shield == True and self.switch_shield == True and self.Player1.getThe_Defender(
            ) == True:
                print(
                    Fore.LIGHTBLUE_EX +
                    "You lose your bonus. The required armor value has been increased again."
                )
                self.switch_bonus_off_shield = False
                self.switch_bonus_on_shield = False
            if self.switch_bonus_on_shield == True and self.switch_bonus_off_shield == False and self.Player1.getThe_Defender(
            ) == True:
                if self.Player1.getThe_Defender() == True:
                    print(
                        Fore.LIGHTBLUE_EX +
                        "Reduces the armor value needed to absorb damage by 2."
                    )
                self.switch_bonus_off_shield = True
                self.switch_shield = False
            #------------------------------------------------------------------------------------------------------------------
            # Leather 5% bonus 2nd attack
            if len(self.Player1.getHead()) == 1 and len(self.Player1.getBody(
            )) == 1 and len(self.Player1.getLegs()) == 1 and len(
                    self.Player1.getFeet()) == 1 and self.Player1.getHead(
                    )[0].getMaterial() == "Leather" and self.Player1.getBody(
                    )[0].getMaterial() == "Leather" and self.Player1.getLegs(
                    )[0].getMaterial() == "Leather" and self.Player1.getFeet(
                    )[0].getMaterial() == "Leather":
                self.switch_bonus_on_Leather = True
            else:
                self.switch_Leather = True
            if self.switch_bonus_off_Leather == True and self.switch_Leather == True:
                self.Player1.setAttack2(self.Player1.Attack2 - 5)
                print(Fore.LIGHTMAGENTA_EX +
                      "You lose your 5% bonus on 2nd attack")
                self.switch_bonus_off_Leather = False
                self.switch_bonus_on_Leather = False
            if self.switch_bonus_on_Leather == True and self.switch_bonus_off_Leather == False:
                self.Player1.setAttack2(self.Player1.Attack2 - 5)
                print(
                    Fore.LIGHTMAGENTA_EX +
                    "Because your armor is made entirely of leather, you get a 5% bonus on 2nd attack"
                )
                self.switch_bonus_off_Leather = True
                self.switch_Leather = False
            #--------------------------------------------------------------------------------------------------------------------
            # Chain 8% bonus total damage
            if len(self.Player1.getHead()) == 1 and len(self.Player1.getBody(
            )) == 1 and len(self.Player1.getLegs()) == 1 and len(
                    self.Player1.getFeet()) == 1 and self.Player1.getHead(
                    )[0].getMaterial() == "Chain" and self.Player1.getBody(
                    )[0].getMaterial() == "Chain" and self.Player1.getLegs(
                    )[0].getMaterial() == "Chain" and self.Player1.getFeet(
                    )[0].getMaterial() == "Chain":
                self.switch_bonus_on_Chain = True
            else:
                self.switch_Chain = True
            if self.switch_bonus_off_Chain == True and self.switch_Chain == True:
                print(Fore.LIGHTMAGENTA_EX +
                      "You lose your 8% bonus on total damage")
                self.switch_bonus_off_Chain = False
                self.switch_bonus_on_Chain = False
            if self.switch_bonus_on_Chain == True and self.switch_bonus_off_Chain == False:
                print(
                    Fore.LIGHTMAGENTA_EX +
                    "Because your armor is made entirely of chain, you get a 8% bonus on total damage"
                )
                self.switch_bonus_off_Chain = True
                self.switch_Chain = False
            #---------------------------------------------------------------------------------------------------------------------
            # Plate increase 1 dmg reduction + 2% blockchance
            if len(self.Player1.getHead()) == 1 and len(self.Player1.getBody(
            )) == 1 and len(self.Player1.getLegs()) == 1 and len(
                    self.Player1.getFeet()) == 1 and self.Player1.getHead(
                    )[0].getMaterial() == "Plate" and self.Player1.getBody(
                    )[0].getMaterial() == "Plate" and self.Player1.getLegs(
                    )[0].getMaterial() == "Plate" and self.Player1.getFeet(
                    )[0].getMaterial() == "Plate":
                self.switch_bonus_on_Plate = True
            else:
                self.switch_Plate = True
            if self.switch_bonus_off_Plate == True and self.switch_Plate == True:
                self.Player1.setBlockchance(self.Player1.Blockchance - 2)
                print(
                    Fore.LIGHTMAGENTA_EX +
                    "You lose your bonus. The required armor value has been increased again. and 2% increased blocking chance"
                )
                self.switch_bonus_off_Plate = False
                self.switch_bonus_on_Plate = False
            if self.switch_bonus_on_Plate == True and self.switch_bonus_off_Plate == False:
                self.Player1.setBlockchance(self.Player1.Blockchance + 2)
                print(
                    Fore.LIGHTMAGENTA_EX +
                    "Because your Armor is made entirely of Plate, reduces the armor value needed to absorb damage by 1 and a 2% increased blocking chance"
                )
                self.switch_bonus_off_Plate = True
                self.switch_Plate = False
            #-- Armor bonus controll ----------- both bonus -----------------------------------------------------
            if self.switch_bonus_on_Plate == True and self.switch_bonus_on_shield and self.Player1.getThe_Defender(
            ) == True:
                self.Player1.setReductionBonus(7)
            #--------------------only armor
            elif self.switch_bonus_on_Plate == True and self.switch_bonus_off_shield == False:
                self.Player1.setReductionBonus(9)
            #--------------------only shield
            elif self.switch_bonus_on_Plate == False and self.switch_bonus_on_shield and self.Player1.getThe_Defender(
            ) == True:
                self.Player1.setReductionBonus(8)
            #--------------------no bonus
            elif self.switch_bonus_on_Plate == False and self.switch_bonus_off_shield == False:
                self.Player1.setReductionBonus(10)
            #-- Dmg bonus controll ------------------- both bonus ------------------------------------------------------
            if self.switch_bonus_on_1_2hand and self.switch_bonus_on_Chain and self.Player1.getThe_Warrior(
            ) == True:
                self.Player1.setDmg(0)
                if self.Player1.getDmg() < 585:
                    self.Player1.setDmg(
                        math.floor(self.Player1.Dmg + (
                            (self.Player1.getHands()[2][0].getMaxDmg() +
                             self.Player1.getStrength()) / 100 * 15)))
                else:
                    self.Player1.setDmg(
                        math.ceil(self.Player1.Dmg +
                                  ((self.Player1.getHands()[2][0].getMaxDmg() +
                                    self.Player1.getStrength()) / 100 * 15)))
            #--------------------only weapon
            elif self.switch_bonus_on_1_2hand and self.switch_bonus_on_Chain == False and self.Player1.getThe_Warrior(
            ) == True:
                self.Player1.setDmg(0)
                if self.Player1.getDmg() < 585:
                    self.Player1.setDmg(
                        math.floor(self.Player1.Dmg + (
                            (self.Player1.getHands()[2][0].getMaxDmg() +
                             self.Player1.getStrength()) / 100 * 7)))
                else:
                    self.Player1.setDmg(
                        math.ceil(self.Player1.Dmg +
                                  ((self.Player1.getHands()[2][0].getMaxDmg() +
                                    self.Player1.getStrength()) / 100 * 7)))
            #--------------------only armor
            elif self.switch_bonus_on_1_2hand == False and self.switch_bonus_on_Chain:
                self.Player1.setDmg(0)
                if self.Player1.getDmg() < 585:
                    if len(self.Player1.getHands()[0]) == 1 and len(
                            self.Player1.getHands()[1]) == 0:
                        self.Player1.setDmg(
                            math.floor(self.Player1.Dmg + (
                                (self.Player1.getHands()[0][0].getMaxDmg() +
                                 self.Player1.getStrength()) / 100 * 8)))
                    elif len(self.Player1.getHands()[0]) == 0 and len(
                            self.Player1.getHands()
                        [1]) == 1 and self.Player1.getHands(
                        )[1][0].getCategory() == "Weapon":
                        self.Player1.setDmg(
                            math.floor(self.Player1.Dmg + (
                                (self.Player1.getHands()[1][0].getMaxDmg() +
                                 self.Player1.getStrength()) / 100 * 8)))
                    elif len(self.Player1.getHands()[1]) == 1 and len(
                            self.Player1.getHands()
                        [1]) == 1 and self.Player1.getHands(
                        )[1][0].getCategory() == "Weapon":
                        self.Player1.setDmg(
                            math.floor(self.Player1.Dmg + (
                                (self.Player1.getHands()[1][0].getMaxDmg() +
                                 self.Player1.getHands()[0][0].getMaxDmg() +
                                 self.Player1.getStrength()) / 100 * 8)))
                else:
                    if len(self.Player1.getHands()[0]) == 1 and len(
                            self.Player1.getHands()[1]) == 0:
                        self.Player1.setDmg(
                            math.ceil(self.Player1.Dmg + (
                                (self.Player1.getHands()[0][0].getMaxDmg() +
                                 self.Player1.getStrength()) / 100 * 8)))
                    elif len(self.Player1.getHands()[0]) == 0 and len(
                            self.Player1.getHands()
                        [1]) == 1 and self.Player1.getHands(
                        )[1][0].getCategory() == "Weapon":
                        self.Player1.setDmg(
                            math.ceil(self.Player1.Dmg + (
                                (self.Player1.getHands()[1][0].getMaxDmg() +
                                 self.Player1.getStrength()) / 100 * 8)))
                    elif len(self.Player1.getHands()[1]) == 1 and len(
                            self.Player1.getHands()
                        [1]) == 1 and self.Player1.getHands(
                        )[1][0].getCategory() == "Weapon":
                        self.Player1.setDmg(
                            math.ceil(self.Player1.Dmg + (
                                (self.Player1.getHands()[1][0].getMaxDmg() +
                                 self.Player1.getHands()[0][0].getMaxDmg() +
                                 self.Player1.getStrength()) / 100 * 8)))
            #--------------------no bonus
            elif self.switch_bonus_on_1_2hand == False and self.switch_bonus_on_Chain == False:
                self.Player1.setDmg(0)

            # Game controls for the player---------------------------------------------------------------------------------------------------
            print("")
            options = input("Options: ")
            print("")
            # move in western direction ---------------------------------------------------------------------------------------------
            if options == "d":
                if self.Player1.x < Celtic_Continent.width:
                    self.Player1.move("d")
                    print("")
                    print("You run 1 km in eastern direction")
                    print("")
                else:
                    print("")
                    print("The sea blocks your way")
                    print("")
                break
            # move in eastern direction ---------------------------------------------------------------------------------------------
            elif options == "a":
                if self.Player1.x > -(Celtic_Continent.width):
                    self.Player1.move("a")
                    print("")
                    print("You run 1 km in western direction")
                    print("")
                else:
                    print("")
                    print("The sea blocks your way")
                    print("")
                break
            # move in northern direction ---------------------------------------------------------------------------------------------
            elif options == "w":
                if self.Player1.y < Celtic_Continent.height:
                    self.Player1.move("w")
                    print("")
                    print("You run 1 km in northern direction")
                    print("")
                else:
                    print("")
                    print("Snow covered mountains block your way")
                    print("")
                break
            # move in southern direction ---------------------------------------------------------------------------------------------
            elif options == "s":
                if self.Player1.y > -(Celtic_Continent.height):
                    self.Player1.move("s")
                    print("")
                    print("You run 1 km in southern direction")
                    print("")
                else:
                    print("")
                    print("The sea blocks your way")
                    print("")
                break
            elif options == "help":
                Help().getHelp()
            # Map---------------------------------------------------------------------------------------------------------------------
            elif options == "map":
                print("Location:", Celtic_Continent.getName(),
                      "  Coordinates: Y:", self.Player1.y, ", X:",
                      self.Player1.x)

            # Quit --------------------------------------------------------------------------------------------------------------------
            elif options == "quit":
                winsound.PlaySound("sounds\\thunder.wav",
                                   winsound.SND_ASYNC | winsound.SND_ALIAS)
                print("")
                print("The windows is now closing...")
                sleep(3)
                exit()
            # Inventory ----------------------------------------------------------------------------------------------------------------
            elif options == "inv":
                self.Player1.getInventory()
            # Skills -------------------------------------------------------------------------------------------------------------------
            elif options == "skills":
                skills.Skills().getSkills(self.Player1)
            elif options == "dmg":
                print(self.Player1.getDmg())
            # Quest_log -----------------------------------------------------------------------------------------------------------------
            elif options == "q":
                self.Player1.getQlog()
            # save ----------------------------------------------------------------------------------------------------------------------
            elif options == "save":
                self.save()
                print("")
                print(Fore.YELLOW + "Game saved...")
                print("")
            # load ------------------------------------------------------------------------------------------------------------------------
            elif options == "load":
                self.load()
                print("")
                print(Fore.YELLOW + "Game loaded...")
                print("")
            elif options == "name":
                print(self.Player1.getName())
            elif options == "dmg":
                print(self.Player1.getDmg())
            elif options == "str":
                self.Player1.setStrength(self.Player1.getStrength() + 2)
            elif options == "block":
                print(self.Player1.getBlockchance())
            elif options == "xp":
                print(len(self.Player1.Xp))
            elif options == "attack":
                print(self.Player1.getAttack2())
            elif options == "armor":
                print(self.Player1.getArmor())
            elif options == "char":
                Char(self.Player1).getchar_info(self.Player1.Dmg)

            elif options == "rest":
                print(Fore.YELLOW + "You rest by a homemade campfire.")
                print(
                    Fore.YELLOW +
                    "You regenerate 10% of your maximum life every 1.5 seconds in the course of 7.5 seconds"
                )
                print("")
                for i in range(5):
                    sleep(1.5)
                    if self.Player1.getRace() == "Kro'L":
                        if self.Player1.getHealth() < (math.floor(
                                self.Player1.getMaxHealth() * 0.9)):
                            self.Player1.setHealth(
                                self.Player1.getHealth() +
                                math.ceil(self.Player1.getMaxHealth() * 0.1))
                            print(Fore.GREEN + "You regenerate",
                                  math.ceil(self.Player1.getMaxHealth() * 0.1),
                                  Fore.GREEN + "life points")
                            print("")
                        elif self.Player1.getHealth() >= (math.floor(
                                self.Player1.getMaxHealth() * 0.9)):
                            self.Player1.setHealth(self.Player1.getMaxHealth())
                            print(
                                Fore.GREEN +
                                "Your life points have been completely regenerated"
                            )
                            print("")
                            break
                    else:
                        if self.Player1.getHealth() < (math.floor(
                                self.Player1.getMaxHealth() * 0.9)):
                            self.Player1.setHealth(
                                self.Player1.getHealth() +
                                math.floor(self.Player1.getMaxHealth() * 0.1))
                            print(
                                Fore.GREEN + "You regenerate",
                                math.floor(self.Player1.getMaxHealth() * 0.1),
                                Fore.GREEN + "life points")
                            print("")
                        elif self.Player1.getHealth() >= (math.floor(
                                self.Player1.getMaxHealth() * 0.9)):
                            self.Player1.setHealth(self.Player1.getMaxHealth())
                            print(
                                Fore.GREEN +
                                "Your life points have been completely regenerated"
                            )
                            print("")
                            break
                print(Fore.GREEN + "Your currently health:",
                      self.Player1.getHealth())
            else:
                print("")
                print("Wrong input, try again...")
                print("")