-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fixes #49: Character cannot have two equal items #90
base: master
Are you sure you want to change the base?
Fixes #49: Character cannot have two equal items #90
Conversation
} | ||
|
||
object Knife { | ||
def apply(name: String, damage: Int = 50) = new Knife(name, damage) |
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.
Honestly, I dislike the approach taken. Now we'll be required to be very careful when declaring our item classes to not hit the same issue with any of them.
There's an alternate route with marking our items with identifiers (the same as we already use for actors and factions).
@ttldtor, what do you think about this alternative? Would it be worse?
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.
@ForNeVeR I don't see any faction id: case class Faction(name: String)
. Yep, I agree with you. I'll add id to items.
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.
Very good work, thank you. I believe that minor changes may improve this PR.
backpack -= item | ||
equipment += item | ||
} else { | ||
return |
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 suggest to return the missing capabilities from the canEquip
method, log them here, and add a // TODO: Show missing capabilities on screen
.
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.
@ForNeVeR ok
def equipped(item: EquipmentItem): Boolean = { | ||
inventory.equipment.contains(item) | ||
} | ||
|
||
def toggleSelected() = { | ||
def toggleSelected(): Unit = { |
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.
Could you please add a test for the new behavior of this method?
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.
@ForNeVeR ok
Fixes #49
Knife
case class converted to class so knifes became unique