From 904d605e4263c03ab5c5301485191f98fef915b1 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Fri, 21 Nov 2014 20:36:56 -0800 Subject: [PATCH 1/3] Getting ready to add new levels. --- app/lib/LevelOptions.coffee | 28 +++++++ app/views/editor/level/treema_nodes.coffee | 3 +- app/views/game-menu/InventoryModal.coffee | 2 +- app/views/play/WorldMapView.coffee | 87 +++++++++++++++++++++- 4 files changed, 116 insertions(+), 4 deletions(-) diff --git a/app/lib/LevelOptions.coffee b/app/lib/LevelOptions.coffee index fab684b45..d703de564 100644 --- a/app/lib/LevelOptions.coffee +++ b/app/lib/LevelOptions.coffee @@ -231,12 +231,37 @@ module.exports = LevelOptions = 'shield-rush': requiredGear: {torso: 'tarnished-bronze-breastplate', waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'crude-glasses', 'right-hand': 'long-sword', 'left-hand': 'bronze-shield', wrists: 'sundial-wristwatch'} restrictedGear: {'left-hand': 'wooden-shield'} + + # Warrior branch 'peasant-protection': requiredGear: {torso: 'tarnished-bronze-breastplate', waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'long-sword', 'left-hand': 'bronze-shield', wrists: 'sundial-wristwatch'} restrictedGear: {eyes: 'crude-glasses'} 'munchkin-swarm': requiredGear: {torso: 'tarnished-bronze-breastplate', waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'long-sword', 'left-hand': 'bronze-shield', wrists: 'sundial-wristwatch'} restrictedGear: {} + + # Ranger branch + 'munchkin-harvest': + requiredGear: {torso: 'tarnished-bronze-breastplate', waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'long-sword', 'left-hand': 'bronze-shield', wrists: 'sundial-wristwatch'} + restrictedGear: {} + 'swift-dagger': + requiredGear: {waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'crude-crossbow', 'left-hand': 'crude-dagger', wrists: 'sundial-wristwatch'} + restrictedGear: {eyes: 'crude-glasses'} + 'shrapnel': + requiredGear: {waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'crude-crossbow', 'left-hand': 'weak-charge', wrists: 'sundial-wristwatch'} + restrictedGear: {eyes: 'crude-glasses', 'left-hand': 'swift-dagger'} + + # Wizard branch + 'arcane-ally': + requiredGear: {torso: 'tarnished-bronze-breastplate', waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'long-sword', 'left-hand': 'bronze-shield', wrists: 'sundial-wristwatch'} + restrictedGear: {eyes: 'crude-glasses'} + 'touch-of-death': + requiredGear: {waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'enchanted-stick', 'left-hand': 'unholy-tome-i', wrists: 'sundial-wristwatch'} + restrictedGear: {} + 'bonemender': + requiredGear: {waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'enchanted-stick', 'left-hand': 'book-of-life-i', wrists: 'sundial-wristwatch'} + restrictedGear: {'left-hand': 'unholy-tome-i'} + 'coinucopia': requiredGear: {'programming-book': 'programmaticon-i', feet: 'leather-boots', 'programming-book': 'programmaticon-ii', flag: 'basic-flags'} restrictedGear: {} @@ -255,3 +280,6 @@ module.exports = LevelOptions = 'multiplayer-treasure-grove': requiredGear: {'programming-book': 'programmaticon-i', feet: 'leather-boots', 'programming-book': 'programmaticon-ii', flag: 'basic-flags', eyes: 'wooden-glasses', torso: 'tarnished-bronze-breastplate'} restrictedGear: {} + 'siege-of-stonehold': + requiredGear: {} + restrictedGear: {} diff --git a/app/views/editor/level/treema_nodes.coffee b/app/views/editor/level/treema_nodes.coffee index 989adfa22..e04092c8b 100644 --- a/app/views/editor/level/treema_nodes.coffee +++ b/app/views/editor/level/treema_nodes.coffee @@ -289,5 +289,4 @@ module.exports.ItemThangTypeNode = ItemThangTypeNode = class ItemThangTypeNode e processThangType: (thangType) -> return unless itemComponent = _.find thangType.get('components'), {original: LevelComponent.ItemID} - return unless itemComponent.config?.slots?.length - @constructor.thangTypes.push name: thangType.get('name'), original: thangType.get('original'), slots: itemComponent.config.slots + @constructor.thangTypes.push name: thangType.get('name'), original: thangType.get('original'), slots: itemComponent.config?.slots ? ['right-hand'] diff --git a/app/views/game-menu/InventoryModal.coffee b/app/views/game-menu/InventoryModal.coffee index f87898998..1fac3a029 100644 --- a/app/views/game-menu/InventoryModal.coffee +++ b/app/views/game-menu/InventoryModal.coffee @@ -84,7 +84,7 @@ module.exports = class InventoryModal extends ModalView # sort into one of the four groups locked = not (item.get('original') in me.items()) - locked = false if me.get('slug') is 'nick' + #locked = false if me.get('slug') is 'nick' if not item.getFrontFacingStats().props.length and not _.size(item.getFrontFacingStats().stats) and not locked # Temp: while there are placeholder items null # Don't put into a collection diff --git a/app/views/play/WorldMapView.coffee b/app/views/play/WorldMapView.coffee index db3b29a70..64547bfca 100644 --- a/app/views/play/WorldMapView.coffee +++ b/app/views/play/WorldMapView.coffee @@ -110,6 +110,7 @@ module.exports = class WorldMapView extends RootView window.levelUnlocksNotWorking = true if level.locked and level.id is @nextLevel # Temporary level.locked = false if window.levelUnlocksNotWorking # Temporary; also possible in HeroVictoryModal level.locked = false if @levelStatusMap[level.id] in ['started', 'complete'] + level.locked = false if me.get('slug') is 'nick' level.disabled = false if @levelStatusMap[level.id] in ['started', 'complete'] level.color = 'rgb(255, 80, 60)' if level.practice @@ -689,7 +690,9 @@ forest = [ continue: 'peasant-protection' x: 58.54 y: 66.73 - } + } + + # Warrior branch { name: 'Peasant Protection' type: 'hero' @@ -710,6 +713,77 @@ forest = [ x: 71.19 y: 63.61 } + + # Ranger branch + { + name: 'Munchkin Harvest' + type: 'hero' + id: 'munchkin-harvest' + description: 'Join forces with a new hero: Amara Arrowhead.' + nextLevels: + continue: 'swift-dagger' + disabled: not me.isAdmin() + x: 64.37 + y: 69.18 + } + { + name: 'Swift Dagger' + type: 'hero' + id: 'swift-dagger' + description: 'Deal damage from a distance with a new hero.' + nextLevels: + continue: 'shrapnel' + disabled: not me.isAdmin() + x: 66 + y: 75.61 + } + { + name: 'Shrapnel' + type: 'hero' + id: 'shrapnel' + description: 'Explore the explosive arts.' + nextLevels: + continue: 'coinucopia' + disabled: not me.isAdmin() + x: 67 + y: 81 + } + + # Wizard branch + { + name: 'Arcane Ally' + type: 'hero' + id: 'arcane-ally' + description: 'Stand your ground against large ogres with a new hero: Ms. Hushbaum.' + nextLevels: + continue: 'touch-of-death' + disabled: not me.isAdmin() + x: 64.37 + y: 55.18 + } + { + name: 'Touch of Death' + type: 'hero' + id: 'touch-of-death' + description: 'Learn your first spell to siphon life from your foes.' + nextLevels: + continue: 'bonemender' + disabled: not me.isAdmin() + x: 65 + y: 48 + } + { + name: 'Bonemender' + type: 'hero' + id: 'bonemender' + description: 'Cast regeneration on allied soldiers to withstand a siege.' + nextLevels: + continue: 'coinucopia' + disabled: not me.isAdmin() + x: 66 + y: 40 + } + { name: 'Coinucopia' type: 'hero' @@ -760,6 +834,17 @@ forest = [ x: 77.54 y: 25.94 } + { + name: 'Siege of Stonehold' + type: 'hero' + id: 'siege-of-stonehold' + description: 'Unlock the desert world, if you are strong enough to win this epic battle!' + #nextLevels: + # continue: '' + disabled: not me.isAdmin() + x: 77.54 + y: 25.94 + } { name: 'Multiplayer Treasure Grove' type: 'hero-ladder' From c012cd4e30b10f03fa72491784e67433bb189c40 Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Fri, 21 Nov 2014 21:02:35 -0800 Subject: [PATCH 2/3] Prevent continuous deletion of a single line --- app/lib/CampaignOptions.coffee | 2 ++ app/views/play/level/tome/SpellView.coffee | 31 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/app/lib/CampaignOptions.coffee b/app/lib/CampaignOptions.coffee index 9762b4a9e..8fb64858a 100644 --- a/app/lib/CampaignOptions.coffee +++ b/app/lib/CampaignOptions.coffee @@ -6,8 +6,10 @@ CampaignList = require('views/play/WorldMapView').campaigns options = 'default': autocompleteFontSizePx: 16 + backspaceThrottle: false 'dungeon': autocompleteFontSizePx: 20 + backspaceThrottle: true module.exports = CampaignOptions = getCampaignForSlug: (slug) -> diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index c333825b7..40f4f90bc 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -216,6 +216,37 @@ module.exports = class SpellView extends CocoView name: 'disable-spaces' bindKey: 'Space' exec: => @ace.execCommand 'insertstring', ' ' unless LevelOptions[@options.level.get('slug')]?.disableSpaces + addCommand + name: 'throttle-backspaces' + bindKey: 'Backspace' + exec: => + # Throttle the backspace speed + # Slow to 500ms when whitespace at beginning of line is first encountered + # Slow to 100ms for remaining whitespace at beginning of line + # Rough testing showed backspaces happen at 150ms when tapping. + # Backspace speed varies by system when holding, 30ms on fastest Macbook setting. + unless CampaignOptions?.getOption?(@options?.level?.get?('slug'), 'backspaceThrottle') + @ace.remove "left" + return + + nowDate = Date.now() + if @aceSession.selection.isEmpty() + cursor = @ace.getCursorPosition() + line = @aceDoc.getLine(cursor.row) + if /^\s*$/.test line.substring(0, cursor.column) + @backspaceThrottleMs ?= 500 + # console.log "SpellView @backspaceThrottleMs=#{@backspaceThrottleMs}" + # console.log 'SpellView lastBackspace diff', nowDate - @lastBackspace if @lastBackspace? + if not @lastBackspace? or nowDate - @lastBackspace > @backspaceThrottleMs + @backspaceThrottleMs = 100 + @lastBackspace = nowDate + @ace.remove "left" + return + @backspaceThrottleMs = null + @lastBackspace = nowDate + @ace.remove "left" + + fillACE: -> @ace.setValue @spell.source From 2fc6f7a8a26f6ae986f1fbda24563ef77e521af8 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Fri, 21 Nov 2014 22:35:03 -0800 Subject: [PATCH 3/3] New required inventory items for ranger/wizard levels. --- app/lib/LevelOptions.coffee | 2 +- app/views/game-menu/InventoryModal.coffee | 11 ++++++++++- app/views/play/WorldMapView.coffee | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/lib/LevelOptions.coffee b/app/lib/LevelOptions.coffee index d703de564..e80605cd8 100644 --- a/app/lib/LevelOptions.coffee +++ b/app/lib/LevelOptions.coffee @@ -249,7 +249,7 @@ module.exports = LevelOptions = restrictedGear: {eyes: 'crude-glasses'} 'shrapnel': requiredGear: {waist: 'leather-belt', 'programming-book': 'programmaticon-ii', eyes: 'wooden-glasses', 'right-hand': 'crude-crossbow', 'left-hand': 'weak-charge', wrists: 'sundial-wristwatch'} - restrictedGear: {eyes: 'crude-glasses', 'left-hand': 'swift-dagger'} + restrictedGear: {eyes: 'crude-glasses', 'left-hand': 'crude-dagger'} # Wizard branch 'arcane-ally': diff --git a/app/views/game-menu/InventoryModal.coffee b/app/views/game-menu/InventoryModal.coffee index 1fac3a029..356adc24a 100644 --- a/app/views/game-menu/InventoryModal.coffee +++ b/app/views/game-menu/InventoryModal.coffee @@ -387,7 +387,9 @@ module.exports = class InventoryModal extends ModalView console.log 'Unequipping restricted item', restrictedGear[slot], 'for', slot, 'before level', @options.levelID @unequipItemFromSlot @$el.find(".item-slot[data-slot='#{slot}']") delete equipment[slot] - if heroClass is 'Warrior' + if (heroClass is 'Warrior' or + (heroClass is 'Ranger' and @options.levelID in ['swift-dagger', 'shrapnel']) or + (heroClass is 'Wizard' and @options.levelID in ['touch-of-death', 'bonemender'])) # After they switch to a ranger or wizard, we stop being so finicky about gear. for slot, item of requiredGear continue if item is 'tarnished-bronze-breastplate' and inWorldMap and @options.levelID is 'the-raised-sword' # Don't tell them they need it until they need it in the level @@ -479,6 +481,7 @@ gear = 'leather-boots': '53e2384453457600003e3f07' 'leather-belt': '5437002a7beba4a82024a97d' 'programmaticon-i': '53e4108204c00d4607a89f78' + 'programmaticon-ii': '546e25d99df4a17d0d449be1' 'crude-glasses': '53e238df53457600003e3f0b' 'crude-builders-hammer': '53f4e6e3d822c23505b74f42' 'long-sword': '544d7d1f8494308424f564a3' @@ -488,3 +491,9 @@ gear = 'basic-flags': '545bacb41e649a4495f887da' 'roughedge': '544d7d918494308424f564a7' 'sharpened-sword': '544d7deb8494308424f564ab' + 'crude-crossbow': '544d7ffd8494308424f564c3' + 'crude-dagger': '544d952b8494308424f56517' + 'weak-charge': '544d957d8494308424f5651f' + 'enchanted-stick': '544d87188494308424f564f1' + 'unholy-tome-i': '546374bc3839c6e02811d308' + 'book-of-life-i': '546375653839c6e02811d30b' diff --git a/app/views/play/WorldMapView.coffee b/app/views/play/WorldMapView.coffee index 64547bfca..099fcfc19 100644 --- a/app/views/play/WorldMapView.coffee +++ b/app/views/play/WorldMapView.coffee @@ -730,7 +730,7 @@ forest = [ name: 'Swift Dagger' type: 'hero' id: 'swift-dagger' - description: 'Deal damage from a distance with a new hero.' + description: 'Deal damage from a distance with your new hero.' nextLevels: continue: 'shrapnel' disabled: not me.isAdmin()