-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Characters #14
Open
Arrgentum
wants to merge
8
commits into
master
Choose a base branch
from
characters
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Characters #14
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
922473b
## What added:
4c385ca
## What added:
eafdfc4
## What added:
7438762
## What added:
6517f7d
## What added:
f5b2648
## What added:
ca9af34
## What added:
ac7ecf7
Merge branch 'master' into characters
Arrgentum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from CharactersList import CharactersList | ||
from server.Characters.Character import Character | ||
from server.District import DistrictsList | ||
|
||
|
||
class Architect(Character): | ||
|
||
def __init__(self): | ||
super().__init__(CharactersList.Architect) | ||
self.choose_character = None | ||
self.text = "After you take an action, you draw two additional district cards and put both in your hand." | ||
|
||
def action(self, character_name): | ||
"""The action of this character""" | ||
self.choose_character = character_name | ||
|
||
def get_progress_information(self, list_of_cards): | ||
"""Print info of this action""" | ||
return super(Architect, self).get_progress_information(self).format("You receive {} {}").format( | ||
", ".join([list_of_cards[i].name for i in range(len(list_of_cards) - 1)]), | ||
str(list_of_cards[len(list_of_cards) - 1].name)) | ||
|
||
def get_info(self): | ||
"""Print info of this character""" | ||
return super(Architect, self).get_info(self).format(self.character_name, self.text) | ||
|
||
|
||
# print(Architect().get_progress_information(DistrictsList.take_the_cards(3))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
from CharactersList import CharactersList | ||
from server.Characters.Character import Character | ||
from server.District import DistrictTypeList | ||
|
||
|
||
class Bishop(Character): | ||
|
||
def __init__(self): | ||
super().__init__(CharactersList.Assassin) | ||
super().__init__(CharactersList.Bishop) | ||
self.text = "You receive one gold for each religious (blue) district in your city." | ||
|
||
def action(self, character_name=None): | ||
"""The action of this character""" | ||
|
||
def get_progress_information(self): | ||
def get_progress_information(self, districts_in_hand): | ||
"""Print info of this action""" | ||
return super(Bishop, self).get_progress_information(self).format("You receive {} gold").format() | ||
return super(Bishop, self).get_progress_information(self).format("You receive {} gold").format(len(list(filter(lambda x: x.value.type_of_district == DistrictTypeList.Religious, districts_in_hand)))) | ||
|
||
def get_info(self): | ||
"""Print info of this character""" | ||
return super(Bishop, self).get_info(self).format(self.character_name, "You receive one gold for each " | ||
"religious (blue) district in your city.") | ||
return super(Bishop, self).get_info(self).format(self.character_name, self.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import random | ||
from enum import Enum | ||
from random import randrange | ||
|
||
|
||
class CharactersList(Enum): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from CharactersList import CharactersList | ||
from server.Characters.Character import Character | ||
from server.District import DistrictTypeList | ||
|
||
|
||
class Merchant(Character): | ||
|
||
def __init__(self): | ||
super().__init__(CharactersList.Assassin) | ||
|
||
def action(self, character_name=None): | ||
"""The action of this character""" | ||
|
||
def get_progress_information(self, districts_in_hand): | ||
"""Print info of this action""" | ||
return super(Merchant, self).get_progress_information(self).format("You receive {} gold").format(len(list(filter(lambda x: x.value.type_of_district == DistrictTypeList.Trade, districts_in_hand)))) | ||
|
||
def get_info(self): | ||
"""Print info of this character""" | ||
return super(Merchant, self).get_info(self).format(self.character_name, "You receive one gold for each trade (green)district in your city") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from CharactersList import CharactersList | ||
from server.Characters.Character import Character | ||
from server.District import DistrictTypeList | ||
|
||
|
||
class Warlord(Character): | ||
|
||
def __init__(self): | ||
super().__init__(CharactersList.Warlord) | ||
self.choose_character = None | ||
self.text = """You receive one gold for each military (red) | ||
district in your city. At the end of your turn, you | ||
may destroy one district of your choice by paying | ||
a number of gold equal to one less than the cost | ||
of the district. Thus, you may destroy a cost one | ||
district for free, a cost two district for one gold, | ||
or a cost six district for five gold, etc. You may | ||
destroy one of your own districts. You may not, | ||
however, destroy a district in a city that is already | ||
completed by having eight districts (or seven | ||
districts when the Bell Tower is in play).""" | ||
|
||
def action(self, character_name): | ||
"""The action of this character""" | ||
self.choose_character = character_name | ||
|
||
def get_progress_information(self, districts_in_hand): | ||
"""Print info of this action""" | ||
return super(Warlord, self).get_progress_information(self).format("You receive {} gold").format(len(list(filter(lambda x: x.value.type_of_district == DistrictTypeList.Religious, districts_in_hand)))) | ||
|
||
def get_info(self): | ||
"""Print info of this character""" | ||
return super(Warlord, self).get_info(self).format(self.character_name, self.text) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import random | ||
from enum import Enum | ||
|
||
|
||
class DistrictTypeList(Enum): | ||
Bonus = 0 | ||
Military = 1 | ||
Church = 2 | ||
Noble = 3 | ||
Trade = 4 | ||
|
||
|
||
class District(object): | ||
"""Is a Basic character class""" | ||
|
||
def __init__(self, name, type_of_district, price, quantity): | ||
"""Constructor""" | ||
self.name = name | ||
self.type_of_district = type_of_district | ||
self.price = price | ||
self.quantity = quantity | ||
|
||
|
||
class DistrictsList(Enum): | ||
Watchtower = District("watchtower", DistrictTypeList.Military, 1, 3) | ||
Prison = District("prison", DistrictTypeList.Military, 2, 3) | ||
The_Field_of_Mars = District("the Field of Mars", DistrictTypeList.Military, 3, 3) | ||
Fortress = District("fortress", DistrictTypeList.Military, 5, 2) | ||
|
||
Temple = District("temple", DistrictTypeList.Church, 1, 3) | ||
Church = District("church", DistrictTypeList.Church, 2, 3) | ||
Monastery = District("monastery", DistrictTypeList.Church, 3, 3) | ||
Cathedral = District("cathedral", DistrictTypeList.Church, 5, 2) | ||
|
||
Estate = District("estate", DistrictTypeList.Noble, 3, 5) | ||
Castle = District("castle", DistrictTypeList.Noble, 4, 4) | ||
Palazzo = District("castle", DistrictTypeList.Noble, 5, 3) | ||
|
||
Tavern = District("tavern", DistrictTypeList.Trade, 1, 5) | ||
Market = District("market", DistrictTypeList.Trade, 2, 4) | ||
Shop = District("shop", DistrictTypeList.Trade, 2, 3) | ||
Port = District("port", DistrictTypeList.Trade, 3, 3) | ||
Harbor = District("harbor", DistrictTypeList.Trade, 4, 3) | ||
Guildhall = District("guildhall", DistrictTypeList.Trade, 5, 2) | ||
|
||
@staticmethod | ||
def take_the_cards(number=1, type_of_district=None): | ||
return random.choices([i for i in DistrictsList if (type_of_district is None or i.value.type_of_district == type_of_district)], k=number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chxen help me with callback in super class pls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done