-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Reduce HP to Modify HP #33
base: master
Are you sure you want to change the base?
Change Reduce HP to Modify HP #33
Conversation
…lete buttons into InfoTab.
Hello! Super cool to see you are still working on this! I will try to take a look at this in ~9 hours. If i don't have the time, it'll be Wednesday instead. Thanks for your cool contribution! |
@@ -167,7 +167,7 @@ private void SaveButton_Click(object sender, EventArgs e) | |||
|
|||
short? maxHP = TryParseNullable(MaxHPInput.Text.Trim()); | |||
short? tempHP = TryParseNullable(TempHPInput.Text.Trim()); | |||
short? reduceHP = TryParseNullable(ReduceHPInput.Text.Trim()); | |||
short? reduceHP = TryParseNullable(amountHPInput.Text.Trim()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think calling it ModifyHPInput
would be better (PascalCase)
@@ -227,7 +227,7 @@ private void SaveButton_Click(object sender, EventArgs e) | |||
if (reduceHP.Value < 0) | |||
{ | |||
errors = true; | |||
ReduceHPLabel.ForeColor = Color.Red; | |||
modifyHPLabel.ForeColor = Color.Red; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also call this ModifyHPLabel
(PascalCase)
@@ -167,7 +167,7 @@ private void SaveButton_Click(object sender, EventArgs e) | |||
|
|||
short? maxHP = TryParseNullable(MaxHPInput.Text.Trim()); | |||
short? tempHP = TryParseNullable(TempHPInput.Text.Trim()); | |||
short? reduceHP = TryParseNullable(ReduceHPInput.Text.Trim()); | |||
short? reduceHP = TryParseNullable(amountHPInput.Text.Trim()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this variable is still called reduceHP
, I think it should be called ModifyHP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take a look at my other comments first. I am not sure if this code still needs to exist here, but that will be more clear after the rest of the code comments :)
@@ -295,11 +295,11 @@ private void SaveButton_Click(object sender, EventArgs e) | |||
{ | |||
//Right now it is unclear if the user has entered wrong input (for example: "dsfsdf") or just didn't didnt enter anything into the Reduce HP range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code comment still refers to "reduce HP" instead of modify
character.HP = (short)(character.HP + addAmt); | ||
|
||
UpdateDetailsTab(character); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the README.md
you can see that the picture is now outdated. Could you replace that picture (see Images folder) with the new version with your changes with the same data?
@@ -620,5 +620,27 @@ private void UpdateNextTab(Character character) | |||
short outValue; | |||
return short.TryParse(val, out outValue) ? (short?)outValue : null; | |||
} | |||
|
|||
private void reduceButton_Click(object sender, EventArgs e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names of the button and method are camelcase and not as clear as other buttons. I would propse to make them CamelCase:
ReduceHPButton
IncreaseHPButton
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do this in the Properties
window in visual studio and of course in here as well :)
@@ -620,5 +620,27 @@ private void UpdateNextTab(Character character) | |||
short outValue; | |||
return short.TryParse(val, out outValue) ? (short?)outValue : null; | |||
} | |||
|
|||
private void reduceButton_Click(object sender, EventArgs e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clicking on the - or + button when there is no text in the input results in an exception. That should not happen! :)
The label should become red and nothing should happen :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably because of short.Parse(amountHPInput.Text);
.
Replacing that with the TryParseNullable()
function combined with the current code on MASTER on rule 222 and 298 might help :)
character.HP = (short)(character.HP + addAmt); | ||
|
||
UpdateDetailsTab(character); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
character.HP = (short)(character.HP + addAmt); | ||
|
||
UpdateDetailsTab(character); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some bugs:
- If you give a user 44 HP, and you reduce it by 100, you would expect the character to die. this happens with existing code. This does not happen with yours; it updates the details tab in a weird way :)
- If you increase someone's HP above their max HP, some weird stuff happens. I would expect that if you give someone 10 HP when they have 9 out of 10, it would just be set to 10 and stop there.
- Changing the HP of a player that is not on the detail tab, changes the detail tab to show that player. That doesn't happen with the current setup and shouldn't happen with the new setup! :)
- I'd like to hear your thoughts on this one. I believe that if you modify the HP of the current player, it should also modify the HP on the left. and in the list. Right now it doesn't update in the list or on the information tab. Take a look at the current behavior on MASTER and try to replicate that :). This means that the + and - buttons perform a SAVE call for you
@@ -620,5 +620,27 @@ private void UpdateNextTab(Character character) | |||
short outValue; | |||
return short.TryParse(val, out outValue) ? (short?)outValue : null; | |||
} | |||
|
|||
private void reduceButton_Click(object sender, EventArgs e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move these 2 new private methods up a bit, put them after the _clicked
methods so they are all nice and close to eachother :)
I think it'd be good to do some more testing after you made it your changes. For example:
Just mess about with the current features and try to not break any of them. I could have made this easier with unit tests but sadly I didn't write these years ago :) |
@Malechus If I can help out with the PR or if it is overwhelming, let me know! We could even do this kind of stuff together if you'd like. Bottom line, I'd love to help you out! ;) |
I appreciate all the detailed feedback here. Give me a little while, and I will go through these and push some updates. |
Adds buttons and moves UI to allow user to modify HP in either direction by increments. Addresses sander1095#20.