mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Update attack snippet if no findNearestEnemy
This is a one-off fix until we have a more general solution to snippet updating based on available skills.
This commit is contained in:
parent
ff2e8eaa21
commit
651ff3c8d0
1 changed files with 16 additions and 1 deletions
|
@ -234,7 +234,22 @@ module.exports = class SpellView extends CocoView
|
|||
meta: 'press enter'
|
||||
name: doc.name
|
||||
tabTrigger: doc.snippets[e.language].tab
|
||||
snippetEntries.push entry
|
||||
if doc.name is 'findNearestEnemy'
|
||||
# Remember if we have findNearestEnemy so attack snippet can be updated
|
||||
haveFindNearestEnemy = true
|
||||
if doc.name is 'attack'
|
||||
# Postpone this until we know if findNearestEnemy is available
|
||||
attackEntry = entry
|
||||
else
|
||||
snippetEntries.push entry
|
||||
|
||||
# TODO: Generalize this snippet replacement
|
||||
# TODO: Where should this logic live, and what format should it be in?
|
||||
if attackEntry?
|
||||
unless haveFindNearestEnemy
|
||||
# No findNearestEnemy, so update attack snippet to string-based target
|
||||
attackEntry.content = attackEntry.content.replace '${1:enemy}', '"${1:Enemy Name}"'
|
||||
snippetEntries.push attackEntry
|
||||
|
||||
# window.zatannaInstance = @zatanna
|
||||
# window.snippetEntries = snippetEntries
|
||||
|
|
Loading…
Reference in a new issue