Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit d75e1169 authored by deuce's avatar deuce
Browse files

Add Barak's House IGM

(Initial port)
Does not currently have an install/uninstall thing... I'm still figuring
out how that should work.
parent c0c60161
'use safe';
function catchup()
{
while (dk.console.waitkey(0)) {
dk.console.getkey();
}
}
function read_direction()
{
var ch = dk.console.getkey();
switch(ch) {
case '8':
case 'KEY_UP':
return 'U';
case '4':
case 'KEY_LEFT':
return 'L';
case '2':
case 'KEY_DOWN':
return 'D';
case '6':
case 'KEY_RIGHT':
return 'R';
case 'q':
case 'Q':
return 'Q';
case ' ':
return ' ';
default:
return '|';
}
}
function check_move(x, y)
{
if (x > 57) {
return false;
}
if (y > 21) {
return false;
}
if (x < 16) {
return false;
}
if (y < 4) {
return false;
}
return true;
}
function run()
{
var old_gold = player.gold;
var time = 30;
var over = false;
var you_x = random(41) + 16;
var you_y = random(17) + 4;
var bar_x = random(41) + 16;
var bar_y = random(17) + 4;
var you_old_x = you_x;
var you_old_y = you_y;
var bar_old_x = bar_x;
var bar_old_y = bar_y;
var old_time = (new Date()).valueOf() + 500;
var j;
var gold = [];
var tmp;
var stole = 0;
var num;
var cur_time;
function important(x, y) {
var i;
for (i = 0; i < gold.length; i++) {
if (gold[i].x === x && gold[i].y === y) {
return i;
}
}
return -1;
}
for (j = 0; j < 10; j++) {
tmp = {x:random(41)+16, y:random(17)+4};
gold.push(tmp);
dk.console.gotoxy(tmp.x - 1, tmp.y - 1);
lw('`r6`%\xec`r0');
}
dk.console.gotoxy(you_x - 1, you_y - 1);
lw('`r6`%\xea`r0');
dk.console.gotoxy(bar_x - 1, bar_y - 1);
lw('`r6`%B`r0');
dk.console.gotoxy(1, 7);
lw('`0READY...');
dk.console.gotoxy(1, 8);
mswait(1000);
lw('`0SET...');
mswait(1000);
lw('`4GO!');
mswait(400);
do {
ch = read_direction();
if (ch === 'L') {
if (check_move(you_x - 1, you_y)) {
you_x -= 1;
}
}
else if (ch === 'R') {
if (check_move(you_x + 1, you_y)) {
you_x += 1;
}
}
else if (ch === 'U') {
if (check_move(you_x, you_y - 1)) {
you_y -= 1;
}
}
else if (ch === 'D') {
if (check_move(you_x, you_y + 1)) {
you_y += 1;
}
}
else if (ch === 'Q') {
over = true;
}
if (you_old_x != you_x || you_old_y != you_y) {
dk.console.gotoxy(you_x - 1, you_y - 1);
lw('`r6`%\xea`r0');
num = important(you_x, you_y);
if (num >= 0) {
gold[num].x = 0;
gold[num].y = 0;
player.gold += player.level * player.level * 100;
stole += 1;
dk.console.gotoxy(0, 7);
lw('`r0`0Gold: `%'+pretty_int(player.gold));
dk.console.gotoxy(0, 8);
lw('`0Time: `%'+pretty_int(time)+' ');
}
dk.console.gotoxy(you_old_x - 1,you_old_y - 1);
lw('`r6 `r0');
}
you_old_x = you_x;
you_old_y = you_y;
if ((new Date()).valueOf() > old_time) {
old_time += 500;
if (you_x > bar_x && check_move(bar_x+1,bar_y)) {
bar_x += 1;
}
if (you_x < bar_x && check_move(bar_x-1,bar_y)) {
bar_x -= 1;
}
if (you_y > bar_y && check_move(bar_x,bar_y+1)) {
bar_y += 1;
}
if (you_y < bar_y && check_move(bar_x,bar_y-1)) {
bar_y -= 1;
}
dk.console.gotoxy(0, 7);
lw('`r0`0Gold: `%'+pretty_int(player.gold));
dk.console.gotoxy(0, 8);
lw('`0Time: `%'+pretty_int(time)+' ');
time--;
}
if (bar_old_x !== bar_x || bar_old_y !== bar_y) {
dk.console.gotoxy(bar_x - 1, bar_y - 1);
lw('`r6`%B`r0');
dk.console.gotoxy(bar_old_x - 1, bar_old_y - 1);
num = important(bar_old_x, bar_old_y);
if (num >= 0) {
lw('`r6\xec`r0');
}
else {
lw('`r6 `r0');
}
}
bar_old_x = bar_x;
bar_old_y = bar_y;
if (bar_old_x === you_x && bar_old_y === you_y) {
dk.console.gotoxy(bar_x - 4, bar_y - 1);
lw('`)Splat!');
mswait(1000);
lln('`r0`c `%YOU ARE DEFEATED.');
lln('`0-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-');
lln(' `2Barak laughs as warm blood flows down your cheek.');
if (old_gold != player.gold) {
sln(' He savagely takes back the gold you stole from him.');
}
player.gold = old_gold;
sln(' Maybe next time?');
sln('');
lln(' `4YOU FEEL AWFULLY WEAK.');
sln('');
player.hp = 1;
catchup();
return;
}
if (time < 0) {
dk.console.gotoxy(you_x - 4, you_y - 1);
lw('`0YAHOO!');
mswait(1000);
lln('`r0`c `%YOU PUT BARAK TO SHAME!');
lln('`0-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-');
lln(' `2Barak curses as you nimbly dance away from his');
sln(' knife. Not only did you live, you also stole ');
lln(' `0'+pretty_int(player.gold - old_gold)+'`2 from his house!');
sln('');
if (player.clss === 3) {
if (stole === 10) {
lln(' `%FOR FANTASTIC THIEVING, YOU GET AN EXTRA '+pretty_int(200 * player.level * player.level));
player.gold += 200 * player.level * player.level;
sln('');
}
}
lln(' `%YOU HEAD HOME, IN GOOD HUMOR.');
sln('');
catchup();
return;
}
} while (!over);
}
function start_fight()
{
var i;
var mc = morechk;
morechk = false;
lln('`c `%HAVING FUN AT BARAK\'S');
sln('');
for (i = 0; i < 18; i++) {
lln('`r0 `r6 `r0');
}
sln('');
lln(' `0(`2Use the keypad`0, `2arrow keys or `%Ctrl`0-`2S`0,`2E`0,`2D`0,`2X keys to run like hell!`0)');
run();
morechk = mc;
more_nomail();
}
function sugar()
{
var ch;
if (player.sex === 'M') {
lln(' `0"You want sugar?! Go give a few gems to `#Violet`0, she\'ll give');
sln(' you some sugar! Har!"');
}
else {
lln(' `0"You want sugar?! Go give a few gems to `%Seth Able`0, he\'ll give');
sln(' you some sugar! Har!"');
}
sln('');
lln(' `2(`0Y`2)ou animal! How dare you! Prepare to fight!');
lln(' `2(`0L`2)augh loudly at Baraks lame humor.');
sln('');
lw(' `2Your choice? [`0Y`2] :`%');
ch = getkey().toUpperCase();
sln(ch);
sln('');
if (ch === 'L') {
lln(' `2You giggle uncontrollably. Barak looks pleased as hell.');
sln('');
more_nomail();
lln(' `0"You know kid? You\'re ok. Here is a little somethun for ya."');
sln('');
lln(' `%BARAK TOSSES YOU A GEM!');
player.gem++;
player.put();
sln('');
sln(' You trot back home in triumph.');
sln('');
more_nomail();
return;
}
lln(' `2Barak looks quite upset.');
sln('');
more_nomail();
lln(' `2He then pulls out a bigass knife.');
sln('');
more_nomail();
lln(' `2He then proceeds to chase you around the house with it.');
sln('');
more_nomail();
start_fight();
}
function say_slow(str)
{
var i;
for (i = 0; i < str.length; i++) {
sw(str[i]);
mswait(100);
}
}
function say_slow2(str)
{
var i;
for (i = 0; i < str.length; i++) {
sw(str[i]);
mswait(10);
}
}
function hair_end(times_hit, shots_left) {
var num_end;
lln('`c `%EPILOGUE');
lln('`0-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-');
lln(' `2The battle is over.');
sln('');
if (times_hit > 0 && times_hit < 5) {
lln(' You struck the hair `0'+pretty_int(times_hit)+'`2 times.');
}
if (times_hit === 0) {
lln(' `2The old woman laughs at you. `#"You are the worst shot I have');
sln(' ever seen, fool! Go practice with the hair on your back. Begone."');
sln('');
if (player.sex === 'M') {
lln(' `4The old women flashes you! `2You gag reflexes take over as you');
lln(' gape at her `4crusty saggers`2.');
sln('');
}
lln(' `%YOU TRUDGE HOME IN DEFEAT - YOU FEEL HAIRABLE.');
player.high_spirits = false;
sln('');
more_nomail();
return;
}
if (times_hit === 5) {
lln(' `2You totally `%DESTROYED `2the hair!');
sln('');
if (shots_left > 0) {
lln(' `0You even had `%'+pretty_int(shots_left)+' `2tries left!');
}
}
sln('');
more_nomail();
if (times_hit < 5) {
lln(' `#"Not bad! Here is your reward." `2the wrinkled woman cackles.');
}
else {
lln(' `#"Incredible! Here is your reward."`2 the saggy one exclaims.');
}
lln(' `0She waves her hair strangely.');
sln('');
if (times_hit > 4) {
num_end = (times_hit+shots_left) * (10*player.level);
}
else {
num_end = (times_hit) * (5*player.level);
}
num_end *= player.level;
player.exp += num_end;
if (player.exp > 220020020) {
player.exp = 220020020;
}
lln(' `%YOU GET '+pretty_int(num_end)+' EXPERIENCE.');
sln('');
if (times_hit === 5) {
lln(' `%YOUR STRENTH IS RAISED BY ONE!');
player.str += 1;
sln('');
// DIFF: The original returned here...
}
more_nomail();
player.high_spirits = true;
lln(' `0You travel home in an incredible mood.');
}
function fly()
{
var j;
var tries;
var time;
var old_time2;
var old_time;
var old_time1;
var cur_time;
var wx;
var wy;
// DIFF: forward1 was uninitialized...
var forward1 = !(random(2) === 0);
var wep_char;
var times_hit;
var speed;
wep_char = 'I';
lln('`c `%A HAIRY PREDICAMENT');
sln('');
for (j = 0; j < 10; j++) {
lln('`r0 `r6 `r0');
}
lln('`r0 `r6 `#o `r0');
lln('`r0 `r6 `#<`5\xdb`#> `r0');
lln('`r0 `r6 `#/\'> `r0');
sln('');
tries = 10;
time = 40;
dk.console.gotoxy(24,18);
lw('`0Tries Left: `%'+pretty_int(tries)+' ');
dk.console.gotoxy(24,19);
lw('`0Time Left: `%'+pretty_int(time)+' ');
speed = random(10);
dk.console.gotoxy(0,22);
lln(' `0(Press space to take your best shot) ');
old_time = (new Date()).valueOf();
old_time1 = old_time;
old_time = old_time + 500;
old_time1 = old_time1 + speed * 10;
wz = 23;
wy = 5;
dk.console.gotoxy(wz-1,wy-1);
lln('`r6\xf7\xf7');
times_hit = 0;
j = 1;
do {
ch = read_direction();
if (tries > 0 && ch === ' ') {
tries -= 1;
j = 14;
old_time2 = cur_time+100;
dk.console.gotoxy(24,18);
lw('`0`r0Tries Left: `%'+pretty_int(tries)+' ');
}
if (cur_time > old_time2 && j > 4) {
if (j !== 14) {
dk.console.gotoxy(29,j);
lw('`r6 ');
}
dk.console.gotoxy(29,j - 1);
lw('`r6'+wep_char);
j -= 1;
if (j === 4 && wz > 28 && wz < 31) {
times_hit += 1;
dk.console.gotoxy(0,22);
lw('`r0');
if (times_hit === 1) {
lw(' `0You hit the thing! It wobbles a little. `2<KEY> ');
}
if (times_hit === 2) {
lw(' `0Nice shot! The wig falters a bit. `2<KEY> ');
}
if (times_hit === 3) {
lw(' `0Direct hit! The hair piece is limping around! `2<KEY> ');
}
if (times_hit === 4) {
lw(' `0You knock some hairs off - It\'s almost dead! `2<KEY> ');
}
if (times_hit === 5) {
lw(' `0Beautiful shot. The wig stops moving. `2<KEY> ');
}
ch = getkey();
if (times_hit === 5) {
hair_end(times_hit,tries);
return;
}
speed = random(10);
dk.console.gotoxy(0,22);
lln('`r0 `0(Press space to take your best shot) ');
}
old_time2 = cur_time+100;
}
if (time < 1) {
dk.console.gotoxy(0,22);
lln('`r0 `%YOU ARE OUT OF TIME! ');
mswait(2000);
hair_end(times_hit, tries);
return;
}
if (tries < 1 && j < 5) {
dk.console.gotoxy(0,22);
lln('`r0 `%YOU ARE TOO TIRED TO THROW AGAIN! ');
mswait(2000);
hair_end(times_hit,tries);
return;
}
cur_time = (new Date()).valueOf();
if (cur_time > old_time) {
old_time = cur_time;
old_time += 500;
time -= 1;
dk.console.gotoxy(25,20);
lw('`0`r0Time Left: `%'+pretty_int(time)+' ');
}
if (cur_time > old_time1) {
old_time1 = cur_time+speed * 10;
dk.console.gotoxy(wz-1,wy-1);
lw('`r6 ');
if (forward1) {
wz += 1;
if (wz === 39) {
forward1 = false;
}
}
else {
wz -= 1;
if (wz < 24) {
forward1 = true;
}
}
dk.console.gotoxy(wz-1,wy-1);
lw('`r6`$\xf7\xf7');
}
} while (time >= 0);
}
function beard()
{
var man;
var ch;
sln('');
lln(' `2Barak\'s face falls. `0"You don\'t like my beard?"');
sln('');
lln(' `%"No, I definitely do not." `2you assure him.');
sln('');
lln(' `2A large tear wells up in one if his eyes.');
sln('');
more_nomail();
lln(' `2Just then, an old women pops up behind him!');
sln('');
lw('`0 ');
say_slow('"MOTHER!"');
lln(' `2Barak screams. `0"Get back into the basement!"');
sln('');
more_nomail();
man = (player.sex === 'M' ? 'man' : 'woman');
lln(' `#"I will not, boy! - That young '+man+' just insulted your beard!"');
sln('');
lln(' `2You scowl at the hag. `%"I\'m just being honest with your boy, ma\'am."');
sln('');
lln(' `#"I cannot tell if you are being serious or not! Are you willing to');
sln(' let me test your skills?"');
sln('');
lln(' `2(`0A`2)gree with the hag');
lln(' `2(`0T`2)ell her to shove it');
sln('');
lw(' `2You decide to ... [`0A`2] :`%');
ch = getkey().toUpperCase();
if (ch !== 'T') {
ch = 'A';
}
sln(ch);
sln('');
if (ch === 'T') {
player.hp = 1;
lln(' `%"Forget it, ancient one. Your boy looks like an ogre." `2you');
sln(' taunt.');
sln('');
more_nomail();
man = (player.sex === 'M' ? '"YOU BASTARD!"' : '"YOU BITCH!"');
lw(' `#');
say_slow(man);
lln(' `2screams the old woman, spittle forming at her mouth. ');
sln(' She then plucks off her hair - only a few strands of white adorn');
sln(' her bald head!');
sln('');
more_nomail();
lln(' `4SHE `)THROWS `4HER HAIR AT YOU!');
sln('');
more_nomail();
lln('`c `2Time has passed. Hours have passed - you rub your sore head');
sln(' wondering what happened.');
sln('');
more_nomail();
lln(' `2YOU TRUDGE HOME WEAK AND DEJECTEDLY.');
sln('');
return
}
if (ch === 'A') {
player.hp = 1;
lln(' `%"Lets do this thing, antique." `2you challenge.');
sln('');
lln(' `2Her wig rises from her head as if by `#magic`2!');
sln('');
lln(' `%IT FLOATS WILDLY AROUND THE ROOM!');
sln('');
more_nomail();
lln(' `2You grip your `0'+player.weapon+' `2tightly, and prepare to');
sln(' take down the hurling hair piece.');
sln('');
more_nomail();
fly();
return;
}
}
function wait()
{
mswait(1000);
sw('.');
}
function history()
{
if (random(2) == 0) {
lln(' `%"The Way Things Were" `2by `0Master Turgon`2.');
sln('');
sln(' Our town has gone to pot. Things used to be so nice - Children');
sln(' used to play on the street. Now they huddle together under their');