Keith1039 / Pygame-RPG

A repository of me trying to make an RPG with a custom game engine with Pygame added in as support.
0 stars 0 forks source link

Pygame-RPG 19.5 housekeeping and bugfixing #68

Closed Keith1039 closed 4 months ago

Keith1039 commented 4 months ago

Pygame-RPG 19.5 Housekeeping and bugfixing

This PR is meant to change the Defence attribute to "Def". This fits with the 3-letter-for-stat-name thing I have going on at the moment. As a result of this, all references to the "Defence" stat need to now reference the "Def" attribute. This includes changing the scripts so that new Entity JSON objects are created with a "Def" attribute instead of "Defence. The existing JSON code was also changed to match this.

The Entity classes (Enemy, Hero) as well as the Equipment class implemented these changes. Since Equipment directly buffs the stats for an Entity, it is more convinient if their attribute names mirror each other.

The second part of this PR is to fix a bug with the combat system. For some reason, the combat began behaving weirdly after the second turn, eventually breaking by turn 3. After further investigation, I realized that the condition I set for the move and target list to be cleared was faulty. The reason for this was the second condition, that being len(target) == battleManager.targetNum, this condition would never be fulfilled because after do_one_turn() is called and executed, battleManager.targetNum would be set to -1 (invalid number). This would make the above condition impossible.

To fix this, we simply remove the line in the do_one_move() function that resets the targetNum attribute and make it so that when the above condition is true, we reset battleManager.targetNum as well. The target list was also renamed to targets

PR checklist