Frame 1
function GetTimeStamp() {
var _local1 = new Date();
var _local2 = _local1.getTime();
return(_local2);
}
function MinMax(val, min, max) {
if (val > max) {
val = max;
}
if (val < min) {
val = min;
}
return(val);
}
function StatusTube(target, percent) {
var _local1 = Math.ceil((percent * target._totalframes) / 100);
_local1 = MinMax(_local1, 1, target._totalframes);
target.gotoAndStop(_local1);
}
function Preloader() {
this.total = _root.getBytesTotal();
this.loaded = 0;
this.percentage = 0;
this.startTime = GetTimeStamp();
}
Preloader.prototype.update = function () {
this.loaded = _root.getBytesLoaded();
this.percentage = (this.loaded / this.total) * 100;
return(this.loaded >= this.total);
};
var pl = new Preloader();
Frame 2
_global.UPSELL_BUY = "";
_global.UPSELL_DOWNLOAD = "";
_global.UPSELL_TARGET = "";
XMLNode.prototype.findNode = function (name, id) {
var _local2 = this.firstChild;
while (_local2) {
if (_local2.nodeName == name) {
if ((id != null) && (_local2.attributes.id != id)) {
_local2 = _local2.nextSibling;
continue;
}
return(_local2);
}
_local2 = _local2.nextSibling;
}
return(null);
};
var xml = new XML();
xml.onLoad = function (success) {
if (!success) {
UPSELL_BUY = "http://www.ldwsoftware.com/";
UPSELL_DOWNLOAD = "http://www.ldwsoftware.com/";
UPSELL_TARGET = "_parent";
return(undefined);
}
var _local3 = this.firstChild;
while (_local3) {
var _local4 = _local3.nodeName.toLowerCase();
var _local2 = _local3.firstChild;
if (_local4 == "links") {
_local3 = _local2;
} else if (_local4 == "buy") {
if (_local2.nodeValue) {
UPSELL_BUY = _local2.nodeValue.toString();
}
} else if (_local4 == "download") {
if (_local2.nodeValue) {
UPSELL_DOWNLOAD = _local2.nodeValue.toString();
}
} else if (_local4 == "target") {
if (_local2.nodeValue) {
UPSELL_TARGET = _local2.nodeValue.toString();
}
}
_local3 = _local3.nextSibling;
}
};
xml.load("links.xml");
var xmlHelp = new XML();
xmlHelp.load("help.xml");
Frame 4
play();
if (pl.update()) {
if ((GetTimeStamp() - pl.startTime) > 0) {
delete pl;
gotoAndPlay ("scripts");
}
}
StatusTube(progressBar, pl.percentage);
Frame 5
prevFrame();
Frame 9
function CPoint(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
if (z == null) {
this.z = 0;
}
}
function SetPoint(p, x, y, z) {
p.x = Number(x);
p.y = Number(y);
p.z = Number(z);
}
function CreatePoint(x, y, z) {
var _local1 = new CPoint();
SetPoint(_local1, x, y, z);
return(_local1);
}
function CopyPoint(p) {
return(CreatePoint(p.x, p.y, p.z));
}
function OffsetPoint(p, Offset) {
p.x = p.x + Offset.x;
p.y = p.y + Offset.y;
p.z = p.z + Offset.z;
}
function ScalePoint(p, s) {
p.x = p.x * s;
p.y = p.y * s;
p.z = p.z * s;
}
function GetLength(p) {
return(Math.sqrt(((p.x * p.x) + (p.y * p.y)) + (p.z * p.z)));
}
function GetLengthXY(p) {
return(Math.sqrt((p.x * p.x) + (p.y * p.y)));
}
function GetDistance(p1, p2) {
var _local2 = p1.x - p2.x;
var _local1 = p1.y - p2.y;
return(Math.sqrt((_local2 * _local2) + (_local1 * _local1)));
}
function GetQuickDistance(p1, p2) {
var _local2 = p1.x - p2.x;
var _local1 = p1.y - p2.y;
return((_local2 * _local2) + (_local1 * _local1));
}
function GetDistance3D(p1, p2) {
var _local3 = p1.x - p2.x;
var _local2 = p1.y - p2.y;
var _local1 = p1.z - p2.z;
return(Math.sqrt(((_local3 * _local3) + (_local2 * _local2)) + (_local1 * _local1)));
}
function GetSlope(p1, p2) {
return((p2.y - p1.y) / (p2.x - p1.x));
}
function NormalizePoint(p) {
var _local1 = GetLength(p);
if (_local1 == 0) {
return(undefined);
}
p.x = p.x / _local1;
p.z = p.z / _local1;
p.y = p.y / _local1;
}
function AimTo(from, to) {
var _local1 = CopyPoint(to);
_local1.x = _local1.x - from.x;
_local1.y = _local1.y - from.y;
_local1.z = _local1.z - from.z;
NormalizePoint(_local1);
return(_local1);
}
function GetDirection(vector) {
if (!vector) {
var _local2 = Math.random() * 100;
if (_local2 < 50) {
return(DIR_SOUTH);
}
return(DIR_WEST);
}
if (vector.x > 0) {
if (vector.y > 0) {
return(DIR_SOUTH);
}
return(DIR_EAST);
}
if (vector.y > 0) {
return(DIR_WEST);
}
return(DIR_NORTH);
}
function CRect(l, t, r, b) {
this.left = l;
this.top = t;
this.right = r;
this.bottom = b;
}
function GetWidth(r) {
return(r.right - r.left);
}
function GetHeight(r) {
return(r.bottom - r.top);
}
function PointInRect(r, p) {
return((((r.left <= p.x) && (r.top <= p.y)) && (r.right >= p.x)) && (r.bottom >= p.y));
}
function RectIntersect(r1, r2) {
if (PointInRect(r1, new CPoint(r2.left, r2.top))) {
return(true);
}
if (PointInRect(r1, new CPoint(r2.left, r2.bottom))) {
return(true);
}
if (PointInRect(r1, new CPoint(r2.right, r2.top))) {
return(true);
}
if (PointInRect(r1, new CPoint(r2.right, r2.bottom))) {
return(true);
}
return(false);
}
function DrawLine(target, p1, p2, color) {
target.lineStyle(1, color, 255);
target.moveTo(p1.x, p1.y);
target.lineTo(p2.x, p2.y);
}
function DrawRect(target, rect, color) {
target.lineStyle(2, color, 255);
target.moveTo(rect.left, rect.top);
target.lineTo(rect.right, rect.top);
target.lineTo(rect.right, rect.bottom);
target.lineTo(rect.left, rect.bottom);
target.lineTo(rect.left, rect.top);
}
function DrawCircle(target, pos, radius, color) {
var _local2 = pos.x;
var _local1 = pos.y;
var _local3 = radius;
var _local6 = _local3 * 0.414213562373095;
var _local5 = (_local3 * Math.SQRT2) / 2;
target.lineStyle(2, color, 255);
target.moveTo(_local2 + _local3, _local1);
target.curveTo(_local2 + _local3, _local1 + _local6, _local2 + _local5, _local1 + _local5);
target.curveTo(_local2 + _local6, _local1 + _local3, _local2, _local1 + _local3);
target.curveTo(_local2 - _local6, _local1 + _local3, _local2 - _local5, _local1 + _local5);
target.curveTo(_local2 - _local3, _local1 + _local6, _local2 - _local3, _local1);
target.curveTo(_local2 - _local3, _local1 - _local6, _local2 - _local5, _local1 - _local5);
target.curveTo(_local2 - _local6, _local1 - _local3, _local2, _local1 - _local3);
target.curveTo(_local2 + _local6, _local1 - _local3, _local2 + _local5, _local1 - _local5);
target.curveTo(_local2 + _local3, _local1 - _local6, _local2 + _local3, _local1);
}
function RandomPointInRect(rect) {
var _local3 = rect.left + Math.round(GetWidth(rect) * Math.random());
var _local2 = rect.top + Math.round(GetHeight(rect) * Math.random());
return(new CPoint(_local3, _local2));
}
function InArray(arr, text) {
var _local1 = 0;
while (_local1 < arr.length) {
var _local2 = arr[_local1];
if (_local2 == text) {
return(true);
}
_local1++;
}
return(false);
}
function CreateParticle(target, template, level, x, y) {
var _local2 = "gPtx" + level;
target.attachMovie(template, _local2, level);
var _local1 = target[_local2];
if (!_local1) {
return(null);
}
_local1._x = x;
_local1._y = y;
return(_local1);
}
function Rnd(n) {
return(Math.floor(Math.random() * n));
}
function BoolRnd(n) {
return(Rnd(100) > n);
}
function ControlLock(show) {
controlLock._visible = show;
}
function GetGlobalPoint(mc) {
var _local2 = new CPoint(mc._x, mc._y);
if (mc._parent) {
OffsetPoint(_local2, GetGlobalPoint(mc._parent));
}
return(_local2);
}
function Villager(age) {
var _local3 = ["M", "F"];
this.gender = _local3[Rnd(2)];
this.name = RandomName(this.gender);
this.age = MinMax(Rnd(20), 1, 20);
if (age) {
this.age = age;
}
this.buried = false;
this.tombText = "";
this.buryWho = 0;
this.skinHead = Rnd(10);
this.skinBody = Rnd(10);
this.ageToBirth = 0;
this.health = 100;
this.food = 100;
this.sick = 0;
this.skills = new Array(0, 0, 0, 0, 0, 0);
this.skill = PRIEST;
this.task = NOTHING;
this.workDone = 0;
this.action = null;
this.actionQueue = new Array();
var _local2 = GetHotspot(OPEN_FIELD);
this.pos = RandomPointInRect(_local2.hotspot);
this.aim = null;
this.path = null;
this.dir = GetDirection(null);
RandomLikes(this);
}
function SelectVillager(char) {
if (char.health <= 0) {
if (char.tombText != "") {
CreatePopup("popupTomb", char.tombText, 0, 0, 0, 0, 270);
} else {
GameStatus("That villager is dead.");
}
selectedChar = null;
return(undefined);
}
selectedChar = char;
if (char.workDone > 0) {
}
if (TRACE_PATH) {
TracePath(gameMap.gfx.drawArea, char.path);
}
if ((selectedChar && (IsHelpShown(3))) && (gameMap._visible)) {
ShowHelpForced(4);
}
}
function CountAlive() {
var _local5 = GetGame();
var _local3 = _local5.villagers;
var _local4 = 0;
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.health > 0) {
_local4++;
}
_local1++;
}
return(_local4);
}
function IsSelected(char) {
return(selectedChar == char);
}
function InitVillagers() {
var _local4 = new Array();
var _local2;
_local2 = new Villager(20);
_local2.gender = "M";
_local2.skills[BUILDER] = 30;
_local2.skill = BUILDER;
_local4.push(_local2);
_local2 = new Villager(25);
_local2.gender = "F";
_local4.push(_local2);
_local2 = new Villager(5);
_local4.push(_local2);
var _local3 = 0;
while (_local3 < 4) {
_local2 = new Villager(18 - (Math.random() * 10));
_local4.push(_local2);
_local3++;
}
var _local5 = new Array(new CPoint(1054, 626), new CPoint(1043, 664), new CPoint(991, 629), new CPoint(891, 549), new CPoint(862, 580), new CPoint(885, 634), new CPoint(928, 592));
_local3 = 0;
while (_local3 < _local4.length) {
if (!_local5[_local3]) {
} else {
_local2 = _local4[_local3];
_local2.pos = _local5[_local3];
var _local1 = 0;
while (_local1 < (4 + Rnd(8))) {
_local2.actionQueue.push(RandomStand());
_local2.actionQueue.push(0);
_local1++;
}
}
_local3++;
}
return(_local4);
}
function GetRandomVillager() {
var _local4 = GetGame();
var _local3 = _local4.villagers;
if (!CountAlive()) {
return(null);
}
while (true) {
var _local2 = Rnd(_local3.length);
var _local1 = _local3[_local2];
if (_local1.health > 0) {
return(_local1);
}
}
}
function UpdateVillager(char, elapsed) {
var _local2 = GetGame();
if (char.health == 0) {
return(undefined);
}
var _local5 = elapsed / TSCALE_ONE_YEAR;
char.age = char.age + _local5;
if (char.ageToBirth > 0) {
char.ageToBirth = char.ageToBirth - _local5;
if (char.ageToBirth <= 0) {
char.skills[BREEDER] = MinMax(char.skills[BREEDER] + 20, 0, 100);
char.ageToBirth = 0;
var _local3 = new Villager(2);
_local3.father = char.spouse;
_local3.mother = char;
_local2.villagers.push(_local3);
if (gameMap._visible) {
gameMap.addVillagerClip(_local3);
trace("added new villager " + _local3.name);
}
ClearActions(char, NOTHING);
}
}
var _local4 = Math.random() * 100;
if ((_local2.food > (FOOD_OK_LEVEL / 2)) || (_local4 < 50)) {
_local2.food = _local2.food - FOOD_CONSUMPTION;
} else {
char.health--;
}
if (_local2.food > FOOD_ABUNDANT) {
if (_local4 <= 75) {
_local2.food = _local2.food - FOOD_CONSUMPTION;
}
}
if (_local2.food <= 0) {
_local2.food = 0;
if (_local4 <= 50) {
char.health--;
}
}
if (char.food < 20) {
char.task = EATING;
}
if (char.health <= 0) {
char.health = 0;
} else if (char.health <= 96) {
if (Rnd(100) > 50) {
if (_local2.food > FOOD_OK_LEVEL) {
char.health++;
}
if (_local2.food > FOOD_ABUNDANT_LEVEL) {
char.health = char.health + 2;
}
}
}
var _local7 = 0;
if (char.age > (AGE_TO_MORTALITY + _local7)) {
var _local6 = Math.random() * 100;
if (_local6 > 20) {
char.health = 0;
}
}
}
function RandomTask(char) {
char.task = NOTHING;
char.action = null;
var _local5 = GetTasks();
var _local4 = new Array();
if (char.ageToBirth > 0) {
_local4 = new Array(BREEDING, ENJOYING_BEACH, WASHING_BABY, CHANGING_BABY);
ShowHelp("FirstPreg");
} else {
var _local3 = 0;
while (_local3 < _local5.length) {
var _local1 = _local5[_local3];
if ((_local1.task == ENJOYING_POND) && (char.age < AGE_TO_TEEN)) {
_local4.push(ENJOYING_BEACH);
} else {
if (_local1.assigned == null) {
_local4.push(_local1.task);
}
if (_local1.assigned == char.skill) {
if (char.skills[char.skill] >= LEVEL_ADEPT) {
_local4.push(_local1.task);
}
}
}
_local3++;
}
if (char.age < AGE_TO_TEEN) {
_local4.push(PLAYING_TAG);
_local4.push(ENJOYING_BEACH);
}
}
if (_local4.length > 0) {
char.task = _local4[Rnd(_local4.length)];
trace((char.name + ": random task ") + char.task);
}
}
function UpdateAction(char) {
if (char.health <= 0) {
return(undefined);
}
char.action = char.actionQueue[0];
if (char.action == 0) {
RandomTask(char);
}
if (char.action == null) {
GenerateActions(char);
char.action = char.actionQueue[0];
animation = char.action.animation;
}
switch (char.action.animation) {
case ACTION_JUMP :
case ACTION_CLIMB :
case ACTION_WALK :
UpdatePosition(char);
break;
case ACTION_COMMIT :
CommitWork(char);
break;
case ACTION_HIDE :
case ACTION_SIT :
case ACTION_STAND :
case ACTION_DIVE :
case ACTION_CROUCH :
case ACTION_WORK :
UpdateWork(char);
}
}
function UpdateWork(char) {
var _local1 = char.actionQueue[0];
if ((_local1.animation == ACTION_STAND) && (_local1.wait)) {
var _local3 = GetTimeStamp();
if (_local3 >= _local1.wait) {
ClearCurrentAction(char);
}
return(undefined);
}
if (_local1.length == 0) {
AttemptSkill(char);
return(undefined);
}
if ((_local1.counter++) > _local1.length) {
ClearCurrentAction(char);
}
}
function CommitWork(char) {
var _local2 = GetGame();
ClearCurrentAction(char);
switch (char.task) {
case BURYING_DEAD :
if (char.buryWho) {
SetTombText(char.buryWho);
char.buryWho = 0;
}
break;
case HARVESTING_COCONUT :
_local2.food = _local2.food + char.workDone;
_local2.coconuts = MinMax(_local2.coconuts - char.workDone, 0, MAX_COCONUTS);
break;
case FISHING :
_local2.food = _local2.food + char.workDone;
_local2.fishes = MinMax(_local2.coconuts - char.workDone, 0, MAX_COCONUTS);
break;
case RESEARCHING :
if (GetTechLevel(RESEARCHER) > 1) {
char.workDone = char.workDone * 1.25;
}
_local2.tech = _local2.tech + char.workDone;
break;
case GATHERING_WOOD :
_local2.wood = GetTimeStamp();
if (_local2.fire > 0) {
_local2.fire = FIRE_HOURS;
}
char.task = 0;
if (IsHelpShown(13)) {
ShowHelpForced(14);
}
break;
case GATHERING_GRASS :
_local2.grass = 1;
char.task = 0;
if (IsHelpShown(15)) {
ShowHelpForced(16);
}
break;
case COLLECT_ITEM :
CommitCollect(char);
break;
case STUDYING_PLANT :
case STUDYING_PLANT1 :
case STUDYING_PLANT2 :
case STUDYING_PLANT3 :
case STUDYING_PLANT4 :
case STUDYING_PLANT5 :
if (!_local2.plants) {
_local2.plants = new Array();
}
_local2.plants[char.task] = true;
if (ArePlantsComplete()) {
if (SolvePuzzle(PUZZLE_PLANTS)) {
Celebrate(char);
}
}
break;
case LIGHTING_FIRE :
if (_local2.grass > 0) {
_local2.grass = 0;
_local2.fire = FIRE_HOURS;
ShowHelpForced(18);
if (SolvePuzzle(PUZZLE_FIRE)) {
Celebrate(char);
}
}
char.task = 0;
break;
case OPENING_CRATE :
}
var _local3 = GetTask(char.task);
if (_local3) {
_local3.progress = _local3.progress + char.workDone;
trace((char.task + "/") + _local3.progress);
if (_local3.progress > _local3.length) {
}
}
char.workDone = 0;
}
function UpdatePosition(char) {
if (char.path == null) {
if (char.action.path) {
trace("custom path");
char.path = char.action.path;
return(undefined);
}
var _local7 = GetPathFinder();
var _local8 = GetHotspot(char.action.area);
if (char.action.animation == ACTION_CLIMB) {
char.path = _local7.climbTree(char.action.area, char.action.down);
} else {
char.path = _local7.findPath(char.pos, RandomPointInRect(_local8.workarea));
if (((char.action.item == null) && (char.action.area >= OPEN_FIELD)) && (char.action.area <= OPEN_FIELD3)) {
while (char.path.length > 5) {
char.path.pop();
}
}
}
}
var _local4 = char.pos;
var _local5 = char.path[0];
var _local10 = char.actionQueue[0];
var _local3 = WALK_SPEED;
char.run = false;
if (InArray(char.likes, "Running")) {
char.run = true;
}
if ((char.task == RUNNING) || (char.task == RUNNING_AWAY)) {
char.run = true;
}
if (char.age < AGE_TO_TEEN) {
char.run = true;
}
if (char.run) {
_local3 = RUN_SPEED;
}
if ((char.ageToBirth > 0) && (_local10.area != SMALL_HUT)) {
_local3 = STAND_SPEED;
char.run = false;
}
if (char.action.animation == ACTION_JUMP) {
_local3 = RUN_SPEED * 4;
}
var _local2 = char.aim;
if (!_local2) {
_local2 = AimTo(_local4, _local5);
ScalePoint(_local2, _local3);
char.walk = GetDistance(_local4, _local5) / GetLengthXY(_local2);
char.aim = _local2;
char.dir = GetDirection(_local2);
}
if (_local2) {
OffsetPoint(_local4, _local2);
}
var _local9 = GetQuickDistance(_local4, _local5);
var _local6 = _local9 < 100;
if ((!_local6) && (char.walk > 0)) {
char.walk--;
_local6 = char.walk < 1;
}
if (_local6) {
char.aim = null;
char.path.shift();
}
if (char.path.length == 0) {
ClearCurrentAction(char);
}
}
function AttemptInteract(char1, char2) {
var _local4 = char1;
var _local3 = char2;
if (char1.gender == "F") {
_local3 = char1;
_local4 = char2;
}
if (char2.health < 1) {
Bury(char1, char2);
return(undefined);
}
if (_local3.ageToBirth > 0) {
GameStatus("She is nursing a baby!");
ClearActions(char2);
char2.task = RUNNING_AWAY;
PlayCharSound(char2, 0);
return(undefined);
}
if (PlayChildren(char1, char2)) {
return(undefined);
}
if (Educate(char1, char2)) {
return(undefined);
}
if (HealSick(char1, char2)) {
return(undefined);
}
if (char1.gender == char2.gender) {
GameStatus("These villagers are both of the same gender!");
ClearActions(char2);
char2.task = RUNNING_AWAY;
PlayCharSound(char2, 0);
return(undefined);
}
if ((char1.age < AGE_TO_ADULT) || (char2.age < AGE_TO_ADULT)) {
GameStatus("The villager is still too young!");
ClearActions(char2);
char2.task = RUNNING_AWAY;
ShowHelp(8.2);
PlayCharSound(char2, 0);
return(undefined);
}
var _local9 = GetGame();
var _local6 = GetTask(BUILDING_HUT);
var _local5 = CountAlive();
if (((_local6.progress < _local6.length) && (_local5 > 8)) || (_local5 > 16)) {
GameStatus("There isn't enough housing!");
PlayCharSound(char2, 0);
return(undefined);
}
var _local8 = char1.skills[BREEDER] + (Math.random() * 60);
var _local7 = 2;
if (char1.skill == BREEDER) {
_local7 = MinMax((100 - (char1.skills[BREEDER] * 2)) / 10, 2, 10);
}
char1.skills[BREEDER] = MinMax(char1.skills[BREEDER] + _local7, 0, 100);
if (_local8 < 55) {
GameStatus("The villager was unsuccessful this time.");
PlayCharSound(char1, 0);
if (IsHelpShown(21)) {
ShowHelpForced("BreedFail");
}
return(undefined);
}
ClearActions(char1);
ClearActions(char2);
char1.task = GOING_INDOORS;
char2.task = GOING_INDOORS;
_local3.ageToBirth = AGE_TO_BIRTH;
_local3.spouse = _local4;
PlayCharSound(char1, 1);
if (IsHelpShown(21)) {
ShowHelpForced(22);
}
}
function OnShowHelpTask(e) {
var _local1 = e.param;
RemoveEvent(e);
if (HasPopup()) {
ShowHelpTask(_local1.task, _local1.success);
return(undefined);
}
var _local2 = GetGame();
if (!_local2.help) {
return(undefined);
}
if (_local1.success) {
switch (_local1.task) {
case FISHING :
if (IsHelpShown(7)) {
ShowHelpForced(8);
DisableHelp("FishingFail");
}
break;
case RESEARCHING :
if (!IsHelpShown(9)) {
break;
}
ShowHelpForced(10);
DisableHelp("ResearchFail");
}
NextHelp();
} else {
switch (_local1.task) {
case FISHING :
ShowHelpForced("FishingFail");
break;
case RESEARCHING :
ShowHelpForced("ResearchFail");
}
}
}
function ShowHelpTask(task, success) {
var _local2 = GetGame();
if (!_local2.help) {
return(undefined);
}
DelayEvent(5);
var _local1 = new Object();
_local1.task = task;
_local1.success = success;
AddEvent(OnShowHelpTask, _local1);
}
function AttemptSkill(char) {
var _local8 = GetGame();
var _local5 = GetTask(char.task);
if ((char.task == FISHING) && (_local8.fishes == 0)) {
ShowHelpTask(char.task, 0);
ShakeHead(char);
return(undefined);
}
var _local6 = true;
var _local7 = _local5.increment;
var _local1 = 0;
while (_local1 < PRIEST) {
if (_local5.skills[_local1] > 0) {
if (((char.skills[_local1] < LEVEL_TRAINEE) && (char.skill != _local1)) && (_local1 == BUILDER)) {
var _local4 = GetProfession(_local1);
GameStatus(("Only " + _local4) + " can attempt this.");
ShowHelpTask(char.task, 0);
char.task = NOTHING;
if (BoolRnd(60)) {
ShakeHead(char);
return(undefined);
}
}
_local6 = _local6 & (char.skills[_local1] >= _local5.skills[_local1]);
var _local3 = 2;
if (char.skill == _local1) {
_local7 = _local7 + ((char.skills[_local1] * 30) / 100);
_local3 = MinMax((100 - (char.skills[_local1] * 2)) / 10, 2, 10);
}
char.skills[_local1] = MinMax(char.skills[_local1] + _local3, 0, 100);
if (char.skill[_local1] >= LEVEL_TRAINEE) {
if (char.skill[_local1] >= LEVEL_ADEPT) {
ShowHelpForced("NewAdept");
} else {
ShowHelpForced("NewTrainee");
}
}
}
_local1++;
}
char.workDone = _local7;
var _local9 = char.actionQueue[0];
_local9.length = 5 + (Math.random() * 10);
if (!_local6) {
if (BoolRnd(80)) {
ShowHelpTask(char.task, 0);
ShakeHead(char);
return(undefined);
}
}
ShowHelpTask(char.task, 1);
}
function CharSick(char) {
var _local1 = Math.random() * 20;
char.health = MinMax((char.health - 50) - _local1, 5, 100);
}
function CharLoseSkill(char) {
var _local1 = Math.random() * PRIEST;
var _local2 = 25 + (Math.random() * 25);
char.skill[_local1] = MinMax(char.skill[_local1] - _local2, 0, 100);
}
function CharLoseAllSkill(char) {
char.skill = new Array(0, 0, 0, 0, 0, 0);
}
function CharAcquireSkill(char) {
var _local1 = Math.random() * PRIEST;
var _local2 = 25 + (Math.random() * 25);
char.skill[_local1] = MinMax(char.skill[_local1] + _local2, 0, 100);
}
function CharToMaster(char, task) {
var _local1 = Math.random() * PRIEST;
if ((task != null) && (task != undefined)) {
_local1 = task;
}
char.skill = _local1;
char.skill[_local1] = 100;
}
function ShowCharGfx(gfx, c, scale) {
gfx.stop();
gfx.charData = c;
gfx.loadGfx(c.gender, c.skinHead, c.skinBody);
gfx.gfxDead.gfx._visible = false;
gfx.gfxBody.gfx.gotoAndStop(2);
gfx.gfxHead.gfx.gotoAndStop(3);
gfx.setFrame(gfx.gfxBody, 9);
gfx.setFrame(gfx.gfxHead, 2);
gfx.adjustHeight();
gfx._xscale = gfx._xscale * scale;
gfx._yscale = gfx._yscale * scale;
gfx._visible = true;
}
function AllHealth(h) {
var _local1 = 0;
while (_local1 < villagers.length) {
var _local2 = villagers[_local1];
if (_local2.health > 0) {
_local2.health = h;
}
_local1++;
}
}
function TotalSkills(char) {
var _local2 = ((((char.skills[0] + char.skills[1]) + char.skills[2]) + char.skills[3]) + char.skills[4]) + char.skills[5];
return(_local2);
}
function InitEventManager() {
var _local1 = new EventManager();
return(_local1);
}
function GetEventsManager() {
return(_global.em);
}
function Event(c, p) {
this.callback = c;
this.param = p;
}
function EventManager() {
this.events = new Array();
this.lastUpdate = 0;
this.index = 0;
}
function AddEvent(c, p) {
var _local1 = GetEventsManager();
_local1.addEvent(c, p);
}
function RemoveEvent(e) {
var _local1 = GetEventsManager();
_local1.removeEvent(e);
}
function DelayEvent(count) {
AddEvent(OnDelayEvent, count);
}
function OnDelayEvent(e) {
RemoveEvent(e);
if (e.param > 0) {
DelayEvent(e.param - 1);
}
}
function UpdateEvents() {
var _local1 = GetEventsManager();
_local1.update();
}
function InitSounds() {
_global.gSounds = new Object();
if (AMBIENT) {
_global.gAmbient = new Sound();
gAmbient.loadSound("song1.mp3", true);
gAmbient.start(0, 9999);
}
var _local3 = ["femaleno", "maleno", "ohkid", "ohwoman", "ohman", "chimes", "button"];
for (var _local4 in _local3) {
var _local2 = _local3[_local4];
gSounds[_local2] = new Sound();
gSounds[_local2].attachSound(_local2);
}
}
function SetVolume(v) {
var _local1 = GetGame();
var _local3 = new Sound();
if (v == null) {
v = Math.round(_local1.sound);
}
_local3.setVolume(v);
return(_local1.sound);
}
function PlaySound(snd, v) {
if (!SetVolume(v)) {
return(undefined);
}
gSounds[snd].start();
}
function PlayMusic(v) {
if (!AMBIENT) {
return(undefined);
}
var _local2 = GetGame();
if (v == undefined) {
v = _local2.music;
}
gAmbient.setVolume(v);
gAmbient.start(0, 9999);
}
function PlayCharSound(char, which) {
if (char.gender == "M") {
var _local2 = ["maleno", "ohman"];
} else {
var _local2 = ["femaleno", "ohwoman"];
}
var _local1 = _local2[which];
if (char.age < AGE_TO_TEEN) {
_local1 = "ohkid";
}
PlaySound(_local1);
}
function Task(task, assigned, length, increment, skills, techs) {
this.task = task;
this.progress = 0;
this.length = length;
this.assigned = assigned;
this.increment = increment;
this.skills = skills;
this.techs = techs;
}
function InitTasks() {
var _local1 = new Array();
_local1.push(new Task(HARVESTING_COCONUT, FARMER, 1000, 10, new Array(LEVEL_TRAINEE, 0, 0, 0, 0), null));
_local1.push(new Task(RESEARCHING, RESEARCHER, 100000, 20, new Array(0, 0, LEVEL_TRAINEE, 0, 0), null));
_local1.push(new Task(BUILDING_HUT, BUILDER, 500, 10, new Array(0, LEVEL_ADEPT, 0, 0, 0), null));
_local1.push(new Task(REPAIRING_HUT, BUILDER, 500, 10, new Array(0, LEVEL_ADEPT, 0, 0, 0), null));
_local1.push(new Task(FISHING, FARMER, 1000, 10, new Array(LEVEL_TRAINEE, 0, 0, 0, 0), null));
_local1.push(new Task(STUDYING_PLANT, HEALER, 5000, 10, new Array(0, 0, 0, LEVEL_ADEPT, 0), null));
_local1.push(new Task(STUDYING_PLANT1, HEALER, 5000, 10, new Array(0, 0, 0, LEVEL_ADEPT, 0), null));
_local1.push(new Task(STUDYING_PLANT2, HEALER, 5000, 10, new Array(0, 0, 0, LEVEL_ADEPT, 0), null));
_local1.push(new Task(STUDYING_PLANT3, HEALER, 5000, 10, new Array(0, 0, 0, LEVEL_ADEPT, 0), null));
_local1.push(new Task(STUDYING_PLANT4, HEALER, 5000, 10, new Array(0, 0, 0, LEVEL_ADEPT, 0), null));
_local1.push(new Task(STUDYING_PLANT5, HEALER, 5000, 10, new Array(0, 0, 0, LEVEL_ADEPT, 0), null));
_local1.push(new Task(ENJOYING_POND, null, 1));
_local1.push(new Task(ENJOYING_BEACH, null, 1));
_local1.push(new Task(ENJOYING_STREAM, null, 1));
_local1.push(new Task(EATING, null, 1));
_local1.push(new Task(OPENING_CRATE, BUILDER, 500, 10, new Array(0, LEVEL_MASTER, 0, 0, 0), null));
_local1.push(new Task(CONFUSED, -1, 1));
return(_local1);
}
function GetTasks() {
var _local1 = GetGame();
return(_local1.tasks);
}
function GetTask(id) {
var _local3 = GetTasks();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.task == id) {
return(_local2);
}
_local1++;
}
return(null);
}
function IsTaskComplete(id) {
var _local1 = GetTask(id);
if (!_local1) {
return(false);
}
if (_local1.progress >= _local1.length) {
return(true);
}
return(false);
}
function ArePlantsComplete() {
var _local3 = GetGame();
var _local2 = 0;
var _local1 = STUDYING_PLANT;
while (_local1 < (STUDYING_PLANT + 6)) {
if (_local3.plants[_local1]) {
_local2++;
}
_local1++;
}
trace("plants:" + _local2);
return(_local2 == 6);
}
function SolvePuzzle(id) {
if (IsPuzzleSolved(id)) {
return(false);
}
var _local3 = GetGame();
var _local1 = PuzzleText(id);
if (_local1 != "") {
CreatePopup("popupMsgOk", _local1);
}
_local3.puzzles[id] = true;
return(true);
}
function IsPuzzleSolved(id) {
var _local1 = GetGame();
return(_local1.puzzles[id] == true);
}
function Tech(tech, cost) {
this.tech = tech;
this.cost = cost;
}
function InitTechs() {
var _local1 = new Array();
_local1.push(new Tech(FARMER, new Array(0, 1500, 50000)));
_local1.push(new Tech(RESEARCHER, new Array(0, 16000, 150000)));
_local1.push(new Tech(BUILDER, new Array(0, 5000, 80000)));
_local1.push(new Tech(HEALER, new Array(0, 20000, 250000)));
_local1.push(new Tech(BREEDER, new Array(0, 10000, 240000)));
_local1.push(new Tech(PRIEST, new Array(0, 20000, 80000)));
return(_local1);
}
function GetTechs() {
return(_global.techs);
}
function GetTech(tech) {
var _local3 = GetTechs();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.tech == tech) {
return(_local2);
}
_local1++;
}
return(null);
}
function GetTechLevel(id) {
var _local1 = GetGame();
return(_local1.techs[id]);
}
function BuyTech(id) {
if ((id != FARMER) && (id != RESEARCHER)) {
ShowUpsell();
return(undefined);
}
var _local2 = GetGame();
var _local6 = TechText(id);
var _local5 = GetTech(id);
var _local4 = _local2.techs[id];
var _local3 = _local5.cost[_local4];
if (DEBUG) {
_local3 = 1;
}
if (_local2.tech < _local3) {
CreatePopup("popupMsgOk", "<p align='center'>\nYou do not enough tech points yet. Do additional research.</p>", null, 0, 0, 0, 140);
return(undefined);
}
if (_local4 > 1) {
ShowUpsell();
return(undefined);
}
_local2.techs[id]++;
_local2.tech = _local2.tech - _local3;
RefreshTech();
}
function HotSpot(task, hotspot, workarea, blocks) {
this.task = task;
this.hotspot = hotspot;
this.workarea = workarea;
this.blocks = blocks;
if (!this.workarea) {
this.workarea = this.hotspot;
}
}
function InitHotspots() {
var _local1 = new Array();
_local1[OPEN_FIELD] = new HotSpot(NOTHING, new CRect(618, 510, 850, 621), null, false);
_local1[OPEN_FIELD1] = new HotSpot(NOTHING, new CRect(542, 698, 759, 836), null, false);
_local1[OPEN_FIELD2] = new HotSpot(NOTHING, new CRect(357, 241, 516, 331), null, false);
_local1[OPEN_FIELD3] = new HotSpot(NOTHING, new CRect(668, 256, 844, 340), null, false);
_local1[WHITE_SAND] = new HotSpot(NOTHING, new CRect(269, 283, 337, 427), null, false);
_local1[WHITE_SAND1] = new HotSpot(NOTHING, new CRect(210, 394, 301, 588), null, false);
_local1[WHITE_SAND2] = new HotSpot(NOTHING, new CRect(151, 558, 234, 717), null, false);
_local1[WHITE_SAND3] = new HotSpot(NOTHING, new CRect(70, 738, 122, 964), null, false);
_local1[FOOD_BASKET] = new HotSpot(NOTHING, new CRect(786, 648, 872, 710), new CRect(830, 710, 870, 720), true);
_local1[COCONUT_TREE] = new HotSpot(HARVESTING_COCONUT, new CRect(189, 5, 239, 140), new CRect(214, 148, 220, 154), true);
_local1[COCONUT_TREE1] = new HotSpot(HARVESTING_COCONUT, new CRect(269, 56, 319, 206), new CRect(286, 211, 292, 217), true);
_local1[COCONUT_TREE2] = new HotSpot(HARVESTING_COCONUT, new CRect(355, 19, 405, 169), new CRect(378, 182, 384, 188), true);
_local1[RESEARCH_HUT] = new HotSpot(RESEARCHING, new CRect(525, 325, 653, 439), new CRect(593, 440, 708, 454), true);
_local1[RESEARCH_TABLE] = new HotSpot(RESEARCHING, new CRect(595, 412, 724, 443), new CRect(593, 440, 708, 454), true);
_local1[SMALL_HUT] = new HotSpot(REPAIRING_HUT, new CRect(198, 905, 299, 1001), new CRect(239, 995, 255, 1000), true);
_local1[NEW_HUT] = new HotSpot(BUILDING_HUT, new CRect(364, 438, 460, 521), new CRect(363, 512, 417, 532), true);
_local1[ROCK_SUPPLY] = new HotSpot(NOTHING, new CRect(702, 131, 791, 190), null, false);
_local1[WOOD_SUPPLY] = new HotSpot(GATHERING_WOOD, new CRect(29, 1030, 165, 1091), null, false);
_local1[GRASS_SUPPLY] = new HotSpot(GATHERING_GRASS, new CRect(107, 31, 173, 63), new CRect(127, 63, 153, 68), false);
_local1[DEEP_WATERS] = new HotSpot(FISHING, new CRect(2, 176, 119, 399), null, false);
_local1[WATERFALLS] = new HotSpot(ENJOYING_POND, new CRect(978, 455, 1106, 545), null, false);
_local1[STREAM] = new HotSpot(NOTHING, new CRect(1036, 647, 1108, 749), null, false);
_local1[STREAM1] = new HotSpot(NOTHING, new CRect(1067, 712, 1125, 892), null, false);
_local1[STREAM2] = new HotSpot(NOTHING, new CRect(1044, 803, 1138, 880), null, false);
_local1[POND_DIVE1] = new HotSpot(NOTHING, new CRect(929, 412, 923, 416), null, false);
_local1[POND_DIVE2] = new HotSpot(NOTHING, new CRect(975, 373, 979, 377), null, false);
_local1[POND_DIVE3] = new HotSpot(NOTHING, new CRect(938, 355, 942, 359), null, false);
_local1[POND_DIVE4] = new HotSpot(NOTHING, new CRect(976, 291, 980, 295), null, false);
_local1[POND_DIVE5] = new HotSpot(NOTHING, new CRect(1040, 278, 1044, 282), null, false);
_local1[POND_DIVE6] = new HotSpot(NOTHING, new CRect(1011, 302, 1015, 306), null, false);
_local1[POND_DIVE7] = new HotSpot(NOTHING, new CRect(1011, 450, 1015, 454), null, false);
_local1[FIRE] = new HotSpot(LIGHTING_FIRE, new CRect(509, 595, 580, 644), new CRect(509, 644, 580, 654), true);
_local1[RUINS] = new HotSpot(NOTHING, new CRect(905, 1004, 1147, 1150), null, false);
_local1[CRATE] = new HotSpot(OPENING_CRATE, new CRect(100, 560, 160, 600), new CRect(100, 605, 160, 610), true);
_local1[BRIARS] = new HotSpot(NOTHING, new CRect(420, 130, 620, 210), null, false);
_local1[PLANT] = new HotSpot(STUDYING_PLANT, new CRect(1137, 965, 1167, 1015), new CRect(1160, 1015, 1167, 1025), false);
_local1[PLANT1] = new HotSpot(STUDYING_PLANT1, new CRect(626, 1126, 656, 1176), new CRect(650, 1170, 656, 1176), false);
_local1[PLANT2] = new HotSpot(STUDYING_PLANT2, new CRect(75, 18, 105, 90), new CRect(100, 80, 105, 85), false);
_local1[PLANT3] = new HotSpot(STUDYING_PLANT3, new CRect(686, 83, 716, 133), new CRect(710, 130, 716, 135), false);
_local1[PLANT4] = new HotSpot(STUDYING_PLANT4, new CRect(904, 8, 934, 48), new CRect(930, 35, 934, 40), false);
_local1[PLANT5] = new HotSpot(STUDYING_PLANT5, new CRect(1083, 225, 1153, 285), new CRect(1100, 285, 1105, 290), false);
_local1[CLIFF] = new HotSpot(NOTHING, new CRect(1030, 292, 1207, 420), null, true);
_local1[BURIAL_GROUNDS] = new HotSpot(NOTHING, new CRect(873, 114, 1056, 236), new CRect(860, 230, 880, 240), true);
return(_local1);
}
function GetTaskLocation(task) {
var _local3 = GetHotspots();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.task == task) {
return(_local1);
}
_local1++;
}
return(OPEN_FIELD);
}
function GetRandomLocation(s, size) {
return(s + Rnd(size));
}
function GetRandomOpenField() {
return(GetRandomLocation(OPEN_FIELD, 4));
}
function GetRandomPlant() {
return(GetRandomLocation(PLANT, 3));
}
function GetRandomWhiteSand() {
return(GetRandomLocation(WHITE_SAND, 4));
}
function GetRandomCoconutTree() {
return(GetRandomLocation(COCONUT_TREE, 3));
}
function GetRandomStream() {
return(GetRandomLocation(STREAM, 3));
}
function CheckBlock(cx, cy) {
var _local5 = gameMap;
if (!_local5) {
return(false);
}
var _local7 = (cx + _local5._x) + _local5.gfx._x;
var _local6 = (cy + _local5._y) + _local5.gfx._y;
var _local4 = 0;
while (_local4 < 4) {
var _local1 = 0;
while (_local1 < 4) {
var _local3 = ("gMap" + _local4) + _local1;
var _local2 = _local5.gfx[_local3].block;
if (!_local2) {
} else if (_local2.hitTest(_local7, _local6, true)) {
return(true);
}
_local1++;
}
_local4++;
}
return(false);
}
function CheckWater(cx, cy) {
var _local4 = gameMap;
if (!_local4) {
return(false);
}
var _local7 = (cx + _local4._x) + _local4.gfx._x;
var _local6 = (cy + _local4._y) + _local4.gfx._y;
var _local5 = new Array("gMap00", "gMap01", "gMap21");
var _local1 = 0;
while (_local1 < 3) {
var _local3 = _local5[_local1];
var _local2 = _local4.gfx[_local3].water;
if (!_local2) {
} else if (_local2.hitTest(_local7, _local6, true)) {
return(true);
}
_local1++;
}
return(false);
}
function CheckPond(cx, cy) {
var _local4 = gameMap;
if (!_local4) {
return(false);
}
var _local7 = (cx + _local4._x) + _local4.gfx._x;
var _local6 = (cy + _local4._y) + _local4.gfx._y;
var _local5 = new Array("gMap00", "gMap21", "gMap22", "gMap23", "gMap32");
var _local1 = 0;
while (_local1 < 3) {
var _local3 = _local5[_local1];
var _local2 = _local4.gfx[_local3].pond;
if (!_local2) {
} else if (_local2.hitTest(_local7, _local6, true)) {
return(true);
}
_local1++;
}
return(false);
}
function CheckHotspot(x, y) {
var _local3 = GetHotspots();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2 && (PointInRect(_local2.hotspot, new CPoint(x, y)))) {
return(_local2);
}
_local1++;
}
return(null);
}
function CheckHotspotId(hs) {
var _local2 = GetHotspots();
var _local1 = 0;
while (_local1 < _local2.length) {
if (hs == _local2[_local1]) {
return(_local1);
}
_local1++;
}
return(null);
}
function ShowHotspots(target) {
var _local3 = GetHotspots();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
DrawRect(target, _local2.hotspot, 255);
DrawRect(target, _local2.workarea, 16711680);
_local1++;
}
}
function GetHotspots() {
return(_global.hotspots);
}
function GetHotspot(index) {
return(_global.hotspots[index]);
}
function PathFinder() {
}
function TracePath(target, path) {
if (!target.drawPath) {
target.createEmptyMovieClip("drawPath", 5000);
}
target = target.drawPath;
target.clear();
var _local1 = 0;
while (_local1 < path.length) {
if (path[_local1] == null) {
trace("path error!");
} else {
var _local3 = 255;
if (path[_local1].z == -1) {
_local3 = _local3 << 8;
}
DrawCircle(target, path[_local1], 5, _local3);
}
_local1++;
}
}
function TracePathTest(target) {
if (!target.drawPath) {
target.createEmptyMovieClip("drawPath", 5000);
}
target = target.drawPath;
target.clear();
var _local5 = GetGame();
var _local7 = GetPathFinder();
var _local6 = CopyPoint(_local5.villagers[0].pos);
var _local8 = CopyPoint(_local5.villagers[1].pos);
var _local2 = _local7.findPath(_local6, _local8);
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1] == null) {
} else {
var _local3 = 255;
if (_local2[_local1].z == -1) {
_local3 = _local3 << 8;
}
DrawCircle(target, _local2[_local1], 5, _local3);
}
_local1++;
}
}
function InitPathFinder() {
var _local1 = new PathFinder();
return(_local1);
}
function GetPathFinder() {
return(_global.pathfinder);
}
function Gfx(id, gfx, pos) {
this.id = id;
this.gfx = gfx;
this.pos = pos;
}
function InitGfx() {
var _local1 = new Array();
_local1.push(new Gfx(RESEARCHING, "research", new CPoint(580, 402)));
_local1.push(new Gfx(STORING_FOOD, "food", new CPoint(786, 648)));
_local1.push(new Gfx(BUILDING_HUT, "hut", new CPoint(332, 428)));
_local1.push(new Gfx(FIRE, "fire", new CPoint(500, 546)));
_local1.push(new Gfx(WAVES, "waves", new CPoint(10, 80)));
_local1.push(new Gfx(CRATE, "crate", new CPoint(100, 560)));
_local1.push(new Gfx(WATERSPRAY, "spray", new CPoint(1080, 260)));
_local1.push(new Gfx(COCONUT, "coconut", new CPoint(210, 20)));
_local1.push(new Gfx(BRIARS, "briars", new CPoint(400, 120)));
_local1.push(new Gfx(REPAIRING_HUT, "lovehut", new CPoint(173, 900)));
_local1.push(new Gfx(COLLECT_ITEM, "collect", new CPoint(-500, -500)));
return(_local1);
}
function GetGfxObjects() {
return(_global.gfxObjects);
}
function GetGfx(id) {
var _local3 = GetGfxObjects();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.id == id) {
return(_local2);
}
_local1++;
}
return(null);
}
function LangGender(g) {
if (g == "M") {
return("Male");
}
return("Female");
}
function LangHealth(char) {
if (char.age >= AGE_TO_ELDERLY) {
return("Elderly");
}
if (char.health < 40) {
return("Unhealthy");
}
return("Healthy");
}
function LangSkillDesc(char) {
var _local3 = char.skills[char.skill];
var _local1 = new Array();
if (_local3 >= LEVEL_TRAINEE) {
switch (char.skill) {
case FARMER :
_local1.push("Child of the Earth");
_local1.push("Nature's Friend");
break;
case BUILDER :
_local1.push("Strong Arms, Big Heart");
_local1.push("Inspired Architect");
break;
case RESEARCHER :
_local1.push("Dedicated Student");
_local1.push("Inspired Inventory");
break;
case HEALER :
_local1.push("Dedicated to Others");
_local1.push("Guardian of Health");
break;
case BREEDER :
_local1.push("Parent, Teach, Friend");
}
} else {
_local1.push("Curious and Playful");
_local1.push("Loving and Special");
}
return(_local1[Rnd(_local1.length)]);
}
function LangSkill(char) {
var _local2 = "Untrained";
var _local3 = char.skills[char.skill];
var _local1 = "";
if (_local3 >= LEVEL_TRAINEE) {
_local2 = "Trainee ";
if (_local3 >= LEVEL_ADEPT) {
_local2 = "Adept ";
}
if (_local3 >= LEVEL_MASTER) {
_local2 = "Master ";
}
switch (char.skill) {
case FARMER :
_local1 = "Farmer";
break;
case RESEARCHER :
_local1 = "Scientist";
break;
case BUILDER :
_local1 = "Builder";
break;
case HEALER :
_local1 = "Doctor";
break;
case BREEDER :
_local1 = "Parent";
}
}
return(_local2 + _local1);
}
function LangAction(char) {
var _local3 = char.task;
var _local1 = char.actionQueue[0];
if (_local1) {
if (_local1.comment != null) {
return(_local1.comment);
}
}
switch (_local3) {
case FISHING :
return("Fishing");
case BREEDING :
return("Nursing a child");
case HARVESTING_COCONUT :
return("Harvesting coconuts");
case BUILDING_HUT :
return("Building small hut");
case RESEARCHING :
return("Researching");
}
if (char.ageToBirth > 0) {
return("Nursing a child");
}
return("Nothing");
}
function TechText(id) {
switch (id) {
case FARMER :
return("<p align='center'>Farming Technology</p><br/>Advancements in farming enable your villagers to obtain food from new and previously untapped sources on Isola.");
case BUILDER :
return("<p align='center'>Engineering Technology</p><br/>Advancements in engineering enable your villagers to engineerand build more advanced types of structures.");
case RESEARCHER :
return("<p align='center'>Science Technology</p><br/>Advancements in science allow your villagers to accumulate tech points faster.");
case HEALER :
return("<p align='center'>Medicine Technology</p><br/>Advancements in medicine reduce the frequency of disease on the island and significantly increase longevity and fertility rates.");
case BREEDER :
return("<p align='center'>Exploration Technology</p><br/>Advancements in exploration enable your villagers to spot things on the ground more easily than before. Also,children will find rarer collectibles.");
case PRIEST :
return("<p align='center'>Culture</p><br/>Advancements in cultural understanding enable your villagers to more easily pass on benefits to their children. It also can lead to better understanding cultures other than their own.");
}
}
function RandomName(gender) {
var _local1 = new Array();
_local1.M = ["Achak", "Ahi", "Ahote", "Akiko", "Akio", "Alohi", "Amago", "Amiri", "Azizi", "Ayu", "Babaco", "Babu", "Bali", "Balun", "Bass", "Bobo", "Buru", "Chip", "Coen", "Coho", "Daku", "Dodo", "Ecco", "Elaku", "Fungo", "Goby", "Guapi", "Hiji", "Hokou", "Hong", "Hoto", "Ipo", "Gin", "Jak", "Joop", "Kaki", "Kamin", "Kanyu", "Kato", "Kayak", "Kazuo", "Kenji", "Kei", "Keli", "Kenobi", "Koi", "Koko", "Kokopu", "Kon", "Kumi", "Kuruk", "Laki", "Lapis", "Leiko", "Lelu", "Lenok", "Lock", "Luc", "Lupo", "Mahalo", "Mahoi", "Mali", "Malo", "Maui", "Mem", "Masao", "Mau", "Miki", "Miro", "Molo", "Momo", "Nani", "Nanu", "Nofo", "Nono", "Nonolo", "Noriko", "Nuku", "Obi", "Okau", "Olu", "Ongo", "Paco", "Papago", "Papu", "Pepe", "Piku", "Polo", "Ponui", "Popo", "Popoki", "Rangi", "Rongo", "Saku", "Salak", "Samar", "Seven", "Solo", "Sulu", "Tabu", "Tafu", "Tamil", "Tappo", "Tapu", "Tarik", "Taro", "Tatau", "Tatoo", "Tepoto", "Tin", "Tobi", "Tocai", "Toki", "Tomil", "Top", "Torak", "Tutuni", "Uan", "Uru", "Wabu", "Wan", "Weeko", "Yap", "Yori", "Zuri"];
_local1.F = ["Aba", "Agate", "Aida", "Aika", "Aisha", "Aki", "Akika", "Alana", "Amaci", "Amina", "Aponi", "Atepa", "Aziza", "Baba", "Banga", "Bati", "Bes", "Beta", "Bibi", "Bindi", "Bixa", "Boga", "Bora", "Caia", "Cape", "Chimba", "Chirita", "City", "Coral", "Dada", "Ebi", "Ema", "Fatai", "Fiji", "Ginger", "Hakea", "Hawa", "Hebe", "Hika", "Hoya", "Huka", "Hula", "Huma", "Ikai", "Ima", "Itchi", "Jade", "Jem", "Kaana", "Kai", "Kaia", "Kaila", "Kaki", "Kalea", "Kali", "Kamea", "Kappa", "Kiki", "Kinga", "Kini", "Kiri", "Kissa", "Kiti", "Koa", "Kora", "Lakia", "Lala", "Latipa", "Lelei", "Lulu", "Luna", "Lupa", "Mali", "Mamba", "Mani", "Moma", "Mua", "Mucha", "Napuka", "Nina", "Nishi", "Noa", "Nunai", "Okai", "Onawa", "Paima", "Pana", "Papa", "Papaya", "Pinky", "Pippa", "Pita", "Pupa", "Puya", "Rapa", "Safari", "Sake", "Shuka", "Soda", "Suki", "Sun", "Sutai", "Tapa", "Tapiwa", "Tara", "Tarita", "Tatoa", "Thema", "Tipa", "Tiki", "Titta", "Tonga", "Topa", "Topaz", "Tuna", "Ulla", "Uma", "Unagi", "Vava", "Waiata", "Yucca", "Zea", "Zen", "Zola", "Zuna"];
n = _local1[gender];
return(n[Math.floor(Math.random() * n.length)]);
}
function PuzzleText(id) {
switch (id) {
case PUZZLE_FIRE :
return("<p align='center'>Fire</p>\nA villager discovered how to make fire! Crackling and warm, this foundation of life and progress provides comfort, health, and technological advantage... as long as your villagers can keep it burning.\n");
case PUZZLE_PLANTS :
return("<p align='center'>Herb Mastery</p>\nAfter thorough investigation of the local flora, your villagers mastered the use of Isola's indigenous herbs. Not only are healing powers improved, the variety of cooking herbs is increased.\n");
}
return("");
}
function HotSpotText(hs) {
var _local4 = CheckHotspotId(hs);
var _local3 = GetGame();
switch (_local4) {
case FIRE :
if (_local3.fire > 0) {
var _local1 = Math.floor((_local3.fire * TSCALE_ONE_YEAR) / 60000);
if (_local1 > 60) {
_local1 = Math.floor(_local1 / 60);
} else {
_local1 = _local1 + " min";
}
GameStatus("Hours remaining for fire: " + _local1);
}
break;
case FOOD_BASKET :
GameStatus("Food available to the villagers: " + _local3.food);
break;
case NEW_HUT :
var _local2 = GetTask(BUILDING_HUT);
if (_local2.progress < _local2.length) {
var _local5 = Math.floor((_local2.progress / _local2.length) * 55) + 45;
GameStatus("Percentage construction completed: " + _local5);
}
break;
case PLANT :
case PLANT1 :
case PLANT2 :
case PLANT3 :
case PLANT4 :
case PLANT5 :
var _local6 = (_local4 - PLANT) + STUDYING_PLANT;
_local2 = GetTask(BUILDING_HUT);
trace(_local2.progress);
break;
case SMALL_HUT :
_local2 = GetTask(REPAIRING_HUT);
if (_local2.progress >= _local2.length) {
break;
}
var _local5 = Math.floor((_local2.progress / _local2.length) * 100);
GameStatus("Percentage repair completed: " + _local5);
}
}
function HotSpotHint(char, hs) {
var _local2 = CheckHotspotId(hs);
var _local1 = GetHeShe(char, 1);
var _local3 = GetGame();
if ((char.age < AGE_TO_TEEN) && (_local2 != null)) {
GameStatus(_local1 + " looks excitedly at everything.");
return(undefined);
}
switch (_local2) {
case FIRE :
if (_local3.fire <= 0) {
if (_local3.wood > 0) {
GameStatus("There is no fire burning.");
} else {
GameStatus("This might be a good spot for a fire.");
}
} else {
GameStatus(_local1 + " sees the warm fire.");
}
break;
case ROCK_SUPPLY :
GameStatus(_local1 + " sees twisted pieces of wood and vines.");
break;
case BRIARS :
GameStatus(_local1 + " sees thick the patch of thorny bushes.");
break;
case RESEARCH_HUT :
case RESEARCH_TABLE :
GameStatus(_local1 + " could work on research here.");
break;
case RUINS :
GameStatus(_local1 + " sees something under the water.");
break;
case DEEP_WATERS :
GameStatus(_local1 + " sees the ocean.");
break;
case COCONUT_TREE :
case COCONUT_TREE1 :
case COCONUT_TREE2 :
if (GetTechLevel[FARMER] < 2) {
GameStatus(_local1 + " doesn't know how to climb yet.");
} else {
GameStatus(_local1 + " could climb for coconuts here.");
}
break;
case WOOD_SUPPLY :
GameStatus(_local1 + " sees dry wood.");
break;
case GRASS_SUPPLY :
GameStatus(_local1 + " sees very dry grass.");
break;
case WATERFALLS :
GameStatus(_local1 + " sees something down there but its too deep.");
break;
case NEW_HUT :
if (!IsTaskComplete(BUILDING_HUT)) {
GameStatus(_local1 + " could try to build here.");
}
break;
case SMALL_HUT :
if (!IsTaskComplete(REPAIRING_HUT)) {
GameStatus(_local1 + " could try to build here.");
}
break;
default :
GameStatus("");
}
}
function GetProfession(id) {
var _local1 = ["farmer", "builder", "scientist", "doctor", "parent"];
return(_local1[id]);
}
function GetHeShe(char, ucase) {
if (ucase == undefined) {
ucase = 0;
}
if (char.gender == "M") {
var _local2 = ["he", "He"];
} else {
var _local2 = ["she", "She"];
}
return(_local2[ucase]);
}
function GetHisHer(char, ucase) {
if (ucase == undefined) {
ucase = 0;
}
if (char.gender == "M") {
var _local2 = ["his", "His"];
} else {
var _local2 = ["her", "Her"];
}
return(_local2[ucase]);
}
function GetHimHer(char, ucase) {
if (ucase == undefined) {
ucase = 0;
}
if (char.gender == "M") {
var _local2 = ["him", "Him"];
} else {
var _local2 = ["her", "Her"];
}
return(_local2[ucase]);
}
function RandomLikes(char) {
var _local6 = ["Running", "Exploring", "Berries", "Lifting", "Swimming", "Flowers", "Bushes", "Resting", "Drums", "Rocks", "Caves", "Flies", "Crowds", "Jokes", "Monkeys", "Wind", "Fish", "Birds", "Butterflies", "Sunlight", "Dancing", "The Ocean", "Playing", "Work", "Fruit"];
var _local2 = new Array();
var _local1 = 0;
while (_local1 < 4) {
var _local4 = Math.random() * 100;
if (_local4 > 60) {
} else {
var _local3 = _local6[Math.floor(Math.random() * _local6.length)];
if (!InArray(_local2, _local3)) {
_local2.push(_local3);
}
}
_local1++;
}
char.likes = new Array();
char.dislikes = new Array();
_local1 = 0;
while (_local1 < _local2.length) {
var _local3 = _local2[_local1];
if (_local1 % 2) {
char.dislikes.push(_local3);
} else {
char.likes.push(_local3);
}
_local1++;
}
}
function SetTombText(dead) {
var _local3 = LangSkillDesc(dead);
var _local2 = LangSkill(dead);
dead.tombText = ((((((("<p align='center'>Here lies " + dead.name) + "<br/><br/>\"") + _local3) + "\"<br/><br/>Job:<br/>") + _local2) + "<br/>Age:") + Math.floor(dead.age)) + "</p>";
}
function CreatePopup(template, text, callback, x, y, w, h, clr, btns, alpha) {
if (!alpha) {
alpha = 100;
}
if (!clr) {
clr = "";
}
h = MinMax(h, 50, 400);
_root.attachMovie(template, "popup", 5000);
var _local2 = _root.popup;
if (!_local2) {
return(null);
}
if (!w) {
w = _local2._width;
}
if (!h) {
h = _local2._height;
}
if (x) {
_local2._x = x;
} else {
_local2._x = (SCREEN_WIDTH / 2) - (w / 2);
}
if (y) {
_local2._y = y;
} else {
_local2._y = (SCREEN_HEIGHT / 2) - (h / 2);
}
_local2.callback = callback;
_local2.text = text;
_local2.w = w;
_local2.h = h;
_local2.clr = clr;
_local2.btns = btns;
_local2.alpha = alpha;
ControlLock(true);
return(_local2);
}
function UpdateText(text, char, item) {
char = _global.eventChar;
var _local6 = char.name;
var _local9 = GetHeShe(char);
var _local4 = GetHisHer(char);
var _local8 = GetHimHer(char);
text = text.replace("*", _local6);
text = text.replace("^", _local9);
text = text.replace("~", _local4);
text = text.replace("+", _local8);
text = text.replace("`", "'");
text = text.replace("</", "#!");
text = text.replace("/", " ");
text = text.replace("#!", "</");
var _local5 = GetHeShe(char, 1);
var _local7 = GetHisHer(char, 1);
var _local10 = GetHimHer(char, 1);
text = text.replace("&", _local5);
text = text.replace("{!his}", _local7);
if (item) {
text = text.replace("#", item);
text = UpdateText(text, char);
}
return(text);
}
function CreateEventPopup(char) {
_global.eventChar = char;
if (_root.popup._visible) {
return(undefined);
}
var _local3 = xmlEvents.randomEvent();
if (!_local3) {
var _local10 = GetGame();
_local10.lastPopup15 = 0;
return(false);
}
var _local6 = _local3.prompt;
var _local8 = _local3.prompt.firstChild.toString();
var _local9 = GetChoiceItem(_local3.prompt);
var _local5 = (("<p align='center'>" + _local3.title) + "</p><br/><br/><br/>") + _local8;
_local5 = UpdateText(_local5, char, _local9.toString());
_local3.btns[0] = UpdateText(_local3.btns[0].toString(), char);
_local3.btns[1] = UpdateText(_local3.btns[1].toString(), char);
var _local7 = CreatePopup("popupEvent", _local5, onEventPopup, 0, 0, _local6.attributes.width, _local6.attributes.height, "O", _local3.btns);
if (!_local3.noChar) {
_local7.char = char;
}
_local3.char = char;
eventPopup = _local3;
return(true);
}
function onEventPopup(t) {
var _local1 = eventPopup;
var _local4 = "";
if (t) {
_local4 = _local1.btns[0];
var _local6 = _local1.choice1;
} else {
_local4 = _local1.btns[1];
var _local6 = _local1.choice2;
}
var _local2 = _local6[Rnd(_local6.length)];
_local1.res = _local2;
var _local8 = _local2.firstChild.toString();
var _local5 = GetChoiceItem(_local2);
if (_local5) {
_local1.res.effect = _local5;
}
var _local3 = (("<p align='center'>" + _local4) + "</p><br/><br/><br/>") + _local8;
_local3 = UpdateText(_local3, char, _local5.toString());
var _local7 = CreatePopup("popupEvent", _local3, onPopupCommit, 0, 0, _local2.attributes.width, _local2.attributes.height, "O", ["", "Ok"]);
if (!_local1.noChar) {
_local7.char = _local1.char;
}
}
function onPopupCommit() {
var _local4 = GetGame();
var _local2 = eventPopup;
var _local1 = _local2.res;
var _local3 = _local1.attributes.effect.toString();
if (_local1.effect) {
_local3 = _local1.effect.attributes.effect.toString();
}
doPopupEffect(_local2.char, _local3, _local1.attributes.value);
}
function doPopupEffect(char, effect, value) {
switch (effect) {
case "-age" :
char.age = MinMax(char.age * 0.6, 2, 98);
break;
case "+age" :
char.age = MinMax(char.age * 1.4, 2, 98);
break;
case "-skill!" :
CharLoseAllSkill(char);
break;
case "-skill" :
CharLoseSkill(char);
break;
case "+skill" :
CharAcquireSkill(char);
break;
case "-health" :
char.health = MinMax(char.health * 0.5, 5, 100);
break;
case "+health" :
char.health = MinMax(char.health * 1.5, 5, 100);
break;
case "-runner" :
char.run = false;
break;
case "+runner" :
char.run = true;
break;
case "-health!" :
AllHealth(Rnd(20) + 20);
break;
case "+health!" :
AllHealth(100);
break;
case "+farmer" :
CharToMaster(char, FARMER);
break;
case "+builder" :
CharToMaster(char, BUILDER);
break;
case "+scientist" :
CharToMaster(char, RESEARCHER);
break;
case "+parent" :
CharToMaster(char, BREEDER);
break;
case "+healer" :
CharToMaster(char, HEALER);
break;
case "+food" :
var _local3 = (2 + Rnd(5)) * 1000;
if (value) {
_local3 = value;
}
g.food = g.food + _local3;
break;
case "-food" :
_local3 = (2 + Rnd(5)) * 1000;
if (value) {
_local3 = value;
}
g.food = g.food - _local3;
break;
case "+tech" :
_local3 = (2 + Rnd(5)) * 1000;
if (value) {
_local3 = value;
}
g.tech = g.tech + _local3;
break;
case "-tech" :
_local3 = MinMax(g.tech * 0.6, 5, 100);
if (value) {
_local3 = value;
}
g.tech = g.tech - _local3;
break;
case "-person" :
break;
case "+person" :
_local3 = new Villager(2);
g.villagers.push(_local3);
if (!gamemap) {
break;
}
gameMap.addVillagerClip(_local3);
}
}
function RandomPopup() {
if (_root.popup._visible) {
return(undefined);
}
var _local3 = GetGame();
var _local2 = GetTimeStamp();
var _local6 = _local2 - _local3.lastPopup15;
var _local5 = _local2 - _local3.lastPopup240;
if (_local5 > (4 * ONE_HOUR)) {
_local3.lastPopup15 = _local2;
_local3.lastPopup240 = _local2;
} else if (_local6 > FIFTEEN_MINUTES) {
_local3.lastPopup15 = _local2;
} else {
return(undefined);
}
var _local4 = GetRandomVillager();
if (!_local4) {
return(undefined);
}
CreateEventPopup(_local4);
}
function ShowUpsell() {
var _local2 = "";
var _local1 = "<p align='center'>\nThis feature is not available on the web version of this game. The desktop version has all the features. Try it now!</p><br/>" + _local2;
var _local3 = CreatePopup("popupUpsell", _local1, null, 0, 0, 0, 220);
}
function BuyGame() {
getURL (UPSELL_BUY, UPSELL_TARGET);
}
function DownloadGame() {
getURL (UPSELL_DOWNLOAD, UPSELL_TARGET);
}
function HasPopup() {
return(_root.popup._visible == true);
}
function RemovePopup() {
ControlLock(false);
HideArrow();
_root.popup.removeMovieClip();
}
function GetChoiceItem(e) {
var _local1 = e.firstChild;
var _local2 = new Array();
while (_local1) {
if (_local1.nodeName == "item") {
_local2.push(_local1);
}
_local1 = _local1.nextSibling;
}
return(_local2[Rnd(_local2.length)]);
}
function GetCollectGfx() {
return(_root.gameMap.gfx.gfxObjcollect);
}
function IsCollectVisible() {
var _local1 = GetCollectGfx();
return((_local1._visible && (_local1._x != -500)) && (_local1._y != -500));
}
function HideCollect() {
var _local1 = GetCollectGfx();
_local1._x = -500;
_local1._y = -500;
}
function ShowCollectItem(i, j, x, y) {
if (i > 2) {
i = 2;
}
var _local1 = GetCollectGfx();
_local1._visible = true;
_local1.item1._visible = false;
_local1.item2._visible = false;
_local1.item3._visible = false;
_local1.item4._visible = false;
var _local2 = _local1["item" + i];
_local2._visible = true;
_local2.gotoAndStop(2 + j);
_local2._rotation = 40;
_local1.collectType = i;
_local1.collectItem = j;
_local1._x = x;
_local1._y = y;
}
function CollectTutorial() {
ShowCollectItem(2, 1, 800, 500);
var _local1 = GetCollectGfx();
var _local2 = new CPoint(_local1._x - 300, _local1._y - 300);
SetMapPos(_local2);
LoadMapPos();
ShowArrow("arrowRight", 360, 280);
}
function RandomCollect(force) {
if (force) {
g.lastCollect15 = 0;
}
var _local8 = GetCollectGfx();
if (IsCollectVisible()) {
return(undefined);
}
var g = GetGame();
var _local1 = GetTimeStamp();
var _local7 = _local1 - g.lastCollect15;
var _local5 = _local1 - g.lastCollect240;
if (_local5 > (4 * ONE_HOUR)) {
g.lastCollect15 = _local1;
g.lastCollect240 = _local1;
} else if (_local7 > FIFTEEN_MINUTES) {
g.lastCollect15 = _local1;
} else {
return(undefined);
}
var _local3 = 1 + Rnd(4);
var _local6 = Rnd(4);
var _local9 = GetHotspot(GetRandomOpenField());
var _local2 = RandomPointInRect(_local9.workarea);
ShowCollectItem(_local3, _local6, _local2.x, _local2.y);
var _local4 = _local8["item" + _local3];
_local4._rotation = -20 + Rnd(40);
}
function CommitCollect(char) {
var _local3 = GetGame();
var _local2 = GetCollectGfx();
if (!_local2) {
return(undefined);
}
HideCollect();
var _local1 = 0;
switch (_local2.collectType) {
case 1 :
_local1 = _local3.beetles;
break;
case 2 :
_local1 = _local3.shells;
break;
case 3 :
_local1 = _local3.pebbles;
break;
case 4 :
_local1 = _local3.butterflies;
}
if (_local1[_local2.collectItem] == 1) {
_local3.tech = _local3.tech + 300;
}
char.collectType = _local2.collectType;
char.collectItem = _local2.collectItem;
_local1[_local2.collectItem] = 1;
SaveGame();
}
function HasCollectible(type, item) {
var _local2 = GetGame();
var _local3 = GetCollectGfx();
if (!_local3._visible) {
return(false);
}
var _local1 = 0;
switch (_local3.collectType) {
case 1 :
_local1 = _local2.beetles;
break;
case 2 :
_local1 = _local2.shells;
break;
case 3 :
_local1 = _local2.pebbles;
break;
case 4 :
_local1 = _local2.butterflies;
}
return(_local1[_local3.collectItem] == 1);
}
function ShowArrow(template, x, y) {
if (template == null) {
return(undefined);
}
_root.attachMovie(template, "arrow", 5001);
var _local2 = _root.arrow;
_local2._x = x;
_local2._y = y;
}
function HideArrow() {
var _local2 = _root.arrow;
_local2.removeMovieClip();
SaveGame();
}
function IsHelpShown(id) {
var _local1 = GetGame();
return(_local1.helpShown[id] == true);
}
function NextHelp() {
if (HasPopup()) {
return(undefined);
}
var _local4 = GetGame();
var _local2 = GetCurrentHelp();
var _local3 = GetHelp(_local2);
if (_local3.attributes.type == "instruct") {
if (IsHelpShown(_local2 + 1)) {
_local4.helpIndex++;
} else if (!_global.firstHelpShown) {
ReplayLastHelp();
} else {
ShowReplayButton();
}
} else if (_local3.attributes.type == "info") {
if (IsHelpShown(_local2)) {
_local4.helpIndex++;
}
}
}
function GetCurrentHelp() {
var _local1 = GetGame();
return(_local1.helpIndex);
}
function GetHelp(id) {
return(xmlHelp.firstChild.findNode("help", id));
}
function ShowHelpForced(id) {
if (IsHelpShown(id)) {
return(false);
}
RemovePopup();
return(ShowHelp(id));
}
function ShowReplayButton() {
btnReplay._visible = false;
if (HasPopup()) {
return(undefined);
}
var _local3 = GetGame();
var _local2 = GetTimeStamp();
var _local1 = _local2 - _local3.lastHelp;
if (_local1 < (ONE_SECOND * TUTORIAL_REPLAY_DELAY)) {
return(false);
}
btnReplay._visible = true;
}
function ReplayLastHelp() {
var _local1 = GetCurrentHelp();
var _local2 = GetHelp(_local1);
if (_local2) {
if (_local2.attributes.type == "instruct") {
var _local3 = GetGame();
_local3.helpShown[_local1] = false;
}
}
btnReplay._visible = false;
}
function ShowHelp(id) {
if (id == 29) {
g.helpIndex = 31;
return(false);
}
var g = GetGame();
if (!g.help) {
return(false);
}
if (HasPopup()) {
return(false);
}
if (id > 32) {
ShowHelpForced("Final");
return(false);
}
if (IsHelpShown(id)) {
NextHelp();
return(false);
}
var _local4 = GetHelp(id);
if (!_local4) {
return(false);
}
var _local6 = _local4.attributes.height;
var _local7 = Math.round(_local6 / 48) * 48;
var _local5 = 148;
if (!_root.gameMap) {
_local5 = 100;
}
CreatePopup("popupTipOk", _local4, onHelpOk, _local5, 1, 0, _local7);
ShowHelpArrow(id);
g.helpShown[id] = true;
g.lastHelp = GetTimeStamp();
_global.firstHelpShown = true;
if (id == 23) {
CollectTutorial();
}
return(true);
}
function UpdateHelp() {
var _local1 = GetGame();
if (!_local1.help) {
return(false);
}
btnReplay._visible = false;
if (HasPopup()) {
return(false);
}
var _local3 = GetTimeStamp();
var _local2 = _local3 - _local1.lastHelp;
if (_local2 < (ONE_SECOND * TUTORIAL_DELAY)) {
return(false);
}
ShowHelp(_local1.helpIndex);
}
function DisableHelp(id) {
var _local1 = GetGame();
_local1.helpShown[id] = true;
}
function DelayHelp(t) {
var _local1 = GetGame();
_local1.lastHelp = GetTimeStamp() + (ONE_SECOND * t);
}
function onHelpOk() {
HideArrow();
var _local1 = GetGame();
_local1.lastHelp = GetTimeStamp();
}
function ShowHelpArrow(id) {
switch (id) {
case "Welcome" :
ShowArrow("arrowLeft", 400, 140);
break;
case 1 :
ShowArrow("arrowLeft", 360, 260);
break;
case 4 :
ShowArrow("arrowLeft", 420, 360);
break;
case 7 :
SetMapPos(new CPoint(20, 20));
LoadMapPos();
ShowArrow("arrowLeft", 260, 300);
break;
case 9 :
SetMapPos(new CPoint(400, 120));
LoadMapPos();
ShowArrow("arrowLeft", 460, 260);
break;
case 11 :
ShowArrow("arrowLeft", 120, 320);
break;
case 13 :
SetMapPos(new CPoint(0, 780));
LoadMapPos();
ShowArrow("arrowLeft", 300, 280);
break;
case 15 :
SetMapPos(new CPoint(0, 0));
LoadMapPos();
ShowArrow("arrowLeft", 340, 20);
_root.popup._y = 210;
break;
case 17 :
SetMapPos(new CPoint(340, 320));
LoadMapPos();
ShowArrow("arrowLeft", 390, 280);
break;
case 19 :
ShowArrow("arrowLeft", 130, 260);
break;
case 25 :
ShowArrow("arrowLeft", 120, 360);
break;
case 27 :
SetMapPos(new CPoint(200, 240));
LoadMapPos();
ShowArrow("arrowRight", 290, 220);
break;
case 31 :
ShowArrow("arrowRight", 420, 360);
}
}
function Action(animation, param1, param2, comment, extra) {
this.animation = animation;
this.counter = 0;
this.length = 0;
this.down = false;
switch (animation) {
case ACTION_CLIMB :
this.down = param2;
case ACTION_JUMP :
case ACTION_WALK :
this.area = param1;
this.item = param2;
break;
case ACTION_STAND :
case ACTION_SIT :
case ACTION_COMMIT :
case ACTION_CROUCH :
case ACTION_WORK :
this.work = param1;
if (param2 == undefined) {
break;
}
this.length = param2;
}
this.comment = comment;
this.path = extra;
this.wait = extra;
}
function ClearCurrentAction(char) {
char.aim = null;
char.path = null;
char.action = null;
char.actionQueue.shift();
}
function ClearActions(char, task) {
if (char.buryWho) {
SetTombText(char.buryWho);
char.buryWho = 0;
}
if (task != null) {
char.task = task;
}
char.workDone = 0;
char.aim = null;
char.path = null;
char.action = null;
char.actionQueue = new Array();
}
function GenerateActions(char) {
var _local7 = GetGame();
var _local5 = GetTask(char.task);
if (_local5) {
if ((_local5.progress >= _local5.length) && (_local5.length > 1)) {
char.task = NOTHING;
}
}
var _local8 = char.task;
var _local1 = new Array();
switch (_local8) {
case HARVESTING_COCONUT :
if (GetTechLevel(FARMER) < 2) {
_local1.push(0);
} else {
var _local6 = GetRandomCoconutTree();
_local1.push(new Action(ACTION_WALK, _local6));
_local1.push(new Action(ACTION_WORK, NOTHING, 0));
_local1.push(new Action(ACTION_CLIMB, _local6));
_local1.push(new Action(ACTION_WORK, NOTHING, 10));
_local1.push(new Action(ACTION_CLIMB, _local6, true));
_local1.push(new Action(ACTION_WORK, NOTHING, 0));
_local1.push(new Action(ACTION_WALK, FOOD_BASKET, ITEM_COCONUT));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0));
_local1.push(new Action(ACTION_COMMIT, HARVESTING_COCONUT));
break;
}
case FISHING :
if (IsHelpShown(7)) {
ShowHelpForced("FishingWait");
}
var _local11 = ITEM_FISH;
if (Rnd(100) > 50) {
_local11 = ITEM_CRAB;
}
_local1.push(new Action(ACTION_WALK, DEEP_WATERS));
_local1.push(new Action(ACTION_WALK, DEEP_WATERS));
_local1.push(new Action(ACTION_DIVE, NOTHING, 50));
_local1.push(new Action(ACTION_WALK, FOOD_BASKET, _local11));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0));
_local1.push(new Action(ACTION_COMMIT, FISHING));
break;
case ENJOYING_POND :
var _local4 = "Enjoying the pond";
_local1.push(new Action(ACTION_WALK, WATERFALLS, 0, _local4));
_local1.push(new Action(ACTION_WALK, WATERFALLS, 0, _local4));
if (Rnd(100) > 80) {
_local1.push(new Action(ACTION_WALK, POND_DIVE1, 0, _local4));
_local1.push(new Action(ACTION_WALK, POND_DIVE2, 0, _local4));
_local1.push(new Action(ACTION_WALK, POND_DIVE3, 0, _local4));
_local1.push(new Action(ACTION_WALK, POND_DIVE4, 0, _local4));
_local1.push(new Action(ACTION_WALK, POND_DIVE5, 0, _local4));
_local1.push(new Action(ACTION_WALK, POND_DIVE6, 0, _local4));
_local1.push(new Action(ACTION_JUMP, POND_DIVE7, 0, _local4));
} else {
_local1.push(new Action(ACTION_WALK, WATERFALLS, 0, _local4));
}
_local1.push(0);
break;
case ENJOYING_BEACH :
_local4 = "Relaxing at the beach";
if (char.ageToBirth > 0) {
_local4 = "Showing baby the ocean";
}
_local1.push(new Action(ACTION_WALK, GetRandomWhiteSand(), 0, _local4));
_local1.push(RandomStand(_local4));
_local1.push(new Action(ACTION_WALK, GetRandomWhiteSand(), 0, _local4));
_local1.push(RandomSit(_local4));
_local1.push(0);
trace("beach!");
break;
case WASHING_BABY :
_local4 = "Washing baby";
_local1.push(new Action(ACTION_WALK, GetRandomStream(), 0, _local4));
_local1.push(RandomStand(_local4));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0, _local4));
_local1.push(RandomSit(_local4));
_local1.push(0);
trace("washing!");
break;
case CHANGING_BABY :
_local4 = "Changing baby";
_local1.push(new Action(ACTION_WALK, GetRandomOpenField(), 0, _local4));
_local1.push(RandomStand(_local4));
_local1.push(new Action(ACTION_WALK, GetRandomOpenField(), 0, _local4));
_local1.push(RandomSit(_local4));
_local1.push(0);
trace("changing!");
break;
case ENJOYING_STREAM :
_local4 = "Cooling feet in stream";
_local1.push(new Action(ACTION_WALK, GetRandomStream(), 0, _local4));
_local1.push(RandomStand(_local4));
_local1.push(new Action(ACTION_WALK, GetRandomStream(), 0, _local4));
_local1.push(RandomSit(_local4));
_local1.push(0);
break;
case STUDYING_PLANT :
case STUDYING_PLANT1 :
case STUDYING_PLANT2 :
case STUDYING_PLANT3 :
case STUDYING_PLANT4 :
case STUDYING_PLANT5 :
_local4 = "Studying strange plant";
var _local13 = (_local8 - STUDYING_PLANT) + PLANT;
_local1.push(new Action(ACTION_WALK, _local13, 0, _local4));
_local1.push(new Action(ACTION_WORK, NOTHING, 30, _local4));
_local1.push(new Action(ACTION_WORK, NOTHING, 30, _local4));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 70, _local4));
_local1.push(new Action(ACTION_WORK, NOTHING, 30, _local4));
_local1.push(new Action(ACTION_COMMIT, _local8));
_local1.push(0);
break;
case RESEARCHING :
if (IsHelpShown(9)) {
ShowHelpForced("ResearchWait");
}
_local1.push(new Action(ACTION_WALK, RESEARCH_TABLE));
_local1.push(new Action(ACTION_WORK, NOTHING, 0));
_local1.push(new Action(ACTION_WORK, NOTHING, 30));
_local1.push(new Action(ACTION_COMMIT, RESEARCHING));
_local1.push(new Action(ACTION_WALK, RESEARCH_TABLE));
_local1.push(new Action(ACTION_WORK, NOTHING, 40));
break;
case GOING_INDOORS :
_local4 = "Going indoors";
_local1.push(new Action(ACTION_WALK, SMALL_HUT, 0, _local4));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0, _local4));
_local1.push(new Action(ACTION_HIDE, NOTHING, 50, "..."));
_local1.push(0);
break;
case GATHERING_WOOD :
_local4 = "Gathering wood";
_local1.push(new Action(ACTION_WALK, WOOD_SUPPLY, null, _local4));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0, _local4));
_local1.push(new Action(ACTION_WALK, FIRE, ITEM_LOG, _local4));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0, _local4));
_local1.push(new Action(ACTION_COMMIT, GATHERING_WOOD, null, _local4));
_local1.push(0);
break;
case GATHERING_GRASS :
_local4 = "Gathering grass";
_local1.push(new Action(ACTION_WALK, GRASS_SUPPLY, null, _local4));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0, _local4));
_local1.push(new Action(ACTION_WALK, FIRE, ITEM_GRASS, _local4));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0, _local4));
_local1.push(new Action(ACTION_COMMIT, GATHERING_GRASS, null, _local4));
_local1.push(0);
break;
case LIGHTING_FIRE :
_local4 = "Starting a fire";
_local1.push(new Action(ACTION_WORK, NOTHING, 0, _local4));
_local1.push(new Action(ACTION_COMMIT, LIGHTING_FIRE, null, _local4));
_local1.push(0);
break;
case BREEDING :
_local1.push(new Action(ACTION_WALK, OPEN_FIELD, ITEM_BABY));
_local1.push(new Action(ACTION_WALK, OPEN_FIELD, ITEM_BABY));
_local1.push(new Action(ACTION_STAND, NOTHING, 100 + Rnd(500)));
_local1.push(0);
break;
case OPENING_CRATE :
_local1.push(new Action(ACTION_WALK, GetRandomOpenField(), 0, "Confused"));
_local1.push(0);
break;
case REPAIRING_HUT :
_local1.push(new Action(ACTION_WALK, SMALL_HUT));
_local1.push(new Action(ACTION_CROUCH, REPAIRING_HUT));
_local1.push(new Action(ACTION_WORK, REPAIRING_HUT));
_local1.push(new Action(ACTION_COMMIT, REPAIRING_HUT));
if (Rnd(10) > 5) {
_local1.push(new Action(ACTION_WALK, ROCK_SUPPLY));
_local1.push(new Action(ACTION_CROUCH));
_local1.push(new Action(ACTION_WALK, SMALL_HUT, ITEM_ROCK));
} else {
_local1.push(new Action(ACTION_WALK, WOOD_SUPPLY));
_local1.push(new Action(ACTION_CROUCH));
_local1.push(new Action(ACTION_WALK, SMALL_HUT, ITEM_LOG));
}
break;
case BUILDING_HUT :
if (IsHelpShown(27) && (char.skills[BUILDER] >= LEVEL_ADEPT)) {
ShowHelpForced(28);
}
_local1.push(new Action(ACTION_WALK, NEW_HUT));
_local1.push(new Action(ACTION_CROUCH, BUILDING_HUT));
_local1.push(new Action(ACTION_WORK, BUILDING_HUT));
_local1.push(new Action(ACTION_COMMIT, BUILDING_HUT));
if (Rnd(10) > 5) {
_local1.push(new Action(ACTION_WALK, ROCK_SUPPLY));
_local1.push(new Action(ACTION_CROUCH));
_local1.push(new Action(ACTION_WALK, NEW_HUT, ITEM_ROCK));
} else {
_local1.push(new Action(ACTION_WALK, WOOD_SUPPLY));
_local1.push(new Action(ACTION_CROUCH));
_local1.push(new Action(ACTION_WALK, NEW_HUT, ITEM_LOG));
}
break;
case EATING :
if ((char.health < 100) && (_local7.food > 10)) {
trace("eating");
_local4 = "Eating";
_local1.push(new Action(ACTION_WALK, FOOD_BASKET, 0, _local4));
_local1.push(new Action(ACTION_WORK, NOTHING, 60, _local4));
_local4 = "|The villager feels better after eating.";
_local1.push(new Action(ACTION_WALK, FOOD_BASKET, 0, _local4));
_local1.push(new Action(ACTION_WALK, FOOD_BASKET, 0, _local4));
char.health = MinMax((char.health = char.health + 2), 5, 100);
_local7.food = _local7.food - FOOD_CONSUMPTION;
}
_local1.push(new Action(ACTION_WALK, OPEN_FIELD, 0));
_local1.push(0);
break;
case CONFUSED :
_local1.push(new Action(ACTION_WALK, GetRandomOpenField(), 0, "Confused"));
_local1.push(0);
GameStatus("Perhaps more research is needed.");
break;
case RUNNING_AWAY :
_local1.push(new Action(ACTION_WALK, GetRandomOpenField(), 0, "Running away"));
_local1.push(0);
break;
case PLAYING_TAG :
PlayChildren(char, char);
trace("playing");
return(undefined);
case COLLECT_ITEM :
_local4 = "Collecting a new common item.";
if (HasCollectible()) {
_local4 = "Collecting an item for the scientist.";
}
if (IsHelpShown(23)) {
ShowHelpForced(24);
}
_local1.push(new Action(ACTION_CROUCH));
_local1.push(new Action(ACTION_COMMIT, COLLECT_ITEM, _local4));
_local1.push(new Action(ACTION_WALK, RESEARCH_TABLE, ITEM_COLLECT, _local4, new Array(new CPoint(580, 431))));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0, _local4));
_local1.push(new Action(ACTION_HIDE, NOTHING, 50, _local4));
_local1.push(0);
break;
case NOTHING :
default :
var _local9 = [GetRandomOpenField(), GetRandomWhiteSand(), GetRandomPlant(), RUINS];
var _local10 = ["Nothing", "Unsure what to do"];
if (_local7.food <= FOOD_LOW_LEVEL) {
var _local2 = 0;
while (_local2 < 10) {
_local10.push("Worried about food");
_local2++;
}
}
if (char.age < AGE_TO_TEEN) {
_local10 = ["Chasing butterflies", "Running", "Nothing"];
}
var _local12 = _local10[Math.floor(Math.random() * _local10.length)];
_local1.push(new Action(ACTION_WALK, _local9[Math.floor(Math.random() * _local9.length)], 0, _local12));
_local1.push(new Action(ACTION_WALK, GetRandomOpenField()));
_local1.push(RandomStand());
_local1.push(0);
RandomTask(char);
}
char.actionQueue = _local1;
}
function CuriousQueue(queue, text, area) {
var _local1 = 0;
while (_local1 < 3) {
queue.push(new Action(ACTION_WALK, area, 0, text));
_local1++;
}
queue.push(new Action(ACTION_WORK, NOTHING, 10, text));
queue.push(new Action(ACTION_WALK, GetRandomOpenField()));
queue.push(0);
}
function ShakeHead(char) {
var _local3 = char.actionQueue[0];
ClearActions(char);
_local3.length = 20 + (Math.random() * 10);
var _local1 = ["Shaking head", "Nothing"];
if (char.age < AGE_TO_ADULT) {
_local1.push("Complaining");
}
var _local4 = _local1[Math.floor(Math.random() * _local1.length)];
char.actionQueue = new Array(_local3, new Action(ACTION_WALK, GetRandomOpenField(), null, _local4));
}
function Celebrate(except) {
var _local9 = GetGame();
var _local8 = _local9.villagers;
var _local5 = "Celebrating";
var _local4 = 0;
while (_local4 < _local8.length) {
var _local2 = _local8[_local4];
if (_local2 == except) {
} else {
_local2.path = new Array(CopyPoint(_local2.pos));
var _local3 = new Array();
var _local1 = 0;
while (_local1 < 4) {
_local3.push(new Action(ACTION_WALK, GetTaskLocation(except.task), 0, _local5));
_local1++;
}
var _local7 = GetTimeStamp() + (ONE_SECOND * 30);
_local3.push(new Action(ACTION_STAND, 0, 50, _local5, _local7));
_local2.actionQueue = _local3;
}
_local4++;
}
SaveGame();
}
function RandomStand(t) {
if (!t) {
t = "";
}
return(new Action(ACTION_STAND, NOTHING, 10 + Rnd(50), t));
}
function RandomSit(t) {
if (!t) {
t = "";
}
if (Rnd(100) > 80) {
return(RandomStand(t));
}
return(new Action(ACTION_SIT, NOTHING, 10 + Rnd(50), t));
}
function PlayChildren(child1, child2) {
if ((child1.age >= AGE_TO_TEEN) || (child2.age >= AGE_TO_TEEN)) {
return(false);
}
var _local9 = GetRandomOpenField();
var _local10 = GetHotspot(_local9);
var _local14 = GetGame();
var _local11 = _local14.villagers;
var _local4 = new Array(new CPoint(758, 592), new CPoint(636, 763), new CPoint(478, 756), new CPoint(293, 438), new CPoint(342, 345), new CPoint(565, 269), new CPoint(778, 328), new CPoint(815, 445));
var _local6 = 0;
while (_local6 < _local11.length) {
var _local5 = _local11[_local6];
if (_local5.age >= AGE_TO_TEEN) {
} else {
ClearActions(_local5);
var _local2 = new Array();
var _local8 = GetTimeStamp() + (ONE_SECOND * 30);
var _local3 = "Playing";
_local2.push(new Action(ACTION_WALK, _local9, 0, _local3));
_local2.push(new Action(ACTION_WALK, _local9, 0, _local3, new Array(new CPoint(_local10.workarea.left + Rnd(40), _local10.workarea.top + Rnd(40)))));
_local2.push(new Action(ACTION_STAND, 0, 50, _local3, _local8));
if (child1 != child2) {
_local3 = "Playing tag";
}
_local2.push(new Action(ACTION_WALK, OPEN_FIELD, 0, _local3));
var _local7 = new Array();
var _local1 = 0;
while (_local1 < _local4.length) {
_local7.push(new CPoint(_local4[_local1].x, _local4[_local1].y));
_local1++;
}
_local2.push(new Action(ACTION_WALK, OPEN_FIELD, 0, _local3, _local7));
_local2.push(new Action(ACTION_WALK, OPEN_FIELD, 0, _local3));
_local2.push(new Action(ACTION_STAND, 0, 50, _local3));
_local2.push(0);
_local5.actionQueue = _local2;
}
_local6++;
}
return(true);
}
function HealSick(healer, sick) {
if (sick.health > 70) {
return(false);
}
ClearActions(healer);
ClearActions(sick);
healer.actionQueue = new Array(new Action(ACTION_STAND, NOTHING, 100, "Healing the sick"));
healer.pos.x = sick.pos.x - 15;
healer.pos.y = sick.pos.y + 10;
healer.actionQueue = new Array(new Action(ACTION_SIT, NOTHING, 100, "Resting"));
}
function Embrace(child1, child2) {
var _local1 = "Embracing";
ClearActions(child1);
ClearActions(child2);
child1.actionQueue = new Array(new Action(ACTION_STAND, NOTHING, 20, _local1));
child1.pos.x = child2.pos.x - 15;
child1.pos.y = child2.pos.y + 10;
child2.actionQueue = new Array(new Action(ACTION_STAND, NOTHING, 20, _local1));
return(true);
}
function Educate(teacher, student) {
if (student.age >= AGE_TO_TEEN) {
return(false);
}
if (teacher.age < AGE_TO_ADULT) {
if (teacher.age >= AGE_TO_TEEN) {
return(Embrace(teacher, student));
}
return(false);
}
var _local13 = TotalSkills(teacher);
var _local11 = "";
var _local6 = "";
if (_local13 > 20) {
_local11 = "Telling a story";
_local6 = "Listening to a story";
} else if (_local13 > 100) {
_local11 = "Telling a lesson";
_local6 = "Learning a lesson";
} else {
return(Embrace(teacher, student));
}
var _local8 = 200 + Rnd(50);
var _local5 = 558;
var _local12 = 812;
ClearActions(teacher);
var _local3 = new Array();
_local3.push(new Action(ACTION_WALK, OPEN_FIELD, 0, _local11, new Array(new CPoint(_local5, _local12))));
_local3.push(new Action(ACTION_STAND, NOTHING, _local8, _local11));
teacher.actionQueue = _local3;
teacher.dir = DIR_EAST;
var _local4 = _local5;
var _local9 = _local12 - 20;
var _local15 = GetGame();
var _local7 = _local15.villagers;
var _local2 = 0;
while (_local2 < _local7.length) {
var _local1 = _local7[_local2];
if (_local1.age < AGE_TO_TEEN) {
ClearActions(_local1);
_local3 = new Array();
_local3.push(new Action(ACTION_WALK, OPEN_FIELD, 0, _local6, new Array(new CPoint(_local4, _local9))));
_local3.push(new Action(ACTION_SIT, NOTHING, 50 + _local8, _local6));
_local1.actionQueue = _local3;
_local4 = _local4 + 20;
if (_local4 > (_local5 + 200)) {
_local4 = _local5;
}
}
_local2++;
}
return(true);
}
function Bury(priest, dead) {
var _local11 = 880;
var _local10 = 120;
var _local4 = 0;
var _local13 = GetGame();
var _local3 = _local13.villagers;
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if ((_local2.health <= 0) && (_local2.buried == true)) {
_local4++;
}
_local1++;
}
var _local7 = Math.floor(_local4 / 10);
var _local12 = _local4 - (_local7 * 10);
dead.pos = new CPoint(_local11 + (_local12 * 25), _local10 + (_local7 * 20));
dead.buried = true;
ClearActions(priest);
var _local6 = "Burying the dead";
var _local5 = new Array();
_local5.push(new Action(ACTION_WALK, BURIAL_GROUNDS, ITEM_SKELS, _local6));
_local5.push(new Action(ACTION_WALK, OPEN_FIELD, ITEM_SKELS, _local6, new Array(dead.pos)));
_local5.push(new Action(ACTION_CROUCH, NOTHING, 0, _local6));
_local5.push(new Action(ACTION_COMMIT, BURYING_DEAD, 0, _local6));
_local5.push(0);
priest.task = BURYING_DEAD;
priest.actionQueue = _local5;
priest.buryWho = dead;
}
function GameData() {
this.villagers = InitVillagers();
this.tech = 99;
this.food = 225;
this.coconuts = 2000;
this.fish = 2000;
this.wood = 0;
this.grass = 0;
this.fire = 0;
this.beetles = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
this.shells = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
this.pebbles = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
this.butterflies = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
this.puzzles = new Array();
this.plants = new Array();
this.tasks = InitTasks();
this.techs = new Array(1, 1, 1, 1, 1, 1);
this.startTime = GetTimeStamp();
this.lastSave = GetTimeStamp();
this.lastUpdate = GetTimeStamp();
this.lastPopup15 = GetTimeStamp();
this.lastPopup240 = GetTimeStamp();
this.lastCollect15 = GetTimeStamp();
this.lastCollect240 = GetTimeStamp();
this.mapPos = new CPoint(-740, -380);
this.statusText = "Welcome to Virtual Villagers.";
this.intro = false;
this.sound = 50;
this.music = 50;
this.lastHelp = GetTimeStamp();
this.help = false;
this.helpIndex = 1;
this.helpShown = new Array();
}
function CreateGame() {
var _local1 = SharedObject.getLocal(SHARED_OBJECT);
_local1.clear();
return(new GameData());
}
function NewGame(intro, help) {
_global.game = CreateGame();
var _local2 = GetGame();
_local2.intro = intro;
_local2.help = help;
SaveGame();
}
function LoadGame() {
var _local1 = SharedObject.getLocal(SHARED_OBJECT);
if (_local1.data.version != VERSION) {
_local1.clear();
delete _local1.data.game;
}
if (_local1.data.game == undefined) {
return(CreateGame());
}
ClearAllActions();
return(_local1.data.game);
}
function SaveGame() {
var _local1 = SharedObject.getLocal(SHARED_OBJECT);
_local1.data.game = GetGame();
_local1.data.version = VERSION;
if (!_local1.flush()) {
System.showSettings(1);
return(false);
}
return(true);
}
function GetGame() {
return(_global.game);
}
function GetVillagerIndex(v) {
var _local4 = GetGame();
var _local2 = _local4.villagers;
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1] == v) {
return(_local1);
}
_local1++;
}
return(null);
}
function UpdateGame() {
if (_root.gameMap._visible) {
UpdateEvents();
UpdateHelp();
RandomPopup();
RandomCollect();
}
var _local6 = GetGame();
var _local7 = GetTimeStamp();
if (_local6.lastUpdate == 0) {
_local6.lastUpdate = _local7;
}
var _local4 = _local7 - _local6.lastUpdate;
var _local9 = false;
var _local8 = false;
if (_local4 < UPDATE_INTERVAL) {
return(undefined);
}
if (_local4 > DORMANT) {
_local8 = true;
}
if (_local4 > ONE_HOUR) {
_local9 = true;
_local4 = ONE_HOUR;
}
_local6.lastUpdate = _local6.lastUpdate + _local4;
if (_local8) {
_local6.lastUpdate = GetTimeStamp();
}
_local6.fire = _local6.fire - (_local4 / TSCALE_ONE_YEAR);
var _local5 = _local6.villagers;
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2];
UpdateVillager(_local3, _local4);
_local2++;
}
_local4 = _local7 - _local6.lastSave;
if (_local4 > ONE_MINUTE) {
_local6.lastSave = _local7;
var _local10 = Math.random() * 100;
if (_local10 > 80) {
SaveGame();
}
}
}
function UpdateBackground() {
var _local4 = GetGame();
var _local5 = _local4.villagers;
var _local7 = 0;
var _local6 = 0;
var _local3 = 0;
while (_local3 < _local5.length) {
var _local1 = _local5[_local3];
if (_local1.skill == FARMER) {
_local4.food = _local4.food + 4;
}
if (_local1.skill == RESEARCHER) {
_local4.tech = _local4.tech + 4;
}
var _local2 = GetTask(_local1.task);
if ((_local2.progress + 10) < _local2.length) {
_local2.progress = _local2.progress + 4;
}
if (_local1.health <= 96) {
if (_local4.food > FOOD_OK_LEVEL) {
_local1.health++;
}
if (_local4.food > FOOD_ABUNDANT_LEVEL) {
_local1.health = _local1.health + 2;
}
}
_local3++;
}
}
function GameStatus(s) {
var _local1 = GetGame();
_local1.statusText = s;
}
_global.VERSION = 2.1;
_global.SHARED_OBJECT = "virtualvillagers" + VERSION;
_global.SCREEN_WIDTH = 580;
_global.SCREEN_HEIGHT = 450;
_global.DEBUG = 0;
_global.AMBIENT = 1;
if (DEBUG) {
_global.TRACE_MOUSE = 1;
_global.TRACE_PATH = 1;
_global.SHOW_PATHS = 1;
}
_global.ONE_SECOND = 1000;
_global.FIVE_SECONDS = 1 * ONE_SECOND;
_global.ONE_MINUTE = 60 * ONE_SECOND;
_global.FIVE_MINUTES = ONE_MINUTE * 5;
_global.TEN_MINUTES = ONE_MINUTE * 10;
_global.FIFTEEN_MINUTES = ONE_MINUTE * 15;
_global.TWENTY_MINUTES = ONE_MINUTE * 20;
_global.ONE_HOUR = ONE_MINUTE * 60;
_global.ONE_DAY = ONE_HOUR * 24;
_global.DORMANT = ONE_DAY * 2;
_global.UPDATE_INTERVAL = ONE_MINUTE;
_global.TUTORIAL_DELAY = 3;
_global.TUTORIAL_REPLAY_DELAY = 60;
_global.TSCALE_ONE_YEAR = ONE_HOUR;
_global.TSCALE_SIX_MONTHS = TSCALE_ONE_YEAR / 2;
_global.AGE_TO_BIRTH = 1;
_global.AGE_TO_TEEN = 14;
_global.AGE_TO_ADULT = 18;
_global.AGE_TO_ELDERLY = 50;
_global.AGE_TO_MORTALITY = 60;
_global.FIRE_HOURS = 20;
_global.FOOD_CONSUMPTION = 2;
_global.FOOD_LOW_LEVEL = 50;
_global.FOOD_OK_LEVEL = 400;
_global.FOOD_ABUNDANT = 2000;
_global.CHANCE_HEAL = 50;
_global.CHANCE_DISEASE_DAMAGE = 70;
_global.CHANCE_STARVE_DAMAGE = 75;
_global.HEALTH_MERCY = 20;
_global.STAND_SPEED = 0.8;
_global.WALK_SPEED = 1.5;
_global.RUN_SPEED = 6;
_global.SCROLL_LENGTH = 10;
_global.SCROLL_SPEED = 8;
var DIR_EAST = 0;
var DIR_SOUTH = 1;
var DIR_WEST = 2;
var DIR_NORTH = 3;
_global.NOWHERE = 0;
_global.OPEN_FIELD = 1;
_global.OPEN_FIELD1 = 2;
_global.OPEN_FIELD2 = 3;
_global.OPEN_FIELD3 = 4;
_global.WHITE_SAND = 5;
_global.WHITE_SAND1 = 6;
_global.WHITE_SAND2 = 7;
_global.WHITE_SAND3 = 8;
_global.FOOD_BASKET = 9;
_global.COCONUT_TREE = 10;
_global.COCONUT_TREE1 = 11;
_global.COCONUT_TREE2 = 12;
_global.RESEARCH_HUT = 13;
_global.RESEARCH_TABLE = 14;
_global.SMALL_HUT = 15;
_global.NEW_HUT = 16;
_global.ROCK_SUPPLY = 17;
_global.WOOD_SUPPLY = 18;
_global.GRASS_SUPPLY = 19;
_global.DEEP_WATERS = 20;
_global.WATERFALLS = 21;
_global.STREAM = 22;
_global.STREAM1 = 23;
_global.STREAM2 = 24;
_global.POND_DIVE1 = 25;
_global.POND_DIVE2 = 26;
_global.POND_DIVE3 = 27;
_global.POND_DIVE4 = 28;
_global.POND_DIVE5 = 29;
_global.POND_DIVE6 = 30;
_global.POND_DIVE7 = 31;
_global.FIRE = 32;
_global.RUINS = 33;
_global.CRATE = 34;
_global.COCONUT = 35;
_global.BRIARS = 36;
_global.PLANT = 37;
_global.PLANT1 = 38;
_global.PLANT2 = 39;
_global.PLANT3 = 40;
_global.PLANT4 = 41;
_global.PLANT5 = 42;
_global.CLIFF = 44;
_global.BURIAL_GROUNDS = 45;
_global.WAVES = 50;
_global.WATERSPRAY = 51;
_global.NOTHING = 0;
_global.STORING_FOOD = 1;
_global.HARVESTING_COCONUT = 2;
_global.RESEARCHING = 3;
_global.BREEDING = 4;
_global.GOING_INDOORS = 5;
_global.BUILDING_HUT = 6;
_global.FISHING = 7;
_global.ENJOYING_POND = 8;
_global.ENJOYING_BEACH = 9;
_global.ENJOYING_STREAM = 10;
_global.EATING = 11;
_global.GATHERING_WOOD = 12;
_global.GATHERING_GRASS = 13;
_global.LIGHTING_FIRE = 14;
_global.COLLECT_ITEM = 15;
_global.OPENING_CRATE = 16;
_global.WASHING_BABY = 17;
_global.CHANGING_BABY = 18;
_global.REPAIRING_HUT = 19;
_global.STUDYING_PLANT = 20;
_global.STUDYING_PLANT1 = 21;
_global.STUDYING_PLANT2 = 22;
_global.STUDYING_PLANT3 = 23;
_global.STUDYING_PLANT4 = 24;
_global.STUDYING_PLANT5 = 25;
_global.BURYING_DEAD = 26;
_global.PLAYING_TAG = 27;
_global.RUNNING_AWAY = 29;
_global.CONFUSED = 30;
_global.ACTION_NOTHING = 0;
_global.ACTION_WALK = 1;
_global.ACTION_CROUCH = 2;
_global.ACTION_WORK = 3;
_global.ACTION_SIT = 4;
_global.ACTION_COMMIT = 5;
_global.ACTION_STAND = 6;
_global.ACTION_CLIMB = 7;
_global.ACTION_JUMP = 8;
_global.ACTION_DIVE = 9;
_global.ACTION_HIDE = 10;
_global.PUZZLE_FIRE = 0;
_global.PUZZLE_PLANTS = 1;
_global.ITEM_ROCK = 2;
_global.ITEM_BABY = 3;
_global.ITEM_LOG = 4;
_global.ITEM_FISH = 5;
_global.ITEM_CRAB = 6;
_global.ITEM_WATER = 7;
_global.ITEM_SKELS = 8;
_global.ITEM_COCONUT = 10;
_global.ITEM_GRASS = 13;
_global.ITEM_COLLECT = 14;
_global.FARMER = 0;
_global.BUILDER = 1;
_global.RESEARCHER = 2;
_global.HEALER = 3;
_global.BREEDER = 4;
_global.PRIEST = 5;
_global.LEVEL_TRAINEE = 10;
_global.LEVEL_ADEPT = 40;
_global.LEVEL_MASTER = 80;
_global.UNTRAINED = 6;
_global.CENTER_X = 566;
_global.CENTER_Y = 498;
_global.PATH_ACCURACY = 30;
_global.PATH_WALKAROUND = PATH_ACCURACY * (100 / PATH_ACCURACY);
_global.MAX_COCONUTS = 2000;
_global.PARTICLE_INDEX = 1500;
CPoint.prototype.toString = function () {
var _local3 = this.x;
var _local2 = this.y;
var _local4 = this.z;
_local3 = Math.round(_local3 * 10) / 10;
_local2 = Math.round(_local2 * 10) / 10;
_local4 = Math.round(_local4 * 10) / 10;
return(((("(" + _local3) + ", ") + _local2) + ") ");
};
String.prototype.replace = function (search, replace) {
var _local2 = this.split(search);
return(_local2.join(replace));
};
_global.selectedChar = null;
EventManager.prototype.addEvent = function (c, p) {
var _local2 = new Event(c, p);
this.events.push(_local2);
};
EventManager.prototype.removeEvent = function (e) {
this.events.shift();
};
EventManager.prototype.update = function () {
var _local4 = this.events;
if (_local4.length == 0) {
return(undefined);
}
var _local3 = GetTimeStamp();
var _local5 = _local3 - this.lastUpdate;
if (_local5 < FIVE_SECONDS) {
return(undefined);
}
this.lastUpdate = _local3;
var _local2 = _local4[0];
_local2.callback(_local2);
};
_global.em = InitEventManager();
_global.lastAmbient = 0;
InitSounds();
_global.techs = InitTechs();
_global.EDGE_TOP = new CRect(0, 0, 580, 50);
_global.EDGE_BOTTOM = new CRect(0, 310, 580, 370);
_global.EDGE_LEFT = new CRect(0, 0, 200, 370);
_global.EDGE_RIGHT = new CRect(530, 0, 580, 370);
_global.hotspots = InitHotspots();
PathFinder.prototype.findPath = function (pos, to) {
if (this.hasWalkLine(pos, to)) {
return(new Array(CopyPoint(pos), CopyPoint(to)));
}
var _local3 = CopyPoint(pos);
var _local8 = GetDistance(_local3, to);
var _local6 = Math.floor(_local8 / PATH_ACCURACY);
var _local2 = new Array(CopyPoint(_local3), CopyPoint(_local3));
var _local5 = AimTo(_local3, to);
ScalePoint(_local5, PATH_ACCURACY);
var _local4 = 0;
while (_local4 < _local6) {
OffsetPoint(_local3, _local5);
if (!this.checkWalkArea(_local3)) {
if (_local2[_local2.length - 1] != null) {
_local2.push(null);
}
} else {
_local2.push(CopyPoint(_local3));
}
_local4++;
}
_local2.push(CopyPoint(to));
_local2.push(CopyPoint(to));
this.checkWalkAround(_local5, _local2);
_local2 = this.cleanPath(_local2);
_local2 = this.shortenPath(_local2, to);
return(_local2);
};
PathFinder.prototype.checkWalkArea = function (pos) {
var _local3 = GetHotspots();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (!_local2.blocks) {
} else if (PointInRect(_local2.hotspot, pos)) {
return(false);
}
_local1++;
}
return(true);
};
PathFinder.prototype.hasWalkLine = function (pos, to) {
var _local3 = CopyPoint(pos);
var _local6 = GetDistance(_local3, to);
var _local5 = Math.floor(_local6 / PATH_ACCURACY);
var _local4 = AimTo(_local3, to);
ScalePoint(_local4, PATH_ACCURACY);
var _local2 = 0;
while (_local2 < _local5) {
OffsetPoint(_local3, _local4);
if (!this.checkWalkArea(_local3)) {
return(false);
}
_local2++;
}
return(true);
};
PathFinder.prototype.doWalkAround = function (aim, p1, p2) {
OffsetPoint(p1, aim);
p1.z = -1;
OffsetPoint(p2, aim);
p2.z = -1;
};
PathFinder.prototype.checkWalkAround = function (aim, path) {
var _local13 = aim.x / aim.y;
var _local12 = Math.atan(_local13);
var _local11 = new CPoint(Math.sin(_local12 + 1.57), Math.cos(_local12 + 1.57));
ScalePoint(_local11, PATH_ACCURACY);
var _local10 = new CPoint(Math.sin(_local12 - 1.57), Math.cos(_local12 - 1.57));
ScalePoint(_local10, PATH_ACCURACY);
var _local2 = 0;
while (_local2 < path.length) {
var _local9 = path[_local2];
if (_local9 == null) {
var _local7 = CopyPoint(path[_local2 - 1]);
var _local6 = CopyPoint(path[_local2 + 1]);
var _local5 = CopyPoint(path[_local2 - 1]);
var _local4 = CopyPoint(path[_local2 + 1]);
var _local8 = 0;
while (_local8 < PATH_WALKAROUND) {
this.doWalkAround(_local11, _local7, _local6);
if (this.hasWalkLine(_local7, _local6)) {
SetPoint(path[_local2 - 1], _local7.x, _local7.y, -1);
SetPoint(path[_local2 + 1], _local6.x, _local6.y, -1);
break;
}
this.doWalkAround(_local10, _local5, _local4);
if (this.hasWalkLine(_local5, _local4)) {
SetPoint(path[_local2 - 1], _local5.x, _local5.y, -1);
SetPoint(path[_local2 + 1], _local4.x, _local4.y, -1);
break;
}
_local8++;
}
}
_local2++;
}
return(path);
};
PathFinder.prototype.cleanPath = function (path) {
var _local4 = new Array(CopyPoint(path[0]));
var _local1 = 0;
while (_local1 < path.length) {
var _local2 = path[_local1];
if (!_local2) {
} else {
_local4.push(_local2);
}
_local1++;
}
return(_local4);
};
PathFinder.prototype.shortenPath = function (path, to) {
var _local3 = new Array();
var _local4 = 0;
while (_local4 < path.length) {
var _local2 = CopyPoint(path[_local4]);
if (!_local3.length) {
_local3.push(_local2);
} else {
if (this.hasWalkLine(_local2, to) && (GetQuickDistance(_local2, to) != 0)) {
_local3.push(_local2);
_local3.push(CopyPoint(to));
break;
}
_local3.push(_local2);
}
_local4++;
}
return(_local3);
};
PathFinder.prototype.climbTree = function (tree, down) {
var _local1 = GetHotspot(tree);
var _local3 = CreatePoint(_local1.workarea.left, _local1.workarea.top, 0);
var _local2 = CreatePoint(_local1.workarea.left, _local1.workarea.top - 90, 0);
if (down) {
return(new Array(_local2, _local3));
}
return(new Array(_local3, _local2));
};
_global.pathfinder = InitPathFinder();
_global.gfxObjects = InitGfx();
_global.eventPopup = null;
var xmlEvents = new XML();
xmlEvents.onLoad = function (success) {
if (!success) {
return(undefined);
}
this.events = new Array();
var _local2 = this.firstChild.firstChild;
while (_local2) {
if (_local2.nodeName == "event") {
this.events.push(_local2);
}
_local2 = _local2.nextSibling;
}
};
xmlEvents.getEventById = function (id) {
for (var _local4 in this.events) {
var _local2 = this.events[_local4];
if (_local2.attributes.id == id) {
return(_local2);
}
}
return(0);
};
xmlEvents.randomEvent = function () {
var _local3 = new Object();
var _local5 = Rnd(this.events.length);
var _local4 = this.events[_local5];
if (Rnd(100) > 90) {
if (Rnd(100) > 50) {
_local4 = this.getEventById("Vial");
} else {
_local4 = this.getEventById("Sack");
}
}
_local3.event = _local4;
_local3.title = _local4.findNode("title");
_local3.prompt = _local4.findNode("prompt");
_local3.btns = new Array(_local4.findNode("button1").firstChild, _local4.findNode("button2").firstChild);
_local3.choice1 = new Array();
_local3.choice2 = new Array();
var _local2 = _local4.firstChild;
while (_local2) {
if (_local2.nodeName == "choice1") {
_local3.choice1.push(_local2);
}
if (_local2.nodeName == "choice2") {
_local3.choice2.push(_local2);
}
_local2 = _local2.nextSibling;
}
return(_local3);
};
xmlEvents.load("events.xml");
DisableHelp(29);
DisableHelp(30);
_global.game = LoadGame();
PlayMusic();
Frame 13
play();
Frame 14
function checkLoadGame() {
var _local3 = GetGame();
var _local2 = GetTimeStamp();
var _local1 = _local2 - _local3.lastUpdate;
return(_local1 < UPDATE_INTERVAL);
}
if (!checkLoadGame()) {
var i = 0;
while (i < 10) {
UpdateGame();
UpdateBackground();
i++;
}
prevFrame();
} else {
SaveGame();
}
Frame 15
function OnStartOver(ret) {
if (ret) {
NewGame();
gotoAndPlay ("newgame");
}
}
function OnQuit(ret) {
if (ret) {
SaveGame();
}
}
function TestEvent(e) {
trace(e.param);
RemoveEvent(e);
}
RemovePopup();
Instance of Symbol 42 MovieClip [placeholder] "controlLock" in Frame 15
on (press, release, releaseOutside, rollOver, rollOut, dragOver, dragOut) {
this.useHandCursor = false;
}
Frame 17
ControlLock(false);
prevFrame();
Frame 18
function UpdateStats() {
var _local1 = GetGame();
vPopulation.text = CountAlive();
vFood.text = Math.floor(_local1.food);
vTechPoints.text = Math.floor(_local1.tech);
}
gameMiniMap.miniMap();
UpdateStats();
RemovePopup();
ShowHelp("MiniMap");
Instance of Symbol 69 MovieClip [CMap] "gameMiniMap" in Frame 18
/* no clip actions */
Frame 20
prevFrame();
Frame 21
function ShowPuzzles() {
var _local2 = 0;
while (_local2 < 15) {
var _local3 = "puzzle_" + _local2;
this[_local3]._visible = IsPuzzleSolved(_local2);
_local2++;
}
}
ShowPuzzles();
RemovePopup();
ShowHelp(20);
Instance of Symbol 503 MovieClip "puzzle_0" in Frame 21
on (release) {
var id = Number(_name.split("_")[1]);
_root.CreatePopup("popupMsgOk", _root.PuzzleText(id));
}
Instance of Symbol 507 MovieClip "puzzle_1" in Frame 21
on (release) {
var id = Number(_name.split("_")[1]);
_root.CreatePopup("popupMsgOk", _root.PuzzleText(id));
}
Frame 23
prevFrame();
Frame 24
function RefreshTech() {
var _local2 = GetGame();
var _local1 = _local2.techs;
farmer.gotoAndStop(_local1[FARMER] + 1);
builder.gotoAndStop(_local1[BUILDER] + 1);
researcher.gotoAndStop(_local1[RESEARCHER] + 1);
healer.gotoAndStop(_local1[HEALER] + 1);
breeder.gotoAndStop(_local1[BREEDER] + 1);
priest.gotoAndStop(_local1[PRIEST] + 1);
vTechPoints.text = Math.floor(_local2.tech);
}
function PopupTechInfo(id) {
var _local5 = GetGame();
var _local1 = TechText(id);
var _local3 = GetTech(id);
var _local2 = _local5.techs[id];
_local1 = _local1 + (("<br/><br/>Your villagers have level " + _local2) + ".");
if (_local2 < 2) {
_local1 = _local1 + (("<br/>The next level costs: " + _local3.cost[_local2]) + ".");
}
CreatePopup("popupMsgOk", _local1, null, 0, 0, 0, 240);
}
function ShowTechCost(id, bShow) {
var _local6 = GetGame();
var _local4 = GetTech(id);
var _local5 = _local6.techs[id];
var _local2 = "Cost: " + _local4.cost[_local5];
if (bShow != null) {
switch (id) {
case FARMER :
_local2 = "Farming";
break;
case BUILDER :
_local2 = "Engineering";
break;
case RESEARCHER :
_local2 = "Science";
break;
case HEALER :
_local2 = "Medicine";
break;
case BREEDER :
_local2 = "Exploration";
break;
case PRIEST :
_local2 = "Culture";
}
}
this["cost_" + id].text = _local2;
}
ShowTechCost(FARMER, false);
ShowTechCost(BUILDER, false);
ShowTechCost(RESEARCHER, false);
ShowTechCost(HEALER, false);
ShowTechCost(BREEDER, false);
ShowTechCost(PRIEST, false);
RefreshTech();
RemovePopup();
ShowHelp(12);
Frame 26
prevFrame();
Frame 27
function RefreshCollection() {
var _local1 = GetGame();
var _local2 = 0;
var _local5 = 0;
var _local4 = 0;
var _local3 = 0;
i = 0;
while (i < 12) {
ShowCollection("b", i, _local1.beetles[i] == 1);
ShowCollection("bf", i, _local1.butterflies[i] == 1);
ShowCollection("p", i, _local1.pebbles[i] == 1);
ShowCollection("s", i, _local1.shells[i] == 1);
_local2 = _local2 + (_local1.beetles[i] == 1);
_local5 = _local5 + (_local1.butterflies[i] == 1);
_local4 = _local4 + (_local1.pebbles[i] == 1);
_local3 = _local3 + (_local1.shells[i] == 1);
i++;
}
vButterflies.text = _local5 + " of 12";
vBeetles.text = _local2 + " of 12";
vPebbles.text = _local4 + " of 12";
vShells.text = _local3 + " of 12";
}
function ShowCollection(prefix, index, display) {
if (display) {
var _local2 = this[prefix + index];
_local2.gotoAndStop(index + 2);
}
}
RefreshCollection();
RemovePopup();
ShowHelp(26);
Frame 29
prevFrame();
Frame 30
function ShowCharacter() {
var _local2 = selectedChar;
if (DEBUG) {
trace("farming: " + _local2.skills[FARMER]);
trace("building: " + _local2.skills[BUILDER]);
trace("researching: " + _local2.skills[RESEARCHER]);
trace("healing: " + _local2.skills[HEALER]);
trace("health: " + _local2.health);
}
ShowCharGfx(charGfx, _local2, 2.1);
charGfx._x = 100;
charGfx._y = 230;
if (_local2.father && (_local2.mother)) {
ShowCharGfx(fatherGfx, _local2.father, 1);
ShowCharGfx(motherGfx, _local2.mother, 1);
fatherGfx._x = 50;
fatherGfx._y = 160;
fatherGfx.charName = _local2.father.name;
motherGfx._x = 150;
motherGfx._y = fatherGfx._y;
motherGfx.charName = _local2.mother.name;
motherGfx._xscale = -100;
fatherGfx._visible = true;
motherGfx._visible = true;
} else {
fatherGfx._visible = false;
motherGfx._visible = false;
}
fatherGfx.useHandCursor = false;
motherGfx.useHandCursor = false;
StatusTube(tubeHealth, _local2.health);
StatusTube(tubeFarming, _local2.skills[FARMER]);
StatusTube(tubeResearch, _local2.skills[RESEARCHER]);
StatusTube(tubeBuilding, _local2.skills[BUILDER]);
StatusTube(tubeHealing, _local2.skills[HEALER]);
StatusTube(tubeBreeding, _local2.skills[BREEDER]);
vName.text = _local2.name;
vAge.text = Math.floor(_local2.age);
vGender.text = LangGender(_local2.gender);
vStatus.text = "";
vHealthStatus.text = LangHealth(_local2);
vSubStatus.text = "";
vLikes.text = _local2.likes;
vDislikes.text = _local2.dislikes;
if (_local2.ageToBirth > 0) {
vStatus.text = "Nursing";
vSubStatus.text = Math.floor((_local2.ageToBirth * TSCALE_ONE_YEAR) / 60000) + " min";
charGfx.showItem(false, true);
} else {
charGfx.showItem(true);
}
var _local3 = this["btn" + _local2.skill];
checkMark._x = _local3._x - 2;
checkMark._y = _local3._y - 2;
if (DEBUG) {
vAge.text = _local2.age;
}
}
function CommitNameChange() {
selectedChar.name = vName.text;
}
function PrevChar(c) {
CommitNameChange();
var _local3 = _global.charList;
var _local2 = GetCharListIndex(selectedChar);
_local2--;
if (_local2 < 0) {
_local2 = _local3.length - 1;
}
SelectVillager(_local3[_local2]);
ShowCharacter();
}
function NextChar(c) {
CommitNameChange();
var _local3 = _global.charList;
var _local2 = GetCharListIndex(selectedChar);
_local2++;
if (_local2 > (_local3.length - 1)) {
_local2 = 0;
}
SelectVillager(_local3[_local2]);
ShowCharacter();
}
function CompareAge(char1, char2) {
return(char1.age > char2.age);
}
function CompareSkill(char1, char2) {
var _local2 = TotalSkills(char1);
var _local1 = TotalSkills(char2);
return(_local2 > _local1);
}
function CompareHealth(char1, char2) {
return(char1.health > char2.health);
}
function SortCharList(index, noChange) {
var _local2 = _global.charList;
switch (index) {
case 1 :
sortMark._x = sort1._x;
sortMark._y = sort1._y;
_local2.sort(CompareAge);
break;
case 2 :
sortMark._x = sort2._x;
sortMark._y = sort2._y;
_local2.sort(CompareSkill);
break;
case 3 :
sortMark._x = sort3._x;
sortMark._y = sort3._y;
_local2.sort(CompareHealth);
}
if (!noChange) {
SelectVillager(_local2[0]);
ShowCharacter();
}
}
function FocusSelectedChar() {
if (selectedChar) {
var _local1 = CopyPoint(selectedChar.pos);
OffsetPoint(_local1, new CPoint(-280, -200));
SetMapPos(_local1);
}
}
function CharactersList() {
var _local3 = new Array();
var _local2 = GetGame();
for (var _local4 in _local2.villagers) {
var _local1 = _local2.villagers[_local4];
if (_local1.health > 0) {
_local3.push(_local1);
}
}
SortCharList(1, true);
return(_local3);
}
function GetCharListIndex(char) {
var _local2 = _global.charList;
for (var _local3 in _local2) {
if (_local2[_local3] == char) {
return(_local3);
}
}
return(-1);
}
charGfx._visible = false;
_global.charList = CharactersList();
ShowCharacter();
RemovePopup();
ShowHelp(32);
Instance of Symbol 176 MovieClip [CVillager] "fatherGfx" in Frame 30
on (rollOver) {
_parent.vSonOf.text = "Son of " + this.charName;
}
Instance of Symbol 176 MovieClip [CVillager] "motherGfx" in Frame 30
on (rollOver) {
_parent.vSonOf.text = "Son of " + this.charName;
}
Frame 32
prevFrame();
Frame 33
function UpdateScore() {
var _local3 = GetGame();
vPopulation.text = CountAlive();
vFood.text = Math.floor(_local3.food);
vTechPoints.text = Math.floor(_local3.tech);
vStatus.text = _local3.statusText;
var _local1 = selectedChar;
if (_local1) {
vName.text = _local1.name;
vSkill.text = LangSkill(_local1);
var _local4 = LangAction(_local1);
var _local2 = _local4.split("|");
if (_local2.length > 1) {
vAction.text = _local2[0];
GameStatus(_local2[1]);
} else {
vAction.text = LangAction(_local1);
}
}
}
function SaveMapPos() {
var _local1 = GetGame();
_local1.mapPos.x = gameMap.gfx._x;
_local1.mapPos.y = gameMap.gfx._y;
}
function LoadMapPos() {
var _local1 = GetGame();
gameMap.gfx._x = _local1.mapPos.x;
gameMap.gfx._y = _local1.mapPos.y;
gameMap.update();
}
function SetMapPos(p) {
var _local1 = GetGame();
_local1.mapPos.x = -p.x;
_local1.mapPos.y = -p.y;
}
UpdateScore();
LoadMapPos();
PlayMusic();
ShowHelp("Welcome");
btnReplay._visible = false;
GameStatus("");
DelayHelp(2);
if (SHOW_PATHS) {
gameMap.gfx.createEmptyMovieClip("drawArea", 9999);
ShowHotspots(gameMap.gfx.drawArea);
ShowPaths(gameMap.gfx.drawArea);
}
Frame 35
prevFrame();
Frame 36
stop();
Frame 41
stop();
Frame 42
stop();
Frame 43
stop();
Frame 45
prevFrame();
Symbol 40 MovieClip [slider] Frame 1
function getPosition() {
var _local2 = btn._x;
var _local1 = Math.floor(((_local2 - 5) * 100) / 230);
return(_local1);
}
function setPosition(p) {
var _local1 = Math.floor((p / 100) * 230);
btn._x = 5 + _local1;
}
Instance of Symbol 39 MovieClip "btn" in Symbol 40 MovieClip [slider] Frame 1
on (press) {
this.startDrag(false, 5, 5, 235, 5);
}
on (release, releaseOutside) {
this.stopDrag();
_parent.onUpdate();
}
Symbol 43 MovieClip [CPopup] Frame 1
#initclip 1
function CPopup() {
}
CPopup.prototype = new MovieClip();
CPopup.prototype.init = function (w, h) {
this.clr = this._parent.clr;
this.w = w;
this.h = h;
this.ow = this._width;
this.oh = this._height;
if (!this.w) {
this.w = this._width;
}
if (!this.h) {
this.h = this._height;
}
this._xscale = 100;
this._yscale = 100;
this.guide.unloadMovie();
this.drawBorders(this.w, this.h);
this.adjustButtons();
};
CPopup.prototype.adjustButtons = function () {
var _local5 = this._parent.btns;
var _local3 = 1;
while (_local3 < 4) {
var _local2 = this._parent["btn" + _local3];
var _local4 = this._parent[("btn" + _local3) + "Text"];
if (_local2 == undefined) {
break;
}
var _local6 = this.oh - _local2._y;
_local2._y = this._height - _local6;
_local4._y = (_local2._y + (_local2._height / 2)) - (_local4._height / 2);
if (_local5) {
_local4.text = _local5[_local3 - 1];
if (_local5[_local3 - 1] == "") {
_local2._visible = false;
}
}
_local3++;
}
};
CPopup.prototype.drawBorders = function (width, height) {
var _local5 = this;
var _local3;
var _local8 = width;
var _local10 = height;
if (!_local8) {
_local8 = _local5._width;
}
if (!_local10) {
_local10 = _local5._height;
}
var _local4 = 0;
var _local7 = (this.horizontal ? 1 : 0);
if (this._alpha < 100) {
_local5.attachMovie("borderBack" + this.clr, "bk" + _local4, 1100 + _local4);
_local3 = _local5["bk" + _local4];
_local3._x = (1 - _local7) * _local3._width;
_local3._y = _local3._height;
_local3._width = (_local8 - (_local3._width * (1 - _local7))) - _local3._x;
if (_root.gameMap._visible) {
_local3._width = _local3._width + 10;
}
_local3._height = (_local10 - _local3._height) - _local3._y;
_local4++;
} else {
var _local9 = 1;
while (_local9 < 100) {
var _local6 = 1 - _local7;
while (_local6 < 100) {
_local5.attachMovie("borderBack" + this.clr, "bk" + _local4, 1100 + _local4);
_local3 = _local5["bk" + _local4];
w = _local6 * _local3._width;
h = _local9 * _local3._height;
_local4++;
_local3._x = w;
_local3._y = h;
if ((w + (_local3._width * (2 - _local7))) > _local8) {
break;
}
_local6++;
}
if ((h + (_local3._height * 2)) > _local10) {
break;
}
_local9++;
}
}
var _local9 = 1 - _local7;
while (_local9 < 100) {
_local5.attachMovie("borderHorizontal" + this.clr, "bh" + _local4, 1250 + _local4);
_local3 = _local5["bh" + _local4];
_local4++;
w = _local9 * _local3._width;
_local3._x = w;
_local3._y = 0;
_local5.attachMovie("borderHorizontalBottom" + this.clr, "bh" + _local4, 1300 + _local4);
_local3 = _local5["bh" + _local4];
_local4++;
_local3._x = w;
_local3._y = _local10 - _local3._height;
if ((w + (_local3._width * (2 - _local7))) > _local8) {
break;
}
_local9++;
}
if (this.horizontal) {
return(undefined);
}
if (this._alpha < 100) {
_local5.attachMovie("borderVerticalLeft" + this.clr, "bv" + _local4, 1350 + _local4);
_local3 = _local5["bv" + _local4];
_local3._x = 0;
_local3._y = _local3._height;
_local3._height = (_local10 - _local3._height) - _local3._y;
_local4++;
_local5.attachMovie("borderVertical" + this.clr, "bv" + _local4, 1350 + _local4);
_local3 = _local5["bv" + _local4];
_local3._x = _local8 - _local3._width;
_local3._y = _local3._height;
_local3._height = (_local10 - _local3._height) - _local3._y;
_local4++;
} else {
_local9 = 1;
while (_local9 < 100) {
_local5.attachMovie("borderVerticalLeft" + this.clr, "bv" + _local4, 1350 + _local4);
_local3 = _local5["bv" + _local4];
h = _local9 * _local3._height;
_local3._x = 0;
_local3._y = h;
_local4++;
_local5.attachMovie("borderVertical" + this.clr, "bv" + _local4, 1400 + _local4);
_local3 = _local5["bv" + _local4];
_local3._x = _local8 - _local3._width;
_local3._y = h;
if ((h + (_local3._height * 2)) > _local10) {
break;
}
_local9++;
}
}
_local5.attachMovie("borderTopLeft" + this.clr, "btl", 2000);
_local3 = _local5.btl;
_local3._x = 0;
_local3._y = 0;
_local5.attachMovie("borderTopRight" + this.clr, "btr", 2001);
_local3 = _local5.btr;
_local3._x = _local8 - _local3._width;
_local3._y = 0;
_local5.attachMovie("borderBottomLeft" + this.clr, "bbl", 2002);
_local3 = _local5.bbl;
_local3._x = 0;
_local3._y = _local10 - _local3._height;
_local5.attachMovie("borderBottomRight" + this.clr, "bbr", 2003);
_local3 = _local5.bbr;
_local3._x = _local8 - _local3._width;
_local3._y = _local10 - _local3._height;
};
Object.registerClass("CPopup", CPopup);
#endinitclip
Symbol 46 MovieClip [gMH0] Frame 1
stop();
Symbol 52 MovieClip [gM1] Frame 1
stop();
Symbol 58 MovieClip [gM0] Frame 1
stop();
Symbol 64 MovieClip Frame 1
stop();
Symbol 69 MovieClip [CMap] Frame 1
#initclip 3
function CMap() {
this.game = GetGame();
this.gfxIndex = 0;
this.useHandCursor = false;
this.viewport = new CRect(0, 0, 400, 400);
this.init();
this.dragCharacter = null;
this.hitCharacter = null;
this.scrollX = 0;
this.scrollY = 0;
this.pIndex = PARTICLE_INDEX;
}
CMap.prototype.init = function () {
var _local11 = this.game;
var _local3 = 0;
while (_local3 < 4) {
var _local2 = 0;
while (_local2 < 4) {
var _local7 = ("gMap" + _local3) + _local2;
this.gfx.attachMovie(_local7, _local7, (1000 + (_local3 * 4)) + _local2);
var _local6 = this.gfx[_local7];
_local6._x = _local3 * 370;
_local6._y = _local2 * 372;
_local2++;
}
_local3++;
}
var _local10 = GetGfxObjects();
var _local5 = 0;
while (_local5 < _local10.length) {
var _local4 = _local10[_local5];
var _local7 = "gfxObj" + _local4.gfx;
this.gfx.attachMovie(_local4.gfx, _local7, 2000 + this.gfxIndex);
var _local6 = this.gfx[_local7];
_local6._x = _local4.pos.x;
_local6._y = _local4.pos.y;
this.gfxIndex++;
_local5++;
}
this.updateTaskObjects();
var _local9 = _local11.villagers;
_local5 = 0;
while (_local5 < _local9.length) {
var _local8 = _local9[_local5];
this.addVillagerClip(_local8);
_local5++;
}
};
CMap.prototype.getIndex = function () {
this.pIndex++;
if (this.pIndex > 1800) {
this.pIndex = PARTICLE_INDEX;
}
return(this.pIndex);
};
CMap.prototype.addVillagerClip = function (v) {
var _local3 = "gVill" + (this.gfxIndex++);
this.gfx.attachMovie("CVillager", _local3, 3000 + this.gfxIndex);
var _local2 = this.gfx[_local3];
_local2.init(v);
_local2.show(true);
v.clip = _local2;
_local2.update();
};
CMap.prototype.showSector = function (x, y, visible) {
var _local3 = ("gMap" + x) + y;
var _local2 = this.gfx[_local3];
if (visible) {
_local2.gotoAndStop(1);
} else {
_local2.gotoAndStop(3);
}
};
CMap.prototype.updateView = function () {
var _local3 = 0;
while (_local3 < 4) {
var _local2 = 0;
while (_local2 < 4) {
var _local4 = ("gMap" + _local3) + _local2;
var _local5 = this.gfx[_local4];
this.showSector(_local3, _local2, true);
_local2++;
}
_local3++;
}
};
CMap.prototype.onPress = function () {
GameStatus("");
if (this._xscale != 100) {
var _local3 = new CPoint(_xmouse - this._x, _ymouse - this._y);
ScalePoint(_local3, 2.4);
SetMapPos(_local3);
_root.gotoAndPlay("game");
return(undefined);
}
this.onStartDrag();
};
CMap.prototype.onRelease = function () {
this.onEndDrag();
};
CMap.prototype.onReleaseOutside = function () {
this.onEndDrag();
};
CMap.prototype.onStartDrag = function () {
HideArrow();
if (TRACE_MOUSE) {
var _local3 = Math.floor((_xmouse - this._x) - this.gfx._x);
var _local2 = Math.floor((_ymouse - this._y) - this.gfx._y);
trace((_local3 + ",") + _local2);
}
this.setScroll(0, 0);
if ((this.dragCharacter = this.checkHitCharacter())) {
this.dragCharacter.onStartDrag();
return(undefined);
}
if (this.checkHotspot()) {
return(undefined);
}
this.startDragX = _xmouse;
this.startDragY = _ymouse;
this.gfx.startDrag(false, -776, -854, 0, 0);
};
CMap.prototype.onEndDrag = function () {
if (this.dragCharacter) {
this.dragCharacter.onEndDrag();
this.dragCharacter = null;
return(undefined);
}
this.gfx.stopDrag();
this.updateView();
var _local5 = GetGame();
if ((_local5.help && (GetCurrentHelp() == 1)) && (IsHelpShown(1))) {
var _local3 = Math.abs(this.startDragX - _xmouse);
var _local2 = Math.abs(this.startDragY - _ymouse);
var _local4 = (_local3 * _local3) + (_local2 * _local2);
if (_local4 > 200) {
ShowHelpForced(2);
} else {
ShowHelpForced("DragFail");
}
}
};
CMap.prototype.checkHitCharacter = function () {
this.hitCharacter = null;
var _local4 = this.game.villagers;
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
if (_local3.clip.hitTest(_xmouse, _ymouse, true)) {
this.hitCharacter = _local3.clip;
break;
}
_local2++;
}
return(this.hitCharacter);
};
CMap.prototype.checkHotspot = function () {
var _local4 = (_xmouse - this.gfx._x) - this._x;
var _local3 = _ymouse - this.gfx._y;
var _local2 = CheckHotspot(_local4, _local3);
if (_local2) {
HotSpotText(_local2);
}
};
CMap.prototype.setScroll = function (x, y) {
this.scrollX = x;
this.scrollY = y;
};
CMap.prototype.update = function () {
this.updateTaskObjects();
UpdateGame();
UpdateScore();
if (this.gfx._y >= 0) {
this.gfx._y = 0;
this.scrollY = 0;
return(undefined);
}
if (this.gfx._x >= 0) {
this.gfx._x = 0;
this.scrollX = 0;
return(undefined);
}
if (this.gfx._x <= -776) {
this.gfx._x = -776;
this.scrollX = 0;
return(undefined);
}
if (this.gfx._y <= -854) {
this.gfx._y = -854;
this.scrollY = 0;
return(undefined);
}
if (this.scrollX > 0) {
this.scrollX--;
this.gfx._x = this.gfx._x + SCROLL_SPEED;
this.dragCharacter._x = this.dragCharacter._x - SCROLL_SPEED;
}
if (this.scrollX < 0) {
this.scrollX++;
this.gfx._x = this.gfx._x - SCROLL_SPEED;
this.dragCharacter._x = this.dragCharacter._x + SCROLL_SPEED;
}
if (this.scrollY > 0) {
this.scrollY--;
this.gfx._y = this.gfx._y + SCROLL_SPEED;
this.dragCharacter._y = this.dragCharacter._y - SCROLL_SPEED;
}
if (this.scrollY < 0) {
this.scrollY++;
this.gfx._y = this.gfx._y - SCROLL_SPEED;
this.dragCharacter._y = this.dragCharacter._y + SCROLL_SPEED;
}
SaveMapPos();
};
CMap.prototype.updateTaskObjects = function () {
var _local3 = GetGame();
var _local2 = 100;
var _local8 = GetGfxObjects();
var _local5 = 0;
while (_local5 < _local8.length) {
var _local4 = _local8[_local5];
switch (_local4.id) {
case HARVESTING_COCONUT :
_local2 = Math.floor((MinMax(MAX_COCONUTS - _local3.berries, 1, MAX_COCONUTS) * 100) / MAX_COCONUTS);
StatusTube(this.gfx.gfxObjberries, _local2);
break;
case STORING_FOOD :
_local2 = 0;
if (_local3.food > FOOD_LOW_LEVEL) {
_local2 = 30;
}
if (_local3.food > FOOD_OK_LEVEL) {
_local2 = 60;
}
if (_local3.food > FOOD_ABUNDANT) {
_local2 = 100;
}
StatusTube(this.gfx.gfxObjfood, _local2);
break;
case FIRE :
_local2 = 0;
if (_local3.fire > 0) {
_local2 = 100;
_local3.wood = 0;
} else if (_local3.wood > 0) {
_local2 = 50;
}
StatusTube(this.gfx.gfxObjfire, _local2);
break;
default :
if (!_local4.gfx) {
break;
}
var _local6 = GetTask(_local4.id);
if (_local6) {
_local2 = Math.floor((_local6.progress / _local6.length) * 100);
_local2 = MinMax(_local2, 0, 100);
}
var _local7 = "gfxObj" + _local4.gfx;
StatusTube(this.gfx[_local7], _local2);
}
_local5++;
}
};
CMap.prototype.miniMap = function () {
this._xscale = 25;
this._yscale = 26;
this.mask._width = 1210;
this.mask._height = 1210;
this.gfx.setMask(this.mask);
};
Object.registerClass("CMap", CMap);
#endinitclip
Symbol 69 MovieClip [CMap] Frame 5
this.update();
gotoAndPlay ("animate");
Symbol 94 MovieClip [gMap00] Frame 1
stop();
Symbol 98 MovieClip [gMap01] Frame 1
stop();
Symbol 100 MovieClip [gMap02] Frame 1
stop();
Symbol 102 MovieClip [gMap03] Frame 1
stop();
Symbol 107 MovieClip [gMap10] Frame 1
stop();
Symbol 109 MovieClip [gMap11] Frame 1
stop();
Symbol 111 MovieClip [gMap12] Frame 1
stop();
Symbol 113 MovieClip [gMap13] Frame 1
stop();
Symbol 117 MovieClip [gMap20] Frame 1
stop();
Symbol 125 MovieClip [gMap21] Frame 1
stop();
Symbol 129 MovieClip [gMap22] Frame 1
stop();
Symbol 133 MovieClip [gMap23] Frame 1
stop();
Symbol 137 MovieClip [gMap30] Frame 1
stop();
Symbol 143 MovieClip [gMap31] Frame 1
stop();
Symbol 149 MovieClip [gMap32] Frame 1
stop();
Symbol 153 MovieClip [gMap33] Frame 1
stop();
Symbol 159 MovieClip Frame 1
stop();
Symbol 165 MovieClip Frame 1
stop();
Symbol 168 MovieClip Frame 1
stop();
Symbol 171 MovieClip Frame 1
stop();
Symbol 174 MovieClip Frame 1
stop();
Symbol 175 MovieClip Frame 1
stop();
Symbol 176 MovieClip [CVillager] Frame 1
#initclip 2
function CVillager() {
}
CHAR_WIDTH = 28;
CHAR_WIDTH2 = 14;
HEAD_OFFSET = 7;
SHADOW_OFFSET = 38;
CVillager.prototype = new MovieClip();
CVillager.prototype.init = function (charData) {
this.charData = charData;
this.frame = 0;
this.headFrame = 0;
this.hidden = false;
this.isDragged = false;
this.dragSound = false;
this.inWater = false;
this.inPond = false;
this.loadGfx(charData.gender, charData.skinHead, charData.skinBody);
this.checkInWater();
};
CVillager.prototype.loadGfx = function (gender, head, body) {
this.hidden = true;
var _local3 = (("g" + gender) + "H") + head;
this.gfxHead.attachMovie(_local3, "gfx", 1);
var _local2 = ("g" + gender) + body;
this.gfxBody.attachMovie(_local2, "gfx", 1);
this.loadDead();
};
CVillager.prototype.loadDead = function () {
var _local2 = this.charData;
if (_local2.health > 0) {
return(undefined);
}
this.focus._visible = false;
var _local3 = Math.floor(Math.random() * 5);
if (!this.gfxDead.gfx) {
this.doHide();
this.gfxDead.attachMovie("gSkels", "gfx", 1);
this._x = _local2.pos.x;
this._y = _local2.pos.y;
this._visible = true;
this.gfxDead.gfx.gotoAndStop(_local3);
}
if (_local2.buried == true) {
if (_local2.tombText == "") {
this._visible = false;
}
if (this.gfxDead.gfx._currentframe < 5) {
this.gfxDead.gfx.gotoAndStop(_local3 + 5);
}
}
};
CVillager.prototype.getCurrentAnimation = function () {
var _local3 = this.charData;
var _local2 = _local3.actionQueue[0];
if ((!_local2) || (_local2.animation == ACTION_COMMIT)) {
return(ACTION_WALK);
}
return(_local2.animation);
};
CVillager.prototype.doHide = function () {
this._visible = false;
this.gfxBody.gfx.gotoAndStop(1);
this.gfxHead.gfx.gotoAndStop(1);
this.gfxItem.gotoAndStop(1);
};
CVillager.prototype.update = function () {
this.checkInWater();
var _local3 = this.charData;
_local3.gfx = this;
this.focus.gotoAndStop(1);
this.gfxBody._visible = this.isDragged || (!this.inWater);
this.gfxHead._visible = true;
this.focus._visible = this.isDragged || (!this.inWater);
this.hidden = this.getCurrentAnimation() == ACTION_HIDE;
if (this.isDragged) {
if (_xmouse < 150) {
this._x = 10 - this._parent._x;
this.dragProblemX = true;
} else if (this.dragProblemX) {
if (_xmouse > 200) {
this._x = (_xmouse - this._parent._x) - 150;
this.dragProblemX = false;
}
}
if (_ymouse > 370) {
this._y = 370 - this._parent._y;
this.dragProblemY = true;
} else if (this.dragProblemY) {
if (_ymouse < 320) {
this._y = (_ymouse + 370) - this._parent._y;
this.dragProblemY = false;
}
}
var _local15 = CheckHotspot(this._x, this._y);
if (_local15) {
HotSpotHint(_local3, _local15);
}
if ((!this.dragSound) && (Math.abs(this._x - this.charData.pos.x) > 20)) {
PlayCharSound(this.charData, 1);
this.dragSound = true;
}
this.focus.gotoAndStop(3);
return(undefined);
}
this.run = _local3.run;
this.adjustHeight();
if (IsSelected(_local3)) {
this.focus.gotoAndStop(2);
}
UpdateAction(_local3);
this._x = _local3.pos.x;
this._y = _local3.pos.y;
this._visible = true;
if (_local3.health <= 0) {
this.loadDead();
return(undefined);
}
var _local4 = _local3.dir;
var _local2 = this.getCurrentAnimation();
var _local25 = _local2;
switch (_local2) {
case ACTION_JUMP :
_local2 = ACTION_WALK;
this.frame = 0;
this.focus._visible = false;
break;
case ACTION_STAND :
if (Rnd(100) > 90) {
_local3.dir = Rnd(4);
}
_local2 = ACTION_WALK;
this.frame = 0;
break;
case ACTION_CLIMB :
case ACTION_HIDE :
_local2 = ACTION_WORK;
break;
case ACTION_DIVE :
_local2 = ACTION_WORK;
this.gfxHead._visible = false;
}
var _local5 = Array();
_local5[ACTION_WALK] = [[1, 2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15, 16], [8, 7, 6, 5, 4, 3, 2, 1], [16, 15, 14, 13, 12, 11, 10, 9]];
_local5[ACTION_CROUCH] = [1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 1, 1, 1, 1, 1];
_local5[ACTION_WORK] = [5, 6, 7, 8, 8, 8, 7, 6, 5];
_local5[ACTION_SIT] = [9];
var _local20 = [2, 3, 4];
var _local19 = _local20[2];
if (_local2 == ACTION_WALK) {
_local19 = _local20[Math.floor(_local4 / 2)];
}
var _local8 = _local5[_local2];
if (_local2 == ACTION_WALK) {
_local8 = _local8[_local4];
}
var _local23 = _local8.length;
if (this.frame >= _local23) {
this.frame = 0;
}
var frame = _local8[Math.floor(this.frame)];
this.gfxBody.gfx.gotoAndStop(_local19);
this.setFrame(this.gfxBody, frame);
var _local11 = [1, 2, 3, 4];
var _local21 = [1, 4];
var _local24 = [5, 6, 7];
var _local12 = [1, 0, -2, -1];
var _local9 = [-1, 0, 0, -1];
var _local18 = SHADOW_OFFSET;
var _local7 = _local11[0];
var _local13 = 0;
var _local6 = 0;
switch (_local2) {
case ACTION_WALK :
_local7 = _local11[_local4];
_local13 = _local12[_local4];
_local6 = _local9[_local4];
break;
case ACTION_WORK :
_local7 = _local21[Math.floor(this.headFrame / (25 - (Math.random() * 5)))];
_local6 = _local9[_local4];
break;
case ACTION_SIT :
_local7 = _local24[Math.floor(this.headFrame / (16 - (Math.random() * 5)))];
_local6 = 6;
_local18 = 32;
break;
case ACTION_CROUCH :
_local7 = _local11[DIR_NORTH];
_local12 = [0, -1, -2, -4, -5];
_local9 = [6, 6, 6, 7, 8];
_local13 = _local12[frame];
_local6 = _local9[frame];
}
if (this.headFrame > 50) {
this.headFrame = 0;
}
this.setFrame(this.gfxHead, _local7);
this.gfxHead.gfx.gotoAndStop(2);
this.gfxHead._x = this.gfxHead._x + _local13;
this.gfxHead._y = (this.gfxBody._y - HEAD_OFFSET) + _local6;
if (this.inWater || (this.inPond)) {
var _local16 = 0;
var _local17 = 30;
if (this.inWater) {
this._y = this._y + 20;
_local16 = -30;
_local17 = 20;
}
var _local14 = true;
if (this.ripple) {
if ((this.ripple._currentframe < _local17) && (this.ripple._currentframe > 0)) {
_local14 = false;
}
}
if (_local14) {
var _local10 = this._parent._parent;
if (!_local10) {
return(undefined);
}
var _local22 = _local10.getIndex();
this.ripple = CreateParticle(_local10.gfx, "ripple", _local22, this._x, this._y + _local16);
}
}
this.focus._y = this.gfxBody._y + _local18;
switch (_local2) {
case ACTION_WORK :
this.frame = this.frame + 0.25;
break;
case ACTION_NOTHING :
this.frame = this.frame + 0.01;
break;
default :
this.frame = this.frame + 0.5;
if (!this.run) {
break;
}
this.frame = this.frame + 1.5;
}
this.headFrame++;
if (this.hidden) {
this.doHide();
return(undefined);
}
this.showItem();
};
CVillager.prototype.setFrame = function (obj, frame) {
obj._x = ((frame - 1) * (-CHAR_WIDTH)) - CHAR_WIDTH2;
};
CVillager.prototype.onStartDrag = function () {
HideArrow();
var _local2 = this.charData;
SelectVillager(_local2);
if (_local2.health < 1) {
return(undefined);
}
this.isDragged = true;
if (this.inWater) {
this._y = this._y - 20;
this.update();
}
this.startDrag(false, 0, 20, 1180, 1230);
};
CVillager.prototype.onEndDrag = function () {
var _local4 = this.charData;
var _local9 = CheckBlock(this._x, this._y);
var _local8 = false;
var _local6 = CheckHotspot(this._x, this._y);
var _local5 = this._parent._parent;
var _local12 = this.charData.actionQueue[0];
this.dragSound = false;
this.stopDrag();
this.checkInWater();
if (_local4.age < AGE_TO_TEEN) {
_local8 = CheckWater(this._x, this._y);
}
if ((((_local5 && (!this.inWater)) && (!this.inPond)) && (!_local9)) && (!_local6)) {
var _local2 = 0;
while (_local2 < 4) {
var _local3 = CreateParticle(_local5.gfx, "dust", _local5.getIndex(), (this._x - 8) + (_local2 * 4), this._y + 4);
_local3._xscale = 50;
_local3._yscale = 50;
_local2++;
}
}
this.isDragged = false;
_local4 = this.charData;
if (GetQuickDistance(_local4.pos, new CPoint(this._x, this._y)) < 100) {
return(undefined);
}
ClearActions(_local4);
if (IsHelpShown(5)) {
ShowHelpForced(6);
}
_local4.task = 0;
if (_local4.age < AGE_TO_TEEN) {
var _local7 = _local5.gfx.gfxObjcollect;
var _local11 = new CPoint(_local7._x, _local7._y);
if (GetQuickDistance(_local11, new CPoint(this._x, this._y)) < 1000) {
_local4.task = COLLECT_ITEM;
_local6 = 0;
}
}
if (_local6) {
if (_local6.task) {
var _local10 = GetTask(_local6.task);
if (_local10) {
_local4.task = _local10.task;
} else {
_local4.task = _local6.task;
}
if (_local4.age < AGE_TO_TEEN) {
ClearActions(_local4);
_local4.task = NOTHING;
GameStatus("The villager is still too young!");
ShowHelp("ChildrenNoWork");
}
if (_local4.ageToBirth > 0) {
ClearActions(_local4);
GameStatus("She's is nursing a baby!");
_local4.task = BREEDING;
}
}
if (!PointInRect(_local6.workarea, new CPoint(this._x, this._y))) {
_local4.pos = RandomPointInRect(_local6.workarea);
_local4.pos.x = this._x;
this.update();
}
}
if (_local9) {
this.reposition(this._x, this._y);
return(undefined);
}
if (_local8) {
this.reposition(this._x, this._y, true);
return(undefined);
}
_local4.pos.x = Math.floor(this._x);
_local4.pos.y = Math.floor(this._y);
this.checkHitMate();
};
CVillager.prototype.checkScroll = function () {
var _local5 = this._parent._parent;
var _local4 = 0;
var _local3 = 0;
var _local2 = GetGlobalPoint(this);
if (PointInRect(EDGE_TOP, _local2)) {
_local3 = SCROLL_LENGTH;
}
if (PointInRect(EDGE_BOTTOM, _local2)) {
_local3 = -SCROLL_LENGTH;
}
if (PointInRect(EDGE_LEFT, _local2)) {
_local4 = SCROLL_LENGTH;
}
if (PointInRect(EDGE_RIGHT, _local2)) {
_local4 = -SCROLL_LENGTH;
}
_local5.setScroll(_local4, _local3);
};
CVillager.prototype.checkDepth = function () {
if ((Math.random() * 10) > 2) {
return(undefined);
}
var _local10 = GetGame();
var _local7 = _local10.villagers;
var _local8 = this.getDepth();
var _local9 = this.charData;
var _local3 = 0;
while (_local3 < _local7.length) {
var _local2 = _local7[_local3].clip;
var _local6 = _local2.getDepth();
var _local5 = this._y;
var _local4 = _local2._y;
if (_local9.health <= 0) {
_local5 = _local5 - 100;
}
if (_local2.charData.health <= 0) {
_local4 = _local4 - 100;
}
if ((_local8 > _local6) && (_local5 < _local4)) {
_local2.swapDepths(this);
return(undefined);
}
_local3++;
}
};
CVillager.prototype.checkHitMate = function () {
var _local7 = GetGame();
var _local6 = _local7.villagers;
var _local4 = this.charData;
var _local3 = 0;
while (_local3 < _local6.length) {
var _local2 = _local6[_local3];
if (_local2 == _local4) {
} else {
var _local5 = GetQuickDistance(_local2.pos, _local4.pos);
if (_local5 < 300) {
AttemptInteract(_local4, _local2);
}
}
_local3++;
}
};
CVillager.prototype.showItem = function (hideItem, noDir) {
this.gfxItem.gotoAndStop(1);
this.gfxItem2.gotoAndStop(1);
if (hideItem) {
return(undefined);
}
if (this.inWater) {
return(undefined);
}
var _local2 = this.charData;
var _local4 = _local2.actionQueue[0];
var _local3 = this.gfxItem;
if ((noDir || (_local2.dir == DIR_WEST)) || (_local2.dir == DIR_SOUTH)) {
_local3 = this.gfxItem2;
}
if ((_local2.ageToBirth > 0) && (_local2.task != GOING_INDOORS)) {
_local4.item = ITEM_BABY;
}
if (_local4.item > 0) {
_local3.gotoAndStop(_local4.item);
}
if (_local4.item == ITEM_COLLECT) {
_local3.gotoAndStop((ITEM_COLLECT + _local2.collectType) - 1);
_local3.clip.gotoAndStop(2 + _local2.collectItem);
}
};
CVillager.prototype.adjustHeight = function () {
var _local4 = this.charData;
var _local3 = 100;
var _local2 = 100;
if (_local4.age < 5) {
_local3 = 76;
_local2 = 70;
} else if (_local4.age < 8) {
_local3 = 80;
_local2 = 76;
} else if (_local4.age < 12) {
_local3 = 86;
_local2 = 82;
} else if (_local4.age < 15) {
_local3 = 90;
_local2 = 90;
} else if (_local4.age < 18) {
_local3 = 94;
_local2 = 94;
}
if (_local4.buried == true) {
_local3 = 100;
_local2 = 100;
}
_local3 = _local3 + 10;
_local2 = _local2 + 10;
this._xscale = _local3;
this._yscale = _local2;
};
CVillager.prototype.reposition = function (x, y, water) {
var _local6 = this.charData;
var _local2 = new CPoint(x, y);
var _local5 = new CPoint(CENTER_X, CENTER_Y);
aim = AimTo(_local2, _local5);
ScalePoint(aim, 20);
var _local3 = 0;
while (_local3 < 100) {
OffsetPoint(_local2, aim);
if (water) {
if (!CheckWater(_local2.x, _local2.y)) {
break;
}
} else if (!CheckBlock(_local2.x, _local2.y)) {
break;
}
_local3++;
}
_local6.pos = _local2;
};
CVillager.prototype.checkInWater = function () {
this.inWater = false;
this.inPond = CheckPond(this._x, this._y);
var _local3 = this.charData;
var _local2;
var _local4;
if (this.isDragged) {
_local2 = new CPoint(this._x, this._y);
} else {
_local2 = _local3.pos;
}
this.inWater = CheckWater(_local2.x, _local2.y);
return(inWater);
};
Object.registerClass("CVillager", CVillager);
#endinitclip
Symbol 176 MovieClip [CVillager] Frame 5
if (this.isDragged) {
this.checkScroll();
}
this.checkDepth();
this.update();
gotoAndPlay ("animate");
Symbol 182 MovieClip [gF0] Frame 1
stop();
Symbol 188 MovieClip [gF1] Frame 1
stop();
Symbol 194 MovieClip [gF2] Frame 1
stop();
Symbol 200 MovieClip [gF3] Frame 1
stop();
Symbol 206 MovieClip [gF4] Frame 1
stop();
Symbol 212 MovieClip [gF5] Frame 1
stop();
Symbol 218 MovieClip [gF6] Frame 1
stop();
Symbol 224 MovieClip [gF7] Frame 1
stop();
Symbol 230 MovieClip [gF8] Frame 1
stop();
Symbol 236 MovieClip [gF9] Frame 1
stop();
Symbol 239 MovieClip [gFH0] Frame 1
stop();
Symbol 242 MovieClip [gFH1] Frame 1
stop();
Symbol 245 MovieClip [gFH2] Frame 1
stop();
Symbol 248 MovieClip [gFH3] Frame 1
stop();
Symbol 251 MovieClip [gFH4] Frame 1
stop();
Symbol 254 MovieClip [gFH5] Frame 1
stop();
Symbol 257 MovieClip [gFH6] Frame 1
stop();
Symbol 260 MovieClip [gFH7] Frame 1
stop();
Symbol 263 MovieClip [gFH8] Frame 1
stop();
Symbol 266 MovieClip [gFH9] Frame 1
stop();
Symbol 272 MovieClip [gM2] Frame 1
stop();
Symbol 278 MovieClip [gM3] Frame 1
stop();
Symbol 284 MovieClip [gM4] Frame 1
stop();
Symbol 285 MovieClip [gM5] Frame 1
stop();
Symbol 291 MovieClip [gM6] Frame 1
stop();
Symbol 297 MovieClip [gM7] Frame 1
stop();
Symbol 303 MovieClip [gM8] Frame 1
stop();
Symbol 309 MovieClip [gM9] Frame 1
stop();
Symbol 315 MovieClip [gMH1] Frame 1
stop();
Symbol 318 MovieClip [gMH2] Frame 1
stop();
Symbol 321 MovieClip [gMH3] Frame 1
stop();
Symbol 324 MovieClip [gMH4] Frame 1
stop();
Symbol 327 MovieClip [gMH5] Frame 1
stop();
Symbol 330 MovieClip [gMH6] Frame 1
stop();
Symbol 333 MovieClip [gMH7] Frame 1
stop();
Symbol 336 MovieClip [gMH8] Frame 1
stop();
Symbol 339 MovieClip [gMH9] Frame 1
stop();
Symbol 346 Button
on (release) {
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 349 MovieClip [popupMsgOk] Frame 1
vMessage.htmlText = text;
this.bg._alpha = this.alpha;
this.bg.init(this.w, this.h);
stop();
Symbol 352 Button
on (release) {
_root.ControlLock(false);
if (this.callback) {
this.callback(false);
}
this.removeMovieClip();
}
Symbol 354 MovieClip [popupMsgOkCancel] Frame 1
vMessage.htmlText = text;
this.bg.init(this.w, this.h);
stop();
Symbol 356 Button [placeholder]
on (press) {
_root.ShowUpsell();
}
Symbol 357 Button
on (release) {
SoundIndicator(snd.getPosition(), msc.getPosition());
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 371 MovieClip [popupOptions] Frame 1
vMessage.htmlText = text;
this.bg.init(this.w, this.h);
Instance of Symbol 39 MovieClip "btn" in Symbol 371 MovieClip [popupOptions] Frame 1
on (press) {
this.startDrag(false, 5, 5, 235, 5);
}
on (release, releaseOutside) {
this.stopDrag();
_parent.onUpdate();
}
Symbol 371 MovieClip [popupOptions] Frame 2
function SoundIndicator(setSound, setMusic) {
var _local2 = _root.GetGame();
if (setSound != null) {
_local2.sound = setSound;
}
if (setMusic != null) {
_local2.music = setMusic;
}
snd.setPosition(_local2.sound);
}
snd.onUpdate = function () {
_root.PlaySound("button", snd.getPosition());
};
SoundIndicator();
stop();
Symbol 372 MovieClip [ripple] Frame 50
this.unloadMovie();
Symbol 378 MovieClip [gSkels] Frame 1
stop();
Symbol 386 Button
on (release) {
_root.ControlLock(false);
if (this.callback) {
this.callback(false);
}
this.removeMovieClip();
}
Symbol 388 Button
on (release) {
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 390 MovieClip [popupEvent] Frame 1
vMessage.htmlText = text;
charGfx._visible = false;
this.bg.init(this.w, this.h);
Symbol 390 MovieClip [popupEvent] Frame 2
_root.ShowCharGfx(charGfx, this.char, 1.2);
stop();
Symbol 397 MovieClip [dust] Frame 2
play();
Symbol 397 MovieClip [dust] Frame 3
if ((Math.random() * 10) < 4) {
prevFrame();
}
Symbol 397 MovieClip [dust] Frame 28
this.unloadMovie();
Symbol 406 MovieClip Frame 1
stop();
Symbol 409 Button
on (release) {
_root.DownloadGame();
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 413 Button
on (release) {
_root.BuyGame();
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 415 MovieClip [popupUpsell] Frame 1
vMessage.htmlText = text;
this.bg.init(this.w, this.h);
stop();
Symbol 422 MovieClip Frame 1
var rWait = (Math.random() * 500);
Symbol 422 MovieClip Frame 2
play();
Symbol 422 MovieClip Frame 3
if ((rWait--) > 10) {
prevFrame();
}
Symbol 423 MovieClip [waves] Frame 1
stop();
Symbol 427 MovieClip Frame 1
gotoAndPlay(Math.floor(Math.random() * _totalframes));
Symbol 427 MovieClip Frame 25
gotoAndPlay (5);
Symbol 428 MovieClip [spray] Frame 1
stop();
Symbol 431 MovieClip [food] Frame 1
stop();
Symbol 437 MovieClip [hut] Frame 1
stop();
Symbol 441 MovieClip [fire] Frame 1
stop();
Symbol 442 MovieClip [collect] Frame 1
stop();
Symbol 445 MovieClip [research] Frame 1
stop();
Symbol 448 MovieClip [crate] Frame 1
stop();
Symbol 451 MovieClip [coconut] Frame 1
stop();
Symbol 455 MovieClip [briars] Frame 1
stop();
Symbol 456 MovieClip [lovehut] Frame 1
this._alpha = 80;
stop();
Symbol 459 MovieClip [popupTipOk] Frame 1
vMessage.htmlText = text;
this.bg._alpha = 60;
this.bg.horizontal = _root.gameMap._visible;
this.bg.init(this.w, this.h);
_root.ControlLock(false);
stop();
Symbol 462 MovieClip [popupTomb] Frame 1
vMessage.htmlText = text;
this.bg._alpha = this.alpha;
this.bg.init(this.w, this.h);
stop();
Symbol 468 Button
on (release) {
var g = GetGame();
if (!g.intro) {
gotoAndPlay ("newgame");
} else {
SaveGame();
gotoAndPlay ("game");
}
}
Symbol 471 Button
on (release) {
CreatePopup("popupMsgOkCancel", "<p align='center'>Are you sure you want to abandon the current game?</p>", OnStartOver, 0, 0, 0, 120);
}
Symbol 475 Button
on (release) {
CreatePopup("popupOptions");
}
Symbol 478 Button
on (release) {
gotoAndPlay ("help");
}
Symbol 482 Button
on (release) {
CreatePopup("popupMsgOkCancel", "<p align='center'>Are you sure you want to quit?</p>", OnQuit, 0, 0, 0, 110);
}
Symbol 485 Button
on (release) {
gotoAndPlay ("game");
}
Symbol 487 Button
on (release) {
gotoAndPlay ("menu");
}
Symbol 496 MovieClip Frame 31
stop();
Symbol 497 Button [placeholder]
on (release) {
ShowUpsell();
}
Symbol 498 Button [placeholder]
on (release) {
CreatePopup("popupMsgOk", "<p align='center'>\nThis milestone has not yet been completed.</p>", null, 0, 0, 0, 140);
}
Symbol 504 Button
on (release) {
gotoAndPlay ("game");
}
Symbol 505 Button
on (release) {
ShowUpsell();
}
Symbol 523 MovieClip Frame 1
stop();
Symbol 526 MovieClip Frame 1
stop();
Symbol 529 MovieClip Frame 1
stop();
Symbol 532 MovieClip Frame 1
stop();
Symbol 535 MovieClip Frame 1
stop();
Symbol 538 MovieClip Frame 1
stop();
Symbol 541 Button
on (release) {
BuyTech(FARMER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(FARMER);
}
on (rollOut) {
ShowTechCost(FARMER, false);
}
Symbol 543 Button
on (release) {
_root.PopupTechInfo(FARMER);
}
Symbol 545 Button
on (release) {
BuyTech(BUILDER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(BUILDER);
}
on (rollOut) {
ShowTechCost(BUILDER, false);
}
Symbol 546 Button
on (release) {
_root.PopupTechInfo(BUILDER);
}
Symbol 547 Button
on (release) {
BuyTech(HEALER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(HEALER);
}
on (rollOut) {
ShowTechCost(HEALER, false);
}
Symbol 548 Button
on (release) {
_root.PopupTechInfo(HEALER);
}
Symbol 549 Button
on (release) {
BuyTech(RESEARCHER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(RESEARCHER);
}
on (rollOut) {
ShowTechCost(RESEARCHER, false);
}
Symbol 550 Button
on (release) {
_root.PopupTechInfo(RESEARCHER);
}
Symbol 551 Button
on (release) {
BuyTech(BREEDER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(BREEDER);
}
on (rollOut) {
ShowTechCost(BREEDER, false);
}
Symbol 552 Button
on (release) {
_root.PopupTechInfo(BREEDER);
}
Symbol 553 Button
on (release) {
BuyTech(PRIEST);
RefreshTech();
}
on (rollOver) {
ShowTechCost(PRIEST);
}
on (rollOut) {
ShowTechCost(PRIEST, false);
}
Symbol 570 Button
on (release) {
selectedChar.skill = 0;
ShowCharacter();
RemovePopup();
ShowHelp("SkillPref");
}
Symbol 574 Button
on (release) {
selectedChar.skill = 1;
ShowCharacter();
RemovePopup();
ShowHelp("SkillPref");
}
Symbol 575 Button
on (release) {
selectedChar.skill = 2;
ShowCharacter();
RemovePopup();
ShowHelp("SkillPref");
}
Symbol 576 Button
on (release) {
selectedChar.skill = 3;
ShowCharacter();
RemovePopup();
ShowHelp("SkillPref");
}
Symbol 577 Button
on (release) {
selectedChar.skill = 4;
ShowCharacter();
RemovePopup();
ShowHelp("SkillPref");
}
Symbol 578 Button
on (release) {
selectedChar.skill = 4;
ShowCharacter();
}
Symbol 579 Button
on (release) {
CommitNameChange();
FocusSelectedChar();
gotoAndPlay ("game");
}
Symbol 582 Button
on (release) {
SortCharList(1);
}
Symbol 583 Button
on (release) {
SortCharList(2);
}
Symbol 584 Button
on (release) {
SortCharList(3);
}
Symbol 600 Button
on (release) {
NextChar();
}
Symbol 601 Button
on (release) {
PrevChar();
}
Symbol 607 MovieClip Frame 1
stop();
Symbol 628 Button
on (release) {
gotoAndPlay ("puzzle");
}
Symbol 632 Button
on (release) {
gotoAndPlay ("map");
}
Symbol 636 Button
on (release) {
gotoAndPlay ("tech");
}
Symbol 640 Button
on (release) {
gotoAndPlay ("menu");
}
Symbol 650 Button
on (release) {
if (!selectedChar) {
selectedChar = GetRandomVillager();
}
if (selectedChar) {
if (selectedChar.health > 0) {
gotoAndPlay ("detail");
}
}
}
Symbol 653 Button
on (release) {
gotoAndPlay ("collections");
}
Symbol 656 Button
on (release) {
ReplayLastHelp();
}
Symbol 657 Button
on (release) {
gotoAndPlay ("credits");
}
Symbol 659 Button
on (release) {
nextFrame();
}
Symbol 663 Button
on (release) {
prevFrame();
}
Symbol 670 Button
on (release) {
gotoAndPlay ("help");
}
Symbol 674 Button [placeholder]
on (release) {
nextFrame();
}
Symbol 684 Button
on (release) {
NewGame(true, true);
gotoAndPlay ("game");
}
Symbol 686 Button
on (release) {
NewGame(true, false);
gotoAndPlay ("game");
}