:: init [nobr]

/*
FREE CITIES
a text-based slave management game
Copyright (C) 2017 freecitiesdev

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* Set up the game as politely as possible. If values are already set, they are preserved. */
<<run App.Update.setNonexistantProperties(V, App.Data.defaultGameStateVariables)>>

/* These variables must be created AND set to default values, NG+ or not */
<<run App.Update.setExistantProperties(V, App.Data.resetOnNGPlus)>>

<<set $ver = App.Version.base, $pmodVer = App.Version.pmod, $releaseID = App.Version.release>>

/* 0 out the record books as we start a new game */
<<run setupLastWeeksCash()>>
<<run setupLastWeeksRep()>>

<<if $saveImported == 0>> /* new game (not NG+) */
	<<set $PC = basePlayer()>>
	<<run WombInit($PC)>>
	<<run cashX(10000, "personalBusiness")>>
	<<include "Init Rules">>
<<else>> /* imported save (NG+) */
	<<run App.Data.NewGamePlus()>>
<</if>>

/* Porn star counts (prestige 1) and ID's (prestige 3) */
<<set $pornStars = {}>>
<<for _genre range App.Porn.getAllGenres()>>
	<<set $pornStars[_genre.fameVar] = { p1count: 0, p3ID: 0 }>>
<</for>>

<<run assistant.object()>>
<<run FCTV.manage()>>
<<run repX(1000, "event")>>
<<run setup.prostheticIDs.forEach(function(id) {
	$prosthetics[id] = {amount: 0, research: 0};
})>>
<<set $JobIDMap = makeJobIdMap()>>

/*SFVAR*/ <<set $SF = Object.assign({}, $SF, {Toggle:0, Active: -1}), $SF.Facility = Object.assign({}, $SF.Facility, {Toggle:0, Active:0})>>

<<set $foodConsumption = (($lowerClass*$foodRate.lower) + ($middleClass*$foodRate.middle) + ($upperClass*$foodRate.upper) + ($topClass*$foodRate.top))>>	/* total amount food consumed per week */

<<set $weatherToday = App.Data.weather.nice.random()>>
<<set $prisonCircuitIndex = random(0,$prisonCircuit.length-1)>>

/* I am not a slave object! Do not treat me like one! */
<<set $customSlave = new App.Entity.CustomSlaveOrder()>>
<<set $huskSlave = new App.Entity.CustomSlaveOrder()>>

<<= App.SF.Init()>>

<<goto "Alpha disclaimer">>

src/init/storyInit.tw