FANDOM


to about
game.about
end

to adjusthappy
make "city.happy :city.happy+(:city.colosseums/5)
if :city.army/:city.population < 0.8 [
	make "city.happy :city.happy+(:city.army/10)
]
if :city.army < 0 [
	make "city.happy :city.happy-1
	;GET SOME TROOPS FOR ****s SAKE!!!!111
]
make "city.happy int :city.happy
end

to adjusthealth
make "city.health :city.health
end

to attack
ifelse :barbarian.presence = 1 [
	ifelse :city.army > 0[
		localmake "temp (sentence [The troops of the] :player.civ.name [now ride out in true glory against the Barbaric tribes!])
		print :temp
		if :tech.archery = 1 [firststrike]
		make "attackstr RANDOM :barbarian.number
		make "defencestr RANDOM :city.army
		make "battle :attackstr - :defencestr
		;If battle is positive then defenders lose two soldiers
		;If battle is negative then attackers lose two soldiers
		;If battle is zero then both sides lose one soldier
		if :battle > 0 [
			make "city.army :city.army - 2
		print [Our troops have been killed!]
		]
		if :battle < 0 [
			make "barbarian.number :barbarian.number - 2
		print [Our troops have bravely warded off those unruly barbarians!]
		]
		if :battle = 0 [
			make "barbarian.number :barbarian.number - 1
			make "city.army :city.army - 1
		print [A nice attempt to fight, but neither side won...]
		]
		if :barbarian.number < 0 [
			make "barbarian.number 0
			make "barbarian.presence 0
		]
	][
		localmake "temp (sentence [Note! The ] :player.civ.name [does not have any troops!])
		print :temp
	]
][print [There are no barbarians!]]
end

to barbariansattack
if :barbarian.presence = 1 [
	print [The barbarians are attacking our city!]
	ifelse :city.army > 0 [
		;Kills army
		if :tech.archery = 1 [firststrike]
		make "attackstr RANDOM :barbarian.number
		make "defencestr RANDOM :city.army
		make "battle :attackstr - :defencestr
		;If battle is positive then defenders lose two soldiers
		;If battle is negative then attackers lose two soldiers
		;If battle is zero then both sides lose one soldier
		if :battle > 0 [
			make "city.army :city.army - 2
		print [Our troops have been killed!]
		]
		if :battle < 0 [
			make "barbarian.number :barbarian.number - 2
		print [Our troops have bravely warded off those unruly barbarians!]
		]
		if :battle = 0 [
			make "barbarian.number :barbarian.number - 1
			make "city.army :city.army - 1
		print [A nice attempt to fight, but neither side won...]
		]
		if :barbarian.number < 0 [
			make "barbarian.number 0
			make "barbarian.presence 0
		]
	][
		;Kills civilians
		make "battle RANDOM :barbarian.number
		make "city.population :city.population - :battle
		localmake "temp (sentence :battle [civilians have been killed in this attack!])
		print :temp
		if :city.population < 0 [game.gameover]
	]
]
end

to barbarianscome
localmake "temp RANDOM 100
localmake "temp :temp/100
if :temp < :barbarian.comechance [
	print [Barbarians have been spotted near our city!]
	make "barbarian.number :barbarian.number + RANDOM 5
	make "barbarian.presence 1
	localmake "temp (sentence [There are, as our intelligence experts estimate, ] :barbarian.number [outside the city at this time.])
	print :temp
]
end

to build
ifelse :city.prod > 0 [
	make "choice 0
	print [What do you want to build?]
	make "choice selectbox [Choose a building to build...] [[Farm] [Mine] [Lumbermill] [School] [Storehouse] [Colosseum] [Wonder]]
	if :choice = 1 [build.farm]
	if :choice = 2 [build.mine]
	if :choice = 3 [build.lumbermill]
	if :choice = 4 [build.school]
	if :choice = 5 [build.storehouse]
	if :choice = 6 [build.colosseum]
	if :choice = 7 [build.wonder]
][
	localmake "temp (sentence [The] :player.civ.name [does not have any Production!])
	print :temp
]
;note that building two storehouses gives no bonus
;make "city.farms 10
;make "city.mines 1
;make "city.lumbermills 1
;make "city.nearbywood 5000
;make "city.nearbywood.growthrate 1.5
;make "city.schools 0
;make "city.storehouses 0
;make "city.colosseums 0
;make "city.wonders 0
;;Farms give food
;;Mines give gold and production
;;Lumbermills use up nearby woodland but gives lumber
;;Schools give extra research
;;Storehouses prevent spoilage by doubling spoilage time
;;Colosseums give happiness bonus
;;Wonders make a lot of gold each turn
;;All buildings take up wood to build
;;Mines and Wonders use gold as well
end

to build.colosseum
ifelse (AND :city.prod>60 :city.wood>100) [
	print [Your workers build a colosseum.]
	make "city.colosseums :city.colosseums+1
	make "city.prod :city.prod-60
	make "city.wood :city.wood-100
][
	print [Sorry, your civilisation needs more resources.]	
]
end

to build.farm
ifelse (AND :city.prod>10 :city.wood>5) [
	print [Your workers build a farm.]
	make "city.farms :city.farms+1
	make "city.prod :city.prod-10
	make "city.wood :city.wood-5
][
	print [Sorry, your civilisation needs more resources.]	
]
end

to build.lumbermill
ifelse (AND :city.prod>40 :city.wood>25) [
	print [Your workers build a lumbermill.]
	make "city.lumbermills :city.lumbermills+1
	make "city.prod :city.prod-40
	make "city.wood :city.wood-25
][
	print [Sorry, your civilisation needs more resources.]
]
end

to build.mine
ifelse (AND :city.prod>20 :city.wood>15 :city.gold>20) [
	print [Your workers build a mine.]
	make "city.mines :city.mines+1
	make "city.prod :city.prod-20
	make "city.wood :city.wood-15
	make "city.gold :city.gold-20
][
	print [Sorry, your civilisation needs more resources.]	
]
end

to build.school
ifelse (AND :city.prod>30 :city.wood>30) [
	print [Your workers build a school.]
	make "city.schools :city.schools+1
	make "city.prod :city.prod-30
	make "city.wood :city.wood-30
][
	print [Sorry, your civilisation needs more resources.]	
]
end

to build.storehouse
ifelse (AND :city.prod>20 :city.wood>15) [
	print [Your workers build a storehouse.]
	make "city.storehouses :city.storehouses+1
	make "city.prod :city.prod-20
	make "city.wood :city.wood-15
][
	print [Sorry, your civilisation needs more resources.]	
]
end

to build.wonder
ifelse (AND :city.prod>1000 :city.wood>500 :city.gold>500) [
	print [Your workers build a Wonder of the World!]
	make "city.wonders :city.wonders+1
	make "city.prod :city.prod-1000
	make "city.wood :city.wood-500
	make "city.gold :city.gold-500
][
	print [Sorry, your civilisation needs more resources.]	
]
end

to collect
ifelse :collects > 0 [
	make "city.food :city.food + :city.farms
	if :tech.archery = 1 [make "city.food :city.food + 1]
	make "city.gold :city.gold + :city.mines
	if :tech.bronze = 1 [make "city.gold :city.gold + :city.mines*0.1]
	if :tech.iron = 1 [make "city.gold :city.gold + :city.mines*0.3]
	make "city.wood :city.wood + :city.lumbermills*2
	make "city.nearbywood (:city.nearbywood - (:city.lumbermills*2))*:city.nearbywood.growthrate
	make "city.prod :city.prod + (:city.mines/2)
	make "city.prod :city.prod + (:city.workers*2)
	if :tech.bronze = 1 [make "city.prod :city.prod + :city.mines*0.1]
	if :tech.iron = 1 [make "city.prod :city.prod + :city.mines*0.3]
	make "collects :collects-1
	print [You have harvested the resources that your peasants have been producing.]
	localmake "temp (sentence [You have] :collects [collection credits remaining.])
][
	print [You can't do that! You have no collection credits!]
	print [Wait a few turns first...]
]
end

to debt
if :city.gold < 0 [
	localmake "temp (sentence [The] :player.civ.name [is broke! Its soldiers are no longer willing to fight!])
	print :temp
	if :city.army > 0 [
		make "city.army :city.army-1
		make "city.population :city.population+1
	]
]
end

to dilemma
localmake "dilemmatoday 0
make "choice 0
make "dilemmatoday RANDOM 3
if "dilemmatoday = 0 [dilemma.0]
if "dilemmatoday = 1 [dilemma.1]
end

to dilemma.0
ifelse health < 3 [
	print [Disease is plaging our city.]
	print [Health is at very low levels and our population are all ill.]
	print []
	print [Your adviser suggests you do one of the following:]
	print [* Eradicate the problems by killing all the diseased animals and people or otherwise forcing them to leave the city.]
	;Happiness -3
	;Health +1
	;Gold -10
	print [* Employ more doctors for our hospitals in our city to provide free healthcare services to our people.]
	;Happiness +2
	;Health +3
	;Gold -50
	print [* Ignore the problems.]
	;Happiness -1
	;Health -1
	;Population -3
	make "choice selectbox [Dilemma...] [[Use force!] [Let's be nice...] [Bah! It's their problem!]]
	if :choice = 1 [
		make "city.happy :city.happy-3
		make "city.health :city.health+1
		make "city.gold :city.gold-10
	]
	if :choice = 2 [
		make "city.happy :city.happy+2
		make "city.health :city.health+3
		make "city.gold :city.gold-50	
	]
	if :choice = 3 [
		make "city.happy :city.happy-1
		make "city.health :city.health-1
		make "city.population :city.population-3
	]
	if :choice = 0 [dilemma.0]
	make "choice 0
][nodilemma]
end

to dilemma.1
localmake "temp (sentence [A high-ranking officer in the Army of the] :player.civ.name [has recently been accused of corruption and has been proved guilty.])
print :temp
print [This news has spread around the city and suburbs, and the people are insisting that you fire that man.]
print [However, he is the best general in the army, and his departure may cause the army morale to fall.]
print []
print [Your adviser suggests you do one of the following:]
print [* Fire the general.]
;Happiness +2
;Gold +10
;Army size -20
;Population +20
print [* Ignore the problem.]
;Happiness -1
;Gold -25
make "choice selectbox [Dilemma...] [[Fire that man...] [Who cares?]]
if :choice = 1 [
	make "city.happy :city.happy+2
	make "city.gold :city.gold+10
	make "city.army :city.army-20
	make "city.population :city.population+20
]
if :choice = 2 [
	make "city.happy :city.happy-1
	make "city.gold :city.gold-25
]
if :choice = 0 [dilemma.0]
make "choice 0
end

to firststrike
;Available with Archery
make "damage RANDOM (:city.army/2)
make "barbarian.number :barbarian.number - :damage
end

to game.about
print [Ancient Civilisations]
print [Version 1.0c]
print [Created by jftsang, All Rights Reserved]
print [Copyright © 2007 jftsang]
print [The copyright holder has irrevocably released all rights to this, so effectively this game is in the public domain.]
print [Email jftsang@logogames.org for any queries, or to report bugs.]
print []
print [Type START to begin your civilisation...]
end

to game.gameover
print []
print [Your civilisation has been totally destroyed!]
print [GAME OVER!!!]
info
print []
print []
print []
game.about
end

to game.reset
;This file contains all the starting numbers and the parameters
;Feel free to change this file if you want to change the things here
make "player.ingame 0
make "player.civ 0
make "player.civ.name []
make "player.name []
make "barbarian.number 0
make "barbarian.presence 0
make "barbarian.strength 0
make "barbarian.comechance 0.05
;Barbarians randomly come to the city and stay
;Barbarians will attack the troops and then will attack civilians every day
;Train troops to defend against barbarians
;Barbarian.Number represents the number of barbarians
;but they only come if Barbarian.Presence is true
;Their strength affects the number of citizens killed per attack
make "city.population 10
make "city.workers 10
make "city.army 0
make "city.scientists 0
;Population use up food and can be changed into workers and soldiers
;Workers can farm and can build things by increasing production
;Soldiers defend the city from barbarians and animals
;Scientists give research points
make "city.happy 0
make "city.health 0
;Happiness is dependant on dilemma choices
;If there are frequent attacks from barbarians then happiness decreases
;With Writing tech happiness increases
;Health is dependant mainly on dilemmas
;Some buildings improve healthcare
;If health is below zero more food is used up every turn
make "city.farms 10
make "city.mines 1
make "city.lumbermills 1
make "city.nearbywood 5000
make "city.nearbywood.growthrate 1.5
make "city.schools 0
make "city.storehouses 0
make "city.colosseums 0
make "city.wonders 0
;Farms give food
;Mines give gold and production
;Lumbermills use up nearby woodland but gives lumber
;Schools give extra research
;Storehouses prevent spoilage by doubling spoilage time
;Colosseums give happiness bonus
;Wonders make a lot of gold each turn
;All buildings take up wood to build
;Mines and Wonders use gold as well
make "city.food 120
make "city.gold 1
make "city.prod 0
make "city.wood 10
;Food is used for citizens and troops
;Gold is used for Mines and soldiers
;Production is used when building anything
;Wood is used for buildings
make "tech.bronze 0
make "tech.iron 0
make "tech.archery 0
make "tech.writing 0
make "tech.philosophy 0
;These are the available technologies
;They are bought with the research points in City.Scientists
;Research points are earned from schools and other sources
;Bronze Working and Iron Working improve the strength of soldiers, and give extra Production from Mines
;Archery gives a first strike ability to soldiers, so they defend better
;It also allows hunting, which gives extra food per turn
;Writing gives extra happiness
;Writing and Philosophy give extra research points every day
;Philosophy also means schools are not as expensive in terms of Gold and Production
make "day 1
make "spoilagetime 7
make "spoilagerate 0.3
;Every spoilagetime days spoilagerate of remaining food and wood is discarded
;This is to simulate the rotting of food and wood
;With a storehouse this period is doubled to prevent spoilage
make "collects 1
make "researches 1
;Credits for collecting and researching
;Every turn one credit is given
;Every time the player collects resources or researches a credit is used
;One may want to save up resources in this way before collecting and losing it to spoilage
end

to game.start
initall
print [Welcome to Ancient Civilisation 1.0!]
print [Loads of bugs are present. Email the developer jftsang@hotmail.com to report bug.]
print []
game.reset
print []
print [What is your name, good sire?]
make "player.name questionbox [Ancient Civilisation] [What is your name, honourable leader?]
print [Choose your civilisation...]
make "player.civ selectbox [Select a civilisation...] [Greeks Romans]
player.civ.determine
localmake "temp (sentence "Greetings, [my honourable lord] :player.name [of the] :player.civ.name)
print :temp
make "player.ingame 1
end

to game.welcomegreek
print [Welcome to Ancient Greece!]
end

to game.welcomeroman
print [Welcome to Ancient Italy!]
end

to grow
if :city.food > 0 [
	make "city.population :city.population+1
	make "city.food :city.food-1
	localmake "temp (sentence [The fine] :player.civ.name [has grown in population!])
	print :temp
	localmake "temp (sentence [There are now] :city.population [citizens living in the] :player.civ.name [.])
	print :temp
]
end

to info
localmake "linea (sentence :player.name [of the] :player.civ.name)
localmake "lineb []
localmake "linec [Available resources:]
localmake "lined (sentence [Food enough for] :city.food [men.])
localmake "linee (sentence :city.wood [piles of wood.])
localmake "linef (sentence :city.gold [bars of gold.])
localmake "lineg (sentence :city.prod [production points.])
localmake "lineh []
localmake "linei (sentence :city.population [citizens,] :city.workers [workers,] :city.army [soldiers, and] :city.scientists [scientists are currently in the city.])
localmake "linej (sentence [The happiness of your people, on a scale of minus ten to ten, is] :city.happy)
localmake "linek (sentence [On the same scale, the cleniness is at around] :city.health)
localmake "linel []
localmake "linem (sentence [There are] :city.farms [farms,] :city.mines [mines,] :city.lumbermills [lumbermills,] :city.schools [schools,])
localmake "linen (sentence :city.storehouses [storehouses,] :city.colosseums [colosseums, and] :city.wonders [wonders.])
localmake "lineo []
localmake "linep (sentence [It is now Day] :day [since the founding of our great empire.])
print :linea
print :lineb
print :linec
print :lined
print :linee
print :linef
print :lineg
print :lineh
print :linei
print :linej
print :linek
print :linel
print :linem
print :linen
print :lineo
print :linep
end

to initall
;No libraries in compiled version
end

to newday
;This is the most important function
;If you mess with this then serves you right if the game crashes
make "day :day+1
make "collects :collects+1
make "researches :researches+1
routine
end

to nodilemma
print [Nothing of importance has happened today...]
end

to player.civ.determine
;call at game.start only!
if :player.civ = 1 [
	make "player.civ.name [Greek Empire]
	game.welcomegreek
]
if :player.civ = 2 [
	make "player.civ.name [Roman Empire]
	game.welcomeroman
]
end

to recruitscientists
ifelse :researches>0 [
	make "totalrecruited 0
	make "totalrecruited :totalrecruited+1
	make "totalrecruited :totalrecruited+:city.schools
	if :tech.writing = 1 [make "totalrecruited :totalrecruited+2]
	if :tech.philosophy = 1 [make "totalrecruited :totalrecruited+2]
	ifelse :totalrecruited < :city.population [
		make "city.scientists :city.scientists+:totalrecruited
		make "city.population :city.population-:totalrecruited
		print [We now have more scientists at our disposal!]
		localmake "temp (sentence [The] :player.civ.name [now has] :city.scientists [scientists.])
		print :temp
		make "researches :researches-1
	][
		print [Seeing as the empire doesn't have that many people in it, you can't hire that many scientists.]
	]
][
	print [Sorry, you have used up all your recruitment drives.]
	print [Try waiting for a new day...]
]
end

to recruitworkers :recruitamount
ifelse :recruitamount < :city.population [
	localmake "temp (sentence :recruitamount [members of the] :player.civ.name [are now being used as workers.])
	print :temp
	make "city.workers :city.workers+:recruitamount
	make "city.population :city.population-:recruitamount
][
	print [Sorry, you do not have enough people in your empire to hire.]
]
end

to research
ifelse :city.scientists > 0 [
	make "choice 0
	print [What do you want to research?]
	make "choice selectbox [Choose a technology to research...] [[Bronze Working] [Iron Working] [Archery] [Writing] [Philosophy]]
	if :choice = 1 [tech.bronze.research]
	if :choice = 2 [tech.iron.research]
	if :choice = 3 [tech.archery.research]
	if :choice = 4 [tech.writing.research]
	if :choice = 5 [tech.philosophy.research]
][
	localmake "temp (sentence [The] :player.civ.name [does not have any scientists at its disposal!])
	print :temp
]
end

to routine
;Everyday tasks
useresources
grow
starve
debt
dilemma
barbarianscome
barbariansattack
if :city.army < 0 [
	make "city.army 0
	localmake "temp (sentence [Note! The ] :player.civ.name [does not have any troops!])
	print :temp
]
if :barbarian.number < 1 [make :barbarian.presence 0]
make "city.nearbywood :city.nearbywood+(:city.nearbywood*:city.nearbywood.growthrate)
spoilageall
adjusthappy
adjusthealth
if :city.population < 0 [
	Game.Gameover
]
end

to spoilageall
if OR (AND (modulo :day :spoilagetime) = 0 :city.storehouses = 0) (AND (modulo :day :spoilagetime*2) = 0 :city.storehouses > 0) [
	print [The unused food and wood rots away!]
	make "city.food :city.food*:spoilagerate
	make "city.wood :city.wood*:spoilagerate
	;The food and wood supplies are damaged by storm and disaster
]
end

to start
game.start
end

to starve
if :city.food = 0 [
	localmake "temp (sentence [The] :player.civ.name [is running low on food, and so the people are starving!])
	print :temp
	make "city.population :city.population-1
	make "city.happy :city.happy-1
]
end

to tech.archery.research
ifelse :tech.archery = 0 [
	print [Your scientists are researching Archery...]
	ifelse :city.scientists > 40 [
		print [Your scientists have completed the research.]
		make "city.scientists :city.scientists-40
		make "city.population :city.population+40
		make "archery.bronze 1
	][
		print [You don't have enough scientists.]
	]
][
	print [You already have this tech!]
]
end

to tech.bronze.research
ifelse :tech.bronze = 0 [
	print [Your scientists are researching Bronze Working...]
	ifelse :city.scientists > 30 [
		print [Your scientists have completed the research.]
		make "city.scientists :city.scientists-30
		make "city.population :city.population+30
		make "tech.bronze 1
	][
		print [You don't have enough scientists.]
	]
][
	print [You already have this tech!]
]
end

to tech.iron.research
ifelse :tech.iron = 0 [
	ifelse :city.scientists > 60 [
		print [Your scientists have completed the research.]
		make "city.scientists :city.scientists-60
		make "city.population :city.population+60
		make "tech.iron 1
	][
		print [You don't have enough scientists.]
	]
][
	print [You already have this tech!]
]
print [Your scientists are researching Iron Working...]
end

to tech.philosophy.research
ifelse :tech.philosophy = 0 [
	print [Your scientists are researching Philosophy...]
	ifelse :city.scientists > 100 [
		print [Your scientists have completed the research.]
		make "city.scientists :city.scientists-100
		make "city.population :city.population+100
		make "tech.philosophy 1
	][
		print [You don't have enough scientists.]
	]
][
	print [You already have this tech!]
]
end

to tech.writing.research
ifelse :tech.writing = 0 [
	print [Your scientists are researching Writing...]
	ifelse :city.scientists > 75 [
		print [Your scientists have completed the research.]
		make "city.scientists :city.scientists-75
		make "city.population :city.population+75
		make "tech.writing 1
	][
		print [You don't have enough scientists.]
	]
][
	print [You already have this tech!]
]
end

to traintroops :trainamount
localmake "ratio (:city.army+:trainamount)/(:city.population-:trainamount)
ifelse :city.prod > :trainamount [
	ifelse OR :ratio<0.8 :ratio=0.8 [
		ifelse :city.population > :trainamount [
			make "city.population :city.population - :trainamount
			make "city.army :city.army + :trainamount
			make "city.prod :city.prod - :trainamount
			localmake "temp (sentence [You have just trained] :trainamount [soldiers. They are ready and waiting for battle!])
			print :temp
		][
			print [What are you talking about? You don't have that many people in your city!]
		]
	][
		print [Sorry, your troop to population ratio is too high. Your people are feeling uneasy about the powerful military.]
		localmake "temp (sentence [There are] :city.population [people in the] :player.civ.name [but there are ] :city.army [soldiers.])
		print :temp
		make "maxtrain (:city.population*0.8)-:city.army
		localmake "temp (sentence [Therefore, you can only train up to] :maxtrain [soldiers at the moment.])
		print :temp
	]
][
	print [Sorry, your civilisation is low on production.]
	print [Try COLLECTing a few times to get more production.]
]
end

to useresources
make "city.food :city.food - :city.population
make "city.food :city.food - :city.army
if :city.food < 0 [make "city.food 0]
;Calls STARVE
if :city.health < 0 [make "city.food :city.food - (0-:city.health)*2]
make "city.gold :city.gold - :city.army
if :city.gold < 0 [make "city.gold 0]
;Calls DEBT
end

Make "startup [game.about]

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.