mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-01 00:15:00 -04:00
Merge pull request #2868 from UltCombo/required-rings
Improved `updateLevelRequiredItems` logic regarding rings, fixes #2740
This commit is contained in:
commit
11d69880f7
1 changed files with 13 additions and 3 deletions
|
@ -430,10 +430,20 @@ module.exports = class InventoryModal extends ModalView
|
||||||
updateLevelRequiredItems: (equipment) ->
|
updateLevelRequiredItems: (equipment) ->
|
||||||
return unless requiredGear = @options.level.get 'requiredGear'
|
return unless requiredGear = @options.level.get 'requiredGear'
|
||||||
return unless heroClass = @selectedHero?.get 'heroClass'
|
return unless heroClass = @selectedHero?.get 'heroClass'
|
||||||
|
|
||||||
|
ringSlots = ['left-ring', 'right-ring']
|
||||||
|
|
||||||
for slot, items of requiredGear when items.length
|
for slot, items of requiredGear when items.length
|
||||||
equipped = equipment[slot]
|
if slot in ringSlots
|
||||||
continue if equipped in items
|
validSlots = ringSlots
|
||||||
continue if equipped # Actually, just let them play if they have equipped anything in that slot (and we haven't unequipped it due to restrictions).
|
else
|
||||||
|
validSlots = [slot]
|
||||||
|
|
||||||
|
continue if validSlots.some (slot) ->
|
||||||
|
equipped = equipment[slot]
|
||||||
|
equipped in items
|
||||||
|
|
||||||
|
continue if equipment[slot] # Actually, just let them play if they have equipped anything in that slot (and we haven't unequipped it due to restrictions).
|
||||||
items = (item for item in items when heroClass in (@items.findWhere(original: item)?.classes ? []))
|
items = (item for item in items when heroClass in (@items.findWhere(original: item)?.classes ? []))
|
||||||
continue unless items.length # If the required items are for another class, then let's not be finicky.
|
continue unless items.length # If the required items are for another class, then let's not be finicky.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue