Conversation
ifdwill
commented
Nov 25, 2019
| COMMON(3), | ||
| PROVINCE(1), | ||
| RARE(0) | ||
|
|
Collaborator
Author
There was a problem hiding this comment.
added values to the enum
ifdwill
commented
Nov 25, 2019
|
|
||
| public Card copy() { | ||
| return new Card(name, rarity); | ||
| return new Card(name, rarity, id); |
Collaborator
Author
There was a problem hiding this comment.
oh, this is wrong right now. gonna undo this
ifdwill
commented
Nov 25, 2019
| hash = 31 * hash + name.hashCode(); | ||
| return hash; | ||
| } | ||
|
|
Collaborator
Author
There was a problem hiding this comment.
hashCode will need more work later, but it's probably good to have. Right now, if you have like conflict Tadaka and dynasty Tadaka, they would be considered the same object with your equals method. Suggestion is to add an id field to the card class.
ifdwill
commented
Nov 25, 2019
| break; | ||
| } | ||
| for (int i = 0; i < count; i++) { | ||
| for (int i = 0; i < c.getRarity().getCardCount(); i++) { |
Collaborator
Author
There was a problem hiding this comment.
adding the cardcount to the enum makes it so that you don't need this switch statement. Could be useful if more "rarities" (though unlikely) are added down the line. Looks a bit cleaner though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update to card to make immutable object (so that other things can't change it. Makes it easier to make changes to the card class down the line).
Update to the RARITY enum so that it's a bit cleaner to work with (eliminates the need to make the switch statement in packfactory)
Override hashCode() method (good practice to always do when overriding equals)