1
0
mirror of https://gitlab.com/Deukhoofd/BattleSim.git synced 2025-10-28 02:00:04 +00:00

Gotta git gud

This commit is contained in:
Deukhoofd
2016-02-20 00:54:42 +01:00
parent 19558607f3
commit 1114909caf
32 changed files with 401 additions and 121 deletions

View File

@@ -141,17 +141,31 @@ class @Battle extends Room
@emit('beforeStart')
else
for id in @playerIds
console.log(id)
team = @teams[id]
allpokemon = team.all()
for pokemon in allpokemon
if pokemon.hasAbility('Illusion')
alivemons = team.getAlivePokemon()
lastalivemon = alivemons[alivemons.length-1]
pokemon.attach(Attachment.Illusion, lastalivemon)
pokemon.attach(Attachment.Illusion, lastalivemon)
@startBattle()
startBattle: ->
@emit('start')
for playerId in @playerIds
team = @teams[playerId]
allpokemon = team.all()
for pokemon in allpokemon
if pokemon.getForme().isItemBased
[ species, forme ] = pokemon.item.itemForme
if pokemon.species != species
pokemon.changeForme("default")
if typeof pokemon.item != 'undefined' and typeof pokemon.item.itemForme != 'undefined'
[ species, forme ] = pokemon.item.itemForme
if species is pokemon.species
pokemon.changeForme(forme)
@tell(Protocol.START_BATTLE)
# TODO: Merge this with performReplacements?
for playerId in @playerIds

View File

@@ -275,7 +275,6 @@ makePinchBerry 'Custap Berry', 'afterTurnOrder', (battle, eater) ->
battle.bump(eater)
makeWeatherItem 'Damp Rock', Weather.RAIN
makeWeatherItem 'Dark Rock', Weather.MOON
makeGemItem 'Dark Gem', 'Dark'
makeTypeBoostItem 'Dragon Fang', 'Dragon'
makeGemItem 'Dragon Gem', 'Dragon'

View File

@@ -18,7 +18,7 @@ class @Pokemon
@species = attributes.species || "Missingno"
@name = attributes.name || @species
@forme = attributes.forme || "default"
@level = attributes.level || 120
@level = attributes.level || @getMaxLevel()
@gender = attributes.gender || "Genderless"
@shiny = attributes.shiny
@nfe = (SpeciesData[@species]?.evolvesInto?.length > 0)
@@ -88,6 +88,10 @@ class @Pokemon
@resetForme()
return true
getMaxLevel: ->
level = 100
level
resetForme: ->
forme = @getForme() || {}
@baseStats = _.clone(forme.stats) || {}
@@ -533,6 +537,7 @@ class @Pokemon
shouldBlockExecution: (move, user) ->
Query.untilTrue('shouldBlockExecution', @attachments.all(), move, user)
update: ->
Query('update', @attachments.all())

View File

@@ -18,6 +18,9 @@ class @Team
@faintedLastTurn = false
@faintedThisTurn = false
hasMegaEvolved = false
hasPrimalEvolved = false
arrange: (arrangement) ->
@pokemon = (@pokemon[index] for index in arrangement)
@@ -45,6 +48,11 @@ class @Team
get: (attachmentName) ->
@attachments.get(attachmentName)
megaEvolve: ->
@hasMegaEvolved = true
primalEvolve: ->
@hasPrimalEvolved = true
attach: (attachment, options={}) ->
options = _.clone(options)
attachment = @attachments.push(attachment, options, battle: @battle, team: this)