Fixes #49: Character cannot have two equal items#90
Fixes #49: Character cannot have two equal items#90ttldtor wants to merge 1 commit intocodingteam:masterfrom
Conversation
| } | ||
|
|
||
| object Knife { | ||
| def apply(name: String, damage: Int = 50) = new Knife(name, damage) |
There was a problem hiding this comment.
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.
@ForNeVeR I don't see any faction id: case class Faction(name: String). Yep, I agree with you. I'll add id to items.
ForNeVeR
left a comment
There was a problem hiding this comment.
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.
I suggest to return the missing capabilities from the canEquip method, log them here, and add a // TODO: Show missing capabilities on screen.
| } | ||
|
|
||
| def toggleSelected() = { | ||
| def toggleSelected(): Unit = { |
There was a problem hiding this comment.
Could you please add a test for the new behavior of this method?
Fixes #49
Knifecase class converted to class so knifes became unique