Made Primal Evolution objects limit a condition

This commit is contained in:
Deukhoofd 2016-02-20 17:25:41 +01:00
parent e48b6408fb
commit ed22806774
6 changed files with 61 additions and 42 deletions

View File

@ -301,13 +301,14 @@
PRANKSTER_SWAGGER_CLAUSE: 10, PRANKSTER_SWAGGER_CLAUSE: 10,
PBV_500: 11, PBV_500: 11,
VISIBLE_TEAM: 12, VISIBLE_TEAM: 12,
TIER_LC: 13, PRIMAL_LIMIT: 13,
TIER_PU: 14, TIER_LC: 14,
TIER_NU: 15, TIER_PU: 15,
TIER_RU: 16, TIER_NU: 16,
TIER_UU: 17, TIER_RU: 17,
TIER_OU: 18, TIER_UU: 18,
TIER_Uber: 19 TIER_OU: 19,
TIER_Uber: 20
}; };
this.SelectableConditions = [this.Conditions.VISIBLE_TEAM, this.Conditions.TIMED_BATTLE, this.Conditions.SLEEP_CLAUSE, this.Conditions.EVASION_CLAUSE, this.Conditions.SPECIES_CLAUSE, this.Conditions.PRANKSTER_SWAGGER_CLAUSE, this.Conditions.OHKO_CLAUSE, this.Conditions.UNRELEASED_BAN]; this.SelectableConditions = [this.Conditions.VISIBLE_TEAM, this.Conditions.TIMED_BATTLE, this.Conditions.SLEEP_CLAUSE, this.Conditions.EVASION_CLAUSE, this.Conditions.SPECIES_CLAUSE, this.Conditions.PRANKSTER_SWAGGER_CLAUSE, this.Conditions.OHKO_CLAUSE, this.Conditions.UNRELEASED_BAN];
@ -323,7 +324,8 @@
EVASION_CLAUSE: "Evasion Clause", EVASION_CLAUSE: "Evasion Clause",
OHKO_CLAUSE: "One-Hit KO Clause", OHKO_CLAUSE: "One-Hit KO Clause",
UNRELEASED_BAN: "Unreleased Ban", UNRELEASED_BAN: "Unreleased Ban",
PRANKSTER_SWAGGER_CLAUSE: "Prankster + Swagger Clause" PRANKSTER_SWAGGER_CLAUSE: "Prankster + Swagger Clause",
PRIMAL_LIMIT: "Primal Limit"
} }
}; };
@ -332,7 +334,7 @@
name: 'insur1000', name: 'insur1000',
humanName: 'Insurgence 1000', humanName: 'Insurgence 1000',
generation: 'in', generation: 'in',
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW], conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW, this.Conditions.PRIMAL_LIMIT],
playable: true, playable: true,
priority: 5, priority: 5,
tierBased: false tierBased: false
@ -341,7 +343,7 @@
name: 'xy1000', name: 'xy1000',
humanName: '1,000 PBV XY', humanName: '1,000 PBV XY',
generation: 'xy', generation: 'xy',
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW], conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW, this.Conditions.PRIMAL_LIMIT],
playable: true, playable: true,
priority: 10, priority: 10,
tierBased: false tierBased: false
@ -350,7 +352,7 @@
name: 'xy500', name: 'xy500',
humanName: '500 PBV XY', humanName: '500 PBV XY',
generation: 'xy', generation: 'xy',
conditions: [this.Conditions.PBV_500, this.Conditions.TEAM_PREVIEW], conditions: [this.Conditions.PBV_500, this.Conditions.TEAM_PREVIEW, this.Conditions.PRIMAL_LIMIT],
playable: true, playable: true,
priority: 10, priority: 10,
tierBased: false tierBased: false
@ -398,12 +400,12 @@
tierbased = true; tierbased = true;
if (typeof window !== "undefined" && window !== null) { if (typeof window !== "undefined" && window !== null) {
formatname = GenerationCondition[gen].conditionname + tier; formatname = GenerationCondition[gen].conditionname + tier;
_conditions = [Conditions[key], Conditions.TEAM_PREVIEW]; _conditions = [Conditions[key], Conditions.TEAM_PREVIEW, Conditions.PRIMAL_LIMIT];
priority = tierData.priority; priority = tierData.priority;
humanname = "" + GenerationCondition[gen].humanName + " " + tierData.humanName; humanname = "" + GenerationCondition[gen].humanName + " " + tierData.humanName;
} else { } else {
formatname = this.GenerationCondition[gen].conditionname + tier; formatname = this.GenerationCondition[gen].conditionname + tier;
_conditions = [this.Conditions[key], this.Conditions.TEAM_PREVIEW]; _conditions = [this.Conditions[key], this.Conditions.TEAM_PREVIEW, this.Conditions.PRIMAL_LIMIT];
priority = tierData.priority; priority = tierData.priority;
humanname = "" + this.GenerationCondition[gen].humanName + " " + tierData.humanName; humanname = "" + this.GenerationCondition[gen].humanName + " " + tierData.humanName;
} }

View File

@ -301,13 +301,14 @@
PRANKSTER_SWAGGER_CLAUSE: 10, PRANKSTER_SWAGGER_CLAUSE: 10,
PBV_500: 11, PBV_500: 11,
VISIBLE_TEAM: 12, VISIBLE_TEAM: 12,
TIER_LC: 13, PRIMAL_LIMIT: 13,
TIER_PU: 14, TIER_LC: 14,
TIER_NU: 15, TIER_PU: 15,
TIER_RU: 16, TIER_NU: 16,
TIER_UU: 17, TIER_RU: 17,
TIER_OU: 18, TIER_UU: 18,
TIER_Uber: 19 TIER_OU: 19,
TIER_Uber: 20
}; };
this.SelectableConditions = [this.Conditions.VISIBLE_TEAM, this.Conditions.TIMED_BATTLE, this.Conditions.SLEEP_CLAUSE, this.Conditions.EVASION_CLAUSE, this.Conditions.SPECIES_CLAUSE, this.Conditions.PRANKSTER_SWAGGER_CLAUSE, this.Conditions.OHKO_CLAUSE, this.Conditions.UNRELEASED_BAN]; this.SelectableConditions = [this.Conditions.VISIBLE_TEAM, this.Conditions.TIMED_BATTLE, this.Conditions.SLEEP_CLAUSE, this.Conditions.EVASION_CLAUSE, this.Conditions.SPECIES_CLAUSE, this.Conditions.PRANKSTER_SWAGGER_CLAUSE, this.Conditions.OHKO_CLAUSE, this.Conditions.UNRELEASED_BAN];
@ -323,7 +324,8 @@
EVASION_CLAUSE: "Evasion Clause", EVASION_CLAUSE: "Evasion Clause",
OHKO_CLAUSE: "One-Hit KO Clause", OHKO_CLAUSE: "One-Hit KO Clause",
UNRELEASED_BAN: "Unreleased Ban", UNRELEASED_BAN: "Unreleased Ban",
PRANKSTER_SWAGGER_CLAUSE: "Prankster + Swagger Clause" PRANKSTER_SWAGGER_CLAUSE: "Prankster + Swagger Clause",
PRIMAL_LIMIT: "Primal Limit"
} }
}; };
@ -332,7 +334,7 @@
name: 'insur1000', name: 'insur1000',
humanName: 'Insurgence 1000', humanName: 'Insurgence 1000',
generation: 'in', generation: 'in',
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW], conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW, this.Conditions.PRIMAL_LIMIT],
playable: true, playable: true,
priority: 5, priority: 5,
tierBased: false tierBased: false
@ -341,7 +343,7 @@
name: 'xy1000', name: 'xy1000',
humanName: '1,000 PBV XY', humanName: '1,000 PBV XY',
generation: 'xy', generation: 'xy',
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW], conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW, this.Conditions.PRIMAL_LIMIT],
playable: true, playable: true,
priority: 10, priority: 10,
tierBased: false tierBased: false
@ -350,7 +352,7 @@
name: 'xy500', name: 'xy500',
humanName: '500 PBV XY', humanName: '500 PBV XY',
generation: 'xy', generation: 'xy',
conditions: [this.Conditions.PBV_500, this.Conditions.TEAM_PREVIEW], conditions: [this.Conditions.PBV_500, this.Conditions.TEAM_PREVIEW, this.Conditions.PRIMAL_LIMIT],
playable: true, playable: true,
priority: 10, priority: 10,
tierBased: false tierBased: false
@ -398,12 +400,12 @@
tierbased = true; tierbased = true;
if (typeof window !== "undefined" && window !== null) { if (typeof window !== "undefined" && window !== null) {
formatname = GenerationCondition[gen].conditionname + tier; formatname = GenerationCondition[gen].conditionname + tier;
_conditions = [Conditions[key], Conditions.TEAM_PREVIEW]; _conditions = [Conditions[key], Conditions.TEAM_PREVIEW, Conditions.PRIMAL_LIMIT];
priority = tierData.priority; priority = tierData.priority;
humanname = "" + GenerationCondition[gen].humanName + " " + tierData.humanName; humanname = "" + GenerationCondition[gen].humanName + " " + tierData.humanName;
} else { } else {
formatname = this.GenerationCondition[gen].conditionname + tier; formatname = this.GenerationCondition[gen].conditionname + tier;
_conditions = [this.Conditions[key], this.Conditions.TEAM_PREVIEW]; _conditions = [this.Conditions[key], this.Conditions.TEAM_PREVIEW, this.Conditions.PRIMAL_LIMIT];
priority = tierData.priority; priority = tierData.priority;
humanname = "" + this.GenerationCondition[gen].humanName + " " + tierData.humanName; humanname = "" + this.GenerationCondition[gen].humanName + " " + tierData.humanName;
} }

View File

@ -321,10 +321,11 @@ class @Battle extends Room
# Passing -1 to turns makes the weather last forever. # Passing -1 to turns makes the weather last forever.
setWeather: (weatherName, turns=-1) -> setWeather: (weatherName, turns=-1) ->
console.log(weatherName)
console.log(@weakWeather)
if weatherName in @weakWeather and @weather in @strongWeather if weatherName in @weakWeather and @weather in @strongWeather
@cannedText("WEATHER_FAIL") switch @weather
when Weather.DELTASTREAM then "WEATHER_FAIL_AIR"
when Weather.HARSHSUN then "WEATHER_FAIL_SUN"
when Weather.HEAVYRAIN then "WEATHER_FAIL_RAIN"
return return
cannedText = switch weatherName cannedText = switch weatherName
when Weather.SUN then "SUN_START" when Weather.SUN then "SUN_START"

View File

@ -131,6 +131,17 @@ createCondition Conditions.EVASION_CLAUSE,
return errors return errors
createCondition Conditions.PRIMAL_LIMIT,
validateTeam: (team, genData) ->
errors = []
items = team.map((p) -> p.item)
primalitems = ["Red Orb", "Blue Orb"]
i = 0
for item in items
i++ if item in primalitems
errors.push("You can only have one Primal Evolution item in your team") if i > 1
return errors
createCondition Conditions.OHKO_CLAUSE, createCondition Conditions.OHKO_CLAUSE,
validatePokemon: (pokemon, genData, prefix) -> validatePokemon: (pokemon, genData, prefix) ->
{moves} = pokemon {moves} = pokemon

View File

@ -13,7 +13,7 @@ eval(coffee.compile(require('fs').readFileSync(path, 'utf8'), bare: true))
[ species, forme ] = @item.mega [ species, forme ] = @item.mega
return false if @species != species || @forme != 'default' return false if @species != species || @forme != 'default'
return false if @team.hasMegaEvolved and forme is "mega" return false if @team.hasMegaEvolved and forme is "mega"
return false if @team.hasPrimalEvolved and forme is "primal" #return false if @team.hasPrimalEvolved and forme is "primal"
return true return true
oldBlockSwitch = @Pokemon::blockSwitch oldBlockSwitch = @Pokemon::blockSwitch

View File

@ -13,13 +13,14 @@ self = (if window? then window.PokeBattle.conditions ?= {} else this)
PRANKSTER_SWAGGER_CLAUSE : 10 PRANKSTER_SWAGGER_CLAUSE : 10
PBV_500 : 11 PBV_500 : 11
VISIBLE_TEAM : 12 VISIBLE_TEAM : 12
TIER_LC : 13 PRIMAL_LIMIT : 13
TIER_PU : 14 TIER_LC : 14
TIER_NU : 15 TIER_PU : 15
TIER_RU : 16 TIER_NU : 16
TIER_UU : 17 TIER_RU : 17
TIER_OU : 18 TIER_UU : 18
TIER_Uber : 19 TIER_OU : 19
TIER_Uber : 20
@SelectableConditions = [ @SelectableConditions = [
@Conditions.VISIBLE_TEAM @Conditions.VISIBLE_TEAM
@ -44,13 +45,15 @@ self = (if window? then window.PokeBattle.conditions ?= {} else this)
OHKO_CLAUSE : "One-Hit KO Clause" OHKO_CLAUSE : "One-Hit KO Clause"
UNRELEASED_BAN : "Unreleased Ban" UNRELEASED_BAN : "Unreleased Ban"
PRANKSTER_SWAGGER_CLAUSE : "Prankster + Swagger Clause" PRANKSTER_SWAGGER_CLAUSE : "Prankster + Swagger Clause"
PRIMAL_LIMIT : "Primal Limit"
self.PresetFormats = self.PresetFormats =
insur1000: insur1000:
name : 'insur1000' name : 'insur1000'
humanName : 'Insurgence 1000' humanName : 'Insurgence 1000'
generation : 'in' generation : 'in'
conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ] conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW, @Conditions.PRIMAL_LIMIT]
playable : true playable : true
priority : 5 priority : 5
tierBased : false tierBased : false
@ -58,7 +61,7 @@ self.PresetFormats =
name : 'xy1000' name : 'xy1000'
humanName : '1,000 PBV XY' humanName : '1,000 PBV XY'
generation : 'xy' generation : 'xy'
conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ] conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW, @Conditions.PRIMAL_LIMIT]
playable : true playable : true
priority : 10 priority : 10
tierBased : false tierBased : false
@ -66,7 +69,7 @@ self.PresetFormats =
name : 'xy500' name : 'xy500'
humanName : '500 PBV XY' humanName : '500 PBV XY'
generation : 'xy' generation : 'xy'
conditions : [ @Conditions.PBV_500, @Conditions.TEAM_PREVIEW ] conditions : [ @Conditions.PBV_500, @Conditions.TEAM_PREVIEW, @Conditions.PRIMAL_LIMIT]
playable : true playable : true
priority : 10 priority : 10
tierBased : false tierBased : false
@ -105,12 +108,12 @@ self.setFormats = ->
tierbased = true tierbased = true
if window? if window?
formatname = GenerationCondition[gen].conditionname + tier formatname = GenerationCondition[gen].conditionname + tier
_conditions = [Conditions[key], Conditions.TEAM_PREVIEW] _conditions = [Conditions[key], Conditions.TEAM_PREVIEW, Conditions.PRIMAL_LIMIT]
priority = tierData.priority priority = tierData.priority
humanname = "#{GenerationCondition[gen].humanName} #{tierData.humanName}" humanname = "#{GenerationCondition[gen].humanName} #{tierData.humanName}"
else else
formatname = @GenerationCondition[gen].conditionname + tier formatname = @GenerationCondition[gen].conditionname + tier
_conditions = [@Conditions[key], @Conditions.TEAM_PREVIEW] _conditions = [@Conditions[key], @Conditions.TEAM_PREVIEW, @Conditions.PRIMAL_LIMIT]
priority = tierData.priority priority = tierData.priority
humanname = "#{@GenerationCondition[gen].humanName} #{tierData.humanName}" humanname = "#{@GenerationCondition[gen].humanName} #{tierData.humanName}"