home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Hack-Phreak Scene Programs
/
cleanhpvac.zip
/
cleanhpvac
/
ARSRC21.ZIP
/
AR256SP.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-02
|
41KB
|
1,652 lines
// BIG HUGE SPELL FUNCTION MADE OF CASES------------------
// Main file of module 4.
#include <dos.h>
#include<process.h>
#include <graphics.h>
#include <string.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "ar256h.cpp"
enum tf {true,false};
//#include "ar256m.cpp"
#include "svga256.h"
#include"ar256def.h"
#include "ar256ex.h"
//#include "ar256h2.cpp"
extern screenmsgs s;
extern mouse m;
extern int fire(char,char);
extern void usemouse();
extern monster create(char,char,unsigned char,char,char,char);
extern int drawtile(char,char,char,char);
int calcspell (int,signed int);
castspell(int which,int real) //which = caster.spells[blah]
{
//foom(10,10);getch(); ya know that random data in the shroom? It gets put in the first time castspell is called, but I dont know why.
int i,j,r,st=1,num,lastnum;
char side[20];
char tgx=curx,tgy=cury,lox,loy;
if(!real)st=2; //real=1 for real monsters, st 2 causes illusions
tgx=mon[curpla][curmon].x,tgy=mon[curpla][curmon].y;
strcpy(side,"On what side?");
if(which<=4)//these ifs break up the switch according to whether
//there will be a select(&tgx,&tgy,2).
{
switch(which)
{
case(0):
outtextxy(485,400,"You do nowt.");downbip(2);
return(0);
case(1):
setcolor(0x0c);s.logo();s.boxes();//outtextxy(485,400,"Fireball! Aim it...");
fire(1,3);
return(0);
case(3):
setcolor(0x07);s.logo();s.boxes();//outtextxy(485,400,"Aim your arrow...");
fire(1,1);
return(0);
case(4):
setcolor(0x0c);s.logo();s.boxes();//outtextxy(485,400,"Aim your ray...");
fire(1,2);
return(0);
case(2):
setcolor(0x0f);outtextxy(485,400,"CHAOS...");
if(noisy)
{
for(i=1000;i<2000;i+=20)
{
r=random(i);
sound(r);
delay(5);
nosound();delay(5);
}
}
outtextxy(485,410,"...alters the arena!");
for(i=0;i<width;++i)
{
for(j=0;j<height;++j)
{
if (!random(10))
{
sq[i][j].land=random(8);
}
}
}
drawmap(curx,cury);delay(500);
setcolor(0x0f);outtextxy(485,420,"...twists your body!");
moof(curx,cury);
mon[curpla][curmon].attack=random(6);
mon[curpla][curmon].defend=random(6);
mon[curpla][curmon].mmoves=random(4);
delay(500);
setcolor(0x0f);outtextxy(485,430,"...and more...");
for(i=1;i<maxmon;++i)
{
j=random(players);r=random(6);
if(mon[j][i].status!=0)
{
if(!r)mon[j][i].status=3;
if((r==1)&&(!mon[j][i].spellnum))mon[j][i].spellnum=2,mon[j][i].spells[1]=random(9);
if((r==2)&&(random(2)))mon[j][i].graphic=22,mon[j][i].attack=random(5),mon[j][i].defend=random(5);
}
}
boof(curx+random(15)-7,cury+random(15)-7);
boof(curx+random(15)-7,cury+random(15)-7);
boof(curx+random(15)-7,cury+random(15)-7);
return(0);
}
}
if(which<30)
{
switch(which)
{
case(5):
setcolor(0x0c);outtextxy(485,400,"Strengthen whom?");
usemouse();
select(&tgx,&tgy,2);
if (sq[tgx][tgy].whatside!=0xff)
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].attack +=2;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].defend +=2;
outtextxy(485,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
outtextxy(485,380,"becomes stronger!");risingbip(3);
}
else
{
outtextxy(485,370,"You wasted the spell.");lowbip(2);
}
return(0);
case(6):
setcolor(0x0c);outtextxy(485,400,"Find HERO material!");
usemouse();
select(&tgx,&tgy,2);
if (sq[tgx][tgy].whatside!=0xff)
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].attack +=3;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].mmoves +=1;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].defend +=3;
outtextxy(485,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
outtextxy(485,380,"looks... HEROIC!!");risingbip(7);
}
else
{
outtextxy(485,370,"You wasted the spell.");lowbip(2);
}
return(0);
case(7):
setcolor(0x0c);outtextxy(485,400,"But which corpse?");
usemouse();
select(&tgx,&tgy,2);
if ((sq[tgx][tgy].whatside!=0xff)&&(mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].status==0x11))
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].status = 3;
outtextxy(485,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
outtextxy(485,380,"stirs in its sleep...");risingbip(3);
}
else
{
outtextxy(485,370,"Not a corpse.");lowbip(2);
}
return(0);
case(8):
setcolor(0x02);outtextxy(485,370,"Put forest where?");
usemouse();
select(&tgx,&tgy,2);curx=tgx;cury=tgy;drawmap(curx,cury);
for(i=0;i<7;++i)
{
if((i+tgx-3<0)||(i+tgx-3>=width))continue;
for(j=0;j<7;++j)
{
if((j+tgy-3<0)||(j+tgy-3>=height))continue;
if ((!random(3))&&(sq[i+tgx-3][j+tgy-3].land<10))
{
sq[(i+tgx)-3][(j+tgy)-3].land=1;
sq[(i+tgx)-3][(j+tgy)-3].whose=curpla;
foom((i+tgx)-3,(j+tgy)-3);
}
}
}
outtextxy(485,380,"Eco-spell finished.");bip(10);
if(alignment[curpla]<260)alignment[curpla]+=40;else{alignment[curpla]=300;}
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
return(0);
case(9):
setcolor(0x02);outtextxy(485,370,"Plant trees where?");
//drawmap(curx,cury);
for (i=0;i<6;++i)
{
usemouse();
do{
select(&tgx,&tgy,2);
setcolor(0x00);line(7*32,7*32,8*32,8*32);line(8*32,7*32,7*32,8*32);
lowbip(4);
}
while(!rangesight(tgx,tgy,curx,cury,6));
if(sq[tgx][tgy].land>9)
{
if(noisy)downbip(3);
}
else
{
drawmap(curx,cury);
sq[tgx][tgy].land=1;sq[tgx][tgy].whose=curpla;
if(noisy)sound(20);
foom(tgx,tgy);
nosound();
tgx=curx,tgy=cury;
}
}
if(alignment[curpla]<270)alignment[curpla]+=30;
outtextxy(485,380,"Trees all planted.");bip(10);
return(0);
case(10):
setcolor(0x02);outtextxy(485,370,"Build walls where?");
//drawmap(curx,cury);
for (i=0;i<6;++i)
{
usemouse();
do{
select(&tgx,&tgy,2);
setcolor(0x00);line(7*32,7*32,8*32,8*32);line(8*32,7*32,7*32,8*32);
lowbip(4);
}
while(!rangesight(tgx,tgy,curx,cury,6));
if(sq[tgx][tgy].land>9)
{
if(noisy)downbip(3);
}
else
{
drawmap(curx,cury);
sq[tgx][tgy].land=2;
if(noisy)sound(20);
foom(tgx,tgy);
nosound();
tgx=curx,tgy=cury;
}
}
outtextxy(485,380,"Walls all built.");bip(10);
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
return(0);
case(11):
setcolor(0x04);outtextxy(485,370,"Aim the blast!");
usemouse();
select(&tgx,&tgy,2);
//ie if wizard dont do it...
if(!decide(7,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].defend))
{
//setfillstyle(1,20);bar(485,390,640,440);
outtextxy(485,380,"Your blast misses!");downbip(0);
tgx+=random(3)-1,tgy+=random(3)-1;
}
if((sq[tgx][tgy].whatmonster==0)&&(sq[tgx][tgy].whatside!=0xff)){outtextxy(485,380,"Nope.");downbip(5);return(0);}
if(sq[tgx][tgy].land>10){outtextxy(485,380,"Nope.");downbip(5);return(0);}
drawmap(tgx,tgy);curx=tgx;cury=tgy;
sq[tgx][tgy].land=4;sq[tgx][tgy].whose=0xff;
if((sq[tgx][tgy].whatside!=0xff)&&(sq[tgx][tgy].whatmonster!=0));
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].status=0;
sq[tgx][tgy].whatside=0xff;
++kills[curpla];
}
if(noisy)
{
for(i=50;i>3;--i)
{sound(i);delay(5);}
}
boof(tgx,tgy);
foom(tgx,tgy);
nosound();
//setfillstyle(1,20);bar(485,400,640,440);
outtextxy(485,380,"Hee hee hee.");
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
return(0);
case(12):
setcolor(0x0b);outtextxy(485,360,"Where to beam your");
outtextxy(485,370,"charismatic smile?");
usemouse();
do
{
select(&tgx,&tgy,2);
setcolor(0x00);line(7*32,7*32,8*32,8*32);line(8*32,7*32,7*32,8*32);
lowbip(4);
}
while(!linesight(curx,cury,tgx,tgy));
if((tgx==curx)&&(tgy==cury)){outtextxy(485,380,"You charm yourself.");return(0);}
curx=tgx;cury=tgy;drawmap(curx,cury);
r=random(5);
if ((r)&&(sq[tgx][tgy].whatside!=0xff)&&(sq[tgx][tgy].whatmonster))
{
if ((mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].id==2)||(mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].id==5))
{
outtextxy(485,380,"He is far too loyal");
outtextxy(485,390,"to be charmed by you.");
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;lowbip(2);
return(0);
}
mon[curpla][moncounter[curpla]]=
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster];
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].status=0;
sq[tgx][tgy].whatside=curpla;
sq[tgx][tgy].whatmonster=moncounter[curpla];
++moncounter[curpla];
moof(tgx,tgy);
outtextxy(485,380,"How charming!");risingbip(3);
}
else
{
outtextxy(485,380,"There is no effect.");lowbip(2);
}
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
return(0);
case(13):
setcolor(0x0d);outtextxy(485,400,"The ritual starts...");
delay(500);
for (i=0;i<maxmon;++i)
{
if((mon[curpla][i].status==0)&&(mon[curpla][i].id))
{
mon[curpla][i].status=1;
mon[curpla][i].attack+=2;
strcat(mon[curpla][i].name," II");
sq[mon[curpla][i].x][mon[curpla][i].y].whatside=curpla;
sq[mon[curpla][i].x][mon[curpla][i].y].whatmonster=i;
outtextxy(485,410,"A reincarnation!");bip(20);bip(20);bip(20);
break;
}
}
outtextxy(485,420,"The ritual ends.");bip(10);
return(0);
case(14):
setcolor(0x0c);outtextxy(485,400,"Weaken whom?");
usemouse();
select(&tgx,&tgy,2);
if (sq[tgx][tgy].whatside!=0xff)
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].attack /=2;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].defend /=2;
outtextxy(485,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
outtextxy(485,380,"shivers miserably.");downbip(2);
}
else
{
outtextxy(485,370,"Wasted the spell.");lowbip(2);
}
return(0);
case(15):
setcolor(0x0c);outtextxy(485,400,"Hasten whom?");
usemouse();
select(&tgx,&tgy,2);
if (sq[tgx][tgy].whatside!=0xff)
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].mmoves *=2;
outtextxy(485,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
outtextxy(485,380,"speeds up!");risingbip(5);
}
else
{
outtextxy(485,370,"Nobody there.");lowbip(2);
}
return(0);
case(16):
setcolor(0x0c);outtextxy(485,400,"Give whom wings?");
usemouse();
select(&tgx,&tgy,2);
if (sq[tgx][tgy].whatside!=0xff)
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].fly =1;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].mmoves +=1;
outtextxy(485,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
outtextxy(485,380,"can now fly.");risingbip(3);
}
else
{
outtextxy(485,370,"There's no target!");lowbip(2);
}
return(0);
case(17):
setcolor(0x0c);outtextxy(485,400,"Protect whom?");
usemouse();
select(&tgx,&tgy,2);
if (sq[tgx][tgy].whatside!=0xff)
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].defend +=3;
outtextxy(485,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
outtextxy(485,380,"is protected.");risingbip(3);
}
else
{
outtextxy(485,370,"You wasted it.");lowbip(2);
}
return(0);
case(18):
setcolor(0x04);outtextxy(485,400,"You invoke a swarm");
for(i=0;i<3;++i)
{
for(j=0;j<3;++j)
{
if((sq[curx+i-1][cury+j-1].whatside!=0xff)&&((i!=1)||(j!=1)))
{
if(decide(6,mon[sq[curx+i-1][cury+j-1].whatside][sq[curx+i-1][cury+j-1].whatmonster].defend))
{
if(mon[sq[curx+i-1][cury+j-1].whatside][sq[curx+i-1][cury+j-1].whatmonster].status==1)
{
mon[sq[curx+i-1][cury+j-1].whatside][sq[curx+i-1][cury+j-1].whatmonster].status=0x11;
}
else
{
mon[sq[curx+i-1][cury+j-1].whatside][sq[curx+i-1][cury+j-1].whatmonster].status=0;
sq[curx+i-1][cury+j-1].whatside=0xff;
}
++kills[curpla];
}
}
}
}
swarm(curx-1,cury-1,curx+2,cury+2,200);
return(0);
case(19):
setcolor(0x04);outtextxy(485,400,"MANA STORM!!");
for(i=0;i<7;++i)
{
for(j=0;j<7;++j)
{
if((sq[curx+i-3][cury+j-3].whatside!=0xff)&&(sq[curx+i-3][cury+j-3].whatmonster))
{
if((i!=3)||(j!=3))
{
if(decide(6,mon[sq[curx+i-3][cury+j-3].whatside][sq[curx+i-3][cury+j-3].whatmonster].defend))
{
if(mon[sq[curx+i-3][cury+j-3].whatside][sq[curx+i-3][cury+j-3].whatmonster].status==1)
{
mon[sq[curx+i-3][cury+j-3].whatside][sq[curx+i-3][cury+j-3].whatmonster].status=0x11;
}
else
{
mon[sq[curx+i-3][cury+j-3].whatside][sq[curx+i-3][cury+j-3].whatmonster].status=0;
sq[curx+i-3][cury+j-3].whatside=0xff;
}
++kills[curpla];
}
}
}
}
}
moof(curx,cury);
swarm(curx-3,cury-3,curx+4,cury+4,100);
moves=0; // this is so that non-wizzes dont walk about dead.
return(0);
case(20):
setcolor(0x04);outtextxy(485,370,"Aim the shockwave.");
usemouse();
do{
select(&tgx,&tgy,2);
setcolor(0x00);line(7*32,7*32,8*32,8*32);line(8*32,7*32,7*32,8*32);
}
while(range(tgx,tgy,curx,cury)>8);
if((curx==tgx)&&(cury==tgy))
{
outtextxy(485,380,"You idiot.");
return(0);
}
curx=tgx,cury=tgy;drawmap(curx,cury);
crawler(mon[curpla][curmon].x,mon[curpla][curmon].y,tgx,tgy);
//setfillstyle(1,20);bar(485,400,640,440);
outtextxy(485,380,"You revel in the");
outtextxy(485,390,"destruction!");
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
return(0);
case(21):
setcolor(0x07);outtextxy(485,370,"Clone whom?");
usemouse();
select(&tgx,&tgy,2);
if(sq[tgx][tgy].whatside==0xff){outtextxy(485,380,"Nobody there!");lowbip(2);return(0);}
if((!random(4))||(sq[tgx][tgy].whatmonster==0)){outtextxy(485,380,"Sadly, you fail.");lowbip(2);return(0);}
drawmap(tgx,tgy);
//fails on wizzes, 1 in 4 chance to fail anyway
do
{
i=random(5),j=random(5);
}
while(sq[i+tgx-2][j+tgy-2].whatside!=0xff);
//create(curpla,moncounter[curpla],mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].id,0,i+tgx-2,j+tgx-2);
mon[curpla][moncounter[curpla]]=mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster];
mon[curpla][moncounter[curpla]].x=i+tgx-2;
mon[curpla][moncounter[curpla]].y=j+tgy-2;
sq[i+tgx-2][j+tgy-2].whatside=curpla;
sq[i+tgx-2][j+tgy-2].whatmonster=moncounter[curpla];
++moncounter[curpla];
//setfillstyle(1,20);bar(485,400,640,440);
outtextxy(485,380,"A clone begins to");
outtextxy(485,390,"take form.");risingbip(5);
return(0);
case(22):
setcolor(0x06);outtextxy(485,370,"Quake? Where?");
usemouse();
do{
select(&tgx,&tgy,2);
setcolor(0x00);line(7*32,7*32,8*32,8*32);line(8*32,7*32,7*32,8*32);
lowbip(4);
}
while(range(tgx,tgy,curx,cury)>4);
drawmap(tgx,tgy);curx=tgx,cury=tgy;
if(noisy)sound(6);
for(i=0;i<5;++i)
{
if((i+tgx-2<0)||(i+tgx-2>=width))continue;
for(j=0;j<5;++j)
{
if((j+tgy-2<0)||(j+tgy-2>=height))continue;
if((sq[tgx+i-2][tgy+j-2].whatside!=0xff)&&(sq[tgx+i-2][tgy+j-2].land<10)&&(sq[tgx+i-2][tgy+j-2].whatmonster)&&(random(2)))
{ // no wizzes or balls to be iced!
mon[sq[tgx+i-2][tgy+j-2].whatside][sq[tgx+i-2][tgy+j-2].whatmonster].status=0;
++kills[curpla];
sq[tgx+i-2][tgy+j-2].whatside=0xff;
foom(tgx+i-2,tgy+j-2);downbip(1);if(noisy)sound(6);
}
if(sq[tgx+i-2][tgy+j-2].land)
{
sq[tgx+i-2][tgy+j-2].land=4;sq[tgx+i-2][tgy+j-2].whose=0xff;
foom(tgx+i-2,tgy+j-2);downbip(2);if(noisy)sound(6);
}
//circle(((tgx+i-2)-curx+7)*32,((tgy+j-2)-cury+7)*32,5);
}
}
nosound();
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
outtextxy(485,370,"The earth stops");
outtextxy(485,380,"trembling.");
return(0);
case(23):
setcolor(0x06);outtextxy(485,370,"Plant grass where?");
drawmap(curx,cury);
for (i=0;i<6;++i)
{
usemouse();
do{
select(&tgx,&tgy,2);
setcolor(0x00);line(7*32,7*32,8*32,8*32);line(8*32,7*32,7*32,8*32);
lowbip(4);
}
while(!rangesight(tgx,tgy,curx,cury,6));
if(sq[tgx][tgy].land>9)
{
if(noisy)downbip(3);
}
else
{
drawmap(curx,cury);
sq[tgx][tgy].land=6;
if(noisy)sound(20);
foom(tgx,tgy);tgx=curx,tgy=cury;
nosound();
}
}
outtextxy(485,380,"Grass all planted.");bip(10);
return(0);
case(24):
setcolor(0x07);outtextxy(485,400,"Change!");
r=random(24)+1;
create(curpla,curmon,r,1,curx,cury);
moof(curx,cury);drawtile(curx,cury,curx,cury);
return(0);
case(25):
setcolor(0x08);outtextxy(485,370,"Afflict what places?");
drawmap(curx,cury);
for (i=0;i<6;++i)
{
usemouse();
do{
select(&tgx,&tgy,2);
setcolor(0x00);line(7*32,7*32,8*32,8*32);line(8*32,7*32,7*32,8*32);
lowbip(4);
}
while(!rangesight(tgx,tgy,curx,cury,6));
if(sq[tgx][tgy].land>9)
{
if(noisy)downbip(3);
}
else
{
drawmap(curx,cury);
sq[tgx][tgy].land=5;
sq[tgx][tgy].whose=5;
if(noisy)sound(20);
foom(tgx,tgy);tgx=curx,tgy=cury;
nosound();
}
}
if(alignment[curpla]>-270)alignment[curpla]-=30;
outtextxy(485,380,"Mirkwoods finished.");bip(10);
return(0);
case(26):
setcolor(0x05);outtextxy(485,360,"Select a spell...");
setwritemode(XOR_PUT);
setcolor(0x10);
m.bitmapoff();
num=(m.y-95)/10;
if(num<0)num=0; //these 4 lines delete the extra copy of the cursor
if(num>=mon[curpla][curmon].spellnum-1)num=mon[curpla][curmon].spellnum-1;
rectangle(481,94+num*10,639,104+num*10);
while(m.wheremouse())
{
num=(m.y-95)/10;
if(num<0)num=0;
if(num>=mon[curpla][curmon].spellnum-1)num=mon[curpla][curmon].spellnum-1;
if (lastnum!=num)
{
rectangle(481,94+lastnum*10,639,104+lastnum*10);
rectangle(481,94+num*10,639,104+num*10);
}
lastnum=num;
}
setwritemode(0);
if(mon[curpla][curmon].spells[num]==26)
{
setcolor(0x0d);outtextxy(485,370,"Hey! You're trying");
setcolor(0x0d);outtextxy(485,380,"to confuse me!");downbip(8);
return(0);
}
m.bitmapon(2,pcol[curpla]);
setcolor(0x05);outtextxy(485,370,"...for whom?");usemouse();
select(&tgx,&tgy,2);
if(sq[tgx][tgy].whatside==0xff)
{
setcolor(0x05);outtextxy(485,380,"You waste it...");lowbip(2);
return(0);
}
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].spellnum += 1;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].spells //easy!
[mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].spellnum-1]
=mon[curpla][curmon].spells[num];
//moof(tgx,tgy);
setcolor(0x0d);outtextxy(485,380,"Spell given!");risingbip(5);
return(0);
case(27):
setcolor(0x04);outtextxy(485,360,"Teleport whom?");usemouse();
select(&tgx,&tgy,2);
if(sq[tgx][tgy].whatside==0xff)
{
outtextxy(485,370,"Whom, not what!");lowbip(2);
return(0);
}
if((!sq[tgx][tgy].whatmonster)&&(sq[tgx][tgy].whatside!=curpla))
{
outtextxy(485,370,"Your plan fails!");
return(0);
}
outtextxy(485,370,"To where?");bip(10);usemouse();
lox=tgx,loy=tgy;
select(&lox,&loy,2);
sq[lox][loy].whatside=sq[tgx][tgy].whatside;
sq[lox][loy].whatmonster=sq[tgx][tgy].whatmonster;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].x=lox;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].y=loy;
sq[tgx][tgy].whatside=0xff;
outtextxy(485,380,"There is a ");
outtextxy(485,390,"sudden motion!");
curx=lox,cury=loy;
moof(lox,loy);drawtile(lox,loy,lox,loy);
curx=mon[curpla][curmon].x,cury=mon[curpla][curmon].y;
return(0);
case(28):
setcolor(0x04);outtextxy(485,370,"Aim the curse!");
usemouse();
select(&tgx,&tgy,2);
if(!random(4))
{
//setfillstyle(1,20);bar(485,390,640,440);
outtextxy(485,380,"Your curse misses!");downbip(0);
tgx+=random(3)-1,tgy+=random(3)-1;
}
drawmap(tgx,tgy);curx=tgx;cury=tgy;
if((sq[tgx][tgy].land==1)||((mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].alignment==1)&&(sq[tgx][tgy].whatside!=0xff)))
// if tree or evil critter
{
if((sq[tgx][tgy].whatmonster==0)&&(sq[tgx][tgy].whatside!=0xff)){outtextxy(485,380,"The wiz resists!");downbip(5);return(0);}
if(sq[tgx][tgy].land>10){outtextxy(485,380,"The Orb resists!");downbip(5);return(0);}
sq[tgx][tgy].land=4;sq[tgx][tgy].whose=0xff;
if((sq[tgx][tgy].whatside!=0xff)&&(sq[tgx][tgy].whatmonster!=0));
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].status=0;
sq[tgx][tgy].whatside=0xff;
++kills[curpla];
}
if(noisy)
{
for(i=50;i>3;--i)
{sound(i);delay(5);}
}
boof(tgx,tgy);
foom(tgx,tgy);
nosound();
//setfillstyle(1,20);bar(485,400,640,440);
outtextxy(485,390,"Har har har!");
}
else
{
moof(tgx,tgy);
outtextxy(485,390,"Nothing cursable!");
}
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
if(alignment[curpla]>-290)alignment[curpla]-=10;
return(0);
case(29):
setcolor(0x04);outtextxy(485,370,"Bless what?");
usemouse();
select(&tgx,&tgy,2);
if(!random(4))
{
//setfillstyle(1,20);bar(485,390,640,440);
outtextxy(485,380,"You bless badly.");downbip(0);
tgx+=random(3)-1,tgy+=random(3)-1;
}
drawmap(tgx,tgy);curx=tgx;cury=tgy;
if((sq[tgx][tgy].land==5)||((mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].alignment==-1)&&(sq[tgx][tgy].whatside!=0xff)))
// if mwood or evil critter
{
if((sq[tgx][tgy].whatmonster==0)&&(sq[tgx][tgy].whatside!=0xff)){outtextxy(485,380,"The wiz resists!");downbip(5);return(0);}
if(sq[tgx][tgy].land>10){outtextxy(485,380,"The orb resists!");downbip(5);return(0);}
sq[tgx][tgy].land=4;sq[tgx][tgy].whose=0xff;
if((sq[tgx][tgy].whatside!=0xff)&&(sq[tgx][tgy].whatmonster!=0));
{
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].status=0;
sq[tgx][tgy].whatside=0xff;
++kills[curpla];
}
if(noisy)
{
for(i=50;i>3;--i)
{sound(i);delay(5);}
}
boof(tgx,tgy);
foom(tgx,tgy);
nosound();
//setfillstyle(1,20);bar(485,400,640,440);
outtextxy(485,390,"How regrettable.");
}
else
{
moof(tgx,tgy);
outtextxy(485,390,"Nothing evil!");
}
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
if(alignment[curpla]<290)alignment[curpla]+=10;
return(0);
}
}
else // middle of breaking-up-cases-if
{
m.bitmapoff();
switch(which)
{
case(30):
setcolor(0x07);outtextxy(485,370,"Reflect where?");
usemouse();
/*do{
select(&tgx,&tgy,2);drawmap(curx,cury);
setcolor(0x00);line(7*32,7*32,8*32,8*32);line(8*32,7*32,7*32,8*32);
}
while((range(tgx,tgy,curx,cury)>3)&&(sq[tgx][tgy].whatside!=0xff));*/
getadj(&tgx,&tgy);
create(curpla,moncounter[curpla],0xff,2,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
//setfillstyle(1,20);bar(485,400,640,440);
outtextxy(485,380,"You are no longer");
outtextxy(485,390,"unique!");
tripbip(10);
return(0);
case(31):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(4,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"No beholder will");outtextxy(485,410,"come to you.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],1,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You feel someone");
outtextxy(485,410,"is watching you :)");
tripbip(10);
return(0);
case(32):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
create(curpla,moncounter[curpla],2,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A staunch ally");
outtextxy(485,410,"appears beside you.");
tripbip(10);
return(0);
case(33):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(2,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"No bones rise");outtextxy(485,410,"from the hard earth.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],3,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"The earth bubbles.");
outtextxy(485,410,"Up leap some bones!");
tripbip(10);
return(0);
case(34):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(2,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"Even the bats");outtextxy(485,410,"laugh at you!.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],4,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"Fat lot of good");
outtextxy(485,410,"that'll do you.");
tripbip(10);
return(0);
case(35):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
create(curpla,moncounter[curpla],5,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A trusty marksman");
outtextxy(485,410,"appears beside you.");
tripbip(10);
return(0);
case(36):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(1,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"No goblins like");outtextxy(485,410,"you enough.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],6,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You summon a filthy");
outtextxy(485,410,"goblin.");
tripbip(10);
return(0);
case(37):
setcolor(0x0c);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(6,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You are too puny");outtextxy(485,410,"to call a dragon.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],7,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"With searing heat");
outtextxy(485,410,"a dragon appears!");
tripbip(10);
return(0);
case(38):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(3,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"No shape appears");outtextxy(485,410,"in the mutable air.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],8,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A ghastly figure");
outtextxy(485,410,"takes shape...");
tripbip(10);
return(0);
case(39):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(6,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You hear hollow");outtextxy(485,410,"laughter underground.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],9,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You have called");
outtextxy(485,410,"an undead wizard!");
tripbip(10);
return(0);
case(40):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(3,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You fail.");outtextxy(485,410,"No ghost replies.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],10,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A cowled figure");
outtextxy(485,410,"rises beside you.");
tripbip(10);
return(0);
case(41):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(7,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"Pathetic! No");outtextxy(485,410,"dragon appears.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],11,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You gasp as a gold");
outtextxy(485,410,"dragon appears!");
tripbip(10);
return(0);
case(42):
setcolor(0x09);outtextxy(485,400,"You call for aid!");
for(i=0;i<5;++i)
{
tgx += (random(3)-1);
tgy += (random(3)-1);
r=random(3);
if((sq[tgx][tgy].whatside==0xff)&&(sq[tgx][tgy].land!=2))
{
if(r)
{
create(curpla,moncounter[curpla],2,st,tgx,tgy);++moncounter[curpla];
}
else
{
create(curpla,moncounter[curpla],5,st,tgx,tgy);++moncounter[curpla];
}
foom(tgx,tgy);
alignment[curpla]-=20;//it gets huge otherwise
}
}
drawmap(curx,cury);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,410,"Your men are ready!");
outtextxy(485,420,"You feel proud.");
tripbip(10);
return(0);
case(43):
num=2;
for(i=0;i<moncounter[curpla];++i)
{
if (mon[curpla][i].id==15){num=4;outtextxy(485,390,"Your sidhe smiles...");break;}
}
setcolor(0x09);outtextxy(485,400,"You summon...");
for(i=0;i<num;++i)
{
tgx += (random(3)-1);
tgy += (random(3)-1);
r=random(10)+1;
if((sq[tgx][tgy].whatside==0xff)&&(sq[tgx][tgy].land!=2)&&(r!=7)&&(r!=11))//no dragons
{
create(curpla,moncounter[curpla],r,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
}
}
drawmap(curx,cury);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,410,"..and trust to");
outtextxy(485,420,"luck.");
tripbip(10);
return(0);
case(44):
setcolor(0x0e);outtextxy(485,400,"Ooh! A nema!");
tgx=random(width);tgy=random(height);
create(curpla,moncounter[curpla],12,st,tgx,tgy);++moncounter[curpla];
outtextxy(485,410,"A nema has arrived");
outtextxy(485,420,"somewhere nearby...");
tripbip(12);
return(0);
case(45):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(4,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"The king of beasts");outtextxy(485,410,"ignores you.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],13,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A majestic lion");
outtextxy(485,410,"comes to your aid.");
tripbip(10);
return(0);
case(46):
setcolor(0x0d);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(1,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"Nobody hears.");outtextxy(485,410,"You are ashamed.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],14,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A footling brownie");
outtextxy(485,410,"saunters along.");
tripbip(10);
return(0);
case(47):
setcolor(0x02);outtextxy(485,400,"Where, begorrah?");
getadj(&tgx,&tgy);
if(real){
if(calcspell(3,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"All the sidhe");outtextxy(485,410,"ignore you, bedad!");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],15,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A sidhe leaps from");
outtextxy(485,410,"behind a stone.");
tripbip(10);
return(0);
case(48):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(kills[curpla]>2){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You are too brutal");outtextxy(485,410,"to own a dog!");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],16,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"Your trusty dog");
outtextxy(485,410,"comes to your aid.");
tripbip(10);
return(0);
case(49):
setcolor(0x07);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(3,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You fail, and");outtextxy(485,410,"sigh dismally.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],17,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A ravening wolf");
outtextxy(485,410,"glares all around.");
tripbip(10);
return(0);
case(50):
setcolor(0x0d);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
r=random(8);
if(r<3){
//setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,410,"Your complex spell");outtextxy(485,420,"fails utterly.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],24,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,410,"A strange mutant");
outtextxy(485,420,"gibbers and raves.");
tripbip(10);
return(0);
case(51):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(6,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"The gryphons");outtextxy(485,410,"ignore you.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],18,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A huge gryphon");
outtextxy(485,410,"answers your call.");
tripbip(10);
return(0);
case(52):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(5,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You hear a horrid");outtextxy(485,410,"double laugh.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],19,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A malicious");
outtextxy(485,410,"manticore comes.");
tripbip(10);
return(0);
case(53):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(5,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"No centaur");outtextxy(485,410,"will help you.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],20,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"An armed centaur,");
outtextxy(485,410,"gallops up.");
tripbip(10);
return(0);
case(54):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(5,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"High above, the");outtextxy(485,410,"eagles mock you");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],21,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A noble eagle");
outtextxy(485,410,"comes to your aid.");
tripbip(10);
return(0);
case(55):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(4,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"The giants are");outtextxy(485,410,"wholly disdainful.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],22,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"Clumsily, a giant");
outtextxy(485,410,"takes up its post.");
tripbip(10);
return(0);
case(56):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(5,1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"You feel a chill.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],23,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"Boiling and hissing,");
outtextxy(485,410,"a salamander comes.");
tripbip(10);
return(0);
case(57):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(1,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"No rotting flesh");outtextxy(485,410,"rises for you.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],25,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"A stinking zombie");
outtextxy(485,410,"staggers up to you.");
tripbip(10);
return(0);
case(58):
setcolor(0x0e);outtextxy(485,400,side);
getadj(&tgx,&tgy);
if(real){
if(calcspell(4,-1)){
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"Hissing laughter");outtextxy(485,410,"mocks your call.");lowbip(2);return(0);
}
}
create(curpla,moncounter[curpla],26,st,tgx,tgy);++moncounter[curpla];
foom(tgx,tgy);
setfillstyle(1,20);bar(485,400,640,410);
outtextxy(485,400,"In a cloud of venom");
outtextxy(485,410,"a hydra appears!");
tripbip(10);
return(0);
}
}//end of if
m.bitmapon(2,pcol[curpla]);
switch(which)
{
case(98):
outtextxy(485,390,"Aim the tea spell.");
do{
select(&tgx,&tgy,2);drawmap(curx,cury);
}
while(range(tgx,tgy,curx,cury)>1);
if (sq[tgx][tgy].whatside!=0xff)
{
setcolor(0x05);outtextxy(485,300,"The nema makes a");
outtextxy(485,310,"lovely pot of tea,");
outtextxy(485,320,"pours some, and");
outtextxy(485,330,"skips away!");
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].attack +=2;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].mmoves *=2;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].range *=2;
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].defend +=3;
moof(curx,cury);
moof(tgx,tgy);
}
else
{
setcolor(0x05);outtextxy(485,300,"Since there is");
outtextxy(485,310,"nobody to share her");
outtextxy(485,320,"tea with, the nema");
outtextxy(485,330,"grumps off back home.");
moof(curx,cury);
}
mon[curpla][curmon].status=0;
mon[curpla][curmon].id=4;
sq[curx][cury].whatside=0xff;
moves=0;
return(0);
case(99):
setcolor(0x04);outtextxy(485,360,"Gaze at what?");
select(&tgx,&tgy,2);
drawmap(tgx,tgy);curx=tgx;cury=tgy;
if(sq[tgx][tgy].whatside!=0xff)
{
if(mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].status==2)
{
outtextxy(485,370,"The false");
outtextxy(485,380,"writhes & vanishes.");
outtextxy(555,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].status=0;
sq[tgx][tgy].whatside=0xff;
setfillstyle(1,20);bar(485,400,640,440);
}
else
{
outtextxy(485,370,"The");
outtextxy(485,380,"must be real!");
outtextxy(520,370,mon[sq[tgx][tgy].whatside][sq[tgx][tgy].whatmonster].name);
}
}
moof(tgx,tgy);drawtile(tgx,tgy,tgx,tgy);
curx=mon[curpla][curmon].x;cury=mon[curpla][curmon].y;
return(0);
}
return(0);
}
int calcspell(int difficulty,signed int align) //returns 0 if success
{
double floaty=0;
double probability;
int r;
align*=(signed int)alignment[curpla];
// so if player is different alignment from
// monster, this variable is negative
// alignment[curpla] is usually about -200 to 200
floaty=(double)align/300;
probability=((8-(double)difficulty)/8);
probability*=pow(2,(double)floaty);
//p=((8-diff)/8)*(2^(al/150))
probability*=1000;
r=random(1000);
if(r<500)luck_history[curpla]+=2; // add 1 to luck if low r -> spell liable to work
luck_history[curpla]--;
//delay(1);
if((int)probability>r)return(0);
return(1);
}