Skip to content
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

Character creation #135

Merged
merged 30 commits into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
469c6ac
views: view_character_creation.py: add name form
Cellmer Mar 6, 2023
76a31b9
views: view_character_creation.py: add alignment form view
Cellmer Mar 6, 2023
ad5ecfe
views: view_character_creation.py: change emojis and descriptions in …
Cellmer Mar 7, 2023
53cd8ad
views: view_character_creation.py: reposition components in alignment…
Cellmer Mar 7, 2023
8fb46b5
views: view_character_creation.py: add class form view
Cellmer Mar 7, 2023
29c968c
views: view_character_creation.py: change dropdown name
Cellmer Mar 7, 2023
ff434a7
views: view_character_creation.py: add race form view
Cellmer Mar 7, 2023
4cca16a
ui: message_templates.py: add embed template for alignment view in ch…
Cellmer Mar 8, 2023
dceb2c4
ui: message_templates.py: add embed template for class form in charac…
Cellmer Mar 8, 2023
3f47735
ui: message_templates.py: add embed template for race form in charact…
Cellmer Mar 8, 2023
e3e84ad
views: view_character_creation.py: change button name and text in rac…
Cellmer Mar 8, 2023
529cf90
ui: add stats retrospective form view and embed
Cellmer Mar 8, 2023
1c126fe
ui: add character creation start view and embed
Cellmer Mar 9, 2023
d42bb3b
add switching between forms during character creation process
Cellmer Mar 9, 2023
33dc4b7
add assigning attribute values during character creation process with…
Cellmer Mar 10, 2023
fa41d37
view_character_creation.py: add reroll functionality
Cellmer Mar 10, 2023
6d2561b
Update dnd-bot/dnd_bot/dc/ui/views/view_character_creation.py
Cellmer Mar 11, 2023
347d7b2
Update dnd-bot/dnd_bot/dc/ui/views/view_character_creation.py
Cellmer Mar 11, 2023
78fde25
Update dnd-bot/dnd_bot/dc/ui/views/view_character_creation.py
Cellmer Mar 11, 2023
1574e11
Update dnd-bot/dnd_bot/dc/ui/views/view_character_creation.py
Cellmer Mar 11, 2023
5f93d8b
Update dnd-bot/dnd_bot/dc/ui/views/view_character_creation.py
Cellmer Mar 11, 2023
454fa05
add handler for fisnishing character creation process and starting game
Cellmer Mar 11, 2023
8ea710e
view_character_creation.py: add restrictions on switching between for…
Cellmer Mar 11, 2023
b30af16
view_character_creation.py: delete redundant view
Cellmer Mar 12, 2023
1d8d293
view_character_creation.py: disable buttons after confirm
Cellmer Mar 12, 2023
8806b5b
view_character_creation.py: handle error messages
Cellmer Mar 12, 2023
71d7a62
view_character_creation.py: minor stylistic changes in forms
Cellmer Mar 12, 2023
be6a421
view_character_creation.py: another minor stylistic changes in forms
Cellmer Mar 12, 2023
16b6fb7
Merge branch 'staging' into character_creation
Cellmer Mar 12, 2023
0cdc652
fix merge conflict bugs
Cellmer Mar 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 183 additions & 0 deletions dnd-bot/dnd_bot/dc/ui/message_templates.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import nextcord

from dnd_bot.logic.character_creation.chosen_attributes import ChosenAttributes
from dnd_bot.logic.prototype.creature import Creature
from dnd_bot.logic.prototype.multiverse import Multiverse
from dnd_bot.logic.prototype.player import Player
Expand Down Expand Up @@ -146,3 +147,185 @@ def player_turn_embed(player: Player, active_player: Player, active_user_icon=No
def end_turn_recent_action_message(ending_creature):
return f"{ending_creature.name} has ended their turn"

@staticmethod
def character_creation_start_message_template():
"""embed at the beginning of character creation process"""

desc = "In the following forms you will be able to create the character for this game.\n\n" \
" Some of the attributes like name, backstory and alignment are just for you in order to immerse" \
" better with your character. \n\n" \
"The other ones: especially race and class can have a direct impact on" \
" your future interactions and attributes "

embed = nextcord.Embed(title=f'Character Creation', description=desc)

return embed

@staticmethod
def alignment_form_view_message_template():
"""embed in character creation explaining alignment"""

desc = "Alignment is a categorization of the ethical and moral perspective of your character.\n\n"
desc += "The nine alignments can be described as follows: \n"

embed = nextcord.Embed(title=f'Alignment Form', description=desc)

embed.add_field(name="Lawful Good",
value="A lawful good character typically acts with compassion and always with honor and a "
"sense of duty. However, lawful good characters will often regret taking any action "
"they fear would violate their code, even if they recognize such action as being good.")

embed.add_field(name="Neutral good",
value="A neutral good character typically acts altruistically, without regard for or against "
"lawful precepts such as rules or tradition. A neutral good character has no problems "
"with cooperating with lawful officials, but does not feel beholden to them. In the "
"event that doing the right thing requires the bending or breaking of rules, "
"they do not suffer the same inner conflict that a lawful good character would.")

embed.add_field(name="Chaotic good",
value="A chaotic good character does what is necessary to bring about change for the better, "
"disdains bureaucratic organizations that get in the way of social improvement, "
"and places a high value on personal freedom, not only for oneself, but for others as "
"well. Chaotic good characters usually intend to do the right thing, but their methods "
"are generally disorganized and often out of sync with the rest of society.")

embed.add_field(name="Lawful neutral",
value="A lawful neutral character typically believes strongly in lawful concepts such as "
"honor, order, rules, and tradition, but often follows a personal code in addition to, "
"or even in preference to, one set down by a benevolent authority.")

embed.add_field(name="True neutral",
value="A neutral character (also called \"true neutral\") is neutral on both axes and tends "
"not to feel strongly towards any alignment, or actively seeks their balance.")

embed.add_field(name="Chaotic neutral",
value="A chaotic neutral character is an individualist who follows their own heart and "
"generally shirks rules and traditions. Although chaotic neutral characters promote the "
"ideals of freedom, it is their own freedom that comes first; good and evil come second "
"to their need to be free.")

embed.add_field(name="Lawful evil",
value="A lawful evil character sees a well-ordered system as being easier to exploit than to "
"necessarily follow.")

embed.add_field(name="Neutral evil",
value="A neutral evil character is typically selfish and has no qualms about turning on "
"allies-of-the-moment, and usually makes allies primarily to further their own goals. A "
"neutral evil character has no compunctions about harming others to get what they want, "
"but neither will they go out of their way to cause carnage or mayhem when they see no "
"direct benefit for themselves. Another valid interpretation of neutral evil holds up "
"evil as an ideal, doing evil for evil's sake and trying to spread its influence.")

embed.add_field(name="Chaotic evil",
value="A chaotic evil character tends to have no respect for rules, other people's lives, "
"or anything but their own desires, which are typically selfish and cruel. They set a "
"high value on personal freedom, but do not have much regard for the lives or freedom "
"of other people. Chaotic evil characters do not work well in groups because they "
"resent being given orders and usually do not behave themselves unless there is no "
"alternative.")

return embed

@staticmethod
def class_form_view_message_template():
"""embed in character creation explaining classes"""

desc = "A character class is a fundamental part of the identity and nature of characters.\n" \
"Their capabilities, strengths, and weaknesses are largely defined by their class\n\n "

desc += "Available classes are described below: \n"

embed = nextcord.Embed(title=f'Class Form', description=desc)

embed.add_field(name="Warrior βš”",
value="Warriors share an unparalleled mastery with weapons and armor, and a thorough "
"knowledge of the skills of combat. They are well acquainted with death, both meting it "
"out and staring it defiantly in the face.")

embed.add_field(name="Mage πŸ§™",
value="Mages are supreme magic-users, defined and united as a class by the spells they cast. "
"Drawing on the subtle weave of magic that permeates the cosmos, mages cast spells of "
"explosive fire, arcing lightning, subtle deception, brute-force mind control, "
"and much more.")

embed.add_field(name="Ranger 🏹",
value="Far from the bustle of cities and towns, past the hedges that shelter the most distant "
"farms from the terrors of the wild, amid the dense-packed trees of trackless forests "
"and across wide and empty plains, rangers keep their unending watch.")

return embed

@staticmethod
def race_form_view_message_template():
"""embed in character creation explaining races"""

desc = "Each race has a distinct appearance, behavior and often range of statistics associated with it.\n\n "

desc += "Available races are described below: \n"

embed = nextcord.Embed(title=f'Race Form', description=desc)

embed.add_field(name="Human πŸ‘¨",
value="In the reckonings of most worlds, humans are the youngest of the common races, "
"late to arrive on the world scene and short-lived in comparison to dwarves, elves, "
"and dragons. Perhaps it is because of their shorter lives that they strive to achieve "
"as much as they can in the years they are given. Or maybe they feel they have "
"something to prove to the elder races, and that's why they build their mighty empires "
"on the foundation of conquest and trade. Whatever drives them, humans are the "
"innovators, the achievers, and the pioneers of the worlds.")

embed.add_field(name="Elf 🧝",
value="Elves are a magical people of otherworldly grace, living in places of ethereal beauty, "
"in the midst of ancient forests or in silvery spires glittering with faerie light, "
"where soft music drifts through the air and gentle fragrances waft on the breeze. Elves "
"love nature and magic, art and artistry, music and poetry.")

embed.add_field(name="Dwarf 🀏",
value="Kingdoms rich in ancient grandeur, halls carved into the roots of mountains, "
"the echoing of picks and hammers in deep mines and blazing forges, a commitment to "
"clan and tradition, and a burning hatred of goblins and orcs – these common threads "
"unite all dwarves.")

return embed

@staticmethod
def stats_retrospective_form_view_message_template(user_id):
"""embed showing created character and his stats"""

character = ChosenAttributes.chosen_attributes[user_id]

embed = nextcord.Embed(title=f'Your Character')

embed.add_field(name="Name",
value=character['name'],
inline=False)

embed.add_field(name="Backstory",
value=character['backstory'],
inline=False)

embed.add_field(name="Alignment",
value='-'.join(character['alignment']),
inline=False)

embed.add_field(name="Class",
value=character['class'],
inline=False)

embed.add_field(name="Race",
value=character['race'],
inline=False)

embed.add_field(name="Stats",
value=f"HP: {character['hp']} \n"
f"Strength: {character['strength']}\n"
f"Dexterity: {character['dexterity']}\n"
f"Intelligence: {character['intelligence']}\n"
f"Charisma: {character['charisma']}\n"
f"Perception: {character['perception']}\n"
f"Initiative: {character['initiative']}\n"
f"Action points: {character['action points']}\n",
inline=False)

return embed

Loading