Conversation
|
Left some comments in the diff, also when I play the game, the extra damage messages go too fast, I think there should be a pause after each. Looks good so far though! |
weaponstrength was updated to weaponsharpness
|
Looks like the build failed? |
|
Any updates @Shaedil? |
|
So sorry, I've been busy with my classes. I've been working on it since two days ago, I believe I have the fix for this. I just can't believe how silly the mistake was. I'll be pushing the final changes by the end of the day. |
|
No worries! Just making sure I have time to merge this before the end of October, if you wanted it to count for Hacktoberfest. Good luck with your classes :) |
tagniam
left a comment
There was a problem hiding this comment.
Left some more comments, but basically we'd like to avoid adding any code to the main game loop if possible. LMK if you have any questions about that.
| // Player turn is over, enemy's status effect damage is calculated | ||
| if (0 < _Player->extradamageturns && _Player->extradamageturns <= 2 && damagePlayer != -1) { | ||
| _Player->extradamageturns--; | ||
| _Enemy->TakeDamage(extradamagePlayer); | ||
| _Player->ReturnDialog(extradamagePlayer, " damage points from burn dealt"); | ||
| } | ||
| // Check if enemy has had molotov thrown at him before or now | ||
| if (damagePlayer == -3) { | ||
| damagePlayer = Common::RandomInt(30, 40); | ||
| _Enemy->TakeDamage(damagePlayer); | ||
| _Player->ReturnDialog(damagePlayer, " regular damage points dealt"); | ||
| _Player->extradamageturns = 2; | ||
| _Player->ReturnDialog(_Player->extradamageturns, " turns of extra burn damage"); | ||
| } |
There was a problem hiding this comment.
There is still molotov logic in the game loop, we'd like to avoid that, I think this can be done wholly in the Player/Enemy classes. Let me know if you have any questions about that.
There was a problem hiding this comment.
I can reduce this to just one function call, if that is what you mean by "done wholly in the Player/Enemy classes". Otherwise, would you rather the molotov damage be added onto the main damage i.e. damagePlayer?
There was a problem hiding this comment.
Ideally there shouldn't be any extra function calls or code in the main game loop. So yeah, I think the molotov damage should be added onto the main damage, then the dialog messages can be printed in the Player class' UseMolotov, similar to UseBomb, BowAndArrow, etc. Keeping track of extradamageturns should also be in the Player class.
There was a problem hiding this comment.
With that approach, you don't need to modify anything in the Enemy class. So really it should be done wholly in the Player class, if I'm not mistaken.
| int extradamagePlayer = _Player->ReturnExtraMolotovDamage(); | ||
| // Player's turn to attack Enemy or choose other action. | ||
| if (damagePlayer != SKIP_TURN) { | ||
| if (damagePlayer != SKIP_TURN && damagePlayer != -3) { |
There was a problem hiding this comment.
Avoid using magic numbers like -3, you should define constants e.g. like SKIP_TURN so it's easier to read :)
| // Reset remaining molotov damage, and prevent it from overlapping into the next battle. | ||
| _Player->extradamageturns = 3; |
| bombs += amount; | ||
| break; | ||
| case ITEMTYPE::MOLOTOV: | ||
| ++molotovs; |
There was a problem hiding this comment.
This should be molotovs += amount
Solves #128.