1
0
mirror of https://gitlab.com/Deukhoofd/BattleSim.git synced 2025-10-27 18:00:03 +00:00

Revamped Challenge Buttons completely, Added primal abilities, items and primals themselves

This commit is contained in:
Deukhoofd
2016-02-10 23:43:15 +01:00
parent 5fdcc4b285
commit 19558607f3
31 changed files with 902 additions and 273 deletions

View File

@@ -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) ->

View File

@@ -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

View File

@@ -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]

View File

@@ -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', ->

View File

@@ -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": {

View File

@@ -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,

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -39,7 +39,7 @@ FIND_BATTLE_CONDITIONS_UNRANKED = [
Conditions.UNRELEASED_BAN
]
MAX_NICKNAME_LENGTH = 15
MAX_NICKNAME_LENGTH = 16
class @BattleServer
constructor: ->