tassaron / dnd-character

library for making Dungeons & Dragons 5e characters as serializable data
https://pypi.org/project/dnd-character/
Eclipse Public License 2.0
45 stars 17 forks source link

Missing class-specific features (class_features_data) #21

Closed gergo-szabo closed 1 year ago

gergo-szabo commented 1 year ago

Discussed in #19

Not discussed in #19:

There is a huge amount of counter type mechanics. I double checked everything but it is possible I have missed something. I created a simple test but it doesn't cover every edge case.

Closes #19

gergo-szabo commented 1 year ago

Sorry about the spam, long day... I will finish it on Friday

tassaron commented 1 year ago

Thanks so much. No worries about the 'spam', we can squash some commits down later. I appreciate your work

gergo-szabo commented 1 year ago

Character init has a class_features_data parameter. It is needed for serialization but the init doesn't use it (class_features_data variable has a fix value until level or class changes).

test_class_features_data.py tests for:

tassaron commented 1 year ago

Since class_features_data is something internally managed by the Character class, I put the underscore signifying that it is "private". This prevents it from being serialized so we don't need it for init

I didn't put a setter method so that might be needed if the user is expected to manually modify the available values... maybe we could do some validation. But this is fine for now, I think.

I am curious why "7 day cooldown" = 999 though? What is the 999?

gergo-szabo commented 1 year ago

I am not sure if I found every ability with cooldown. The largest cooldown I would expect is 1 year. So I choose 999 day to signal all abilities are available. We could count the days until ability available if you want to. But then we need some logic for keeping it >= 0.

tassaron commented 1 year ago

Okay. Your comments of '1 day' and '7 days' are referring to the cooldown that could be implemented. The 999 is just a suitably large number that the ability wouldn't be cooled down after reset. I think I understand.

I will change the comments a bit and merge shortly. Thank you :)

tassaron commented 1 year ago

Sorry, I got busy yesterday. I'll work on this more tonight/tomorrow (probably tonight).

I moved your new methods into a separate file as I want to start organizing the character class and splitting it up more.

I started writing some tests but one is failing. I'll look at it tonight.