Example #1
0
        if player.guild == 'Unaffiliated':
            player.guild = self.name
            self.player_list.append(player)
            return f'Welcome player {player.name} to the guild {self.name}'
        elif player.guild == self.name:
            return f'Player {player.name} is already in the guild.'
        else:
            return f'Player {player.name} is in another guild.'

    def kick_player(self, player: str):
        if player not in self.player_list:
            return f'Player {player} is not in the guild.'
        else:
            player.guild = 'Unaffiliated'
            self.player_list.remove(player)
            return f'Player {player} has been removed from the guild.'

    def guild_info(self):
        result = f'Guild: {self.name}\n'
        for p in self.player_list:
            result += f'{p.player_info()}\n'
        return result


player = Player("George", 50, 100)
print(player.add_skill("Shield Break", 20))
print(player.player_info())
guild = Guild("UGT")
print(guild.assign_player(player))
print(guild.guild_info())
from project.player import Player
from project.guild import Guild

player = Player("name", 10, 10)
player1 = Player("name1", 10, 10)
player2 = Player("name2", 10, 20)

player1.add_skill("fire", 20)
player1.add_skill("ice", 200)
player.add_skill("earth", 200)
player.add_skill("marce", 200)

guild = Guild("UGT")
print(guild.assign_player(player))
# print(guild.assign_player(player1))
# print(guild.assign_player(player2))
print(guild.guild_info())
Example #3
0
from project.guild import Guild
from project.player import Player

player = Player("George", 50, 100)
player2 = Player("Geor", 5, 10)
print(player.add_skill("Shield Break", 20))
print(player2.add_skill("Break", 255))
print(player2.add_skill("Breakfast", 35))
print(player.player_info())
guild = Guild("UGT")
print(guild.assign_player(player))
print(guild.assign_player(player2))
print(guild.guild_info())

# from project.player import Player
# from project.guild import Guild
#
# import unittest
#
#
# class PlayerTest(unittest.TestCase):
#
#     def test_player_init(self):
#         player = Player("Pesho", 90, 90)
#         expected = "Name: Pesho\nGuild: Unaffiliated\nHP: 90\nMP: 90\n"
#         self.assertEqual(player.player_info(), expected)
#
#     def test_adding_skill_should_work(self):
#         player = Player("Pesho", 90, 90)
#         message = player.add_skill("A", 3)
#         expected = "Skill A added to the collection of the player Pesho"
Example #4
0
from project.player import Player
from project.guild import Guild

player_1 = Player("P1", 100, 100)
player_2 = Player("P2", 100, 100)
player_3 = Player("P2", 100, 100)
print(player_1.add_skill("S1", 50))
print(player_1.add_skill("S1", 50))
print(player_1.add_skill("S1", 60))
print(player_1.add_skill("S2", 60))
print(player_1.player_info())

guild1 = Guild("G1")
guild2 = Guild("G2")

print(guild1.assign_player(player_1))
print(guild1.assign_player(player_1))
print(guild1.assign_player(player_2))
print(guild2.assign_player(player_1))
print(guild1.assign_player(player_3))

print(guild1.kick_player("P1"))
print(guild1.kick_player("P1"))

print(guild1.guild_info())

player = Player("George", 50, 100)
print(player.add_skill("Shield Break", 20))
print(player.player_info())
guild = Guild("UGT")
print(guild.assign_player(player))
Example #5
0
 def test_info(self):
     player = Player("Pesho", 90, 90)
     player.add_skill("A", 3)
     message = player.player_info().strip()
     expected = "Name: Pesho\nGuild: Unaffiliated\nHP: 90\nMP: 90\n===A - 3"
     self.assertEqual(message, expected)
Example #6
0
 def test_adding_existing_skill_should_not_work(self):
     player = Player("Pesho", 90, 90)
     player.add_skill("A", 3)
     message = player.add_skill("A", 3)
     expected = "Skill already added"
     self.assertEqual(message, expected)
Example #7
0
 def test_adding_skill_should_work(self):
     player = Player("Pesho", 90, 90)
     message = player.add_skill("A", 3)
     expected = "Skill A added to the collection of the player Pesho"
     self.assertEqual(message, expected)
from project.guild import Guild
from project.player import Player

player = Player("George", 50, 100)
player_3 = Player("George", 70, 90)
player_2 = Player("Ivan", 70, 99)
print(player_2.add_skill("Tuturutka", 30))
print(player.add_skill("Shield Break", 20))
# print(player.add_skill("Shield Break_3", 30))
print(player.player_info())
guild = Guild("UGT")
guild_2 = Guild("BIBOBIBI")

print(guild.assign_player(player))
print(guild.assign_player(player_3))
print(guild.kick_player("George"))
print("-------------------------------")
print(player_3.player_info())
print(player.player_info())
print(guild.assign_player(player_2))
print(guild_2.assign_player(player_2))
print(guild.guild_info())
# print(guild.assign_player(player_2))
# print(player.player_info())
print("----------------------------")
print(guild_2.guild_info())
print("-----------------------------------")
# print(player.player_info())
# print(player.player_info())