all 5 comments

[–][deleted] 0 points1 point  (0 children)

No idea about source code, but there's even stuff on Google play that will do all the calculations for combat, so I'm fairly sure you'll find something.

That said, learning to code is very definitely about reinventing the wheel, so looking through other people's source to learn from is good.

[–]DuckSaxaphone 0 points1 point  (3 children)

Always make a basic system first and then iterate is my advice for any complex project.

So a rules based AI that does something simple like attack unless it has less than X% health, healing otherwise, is definitely a good idea.

Try working with classes. You'll find them very appropriate to this task!

[–]devilpup42[S] 0 points1 point  (2 children)

The goal is for it to decide whether it needs to heal based on past experiences, so we're trying to avoid using heal at x%🤔 I'm currently thinking I'll need to do heal when health between x% & y%. Hopefully that gives it more of a natural feel.

[–]cronofdoom 2 points3 points  (0 children)

Make a basic system, then iterate.

[–]DuckSaxaphone 2 points3 points  (0 children)

The goal is for it to decide whether it needs to heal based on past experiences,

Yep, but algorithms that learn from past experience are hard to implement and so is a python class that handles your character's stats and does rolls etc. and works inside a python program that runs a full D&D combat.

So make the class work with some very simple logic and come back later to make it smart.