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

Multiclassing #25

Open
TypicallyThomas opened this issue Dec 12, 2023 · 2 comments
Open

Multiclassing #25

TypicallyThomas opened this issue Dec 12, 2023 · 2 comments
Labels
new feature New feature or request

Comments

@TypicallyThomas
Copy link

Amazing library. Just reading the source code is teaching me a lot about Python I didn't know.
I haven't had a full deep dive into the actual workings of the code, but unless I'm missing something, multiclassing isn't currently possible. Is this something you're thinking about? If not, I might be able to have a go at implementing such a feature through a pull request, but I can plainly see you're much better at it than me, so if it is something that interests you, might be worth implementing.

I ask cause I wanna build a program that tries literally every possible character and ranks them based on certain metrics, and so I wanna be able to try every possible multiclass as well. I realise it's quite a complex ask, though, so no sweat if you don't have time for such a massive addition.

@tassaron
Copy link
Owner

In theory I would like to implement multiclassing, but it would challenge a lot of assumptions made throughout the code.

The code treats "level" and "class" as if they are separate (albeit linked) concepts, but with multiclassing we would have to store class features for each level gained (e.g., at level 6 a character can gain the class features for a level 1 class) rather than assuming the class features based on the level. Hit dice also need to be stored per level in a similar fashion. Spellcasting stat needs to be stored per spell instead of per character (since you can use Int for one spell and Cha for another spell).

For me, it's a question of what API gets exposed to the user, and the API is poorly documented at the moment. I'm working on multi-page documentation (#24) which I'd like to finish first.

I will take a stab at this, and it will definitely happen someday, but it may take me a while to get to it.

How do you think leveling up should work with multiclassing?

from dnd_character.character import Character
from dnd_character.classes import CLASSES
char = Character(classs=CLASSES['ranger'], level=2)

This character would be a level 2 Ranger, and I'm not sure how they would gain a level of Rogue (for example (it's a popular multiclass, I think)).

I can think of some weird designs like this:

# continued from above snippet
char.multiclassing[3] = CLASSES['rogue']
char.level = 3

So then multiclassing would be a list of up to 20 _CLASS objects which could be used when leveling up. But this seems like an unintuitive design. I have to think about it. Feedback on this is highly appreciated!

I do appreciate pull requests, but it's a major change and probably wouldn't be worthwhile for you to spend so much time on it. The API needs to be decided first, either way.

@tassaron
Copy link
Owner

Another design could be treating the class as an attribute of the character which itself owns the level. E.g., character.rogue.level = 1; character.ranger.level = 2; assert character.level == 3 ... Not sure if setting character.level should be allowed anymore in that case.

@tassaron tassaron added the new feature New feature or request label Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants