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
[x] All Pytests pass
[x] All changes are documented somewhere in the commit
[x] Rpg2.py is tested and works even with the changes
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 theEquipment
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 afterdo_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 thetargetNum
attribute and make it so that when the above condition is true, we resetbattleManager.targetNum
as well. The target list was also renamed totargets
PR checklist