Skip to content

CharacterInfo.StatIncrease could loop over stat types #43

@VirtuaBoza

Description

@VirtuaBoza

@warpfox This morning it occurred to me that if your stat gain values were in a dictionary as well as your stats and both with a StatType enum as a key, you could loop over StatType values and cut down the copy/paste in the StatIncrease method. I created a branch off of my Battle branch (a bad idea in hindsight) that you can take a look at.

Given that I branched off of Battle, I'd say, take what you want out of the branch I made and then delete it. Otherwise, it will be confusing to merge that into what you have bc you'd be taking Battle WIP as well.

A couple more things I see in CharacterInfo that I feel compelled to give advice about:

  • you can declare multiple variables of the same type on one line like you have, and I think the Udemy course even teaches that, but it can make debugging more difficult, and as far as I know, that's a practice that's largely avoided in the "real world"
  • Try to ensure your method names are verbs or verb phrases. So instead of "StatIncrease" maybe "IncreaseStats"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions