Revamped Challenge Buttons completely, Added primal abilities, items and primals themselves
|
@ -4,26 +4,10 @@ $ ->
|
|||
$mainButtons.on 'click', '.teambuilder_button', (e) ->
|
||||
PokeBattle.navigation.showTeambuilder()
|
||||
|
||||
challengeobjunranked =
|
||||
eventName: "findBattleunranked"
|
||||
populate: $mainButtons.find('.find_battle_select_team')
|
||||
button: $mainButtons.find('.find_battle_non_ranked')
|
||||
defaultClauses: [
|
||||
Conditions.SLEEP_CLAUSE
|
||||
Conditions.EVASION_CLAUSE
|
||||
Conditions.SPECIES_CLAUSE
|
||||
Conditions.OHKO_CLAUSE
|
||||
Conditions.PRANKSTER_SWAGGER_CLAUSE
|
||||
Conditions.UNRELEASED_BAN
|
||||
Conditions.TIMED_BATTLE
|
||||
]
|
||||
blockedClauses: true
|
||||
|
||||
challengeobj =
|
||||
createChallengeButton
|
||||
eventName: "findBattle"
|
||||
populate: $mainButtons.find('.find_battle_select_team')
|
||||
button: $mainButtons.find('.find_battle')
|
||||
defaultClauses: [
|
||||
clauses: [
|
||||
Conditions.SLEEP_CLAUSE
|
||||
Conditions.EVASION_CLAUSE
|
||||
Conditions.SPECIES_CLAUSE
|
||||
|
@ -33,43 +17,22 @@ $ ->
|
|||
Conditions.RATED_BATTLE
|
||||
Conditions.TIMED_BATTLE
|
||||
]
|
||||
blockedClauses: true
|
||||
|
||||
challengepaneobjunranked = new challengePaneObject(challengeobjunranked)
|
||||
challengePaneArray.push(challengepaneobjunranked)
|
||||
challengepaneobj = new challengePaneObject(challengeobj)
|
||||
challengePaneArray.push(challengepaneobj)
|
||||
|
||||
createChallengePane
|
||||
createChallengeButton
|
||||
eventName: "findBattleunranked"
|
||||
populate: $mainButtons.find('.find_battle_select_team')
|
||||
button: $mainButtons.find('.find_battle_non_ranked')
|
||||
defaultClauses: [
|
||||
Conditions.SLEEP_CLAUSE
|
||||
Conditions.EVASION_CLAUSE
|
||||
Conditions.SPECIES_CLAUSE
|
||||
Conditions.OHKO_CLAUSE
|
||||
Conditions.PRANKSTER_SWAGGER_CLAUSE
|
||||
Conditions.UNRELEASED_BAN
|
||||
Conditions.TIMED_BATTLE
|
||||
clauses: [
|
||||
Conditions.SLEEP_CLAUSE
|
||||
Conditions.EVASION_CLAUSE
|
||||
Conditions.SPECIES_CLAUSE
|
||||
Conditions.OHKO_CLAUSE
|
||||
Conditions.PRANKSTER_SWAGGER_CLAUSE
|
||||
Conditions.UNRELEASED_BAN
|
||||
Conditions.TIMED_BATTLE
|
||||
]
|
||||
blockedClauses: true
|
||||
|
||||
createChallengePane
|
||||
eventName: "findBattle"
|
||||
populate: $mainButtons.find('.find_battle_select_team')
|
||||
button: $mainButtons.find('.find_battle')
|
||||
defaultClauses: [
|
||||
Conditions.SLEEP_CLAUSE
|
||||
Conditions.EVASION_CLAUSE
|
||||
Conditions.SPECIES_CLAUSE
|
||||
Conditions.OHKO_CLAUSE
|
||||
Conditions.PRANKSTER_SWAGGER_CLAUSE
|
||||
Conditions.UNRELEASED_BAN
|
||||
Conditions.RATED_BATTLE
|
||||
Conditions.TIMED_BATTLE
|
||||
]
|
||||
blockedClauses: true
|
||||
createChallengePaneNew
|
||||
populate: $mainButtons.find('.find_battle_select_team')
|
||||
|
||||
|
||||
$mainButtons.find('.find_battle').on 'challenge', ->
|
||||
$this = $(this)
|
||||
|
|
|
@ -9,29 +9,76 @@ class @challengePaneObject
|
|||
@populate = @object.populate
|
||||
@clauses = @object.defaultClauses
|
||||
@blockedClauses = @object.blockedClauses
|
||||
|
||||
|
||||
@SelectedTeamID = null
|
||||
@SelectedFormat = null
|
||||
|
||||
@createChallengePane = (opts) ->
|
||||
$wrapper = opts.populate
|
||||
@ChallengePaneOpts =
|
||||
SelectedTeamID : null
|
||||
SelectedFormat : null
|
||||
SelectedAlt : null
|
||||
|
||||
@createChallengeButton = (opts) ->
|
||||
$button = opts.button
|
||||
$accept = opts.acceptButton || $()
|
||||
$reject = opts.rejectButton || $()
|
||||
$buttons = $button.add($accept).add($reject)
|
||||
eventName = opts.eventName
|
||||
capitalizedEventName = "#{eventName[0].toUpperCase()}#{eventName.substr(1)}"
|
||||
$eventName = opts.eventName
|
||||
$clauses = opts.clauses
|
||||
capitalizedEventName = "#{$eventName[0].toUpperCase()}#{$eventName.substr(1)}"
|
||||
acceptEventName = "accept#{capitalizedEventName}"
|
||||
rejectEventName = "reject#{capitalizedEventName}"
|
||||
cancelEventName = "cancel#{capitalizedEventName}"
|
||||
generation = opts.generation
|
||||
personId = opts.personId
|
||||
defaultClauses = opts.defaultClauses || []
|
||||
blockedClauses = opts.blockedClauses ? false
|
||||
|
||||
selectedTeamId = null
|
||||
selectedAlt = null
|
||||
$PaneArray = @challengePaneArray
|
||||
|
||||
getSelectedTeam = ->
|
||||
PokeBattle.TeamStore.get(selectedTeamId) || PokeBattle.TeamStore.at(0)
|
||||
PokeBattle.TeamStore.get(@ChallengePaneOpts.SelectedTeamID) || PokeBattle.TeamStore.at(0)
|
||||
|
||||
cancelChallenge = ->
|
||||
#enableButtons()
|
||||
format = getChallengeOpts().SelectedFormat
|
||||
PokeBattle.primus.send(cancelEventName, format)
|
||||
$button.trigger('cancelChallenge')
|
||||
|
||||
getChallengeOpts = ->
|
||||
return @ChallengePaneOpts
|
||||
|
||||
|
||||
disableButtons = ->
|
||||
$('.select').addClass('disabled')
|
||||
#$buttons.addClass('disabled')
|
||||
|
||||
defaultformat = ->
|
||||
return @DEFAULT_FORMAT
|
||||
|
||||
$button.on 'click.challenge', ->
|
||||
# Start requesting for notify permission here
|
||||
PokeBattle.requestNotifyPermission()
|
||||
options = getChallengeOpts()
|
||||
if options.SelectedFormat != null
|
||||
format = options.SelectedFormat
|
||||
else
|
||||
format = defaultformat()
|
||||
# Toggle state when you press the button.
|
||||
if !$button.hasClass('disabled')
|
||||
team = getSelectedTeam()
|
||||
unless team
|
||||
alert("You need to create a team using the Teambuilder before you can battle.")
|
||||
PokeBattle.navigation.showTeambuilder()
|
||||
return
|
||||
disableButtons()
|
||||
teamJSON = team.toNonNullJSON().pokemon
|
||||
# Send the event
|
||||
PokeBattle.primus.send($eventName, format, teamJSON, options.selectedAlt)
|
||||
$button.addClass('disabled').trigger('challenge')
|
||||
else
|
||||
cancelChallenge()
|
||||
|
||||
|
||||
@createChallengePaneNew = (opts) ->
|
||||
$wrapper = opts.populate
|
||||
$accept = opts.acceptButton || $()
|
||||
$reject = opts.rejectButton || $()
|
||||
generation = opts.generation
|
||||
getSelectedTeam = ->
|
||||
PokeBattle.TeamStore.get(@ChallengePaneOpts.SelectedTeamID) || PokeBattle.TeamStore.at(0)
|
||||
|
||||
renderCurrentTeam = ($context) ->
|
||||
$selectTeam = $context.find('.select-team')
|
||||
|
@ -42,98 +89,23 @@ class @challengePaneObject
|
|||
else
|
||||
$selectTeam.html("You have no teams!")
|
||||
|
||||
cancelChallenge = ->
|
||||
enableButtons()
|
||||
if personId
|
||||
PokeBattle.primus.send(cancelEventName, personId)
|
||||
else
|
||||
format = $selectFormat.data('format')
|
||||
PokeBattle.primus.send(cancelEventName, format)
|
||||
$button.trigger('cancelChallenge')
|
||||
|
||||
disableButtons = ->
|
||||
$wrapper.find('.select').addClass('disabled')
|
||||
$buttons.addClass('disabled')
|
||||
$('.select').addClass('disabled')
|
||||
|
||||
# Enable buttons
|
||||
enableButtons = ->
|
||||
$buttons.removeClass('disabled')
|
||||
|
||||
toggleAltInput = (visible) ->
|
||||
$wrapper.find('.alt-input').toggleClass("hidden", !visible)
|
||||
$wrapper.find('.alt-dropdown-section').toggleClass("hidden", visible)
|
||||
$wrapper.find('.alt-input input').focus() if visible
|
||||
|
||||
isAttachedToDom = ->
|
||||
$.contains(document, $wrapper.get(0))
|
||||
|
||||
altCreatedEvent = ->
|
||||
return PokeBattle.primus.off('altCreated', altCreatedEvent) unless isAttachedToDom()
|
||||
$wrapper.find('.alt-input input').val("")
|
||||
toggleAltInput(false)
|
||||
|
||||
PokeBattle.primus.on 'altCreated', altCreatedEvent
|
||||
|
||||
enableButtons()
|
||||
|
||||
$wrapper.html(JST['new_battle']({window, defaultClauses}))
|
||||
$wrapper.html(JST['new_battle']({window}))
|
||||
$selectFormat = $wrapper.find(".select-format")
|
||||
|
||||
# Implement finding battle/challenging
|
||||
$button.on 'click.challenge', ->
|
||||
thisChallenge = _.find($PaneArray, (butt) -> butt.button.selector is $button.selector)
|
||||
# Start requesting for notify permission here
|
||||
PokeBattle.requestNotifyPermission()
|
||||
format = $selectFormat.data('format')
|
||||
if typeof format == "undefined" and typeof personId == "undefined"
|
||||
format = $('.select-format').data('format')
|
||||
# Toggle state when you press the button.
|
||||
if !$button.hasClass('disabled')
|
||||
team = getSelectedTeam()
|
||||
unless team
|
||||
alert("You need to create a team using the Teambuilder before you can battle.")
|
||||
PokeBattle.navigation.showTeambuilder()
|
||||
return
|
||||
|
||||
disableButtons()
|
||||
teamJSON = team.toNonNullJSON().pokemon
|
||||
# Send the event
|
||||
if personId
|
||||
$clauses = $wrapper.find('input:checked[type="checkbox"]')
|
||||
clauses = []
|
||||
$clauses.each(-> clauses.push(parseInt($(this).val(), 10)))
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, thisChallenge.clauses, selectedAlt)
|
||||
else
|
||||
PokeBattle.primus.send(eventName, format, teamJSON, selectedAlt)
|
||||
$button.addClass('disabled').trigger('challenge')
|
||||
else
|
||||
cancelChallenge()
|
||||
|
||||
# Implement accept/reject buttons.
|
||||
$accept.on 'click.challenge', ->
|
||||
return if $(this).hasClass('disabled')
|
||||
team = getSelectedTeam()
|
||||
unless team
|
||||
alert("You need to create a team using the Teambuilder before you can battle.")
|
||||
PokeBattle.navigation.showTeambuilder()
|
||||
return
|
||||
disableButtons()
|
||||
teamJSON = team.toNonNullJSON().pokemon
|
||||
PokeBattle.primus.send(acceptEventName, personId, teamJSON, selectedAlt)
|
||||
|
||||
$reject.on 'click.challenge', ->
|
||||
return if $(this).hasClass('disabled')
|
||||
disableButtons()
|
||||
PokeBattle.primus.send(rejectEventName, personId)
|
||||
|
||||
# Clicking the alts dropdown brings down an alt selection dropdown menu
|
||||
$wrapper.find('.select-alt').click (e) ->
|
||||
html = JST['alt_dropdown'](alts: PokeBattle.alts.list, username: PokeBattle.username)
|
||||
$wrapper.find('.alt-dropdown').html(html)
|
||||
|
||||
setAlt = (altname) ->
|
||||
@ChallengePaneOpts.SelectedAlt = altname
|
||||
|
||||
# Selecting an alt from the dropdown
|
||||
$wrapper.find('.alt-dropdown').on 'click', '.select-alt-dropdown-item', (e) ->
|
||||
selectedAlt = $(this).data('alt-name')
|
||||
setAlt($(this).data('alt-name'))
|
||||
$wrapper.find('.select-alt').html($(this).html())
|
||||
|
||||
# When add alt is clicked, show the alt input form
|
||||
|
@ -156,21 +128,28 @@ class @challengePaneObject
|
|||
html = JST['team_dropdown'](window: window, teams: allTeams)
|
||||
$wrapper.find('.team-dropdown').html(html)
|
||||
|
||||
setTeam = (slot) ->
|
||||
@ChallengePaneOpts.SelectedTeamID = PokeBattle.TeamStore.at(slot).id
|
||||
|
||||
# Selecting a team from the menu
|
||||
$wrapper.find('.team-dropdown').on 'click', '.select-team-dropdown-item', (e) ->
|
||||
slot = $(e.currentTarget).data('slot')
|
||||
selectedTeamId = PokeBattle.TeamStore.at(slot).id
|
||||
setTeam(slot)
|
||||
renderCurrentTeam($wrapper)
|
||||
|
||||
# Selecting build team from the menu
|
||||
$wrapper.find('.team-dropdown').on 'click', '.build-team-option', (e) ->
|
||||
PokeBattle.navigation.showTeambuilder()
|
||||
|
||||
setFormat = (format) ->
|
||||
@ChallengePaneOpts.SelectedFormat = format
|
||||
|
||||
# Selecting the format changes the dropdown.
|
||||
$wrapper.find('.format-dropdown').on 'click', '.select-format-dropdown-item', (e) ->
|
||||
$target = $(e.currentTarget)
|
||||
format = $target.data('format')
|
||||
$selectFormat.text($target.text())
|
||||
setFormat(format)
|
||||
$selectFormat.data('format', format)
|
||||
|
||||
# Select non-alt option
|
||||
|
@ -186,14 +165,9 @@ class @challengePaneObject
|
|||
# Auto-select first available format.
|
||||
$wrapper.find('.format-dropdown a').first().click()
|
||||
|
||||
if blockedClauses
|
||||
$checkboxes = $wrapper.find('input[type="checkbox"]')
|
||||
if blockedClauses != true
|
||||
$checkboxes = $checkboxes.filter ->
|
||||
clause = Number($(this).data('clause'))
|
||||
clause in blockedClauses
|
||||
$checkboxes.prop('disabled', true)
|
||||
$checkboxes.closest('label').addClass('disabled')
|
||||
isAttachedToDom = ->
|
||||
$.contains(document, $wrapper.get(0))
|
||||
|
||||
|
||||
renderCurrentTeam($wrapper)
|
||||
|
||||
|
@ -208,4 +182,195 @@ class @challengePaneObject
|
|||
renderCurrentTeam($wrapper)
|
||||
|
||||
# Start listening for team updated events
|
||||
PokeBattle.TeamStore.on 'add remove reset saved', teamUpdated
|
||||
PokeBattle.TeamStore.on 'add remove reset saved', teamUpdated
|
||||
|
||||
@createChallengePane = (opts) ->
|
||||
$wrapper = opts.populate
|
||||
$button = opts.button
|
||||
$accept = opts.acceptButton || $()
|
||||
$reject = opts.rejectButton || $()
|
||||
$buttons = $button.add($accept).add($reject)
|
||||
eventName = opts.eventName
|
||||
capitalizedEventName = "#{eventName[0].toUpperCase()}#{eventName.substr(1)}"
|
||||
acceptEventName = "accept#{capitalizedEventName}"
|
||||
rejectEventName = "reject#{capitalizedEventName}"
|
||||
cancelEventName = "cancel#{capitalizedEventName}"
|
||||
generation = opts.generation
|
||||
personId = opts.personId
|
||||
defaultClauses = opts.defaultClauses || []
|
||||
blockedClauses = opts.blockedClauses ? false
|
||||
|
||||
selectedTeamId = null
|
||||
selectedAlt = null
|
||||
|
||||
getSelectedTeam = ->
|
||||
PokeBattle.TeamStore.get(selectedTeamId) || PokeBattle.TeamStore.at(0)
|
||||
|
||||
renderCurrentTeam = ($context) ->
|
||||
$selectTeam = $context.find('.select-team')
|
||||
if PokeBattle.TeamStore.length > 0
|
||||
currentTeam = getSelectedTeam()
|
||||
html = JST['team_dropdown'](window: window, team: currentTeam)
|
||||
$selectTeam.html(html)
|
||||
else
|
||||
$selectTeam.html("You have no teams!")
|
||||
|
||||
cancelChallenge = ->
|
||||
enableButtons()
|
||||
if personId
|
||||
PokeBattle.primus.send(cancelEventName, personId)
|
||||
else
|
||||
format = $selectFormat.data('format')
|
||||
PokeBattle.primus.send(cancelEventName, format)
|
||||
$button.trigger('cancelChallenge')
|
||||
|
||||
disableButtons = ->
|
||||
$wrapper.find('.select').addClass('disabled')
|
||||
$buttons.addClass('disabled')
|
||||
|
||||
# Enable buttons
|
||||
enableButtons = ->
|
||||
$buttons.removeClass('disabled')
|
||||
|
||||
toggleAltInput = (visible) ->
|
||||
$wrapper.find('.alt-input').toggleClass("hidden", !visible)
|
||||
$wrapper.find('.alt-dropdown-section').toggleClass("hidden", visible)
|
||||
$wrapper.find('.alt-input input').focus() if visible
|
||||
|
||||
isAttachedToDom = ->
|
||||
$.contains(document, $wrapper.get(0))
|
||||
|
||||
altCreatedEvent = ->
|
||||
return PokeBattle.primus.off('altCreated', altCreatedEvent) unless isAttachedToDom()
|
||||
$wrapper.find('.alt-input input').val("")
|
||||
toggleAltInput(false)
|
||||
|
||||
PokeBattle.primus.on 'altCreated', altCreatedEvent
|
||||
|
||||
enableButtons()
|
||||
|
||||
$wrapper.html(JST['new_battle']({window, defaultClauses}))
|
||||
$selectFormat = $wrapper.find(".select-format")
|
||||
# Implement finding battle/challenging
|
||||
$button.on 'click.challenge', ->
|
||||
# Start requesting for notify permission here
|
||||
PokeBattle.requestNotifyPermission()
|
||||
|
||||
format = $selectFormat.data('format')
|
||||
# Toggle state when you press the button.
|
||||
if !$button.hasClass('disabled')
|
||||
team = getSelectedTeam()
|
||||
unless team
|
||||
alert("You need to create a team using the Teambuilder before you can battle.")
|
||||
return
|
||||
|
||||
disableButtons()
|
||||
teamJSON = team.toNonNullJSON().pokemon
|
||||
# Send the event
|
||||
if personId
|
||||
$clauses = $wrapper.find('input:checked[type="checkbox"]')
|
||||
clauses = []
|
||||
$clauses.each(-> clauses.push(parseInt($(this).val(), 10)))
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, clauses, selectedAlt)
|
||||
else
|
||||
PokeBattle.primus.send(eventName, format, teamJSON, selectedAlt)
|
||||
$button.addClass('disabled').trigger('challenge')
|
||||
else
|
||||
cancelChallenge()
|
||||
|
||||
# Implement accept/reject buttons.
|
||||
$accept.on 'click.challenge', ->
|
||||
return if $(this).hasClass('disabled')
|
||||
team = getSelectedTeam()
|
||||
unless team
|
||||
alert("You need to create a team using the Teambuilder before you can battle.")
|
||||
return
|
||||
disableButtons()
|
||||
teamJSON = team.toNonNullJSON().pokemon
|
||||
PokeBattle.primus.send(acceptEventName, personId, teamJSON, selectedAlt)
|
||||
|
||||
$reject.on 'click.challenge', ->
|
||||
return if $(this).hasClass('disabled')
|
||||
disableButtons()
|
||||
PokeBattle.primus.send(rejectEventName, personId)
|
||||
|
||||
# Clicking the alts dropdown brings down an alt selection dropdown menu
|
||||
$wrapper.find('.select-alt').click (e) ->
|
||||
html = JST['alt_dropdown'](alts: PokeBattle.alts.list, username: PokeBattle.username)
|
||||
$wrapper.find('.alt-dropdown').html(html)
|
||||
|
||||
# Selecting an alt from the dropdown
|
||||
$wrapper.find('.alt-dropdown').on 'click', '.select-alt-dropdown-item', (e) ->
|
||||
selectedAlt = $(this).data('alt-name')
|
||||
$wrapper.find('.select-alt').html($(this).html())
|
||||
|
||||
# When add alt is clicked, show the alt input form
|
||||
$wrapper.find('.alt-dropdown').on 'click', '.add-alt-dropdown-item', (e) ->
|
||||
toggleAltInput(true)
|
||||
|
||||
# Clicking the Add Alt Button
|
||||
$wrapper.find('.alt-input .add-button').click (e) ->
|
||||
altName = $wrapper.find('.alt-input input').val().trim()
|
||||
PokeBattle.alts.createAlt(altName)
|
||||
|
||||
# Clicking the Cancel Add Alt Button
|
||||
$wrapper.find('.alt-input .cancel-button').click (e) ->
|
||||
toggleAltInput(false)
|
||||
|
||||
# Clicking the team dropdown brings down a team selection menu.
|
||||
# Also updates the allTeams collection
|
||||
$wrapper.find('.select-team').click (e) ->
|
||||
allTeams = PokeBattle.TeamStore.models
|
||||
if allTeams && allTeams.length > 0
|
||||
html = JST['team_dropdown'](window: window, teams: allTeams)
|
||||
$wrapper.find('.team-dropdown').html(html)
|
||||
|
||||
# Selecting a team from the menu
|
||||
$wrapper.find('.team-dropdown').on 'click', '.select-team-dropdown-item', (e) ->
|
||||
slot = $(e.currentTarget).data('slot')
|
||||
selectedTeamId = PokeBattle.TeamStore.at(slot).id
|
||||
renderCurrentTeam($wrapper)
|
||||
|
||||
# Selecting the format changes the dropdown.
|
||||
$wrapper.find('.format-dropdown').on 'click', '.select-format-dropdown-item', (e) ->
|
||||
$target = $(e.currentTarget)
|
||||
format = $target.data('format')
|
||||
$selectFormat.text($target.text())
|
||||
$selectFormat.data('format', format)
|
||||
|
||||
# Select non-alt option
|
||||
$wrapper.find('.select-alt').html(JST['alt_dropdown'](alt: null, username: PokeBattle.username))
|
||||
|
||||
# Auto-select format.
|
||||
if generation
|
||||
# If a generation is passed, auto-select it.
|
||||
$format = $wrapper.find(".format-dropdown a[data-format='#{generation}']")
|
||||
$format.first().click()
|
||||
$wrapper.find('.select-format').addClass('disabled')
|
||||
else
|
||||
# Auto-select first available format.
|
||||
$wrapper.find('.format-dropdown a').first().click()
|
||||
|
||||
if blockedClauses
|
||||
$checkboxes = $wrapper.find('input[type="checkbox"]')
|
||||
if blockedClauses != true
|
||||
$checkboxes = $checkboxes.filter ->
|
||||
clause = Number($(this).data('clause'))
|
||||
clause in blockedClauses
|
||||
$checkboxes.prop('disabled', true)
|
||||
$checkboxes.closest('label').addClass('disabled')
|
||||
|
||||
renderCurrentTeam($wrapper)
|
||||
|
||||
# Called when a team has been updated
|
||||
teamUpdated = ->
|
||||
# If this challenge panel no longer exists, remove the callback
|
||||
if not isAttachedToDom()
|
||||
PokeBattle.TeamStore.off 'add remove reset saved', teamUpdated
|
||||
return
|
||||
|
||||
# Rerender the current team
|
||||
renderCurrentTeam($wrapper)
|
||||
|
||||
# Start listening for team updated events
|
||||
PokeBattle.TeamStore.on 'add remove reset saved', teamUpdated
|
||||
|
|
|
@ -244,6 +244,8 @@ class @Pokemon extends Backbone.Model
|
|||
canMegaEvolve: ->
|
||||
# TODO: Refactor this to use getPossibleMegaForme()
|
||||
# I didn't feel like making the change and testing it while implementing getPossibleMegaForme()
|
||||
if @get('species') == "Rayquaza" and "Dragon Ascent" in @get('moves')
|
||||
return true
|
||||
item = @getItem()
|
||||
return false if item.type != 'megastone'
|
||||
[ species, forme ] = item.mega
|
||||
|
|
|
@ -118,11 +118,11 @@ class @BattleView extends Backbone.View
|
|||
$actions.html @action_template(locals)
|
||||
|
||||
pokemon = @model.getPokemon(@model.get('index'), 0)
|
||||
if pokemon.getItem()?.type == 'megastone'
|
||||
$button = $actions.find('.mega-evolve')
|
||||
$button = $actions.find('.mega-evolve')
|
||||
if pokemon.canMegaEvolve()
|
||||
$button.removeClass("hidden")
|
||||
if !pokemon.canMegaEvolve()
|
||||
$button.addClass('disabled')
|
||||
else
|
||||
$button.addClass('disabled')
|
||||
|
||||
$actions.find('.move.button').each (i, el) =>
|
||||
$this = $(el)
|
||||
|
|
|
@ -27,13 +27,14 @@ p
|
|||
strong Your team
|
||||
ul.dropdown-menu.team-dropdown(role = "menu")
|
||||
|
||||
p
|
||||
strong Clauses:
|
||||
ul.challenge_clauses.well
|
||||
for value in window.SelectableConditions
|
||||
- var checked = (defaultClauses.indexOf(value) >= 0)
|
||||
- var clause = window._.invert(window.Conditions)[value]
|
||||
li
|
||||
label
|
||||
input(type = "checkbox", value = value, checked = checked, data-clause = value)
|
||||
| #{window.HumanizedConditions['en'][clause]}
|
||||
if defaultClauses
|
||||
p
|
||||
strong Clauses:
|
||||
ul.challenge_clauses.well
|
||||
for value in window.SelectableConditions
|
||||
- var checked = (defaultClauses.indexOf(value) >= 0)
|
||||
- var clause = window._.invert(window.Conditions)[value]
|
||||
li
|
||||
label
|
||||
input(type = "checkbox", value = value, checked = checked, data-clause = value)
|
||||
| #{window.HumanizedConditions['en'][clause]}
|
||||
|
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
273
public/js/app.js
|
@ -225,7 +225,10 @@
|
|||
FIRE_ROCK_START: "Molten rocks float in the air around $ts!",
|
||||
FIRE_ROCK_HURT: "$p is hurt by molten rocks!",
|
||||
FIRE_ROCK_END: "The molten rocks disappeared from around $ts!",
|
||||
ILLUSION_BROKE: "The foes $p broke it's illusion!"
|
||||
ILLUSION_BROKE: "The foes $p broke it's illusion!",
|
||||
WEATHER_FAIL: "But the weather was suppressed!",
|
||||
HARSHSUN_MOVEFAIL: "But the Harsh Sun caused the move to fail!",
|
||||
HEAVYRAIN_MOVEFAIL: "But the Harsh Sun caused the move to fail!"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1120,7 +1123,8 @@
|
|||
NONE: 'None',
|
||||
MOON: 'Moon',
|
||||
DELTASTREAM: 'DeltaStream',
|
||||
HARSHSUN: 'HarshSun'
|
||||
HARSHSUN: 'HarshSun',
|
||||
HEAVYRAIN: 'HeavyRain'
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
|
@ -1810,6 +1814,9 @@
|
|||
|
||||
Pokemon.prototype.canMegaEvolve = function() {
|
||||
var forme, item, species, _ref;
|
||||
if (this.get('species') === "Rayquaza" && __indexOf.call(this.get('moves'), "Dragon Ascent") >= 0) {
|
||||
return true;
|
||||
}
|
||||
item = this.getItem();
|
||||
if (item.type !== 'megastone') {
|
||||
return false;
|
||||
|
@ -3080,7 +3087,7 @@
|
|||
};
|
||||
|
||||
BattleView.prototype.renderActions = function(validActions) {
|
||||
var $actions, $button, locals, pokemon, _ref;
|
||||
var $actions, $button, locals, pokemon;
|
||||
if (validActions == null) {
|
||||
validActions = [];
|
||||
}
|
||||
|
@ -3092,20 +3099,19 @@
|
|||
$actions = this.$('.battle_actions');
|
||||
$actions.html(this.action_template(locals));
|
||||
pokemon = this.model.getPokemon(this.model.get('index'), 0);
|
||||
if (((_ref = pokemon.getItem()) != null ? _ref.type : void 0) === 'megastone') {
|
||||
$button = $actions.find('.mega-evolve');
|
||||
$button = $actions.find('.mega-evolve');
|
||||
if (pokemon.canMegaEvolve()) {
|
||||
$button.removeClass("hidden");
|
||||
if (!pokemon.canMegaEvolve()) {
|
||||
$button.addClass('disabled');
|
||||
}
|
||||
} else {
|
||||
$button.addClass('disabled');
|
||||
}
|
||||
$actions.find('.move.button').each((function(_this) {
|
||||
return function(i, el) {
|
||||
var $this, gen, moveData, moveName, _ref1;
|
||||
var $this, gen, moveData, moveName, _ref;
|
||||
$this = $(el);
|
||||
moveName = $this.data('move-id');
|
||||
gen = _this.model.get('generation').toUpperCase();
|
||||
moveData = (_ref1 = window.Generations[gen]) != null ? _ref1.MoveData[moveName] : void 0;
|
||||
moveData = (_ref = window.Generations[gen]) != null ? _ref.MoveData[moveName] : void 0;
|
||||
return _this.movePopover($this, moveName, moveData);
|
||||
};
|
||||
})(this));
|
||||
|
@ -7492,8 +7498,184 @@
|
|||
|
||||
})();
|
||||
|
||||
this.SelectedTeamID = null;
|
||||
|
||||
this.SelectedFormat = null;
|
||||
|
||||
this.ChallengePaneOpts = {
|
||||
SelectedTeamID: null,
|
||||
SelectedFormat: null,
|
||||
SelectedAlt: null
|
||||
};
|
||||
|
||||
this.createChallengeButton = function(opts) {
|
||||
var $button, $clauses, $eventName, acceptEventName, cancelChallenge, cancelEventName, capitalizedEventName, defaultformat, disableButtons, getChallengeOpts, getSelectedTeam, rejectEventName;
|
||||
$button = opts.button;
|
||||
$eventName = opts.eventName;
|
||||
$clauses = opts.clauses;
|
||||
capitalizedEventName = "" + ($eventName[0].toUpperCase()) + ($eventName.substr(1));
|
||||
acceptEventName = "accept" + capitalizedEventName;
|
||||
rejectEventName = "reject" + capitalizedEventName;
|
||||
cancelEventName = "cancel" + capitalizedEventName;
|
||||
getSelectedTeam = function() {
|
||||
return PokeBattle.TeamStore.get(this.ChallengePaneOpts.SelectedTeamID) || PokeBattle.TeamStore.at(0);
|
||||
};
|
||||
cancelChallenge = function() {
|
||||
var format;
|
||||
format = getChallengeOpts().SelectedFormat;
|
||||
PokeBattle.primus.send(cancelEventName, format);
|
||||
return $button.trigger('cancelChallenge');
|
||||
};
|
||||
getChallengeOpts = function() {
|
||||
return this.ChallengePaneOpts;
|
||||
};
|
||||
disableButtons = function() {
|
||||
return $('.select').addClass('disabled');
|
||||
};
|
||||
defaultformat = function() {
|
||||
return this.DEFAULT_FORMAT;
|
||||
};
|
||||
return $button.on('click.challenge', function() {
|
||||
var format, options, team, teamJSON;
|
||||
PokeBattle.requestNotifyPermission();
|
||||
options = getChallengeOpts();
|
||||
if (options.SelectedFormat !== null) {
|
||||
format = options.SelectedFormat;
|
||||
} else {
|
||||
format = defaultformat();
|
||||
}
|
||||
if (!$button.hasClass('disabled')) {
|
||||
team = getSelectedTeam();
|
||||
if (!team) {
|
||||
alert("You need to create a team using the Teambuilder before you can battle.");
|
||||
PokeBattle.navigation.showTeambuilder();
|
||||
return;
|
||||
}
|
||||
disableButtons();
|
||||
teamJSON = team.toNonNullJSON().pokemon;
|
||||
PokeBattle.primus.send($eventName, format, teamJSON, options.selectedAlt);
|
||||
return $button.addClass('disabled').trigger('challenge');
|
||||
} else {
|
||||
return cancelChallenge();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.createChallengePaneNew = function(opts) {
|
||||
var $accept, $format, $reject, $selectFormat, $wrapper, disableButtons, generation, getSelectedTeam, isAttachedToDom, renderCurrentTeam, setAlt, setFormat, setTeam, teamUpdated;
|
||||
$wrapper = opts.populate;
|
||||
$accept = opts.acceptButton || $();
|
||||
$reject = opts.rejectButton || $();
|
||||
generation = opts.generation;
|
||||
getSelectedTeam = function() {
|
||||
return PokeBattle.TeamStore.get(this.ChallengePaneOpts.SelectedTeamID) || PokeBattle.TeamStore.at(0);
|
||||
};
|
||||
renderCurrentTeam = function($context) {
|
||||
var $selectTeam, currentTeam, html;
|
||||
$selectTeam = $context.find('.select-team');
|
||||
if (PokeBattle.TeamStore.length > 0) {
|
||||
currentTeam = getSelectedTeam();
|
||||
html = JST['team_dropdown']({
|
||||
window: window,
|
||||
team: currentTeam
|
||||
});
|
||||
return $selectTeam.html(html);
|
||||
} else {
|
||||
return $selectTeam.html("You have no teams!");
|
||||
}
|
||||
};
|
||||
disableButtons = function() {
|
||||
return $('.select').addClass('disabled');
|
||||
};
|
||||
$wrapper.html(JST['new_battle']({
|
||||
window: window
|
||||
}));
|
||||
$selectFormat = $wrapper.find(".select-format");
|
||||
$wrapper.find('.select-alt').click(function(e) {
|
||||
var html;
|
||||
html = JST['alt_dropdown']({
|
||||
alts: PokeBattle.alts.list,
|
||||
username: PokeBattle.username
|
||||
});
|
||||
return $wrapper.find('.alt-dropdown').html(html);
|
||||
});
|
||||
setAlt = function(altname) {
|
||||
return this.ChallengePaneOpts.SelectedAlt = altname;
|
||||
};
|
||||
$wrapper.find('.alt-dropdown').on('click', '.select-alt-dropdown-item', function(e) {
|
||||
setAlt($(this).data('alt-name'));
|
||||
return $wrapper.find('.select-alt').html($(this).html());
|
||||
});
|
||||
$wrapper.find('.alt-dropdown').on('click', '.add-alt-dropdown-item', function(e) {
|
||||
return toggleAltInput(true);
|
||||
});
|
||||
$wrapper.find('.alt-input .add-button').click(function(e) {
|
||||
var altName;
|
||||
altName = $wrapper.find('.alt-input input').val().trim();
|
||||
return PokeBattle.alts.createAlt(altName);
|
||||
});
|
||||
$wrapper.find('.alt-input .cancel-button').click(function(e) {
|
||||
return toggleAltInput(false);
|
||||
});
|
||||
$wrapper.find('.select-team').click(function(e) {
|
||||
var allTeams, html;
|
||||
allTeams = PokeBattle.TeamStore.models || [];
|
||||
html = JST['team_dropdown']({
|
||||
window: window,
|
||||
teams: allTeams
|
||||
});
|
||||
return $wrapper.find('.team-dropdown').html(html);
|
||||
});
|
||||
setTeam = function(slot) {
|
||||
return this.ChallengePaneOpts.SelectedTeamID = PokeBattle.TeamStore.at(slot).id;
|
||||
};
|
||||
$wrapper.find('.team-dropdown').on('click', '.select-team-dropdown-item', function(e) {
|
||||
var slot;
|
||||
slot = $(e.currentTarget).data('slot');
|
||||
setTeam(slot);
|
||||
return renderCurrentTeam($wrapper);
|
||||
});
|
||||
$wrapper.find('.team-dropdown').on('click', '.build-team-option', function(e) {
|
||||
return PokeBattle.navigation.showTeambuilder();
|
||||
});
|
||||
setFormat = function(format) {
|
||||
return this.ChallengePaneOpts.SelectedFormat = format;
|
||||
};
|
||||
$wrapper.find('.format-dropdown').on('click', '.select-format-dropdown-item', function(e) {
|
||||
var $target, format;
|
||||
$target = $(e.currentTarget);
|
||||
format = $target.data('format');
|
||||
$selectFormat.text($target.text());
|
||||
setFormat(format);
|
||||
return $selectFormat.data('format', format);
|
||||
});
|
||||
$wrapper.find('.select-alt').html(JST['alt_dropdown']({
|
||||
alt: null,
|
||||
username: PokeBattle.username
|
||||
}));
|
||||
if (generation) {
|
||||
$format = $wrapper.find(".format-dropdown a[data-format='" + generation + "']");
|
||||
$format.first().click();
|
||||
$wrapper.find('.select-format').addClass('disabled');
|
||||
} else {
|
||||
$wrapper.find('.format-dropdown a').first().click();
|
||||
}
|
||||
isAttachedToDom = function() {
|
||||
return $.contains(document, $wrapper.get(0));
|
||||
};
|
||||
renderCurrentTeam($wrapper);
|
||||
teamUpdated = function() {
|
||||
if (!isAttachedToDom()) {
|
||||
PokeBattle.TeamStore.off('add remove reset saved', teamUpdated);
|
||||
return;
|
||||
}
|
||||
return renderCurrentTeam($wrapper);
|
||||
};
|
||||
return PokeBattle.TeamStore.on('add remove reset saved', teamUpdated);
|
||||
};
|
||||
|
||||
this.createChallengePane = function(opts) {
|
||||
var $PaneArray, $accept, $button, $buttons, $checkboxes, $format, $reject, $selectFormat, $wrapper, acceptEventName, altCreatedEvent, blockedClauses, cancelChallenge, cancelEventName, capitalizedEventName, defaultClauses, disableButtons, enableButtons, eventName, generation, getSelectedTeam, isAttachedToDom, personId, rejectEventName, renderCurrentTeam, selectedAlt, selectedTeamId, teamUpdated, toggleAltInput, _ref;
|
||||
var $accept, $button, $buttons, $checkboxes, $format, $reject, $selectFormat, $wrapper, acceptEventName, altCreatedEvent, blockedClauses, cancelChallenge, cancelEventName, capitalizedEventName, defaultClauses, disableButtons, enableButtons, eventName, generation, getSelectedTeam, isAttachedToDom, personId, rejectEventName, renderCurrentTeam, selectedAlt, selectedTeamId, teamUpdated, toggleAltInput, _ref;
|
||||
$wrapper = opts.populate;
|
||||
$button = opts.button;
|
||||
$accept = opts.acceptButton || $();
|
||||
|
@ -7510,7 +7692,6 @@
|
|||
blockedClauses = (_ref = opts.blockedClauses) != null ? _ref : false;
|
||||
selectedTeamId = null;
|
||||
selectedAlt = null;
|
||||
$PaneArray = this.challengePaneArray;
|
||||
getSelectedTeam = function() {
|
||||
return PokeBattle.TeamStore.get(selectedTeamId) || PokeBattle.TeamStore.at(0);
|
||||
};
|
||||
|
@ -7571,20 +7752,13 @@
|
|||
}));
|
||||
$selectFormat = $wrapper.find(".select-format");
|
||||
$button.on('click.challenge', function() {
|
||||
var $clauses, clauses, format, team, teamJSON, thisChallenge;
|
||||
thisChallenge = _.find($PaneArray, function(butt) {
|
||||
return butt.button.selector === $button.selector;
|
||||
});
|
||||
var $clauses, clauses, format, team, teamJSON;
|
||||
PokeBattle.requestNotifyPermission();
|
||||
format = $selectFormat.data('format');
|
||||
if (typeof format === "undefined" && typeof personId === "undefined") {
|
||||
format = $('.select-format').data('format');
|
||||
}
|
||||
if (!$button.hasClass('disabled')) {
|
||||
team = getSelectedTeam();
|
||||
if (!team) {
|
||||
alert("You need to create a team using the Teambuilder before you can battle.");
|
||||
PokeBattle.navigation.showTeambuilder();
|
||||
return;
|
||||
}
|
||||
disableButtons();
|
||||
|
@ -7595,7 +7769,7 @@
|
|||
$clauses.each(function() {
|
||||
return clauses.push(parseInt($(this).val(), 10));
|
||||
});
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, thisChallenge.clauses, selectedAlt);
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, clauses, selectedAlt);
|
||||
} else {
|
||||
PokeBattle.primus.send(eventName, format, teamJSON, selectedAlt);
|
||||
}
|
||||
|
@ -7612,7 +7786,6 @@
|
|||
team = getSelectedTeam();
|
||||
if (!team) {
|
||||
alert("You need to create a team using the Teambuilder before you can battle.");
|
||||
PokeBattle.navigation.showTeambuilder();
|
||||
return;
|
||||
}
|
||||
disableButtons();
|
||||
|
@ -7651,12 +7824,14 @@
|
|||
});
|
||||
$wrapper.find('.select-team').click(function(e) {
|
||||
var allTeams, html;
|
||||
allTeams = PokeBattle.TeamStore.models || [];
|
||||
html = JST['team_dropdown']({
|
||||
window: window,
|
||||
teams: allTeams
|
||||
});
|
||||
return $wrapper.find('.team-dropdown').html(html);
|
||||
allTeams = PokeBattle.TeamStore.models;
|
||||
if (allTeams && allTeams.length > 0) {
|
||||
html = JST['team_dropdown']({
|
||||
window: window,
|
||||
teams: allTeams
|
||||
});
|
||||
return $wrapper.find('.team-dropdown').html(html);
|
||||
}
|
||||
});
|
||||
$wrapper.find('.team-dropdown').on('click', '.select-team-dropdown-item', function(e) {
|
||||
var slot;
|
||||
|
@ -7664,9 +7839,6 @@
|
|||
selectedTeamId = PokeBattle.TeamStore.at(slot).id;
|
||||
return renderCurrentTeam($wrapper);
|
||||
});
|
||||
$wrapper.find('.team-dropdown').on('click', '.build-team-option', function(e) {
|
||||
return PokeBattle.navigation.showTeambuilder();
|
||||
});
|
||||
$wrapper.find('.format-dropdown').on('click', '.select-format-dropdown-item', function(e) {
|
||||
var $target, format;
|
||||
$target = $(e.currentTarget);
|
||||
|
@ -11088,42 +11260,23 @@
|
|||
var depressFindBattle, depressFindBattleUnranked;
|
||||
|
||||
$(function() {
|
||||
var $mainButtons, challengeobj, challengeobjunranked, challengepaneobj, challengepaneobjunranked;
|
||||
var $mainButtons;
|
||||
$mainButtons = $('.main_buttons');
|
||||
$mainButtons.on('click', '.teambuilder_button', function(e) {
|
||||
return PokeBattle.navigation.showTeambuilder();
|
||||
});
|
||||
challengeobjunranked = {
|
||||
eventName: "findBattleunranked",
|
||||
populate: $mainButtons.find('.find_battle_select_team'),
|
||||
button: $mainButtons.find('.find_battle_non_ranked'),
|
||||
defaultClauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.TIMED_BATTLE],
|
||||
blockedClauses: true
|
||||
};
|
||||
challengeobj = {
|
||||
createChallengeButton({
|
||||
eventName: "findBattle",
|
||||
populate: $mainButtons.find('.find_battle_select_team'),
|
||||
button: $mainButtons.find('.find_battle'),
|
||||
defaultClauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.RATED_BATTLE, Conditions.TIMED_BATTLE],
|
||||
blockedClauses: true
|
||||
};
|
||||
challengepaneobjunranked = new challengePaneObject(challengeobjunranked);
|
||||
challengePaneArray.push(challengepaneobjunranked);
|
||||
challengepaneobj = new challengePaneObject(challengeobj);
|
||||
challengePaneArray.push(challengepaneobj);
|
||||
createChallengePane({
|
||||
eventName: "findBattleunranked",
|
||||
populate: $mainButtons.find('.find_battle_select_team'),
|
||||
button: $mainButtons.find('.find_battle_non_ranked'),
|
||||
defaultClauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.TIMED_BATTLE],
|
||||
blockedClauses: true
|
||||
clauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.RATED_BATTLE, Conditions.TIMED_BATTLE]
|
||||
});
|
||||
createChallengePane({
|
||||
eventName: "findBattle",
|
||||
populate: $mainButtons.find('.find_battle_select_team'),
|
||||
button: $mainButtons.find('.find_battle'),
|
||||
defaultClauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.RATED_BATTLE, Conditions.TIMED_BATTLE],
|
||||
blockedClauses: true
|
||||
createChallengeButton({
|
||||
eventName: "findBattleunranked",
|
||||
button: $mainButtons.find('.find_battle_non_ranked'),
|
||||
clauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.TIMED_BATTLE]
|
||||
});
|
||||
createChallengePaneNew({
|
||||
populate: $mainButtons.find('.find_battle_select_team')
|
||||
});
|
||||
$mainButtons.find('.find_battle').on('challenge', function() {
|
||||
var $this;
|
||||
|
|
|
@ -225,7 +225,10 @@
|
|||
FIRE_ROCK_START: "Molten rocks float in the air around $ts!",
|
||||
FIRE_ROCK_HURT: "$p is hurt by molten rocks!",
|
||||
FIRE_ROCK_END: "The molten rocks disappeared from around $ts!",
|
||||
ILLUSION_BROKE: "The foes $p broke it's illusion!"
|
||||
ILLUSION_BROKE: "The foes $p broke it's illusion!",
|
||||
WEATHER_FAIL: "But the weather was suppressed!",
|
||||
HARSHSUN_MOVEFAIL: "But the Harsh Sun caused the move to fail!",
|
||||
HEAVYRAIN_MOVEFAIL: "But the Harsh Sun caused the move to fail!"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1120,7 +1123,8 @@
|
|||
NONE: 'None',
|
||||
MOON: 'Moon',
|
||||
DELTASTREAM: 'DeltaStream',
|
||||
HARSHSUN: 'HarshSun'
|
||||
HARSHSUN: 'HarshSun',
|
||||
HEAVYRAIN: 'HeavyRain'
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
|
@ -1810,6 +1814,9 @@
|
|||
|
||||
Pokemon.prototype.canMegaEvolve = function() {
|
||||
var forme, item, species, _ref;
|
||||
if (this.get('species') === "Rayquaza" && __indexOf.call(this.get('moves'), "Dragon Ascent") >= 0) {
|
||||
return true;
|
||||
}
|
||||
item = this.getItem();
|
||||
if (item.type !== 'megastone') {
|
||||
return false;
|
||||
|
@ -2806,7 +2813,7 @@
|
|||
};
|
||||
|
||||
BattleView.prototype.renderActions = function(validActions) {
|
||||
var $actions, $button, locals, pokemon, _ref;
|
||||
var $actions, $button, locals, pokemon;
|
||||
if (validActions == null) {
|
||||
validActions = [];
|
||||
}
|
||||
|
@ -2818,20 +2825,19 @@
|
|||
$actions = this.$('.battle_actions');
|
||||
$actions.html(this.action_template(locals));
|
||||
pokemon = this.model.getPokemon(this.model.get('index'), 0);
|
||||
if (((_ref = pokemon.getItem()) != null ? _ref.type : void 0) === 'megastone') {
|
||||
$button = $actions.find('.mega-evolve');
|
||||
$button = $actions.find('.mega-evolve');
|
||||
if (pokemon.canMegaEvolve()) {
|
||||
$button.removeClass("hidden");
|
||||
if (!pokemon.canMegaEvolve()) {
|
||||
$button.addClass('disabled');
|
||||
}
|
||||
} else {
|
||||
$button.addClass('disabled');
|
||||
}
|
||||
$actions.find('.move.button').each((function(_this) {
|
||||
return function(i, el) {
|
||||
var $this, gen, moveData, moveName, _ref1;
|
||||
var $this, gen, moveData, moveName, _ref;
|
||||
$this = $(el);
|
||||
moveName = $this.data('move-id');
|
||||
gen = _this.model.get('generation').toUpperCase();
|
||||
moveData = (_ref1 = window.Generations[gen]) != null ? _ref1.MoveData[moveName] : void 0;
|
||||
moveData = (_ref = window.Generations[gen]) != null ? _ref.MoveData[moveName] : void 0;
|
||||
return _this.movePopover($this, moveName, moveData);
|
||||
};
|
||||
})(this));
|
||||
|
@ -5224,8 +5230,184 @@
|
|||
|
||||
})();
|
||||
|
||||
this.SelectedTeamID = null;
|
||||
|
||||
this.SelectedFormat = null;
|
||||
|
||||
this.ChallengePaneOpts = {
|
||||
SelectedTeamID: null,
|
||||
SelectedFormat: null,
|
||||
SelectedAlt: null
|
||||
};
|
||||
|
||||
this.createChallengeButton = function(opts) {
|
||||
var $button, $clauses, $eventName, acceptEventName, cancelChallenge, cancelEventName, capitalizedEventName, defaultformat, disableButtons, getChallengeOpts, getSelectedTeam, rejectEventName;
|
||||
$button = opts.button;
|
||||
$eventName = opts.eventName;
|
||||
$clauses = opts.clauses;
|
||||
capitalizedEventName = "" + ($eventName[0].toUpperCase()) + ($eventName.substr(1));
|
||||
acceptEventName = "accept" + capitalizedEventName;
|
||||
rejectEventName = "reject" + capitalizedEventName;
|
||||
cancelEventName = "cancel" + capitalizedEventName;
|
||||
getSelectedTeam = function() {
|
||||
return PokeBattle.TeamStore.get(this.ChallengePaneOpts.SelectedTeamID) || PokeBattle.TeamStore.at(0);
|
||||
};
|
||||
cancelChallenge = function() {
|
||||
var format;
|
||||
format = getChallengeOpts().SelectedFormat;
|
||||
PokeBattle.primus.send(cancelEventName, format);
|
||||
return $button.trigger('cancelChallenge');
|
||||
};
|
||||
getChallengeOpts = function() {
|
||||
return this.ChallengePaneOpts;
|
||||
};
|
||||
disableButtons = function() {
|
||||
return $('.select').addClass('disabled');
|
||||
};
|
||||
defaultformat = function() {
|
||||
return this.DEFAULT_FORMAT;
|
||||
};
|
||||
return $button.on('click.challenge', function() {
|
||||
var format, options, team, teamJSON;
|
||||
PokeBattle.requestNotifyPermission();
|
||||
options = getChallengeOpts();
|
||||
if (options.SelectedFormat !== null) {
|
||||
format = options.SelectedFormat;
|
||||
} else {
|
||||
format = defaultformat();
|
||||
}
|
||||
if (!$button.hasClass('disabled')) {
|
||||
team = getSelectedTeam();
|
||||
if (!team) {
|
||||
alert("You need to create a team using the Teambuilder before you can battle.");
|
||||
PokeBattle.navigation.showTeambuilder();
|
||||
return;
|
||||
}
|
||||
disableButtons();
|
||||
teamJSON = team.toNonNullJSON().pokemon;
|
||||
PokeBattle.primus.send($eventName, format, teamJSON, options.selectedAlt);
|
||||
return $button.addClass('disabled').trigger('challenge');
|
||||
} else {
|
||||
return cancelChallenge();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.createChallengePaneNew = function(opts) {
|
||||
var $accept, $format, $reject, $selectFormat, $wrapper, disableButtons, generation, getSelectedTeam, isAttachedToDom, renderCurrentTeam, setAlt, setFormat, setTeam, teamUpdated;
|
||||
$wrapper = opts.populate;
|
||||
$accept = opts.acceptButton || $();
|
||||
$reject = opts.rejectButton || $();
|
||||
generation = opts.generation;
|
||||
getSelectedTeam = function() {
|
||||
return PokeBattle.TeamStore.get(this.ChallengePaneOpts.SelectedTeamID) || PokeBattle.TeamStore.at(0);
|
||||
};
|
||||
renderCurrentTeam = function($context) {
|
||||
var $selectTeam, currentTeam, html;
|
||||
$selectTeam = $context.find('.select-team');
|
||||
if (PokeBattle.TeamStore.length > 0) {
|
||||
currentTeam = getSelectedTeam();
|
||||
html = JST['team_dropdown']({
|
||||
window: window,
|
||||
team: currentTeam
|
||||
});
|
||||
return $selectTeam.html(html);
|
||||
} else {
|
||||
return $selectTeam.html("You have no teams!");
|
||||
}
|
||||
};
|
||||
disableButtons = function() {
|
||||
return $('.select').addClass('disabled');
|
||||
};
|
||||
$wrapper.html(JST['new_battle']({
|
||||
window: window
|
||||
}));
|
||||
$selectFormat = $wrapper.find(".select-format");
|
||||
$wrapper.find('.select-alt').click(function(e) {
|
||||
var html;
|
||||
html = JST['alt_dropdown']({
|
||||
alts: PokeBattle.alts.list,
|
||||
username: PokeBattle.username
|
||||
});
|
||||
return $wrapper.find('.alt-dropdown').html(html);
|
||||
});
|
||||
setAlt = function(altname) {
|
||||
return this.ChallengePaneOpts.SelectedAlt = altname;
|
||||
};
|
||||
$wrapper.find('.alt-dropdown').on('click', '.select-alt-dropdown-item', function(e) {
|
||||
setAlt($(this).data('alt-name'));
|
||||
return $wrapper.find('.select-alt').html($(this).html());
|
||||
});
|
||||
$wrapper.find('.alt-dropdown').on('click', '.add-alt-dropdown-item', function(e) {
|
||||
return toggleAltInput(true);
|
||||
});
|
||||
$wrapper.find('.alt-input .add-button').click(function(e) {
|
||||
var altName;
|
||||
altName = $wrapper.find('.alt-input input').val().trim();
|
||||
return PokeBattle.alts.createAlt(altName);
|
||||
});
|
||||
$wrapper.find('.alt-input .cancel-button').click(function(e) {
|
||||
return toggleAltInput(false);
|
||||
});
|
||||
$wrapper.find('.select-team').click(function(e) {
|
||||
var allTeams, html;
|
||||
allTeams = PokeBattle.TeamStore.models || [];
|
||||
html = JST['team_dropdown']({
|
||||
window: window,
|
||||
teams: allTeams
|
||||
});
|
||||
return $wrapper.find('.team-dropdown').html(html);
|
||||
});
|
||||
setTeam = function(slot) {
|
||||
return this.ChallengePaneOpts.SelectedTeamID = PokeBattle.TeamStore.at(slot).id;
|
||||
};
|
||||
$wrapper.find('.team-dropdown').on('click', '.select-team-dropdown-item', function(e) {
|
||||
var slot;
|
||||
slot = $(e.currentTarget).data('slot');
|
||||
setTeam(slot);
|
||||
return renderCurrentTeam($wrapper);
|
||||
});
|
||||
$wrapper.find('.team-dropdown').on('click', '.build-team-option', function(e) {
|
||||
return PokeBattle.navigation.showTeambuilder();
|
||||
});
|
||||
setFormat = function(format) {
|
||||
return this.ChallengePaneOpts.SelectedFormat = format;
|
||||
};
|
||||
$wrapper.find('.format-dropdown').on('click', '.select-format-dropdown-item', function(e) {
|
||||
var $target, format;
|
||||
$target = $(e.currentTarget);
|
||||
format = $target.data('format');
|
||||
$selectFormat.text($target.text());
|
||||
setFormat(format);
|
||||
return $selectFormat.data('format', format);
|
||||
});
|
||||
$wrapper.find('.select-alt').html(JST['alt_dropdown']({
|
||||
alt: null,
|
||||
username: PokeBattle.username
|
||||
}));
|
||||
if (generation) {
|
||||
$format = $wrapper.find(".format-dropdown a[data-format='" + generation + "']");
|
||||
$format.first().click();
|
||||
$wrapper.find('.select-format').addClass('disabled');
|
||||
} else {
|
||||
$wrapper.find('.format-dropdown a').first().click();
|
||||
}
|
||||
isAttachedToDom = function() {
|
||||
return $.contains(document, $wrapper.get(0));
|
||||
};
|
||||
renderCurrentTeam($wrapper);
|
||||
teamUpdated = function() {
|
||||
if (!isAttachedToDom()) {
|
||||
PokeBattle.TeamStore.off('add remove reset saved', teamUpdated);
|
||||
return;
|
||||
}
|
||||
return renderCurrentTeam($wrapper);
|
||||
};
|
||||
return PokeBattle.TeamStore.on('add remove reset saved', teamUpdated);
|
||||
};
|
||||
|
||||
this.createChallengePane = function(opts) {
|
||||
var $PaneArray, $accept, $button, $buttons, $checkboxes, $format, $reject, $selectFormat, $wrapper, acceptEventName, altCreatedEvent, blockedClauses, cancelChallenge, cancelEventName, capitalizedEventName, defaultClauses, disableButtons, enableButtons, eventName, generation, getSelectedTeam, isAttachedToDom, personId, rejectEventName, renderCurrentTeam, selectedAlt, selectedTeamId, teamUpdated, toggleAltInput, _ref;
|
||||
var $accept, $button, $buttons, $checkboxes, $format, $reject, $selectFormat, $wrapper, acceptEventName, altCreatedEvent, blockedClauses, cancelChallenge, cancelEventName, capitalizedEventName, defaultClauses, disableButtons, enableButtons, eventName, generation, getSelectedTeam, isAttachedToDom, personId, rejectEventName, renderCurrentTeam, selectedAlt, selectedTeamId, teamUpdated, toggleAltInput, _ref;
|
||||
$wrapper = opts.populate;
|
||||
$button = opts.button;
|
||||
$accept = opts.acceptButton || $();
|
||||
|
@ -5242,7 +5424,6 @@
|
|||
blockedClauses = (_ref = opts.blockedClauses) != null ? _ref : false;
|
||||
selectedTeamId = null;
|
||||
selectedAlt = null;
|
||||
$PaneArray = this.challengePaneArray;
|
||||
getSelectedTeam = function() {
|
||||
return PokeBattle.TeamStore.get(selectedTeamId) || PokeBattle.TeamStore.at(0);
|
||||
};
|
||||
|
@ -5303,20 +5484,13 @@
|
|||
}));
|
||||
$selectFormat = $wrapper.find(".select-format");
|
||||
$button.on('click.challenge', function() {
|
||||
var $clauses, clauses, format, team, teamJSON, thisChallenge;
|
||||
thisChallenge = _.find($PaneArray, function(butt) {
|
||||
return butt.button.selector === $button.selector;
|
||||
});
|
||||
var $clauses, clauses, format, team, teamJSON;
|
||||
PokeBattle.requestNotifyPermission();
|
||||
format = $selectFormat.data('format');
|
||||
if (typeof format === "undefined" && typeof personId === "undefined") {
|
||||
format = $('.select-format').data('format');
|
||||
}
|
||||
if (!$button.hasClass('disabled')) {
|
||||
team = getSelectedTeam();
|
||||
if (!team) {
|
||||
alert("You need to create a team using the Teambuilder before you can battle.");
|
||||
PokeBattle.navigation.showTeambuilder();
|
||||
return;
|
||||
}
|
||||
disableButtons();
|
||||
|
@ -5327,7 +5501,7 @@
|
|||
$clauses.each(function() {
|
||||
return clauses.push(parseInt($(this).val(), 10));
|
||||
});
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, thisChallenge.clauses, selectedAlt);
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, clauses, selectedAlt);
|
||||
} else {
|
||||
PokeBattle.primus.send(eventName, format, teamJSON, selectedAlt);
|
||||
}
|
||||
|
@ -5344,7 +5518,6 @@
|
|||
team = getSelectedTeam();
|
||||
if (!team) {
|
||||
alert("You need to create a team using the Teambuilder before you can battle.");
|
||||
PokeBattle.navigation.showTeambuilder();
|
||||
return;
|
||||
}
|
||||
disableButtons();
|
||||
|
@ -5383,12 +5556,14 @@
|
|||
});
|
||||
$wrapper.find('.select-team').click(function(e) {
|
||||
var allTeams, html;
|
||||
allTeams = PokeBattle.TeamStore.models || [];
|
||||
html = JST['team_dropdown']({
|
||||
window: window,
|
||||
teams: allTeams
|
||||
});
|
||||
return $wrapper.find('.team-dropdown').html(html);
|
||||
allTeams = PokeBattle.TeamStore.models;
|
||||
if (allTeams && allTeams.length > 0) {
|
||||
html = JST['team_dropdown']({
|
||||
window: window,
|
||||
teams: allTeams
|
||||
});
|
||||
return $wrapper.find('.team-dropdown').html(html);
|
||||
}
|
||||
});
|
||||
$wrapper.find('.team-dropdown').on('click', '.select-team-dropdown-item', function(e) {
|
||||
var slot;
|
||||
|
@ -5396,9 +5571,6 @@
|
|||
selectedTeamId = PokeBattle.TeamStore.at(slot).id;
|
||||
return renderCurrentTeam($wrapper);
|
||||
});
|
||||
$wrapper.find('.team-dropdown').on('click', '.build-team-option', function(e) {
|
||||
return PokeBattle.navigation.showTeambuilder();
|
||||
});
|
||||
$wrapper.find('.format-dropdown').on('click', '.select-format-dropdown-item', function(e) {
|
||||
var $target, format;
|
||||
$target = $(e.currentTarget);
|
||||
|
|
|
@ -654,7 +654,10 @@ buf.push("<li><a" + (jade.attrs({ 'data-format':("" + (format.name) + ""), "clas
|
|||
}
|
||||
}).call(this);
|
||||
|
||||
buf.push("</ul></div><p><strong>Select a team:</strong></p><div class=\"dropdown\"><div data-toggle=\"dropdown\" class=\"select select-team rounded\"><strong>Your team</strong></div><ul role=\"menu\" class=\"dropdown-menu team-dropdown\"></ul></div><p><strong>Clauses:</strong></p><ul class=\"challenge_clauses well\">");
|
||||
buf.push("</ul></div><p><strong>Select a team:</strong></p><div class=\"dropdown\"><div data-toggle=\"dropdown\" class=\"select select-team rounded\"><strong>Your team</strong></div><ul role=\"menu\" class=\"dropdown-menu team-dropdown\"></ul></div>");
|
||||
if ( defaultClauses)
|
||||
{
|
||||
buf.push("<p><strong>Clauses:</strong></p><ul class=\"challenge_clauses well\">");
|
||||
// iterate window.SelectableConditions
|
||||
;(function(){
|
||||
var $$obj = window.SelectableConditions;
|
||||
|
@ -681,7 +684,8 @@ buf.push("<li><label><input" + (jade.attrs({ 'type':("checkbox"), 'value':(value
|
|||
}
|
||||
}).call(this);
|
||||
|
||||
buf.push("</ul>");;return buf.join("");
|
||||
buf.push("</ul>");
|
||||
};return buf.join("");
|
||||
};
|
||||
|
||||
this["JST"]["private_message"] = function anonymous(locals
|
||||
|
|
|
@ -126,6 +126,10 @@ class @Battle extends Room
|
|||
|
||||
@logger = logger.withContext(battleId: @id)
|
||||
|
||||
@weakWeather = [Weather.SUN, Weather.RAIN, Weather.SAND, Weather.HAIL, Weather.MOON]
|
||||
@strongWeather = [Weather.DELTASTREAM, Weather.HARSHSUN, Weather.HEAVYRAIN]
|
||||
|
||||
|
||||
# Creates a new log messages with context
|
||||
debug: (message, context) ->
|
||||
# TODO: Add more context. Elements such as the turn.
|
||||
|
@ -303,12 +307,18 @@ class @Battle extends Room
|
|||
|
||||
# Passing -1 to turns makes the weather last forever.
|
||||
setWeather: (weatherName, turns=-1) ->
|
||||
console.log(weatherName)
|
||||
console.log(@weakWeather)
|
||||
if weatherName in @weakWeather and @weather in @strongWeather
|
||||
@cannedText(WEATHER_FAIL)
|
||||
return
|
||||
cannedText = switch weatherName
|
||||
when Weather.SUN then "SUN_START"
|
||||
when Weather.RAIN then "RAIN_START"
|
||||
when Weather.SAND then "SAND_START"
|
||||
when Weather.HAIL then "HAIL_START"
|
||||
when Weather.MOON then "MOON_START"
|
||||
when Weather.DELTASTREAM then "DELTASTREAM_START"
|
||||
else
|
||||
switch @weather
|
||||
when Weather.SUN then "SUN_END"
|
||||
|
@ -316,6 +326,7 @@ class @Battle extends Room
|
|||
when Weather.SAND then "SAND_END"
|
||||
when Weather.HAIL then "HAIL_END"
|
||||
when Weather.MOON then "MOON_END"
|
||||
when Weather.DELTASTREAM then "DELTASTREAM_END"
|
||||
@cannedText(cannedText) if cannedText
|
||||
@weather = weatherName
|
||||
@weatherDuration = turns
|
||||
|
@ -339,10 +350,24 @@ class @Battle extends Room
|
|||
else if @weatherDuration > 1
|
||||
@weatherDuration--
|
||||
|
||||
activePokemon = @getActivePokemon().filter((p) -> !p.isFainted())
|
||||
|
||||
#Handles removing strong weather if there is no pokemon to keep it up anymore
|
||||
if @weather in @strongWeather
|
||||
weatherability = switch @weather
|
||||
when Weather.DELTASTREAM then "Delta Stream"
|
||||
when Weather.HARSHSUN then "Desolate Land"
|
||||
when Weather.HEAVYRAIN then "Primordial Sea"
|
||||
abilityarr = []
|
||||
for pokemon in activePokemon
|
||||
abilityarr.push(pokemon.ability)
|
||||
console.log(abilityarr)
|
||||
if !weatherability in abilityarr
|
||||
@setWeather(Weather.NONE)
|
||||
|
||||
cannedText = @weatherCannedText()
|
||||
@cannedText(cannedText) if cannedText?
|
||||
|
||||
activePokemon = @getActivePokemon().filter((p) -> !p.isFainted())
|
||||
for pokemon in activePokemon
|
||||
continue if pokemon.isWeatherDamageImmune(@weather)
|
||||
damage = pokemon.stat('hp') >> 4
|
||||
|
@ -352,6 +377,7 @@ class @Battle extends Room
|
|||
else if @hasWeather(Weather.SAND)
|
||||
if pokemon.damage(damage)
|
||||
@cannedText('SAND_HURT', pokemon)
|
||||
|
||||
|
||||
hasWeatherCancelAbilityOnField: ->
|
||||
_.any @getActivePokemon(), (pokemon) ->
|
||||
|
|
|
@ -131,6 +131,13 @@ class @Move
|
|||
@afterMiss(battle, user, target)
|
||||
return false
|
||||
|
||||
if battle.hasWeather(Weather.HARSHSUN) and @getType(battle, user, target) == "Water"
|
||||
battle.cannedText('HARSHSUN_MOVEFAIL')
|
||||
return false
|
||||
if battle.hasWeather(Weather.HEAVYRAIN) and @getType(battle, user, target) == "Fire"
|
||||
battle.cannedText('HEAVYRAIN_MOVEFAIL')
|
||||
return false
|
||||
|
||||
# Calculates damage, deals damage, and returns the amount of damage dealt
|
||||
hit: (battle, user, target, hitNumber, isDirect) ->
|
||||
damage = @calculateDamage(battle, user, target, hitNumber, isDirect)
|
||||
|
@ -297,6 +304,14 @@ class @Move
|
|||
typeEffectiveness: (battle, user, target) ->
|
||||
type = @getType(battle, user, target)
|
||||
effect = target.effectivenessOf(type, user: user, move: this)
|
||||
if battle.hasWeather(Weather.DELTASTREAM) and target.hasType("Flying")
|
||||
neweffect = 1
|
||||
for targettype in target.types
|
||||
typeeffect = util.typeEffectiveness(type, targettype)
|
||||
if targettype == "Flying" and typeeffect > 1
|
||||
typeeffect = 1
|
||||
neweffect * typeeffect
|
||||
effect = neweffect
|
||||
if target.hasAbility("Ethereal Shroud")
|
||||
ghosteffect = util.typeEffectiveness(type, ["Ghost"])
|
||||
if ghosteffect < 1
|
||||
|
|
|
@ -12,7 +12,11 @@ eval(coffee.compile(require('fs').readFileSync(path, 'utf8'), bare: true))
|
|||
@performMegaEvolution(action.pokemon)
|
||||
|
||||
@Battle::performMegaEvolution = (pokemon) ->
|
||||
[ species, forme ] = pokemon.item.mega
|
||||
if pokemon.species == "Rayquaza"
|
||||
species = "Rayquaza"
|
||||
forme = "mega"
|
||||
else
|
||||
[ species, forme ] = pokemon.item.mega
|
||||
pokemon.changeForme(forme)
|
||||
|
||||
ability = @FormeData[species][forme]["abilities"][0]
|
||||
|
|
|
@ -169,6 +169,24 @@ makeAbility "Tough Claws", ->
|
|||
return 0x14CD if move.hasFlag("contact")
|
||||
return 0x1000
|
||||
|
||||
makeAbility "Delta Stream", ->
|
||||
this::switchIn = ->
|
||||
if !@battle.hasWeather(Weather.DELTASTREAM)
|
||||
@battle.setWeather(Weather.DELTASTREAM, -1)
|
||||
@pokemon.activateAbility()
|
||||
|
||||
makeAbility "Desolate Land", ->
|
||||
this::switchIn = ->
|
||||
if !@battle.hasWeather(Weather.HARSHSUN)
|
||||
@battle.setWeather(Weather.HARSHSUN, -1)
|
||||
@pokemon.activateAbility()
|
||||
|
||||
makeAbility "Primordial Sea", ->
|
||||
this::switchIn = ->
|
||||
if !@battle.hasWeather(Weather.HEAVYRAIN)
|
||||
@battle.setWeather(Weather.HEAVYRAIN, -1)
|
||||
@pokemon.activateAbility()
|
||||
|
||||
makeWeatherAbility("Noctem", Weather.MOON)
|
||||
|
||||
makeAbility 'Heliophobia', ->
|
||||
|
|
|
@ -26659,7 +26659,29 @@
|
|||
],
|
||||
"weight": 9500,
|
||||
"pokeBattleValue": 1001,
|
||||
"tier": [ "Uber" ]
|
||||
"tier": [ "Uber" ]
|
||||
},
|
||||
"primal": {
|
||||
"types": [
|
||||
"Ground",
|
||||
"Fire"
|
||||
],
|
||||
"stats": {
|
||||
"attack": 180,
|
||||
"defense": 160,
|
||||
"hp": 100,
|
||||
"specialAttack": 150,
|
||||
"specialDefense": 90,
|
||||
"speed": 90
|
||||
},
|
||||
"abilities": [
|
||||
"Desolate Land"
|
||||
],
|
||||
"isBattleOnly": true,
|
||||
"weight": 3920,
|
||||
"unreleased": true,
|
||||
"pokeBattleValue": 1001,
|
||||
"tier": [ "Uber" ]
|
||||
}
|
||||
},
|
||||
"Grovyle": {
|
||||
|
@ -32542,9 +32564,30 @@
|
|||
"Water"
|
||||
],
|
||||
"weight": 3520,
|
||||
"unreleased": true,
|
||||
"unreleased": true,
|
||||
"pokeBattleValue": 1001,
|
||||
"tier": [ "Uber" ]
|
||||
"tier": [ "Uber" ]
|
||||
},
|
||||
"primal": {
|
||||
"types": [
|
||||
"Water"
|
||||
],
|
||||
"stats": {
|
||||
"attack": 150,
|
||||
"defense": 90,
|
||||
"hp": 100,
|
||||
"specialAttack": 180,
|
||||
"specialDefense": 160,
|
||||
"speed": 90
|
||||
},
|
||||
"abilities": [
|
||||
"Primordial Sea"
|
||||
],
|
||||
"isBattleOnly": true,
|
||||
"weight": 4300,
|
||||
"unreleased": true,
|
||||
"pokeBattleValue": 1001,
|
||||
"tier": [ "Uber" ]
|
||||
}
|
||||
},
|
||||
"Kyurem": {
|
||||
|
@ -48716,7 +48759,8 @@
|
|||
"Dragonify": 0
|
||||
},
|
||||
"tutor": {
|
||||
"Draco Meteor": 0
|
||||
"Draco Meteor": 0,
|
||||
"Dragon Ascent": 0
|
||||
}
|
||||
},
|
||||
"stats": {
|
||||
|
|
|
@ -329,6 +329,17 @@
|
|||
"spriteId": 73,
|
||||
"type": "misc"
|
||||
},
|
||||
"Blue Orb": {
|
||||
"description": "A shiny blue orb that is said to have a legend tied to it. It's known to have a deep connection with the Hoenn region.",
|
||||
"flingPower": 80,
|
||||
"mega": [
|
||||
"Kyogre",
|
||||
"primal"
|
||||
],
|
||||
"spriteId": 407,
|
||||
"unreleased": true,
|
||||
"type": "megastone"
|
||||
},
|
||||
"Bluk Berry": {
|
||||
"description": "No competitive use.",
|
||||
"flingPower": 10,
|
||||
|
@ -2515,6 +2526,17 @@
|
|||
"spriteId": 72,
|
||||
"type": "misc"
|
||||
},
|
||||
"Red Orb": {
|
||||
"description": "A shiny red orb that is said to have a legend tied to it. It's known to have a deep connection with the Hoenn region",
|
||||
"flingPower": 80,
|
||||
"mega": [
|
||||
"Groudon",
|
||||
"primal"
|
||||
],
|
||||
"spriteId": 407,
|
||||
"unreleased": true,
|
||||
"type": "megastone"
|
||||
},
|
||||
"Relic Band": {
|
||||
"description": "No competitive use. Can be sold for a high price.",
|
||||
"flingPower": 30,
|
||||
|
|
|
@ -2816,6 +2816,32 @@
|
|||
"target": "selected-pokemon",
|
||||
"type": "Dragon"
|
||||
},
|
||||
"Dragon Ascent": {
|
||||
"accuracy": 100,
|
||||
"ailmentChance": 0,
|
||||
"ailmentId": "none",
|
||||
"damage": "physical",
|
||||
"description": "After soaring upward, the user attacks its target by dropping out of the sky at high speeds, although it lowers its own Defense and Sp. Def in the process.",
|
||||
"flags": [
|
||||
"contact",
|
||||
"protect",
|
||||
"mirror"
|
||||
],
|
||||
"flinchChance": 0,
|
||||
"maxHits": 1,
|
||||
"minHits": 1,
|
||||
"power": 120,
|
||||
"pp": 5,
|
||||
"priority": 0,
|
||||
"recoil": 0,
|
||||
"target": "selected-pokemon",
|
||||
"type": "Flying",
|
||||
"primaryBoostStats": {
|
||||
"defense": -1,
|
||||
"specialDefense": -1
|
||||
},
|
||||
"primaryBoostTarget": "self"
|
||||
},
|
||||
"Dragon Claw": {
|
||||
"accuracy": 100,
|
||||
"ailmentChance": 0,
|
||||
|
|
|
@ -97,6 +97,8 @@ extendMove 'Venom Drench', ->
|
|||
|
||||
target.boost(attack: -1, specialAttack: -1, speed: -1)
|
||||
|
||||
#ORAS shit
|
||||
|
||||
#insurgence shit beneath this
|
||||
makeWeatherMove 'New Moon', Weather.MOON
|
||||
|
||||
|
|
|
@ -3,6 +3,11 @@ path = require('path').resolve(__dirname, '../bw/pokemon.coffee')
|
|||
eval(coffee.compile(require('fs').readFileSync(path, 'utf8'), bare: true))
|
||||
|
||||
@Pokemon::canMegaEvolve = ->
|
||||
if @species == "Rayquaza"
|
||||
hasDA = _.findWhere(@moves, {name: "Dragon Ascent"})
|
||||
console.log(hasDA)
|
||||
if typeof hasDA != "undefined"
|
||||
return true
|
||||
return false if !@hasItem()
|
||||
return false if @item.type != 'megastone'
|
||||
[ species, forme ] = @item.mega
|
||||
|
|
|
@ -341,6 +341,9 @@ CLIENT_VERSION = assets.getVersion()
|
|||
callback(battleMetadata)
|
||||
|
||||
spark.on 'findBattle', (format, team, altName=null) ->
|
||||
console.log('find battle')
|
||||
console.log(format)
|
||||
console.log(team)
|
||||
return unless _.isString(format)
|
||||
return unless _.isObject(team)
|
||||
return unless !altName || _.isString(altName)
|
||||
|
|
|
@ -39,7 +39,7 @@ FIND_BATTLE_CONDITIONS_UNRANKED = [
|
|||
Conditions.UNRELEASED_BAN
|
||||
]
|
||||
|
||||
MAX_NICKNAME_LENGTH = 15
|
||||
MAX_NICKNAME_LENGTH = 16
|
||||
|
||||
class @BattleServer
|
||||
constructor: ->
|
||||
|
|
|
@ -161,6 +161,9 @@ CannedText =
|
|||
FIRE_ROCK_HURT: "$p is hurt by molten rocks!"
|
||||
FIRE_ROCK_END: "The molten rocks disappeared from around $ts!"
|
||||
ILLUSION_BROKE: "The foes $p broke it's illusion!"
|
||||
WEATHER_FAIL: "But the weather was suppressed!"
|
||||
HARSHSUN_MOVEFAIL: "But the Harsh Sun caused the move to fail!"
|
||||
HEAVYRAIN_MOVEFAIL: "But the Harsh Sun caused the move to fail!"
|
||||
|
||||
cannedMap = {}
|
||||
cannedMapReverse = {}
|
||||
|
|
|
@ -9,4 +9,5 @@ self.Weather =
|
|||
MOON: 'Moon'
|
||||
DELTASTREAM: 'DeltaStream'
|
||||
HARSHSUN: 'HarshSun'
|
||||
HEAVYRAIN: 'HeavyRain'
|
||||
|