//Beastrove complex; Vanguard scenario; Arms Reach module; //Stacking, Skirmish options (freeware: no disk dta) //import java.lang.Math; //unnec: String, Integer also in java.lang (refs in cod na) import java.awt.*; //incorpg Graphics class import java.awt.event.*; //incorpg KeyListener/Adapter classes (avoids refs in cod) public class arhX0Ap extends Panel{ static final int X=10,C=100,Asc0=+'0'; //note shorthand for (int)'0' int x1=1,x2,x3,x4,x5,x6,x7,y1=1,y2,y3,y4,y5,y6,y7; //var lvl 1 routines' constants static final int Sho4th=1,PikPty=2,UseOpt=3,AtLrg=4,ChkTil=5,ChkIn=6,ChkTrp=7, ChkBar=8,ChkBst=9,SeeBst=X,RndOne=11,OneRnd=12,ChkVlt=13,ChkTrv=14, ChkOut=15,ChkFea=16,TryTdr=17,TryStp=18,ChkMov=19,EndGam=20; //var lvl 2 routines' constants static final int TryNgo=1,TryId=2,TryDtp=3,DoTrp=4,AdvAtk=5,BstAtk=6, BstOrg=7,AdvOrg=8; //var lvl 3 routines' constants static final int PikItm=1,UseItm=2,BadUse=3,DoItm=4,DoWpn=5,DoSpl=6, DoSpi=7,DoPot=8,DoDvc=9,FxExp=X; //var lvl 4 routines' constants static final int PikAds=1,OrdPty=2,RdyItm=3,SelJew=4,UpGra=5,AddAdv=6,GenTrv=7, AtkVs=8,HitVs=9; //var lvl 5 routines' constants static final int PutTrp=1,SplPay=2,MovPty=3; //var lvl 6 routines' constants static final int PikChr=1,TskRol=2,ADie=3,Rpt=4; //var lvl 7 routines' constants static final int ShoAdv=1,VuMap=2,ChgBd=3,SetPst=4; int hlfSqSid=13,sqSid,bdrWd; int bdWd,bdHt,pflWd,pflHt,fldWd,fldHt,mapWd,mapHt,ioWd,ioHt,zonWd; static final int ImgWd=20,ImgHt=20; int ltrPt,typHt,ptDec=1; Font ltr; //& FontMetrics class instance ltrSiz obj boolean isBld; static final String ChkBrf$="3) add adventurer "; //tests for selected font width static final Color StdHue[]={ Color.black,Color.magenta,Color.red,Color.orange,Color.yellow, Color.green,Color.cyan,Color.blue,Color.lightGray,Color.white }; //StdHue[] (-1= transparent bkg iaw shoMkr() sbr) int hues[]={0,6,0,9,0,9,0,8,0,8,-1,0,6,7,5,2,-1,3,-1,9}; //hue() fnc's indirect ref sto static final int BdrFgd=1,BrfBkg=2,BrfFgd=3,PflBkg=4,PflFgd=5,FldBkg=6,FldFgd=7, MapBkg=8,MapFgd=9,ChrBkg=X,ChrFgd=11,AdvBkg=12,AdvFgd=13, BstBkg=14,BstFgd=15,FeaBkg=16,FeaFgd=17,CsrBkg=18,CsrFgd=19; static final String HueObj$="bdr,brf,pfl,fld,map,chr,adv,bst,fea,csr"; static final String HueSet$="/609090808/06752/3/9"+"/790909090/78041/2/7" +"/080808987/87003/0/1"; static final Color NewHue[]={ new Color(0,C,0).brighter() //grass green }; //NewHue[] int trvChr,oprChr,srcChr,tgtChr,newChr; //for active chr tracking at base lvl 1 (& utl sbrs) //Bst= bst in bst ctl, Adv= adv in adv ctl, Foe= in bst ctl, Pty= in adv ctl, Any= in coo //Set= must be unacted eg. pikChr(Pty+Set,"show a token") //Out= may be unconscious/ asleep (can't look for both Set & Out at once) static final int All=-1,Bst=0,Adv=1,Foe=2,Pty=3,Any=4,Set=5,Out=X,By=0; //nxtChr(), rdmChr() args static final int HasEmy=-10000; //has() args static final String Ctl$="BAba"; int atkSrc,atkTgt,atkItm,atkAmo,amoCnt; //for typical atk prcg at var lvl 4 int atkTyp; static final int Nop=0,Rdy=1,Cbt=2,Mgc=3,Dvc=4; //setAtk() args int atkRng; static final int Eng=1,Msl=2; int atkCmp; static final int Wpn=0,Spl=1,Mtl=2; int atkWpn; static final int Una=0,Dag=1,Qsf=2,Bow=3,Hmr=4,Swd=5,Axe=6,Aro=7, Bst1=20,Bst2=21; int atkSpl; static final int Sbd=1,Chk=2,Exp=3,Shk=4,Psn=5,Unp=6,Tmt=7,Fbr=8,Drn=9, Bla=X,Aid=11,Hea=12,Prf=13,Stl=14,Tng=15,Swn=16,Blf=17,Bgl=18; int atkMtl; static final int Egy=0,Gas=1,Flr=2,Acd=3,Pwd=4; static final int Dmy=99; //dummy atkWpn/Spl/Mtl to use for spec atkVs() calls int rndCnt,trnCnt=1; //trnCnt++ in chkMov() when all advs acted int opeCnt,exiCnt=-1,exiTrn; //exiTrn= sep sum of all extra turns added for exits StringBuffer ope$=new StringBuffer(","); //openings onto open coos locator int totRoo,totHal,totHalRoo,totBfd,totLar,totTdr,totStp; //allows tots inp mod, vs csts int mazBig,frqRoo,frqHal,pktCnt; //~totDor or frqDor? //map features feaImg index: party & beast mkrs, entry, shortcut, isolated, disturbed, battlefield, lair, trapdoor, steps static final String FeaIdx$="AB+-XDFLTS"; int frqFeaSiz=FeaIdx$.length(),frqFea[]=new int[frqFeaSiz+1]; //elm#s [0]..[frqFeaSiz] int feaVar; //1..6= partic site of fea char fea$; int ptySiz,typBst,sumBst,bstRtg,encEp,namBst; int ngoDif,idDif,trpDif,trpTyp,tryOut,seqDic,barOpt; int modAtr,hitSum,splWds,payDif=3; int dieWgt,diePch,dieNix=6,drpWpn=6; boolean isCbt,is1st,isCru,isPar,isDef=true,isPrf=true,isDod=true,isPsn,isBla,isInp; boolean isRov,isDis,isDin,isStp,isTdr,ptPty,newTil,isBar,isTrv,isVlt,isThf,isWzd,isSrp; boolean isNo1,isMov,isPfl,isEva=true,isCsr=true,isLay=true,isDon,isPkt,isRv; boolean isStk,isDwn; //isStk(stacking)= sho unc bsts prone (else mov->sq8/18 if unc) boolean isCg=false; boolean isBad,badNgo,badCrs,badRov,badBst,badTrp,badPas; //useOpt: flgs for penalty mazes int totCrs; StringBuffer inp$=new StringBuffer(); //KeyListener user inp $ StringBuffer die$=new StringBuffer(); //dic() dice result listg $ StringBuffer rol$=new StringBuffer(); //Task dice result list holder $ StringBuffer aim$=new StringBuffer(); //hit roll dice listg $ StringBuffer rcd$=new StringBuffer(); //rpt() global arg StringBuffer stpVar$=new StringBuffer(); //Steps' varieties seen holder static final String StpElm$="Watercourse,Faultline,Nasty/Bane,Heirloom,Boss/Leader,Rumor"; static final String TdrElm$="Hidden Den,Spring Cavern,Root Cellar,Antique Armory,Garbage Pit,Prison Cell"; StringBuffer whyEnd$=new StringBuffer(); //endGam() reason msg static final String Way$="WNES"; static final String WpnCod$="DQBHSA"; static final String WpnElm$="Dagger,Quarterstaff,Bow,Hammer,Sword,Axe,Arrow"; static final String SplElm$="Spellbind,Check,Explosion,Shock,Poison,Unpoison,Transmute," +"Firebreath,Drain,Blast,Aid,Heal,Proof,Steel,Tangle,Swoon,Balefire,Beguile"; static final String SplAbr$="SbdChkExpShkPsnUnpTmtFbrDrnBlaAidHeaPrfStlTngSwnBlfBgl"; static final String SplCst$="111111122222222333"; static final String TrpElm$="Springboard,,Poison Arrow,Poison Gas,Detonation,Acid,Blade,Deadfall,latch,fissure"; static final String TrvTbl$="a31,11,10,00b32,12,11,00c33,21,21,00d44,22,22,00" +"e45,31,32,11f4:,32,33,21g5?,41,43,22h5D,42,44,32"; //utility vars char a$,A$; boolean isa1,isb1,isc1,isd1,isa2,isb2,isc2,isd2,ise2,isa3,isb3,isc3,isd3, isa4,isb4,isc4,isd4,ise4,isf4,isg4,ish4,isi4,isa5,isb5,isc5,isa6,isb6,isc6,isd6,isa7,isb7; boolean isA5,isB5,isA6,isB6,isC6,isA7,isB7,isA8,isB8,isC8,isA9; int a1,b1,c1,d1,e1,f1,g1,h1; int a2,b2,c2,d2,e2,f2,g2,h2,i2; int a3,b3,c3,d3,e3,f3,g3,h3; int a4,b4,c4,d4,e4,f4,g4,h4,i4,j4; int a5,b5,c5,d5,e5,f5,g5,h5; int a6,b6,c6,d6,e6,f6,g6,h6; int a7,b7,c7,d7,e7,f7,g7,h7; int A5,B5,C5,D5,E5,F5,G5,H5,I5; int A6,B6,C6,D6,E6,F6,G6,H6,I6,J6,K6,L6,M6,N6; int A7,B7,C7,D7,E7,F7,G7,H7,I7,J7,K7,L7; int A8,B8,C8,D8,E8,F8,G8,H8,I8,J8,K8,L8,M8,N8,O8,P8,Q8,R8; int A9,B9,C9,D9; StringBuffer a1$=new StringBuffer(); StringBuffer b1$=new StringBuffer(); StringBuffer c1$=new StringBuffer(); StringBuffer a2$=new StringBuffer(); StringBuffer b2$=new StringBuffer(); StringBuffer c2$=new StringBuffer(); StringBuffer a3$=new StringBuffer(); StringBuffer b3$=new StringBuffer(); StringBuffer c3$=new StringBuffer(); StringBuffer a4$=new StringBuffer(); StringBuffer b4$=new StringBuffer(); StringBuffer c4$=new StringBuffer(); StringBuffer d4$=new StringBuffer(); StringBuffer e4$=new StringBuffer(); StringBuffer f4$=new StringBuffer(); StringBuffer a5$=new StringBuffer(); StringBuffer b5$=new StringBuffer(); StringBuffer a6$=new StringBuffer(); StringBuffer b6$=new StringBuffer(); StringBuffer c6$=new StringBuffer(); StringBuffer a7$=new StringBuffer(); StringBuffer b7$=new StringBuffer(); StringBuffer c7$=new StringBuffer(); StringBuffer d7$=new StringBuffer(); StringBuffer e7$=new StringBuffer(); StringBuffer A5$=new StringBuffer(); StringBuffer B5$=new StringBuffer(); StringBuffer A6$=new StringBuffer(); StringBuffer B6$=new StringBuffer(); StringBuffer C6$=new StringBuffer(); StringBuffer A7$=new StringBuffer(); StringBuffer B7$=new StringBuffer(); StringBuffer C7$=new StringBuffer(); StringBuffer D7$=new StringBuffer(); StringBuffer E7$=new StringBuffer(); StringBuffer A8$=new StringBuffer(); StringBuffer B8$=new StringBuffer(); StringBuffer A9$=new StringBuffer(); StringBuffer A0$=new StringBuffer(); //decl small util int arys static final int ChrMax=30; //6 advs + 6 Bgl'd bsts + 6 BstGuis + 9 bsts + trove-chr int z1Siz=ChrMax,z1[]=new int[z1Siz+1]; //rout lvl1: copy of chr list ary for rdmChr() int z2Siz=20,z2[]=new int[z2Siz+1]; //Fld sq occ log for bstOrg(), tgt list for Hits fx in adv/bstAtk() int z3Siz=20,z3[]=new int[z3Siz+1]; //tgt list for doSpl() int z4Siz=X,z4[]=new int[z4Siz+1]; //atr choice ary for pikAds() int z7Siz=X,z7[]=new int[z7Siz+1]; //itm list ary for shoAdv() int Z6Siz=ChrMax,Z6[]=new int[Z6Siz+1]; //sbr lvl6: chr list ary for rdmChr() int Z7Siz=X,Z7[]=new int[Z7Siz+1]; //result ary for chkWpn() int bfSiz=6,bf[]=new int[bfSiz+1]; //Battlefield incid stats idx by feaVar for rndOne() int lrSiz=6,lr[]=new int[lrSiz+1]; //Lair incid stats idx by feaVar for rndOne() //single z1$[] 1-dim array with int section indexes mazMap,chrPoo,itmPoo,chrGrp,itmGrp int begDiv,endDiv,begElm,endElm,elmNum,itmElm,arySiz=500; StringBuffer z1$[]=new StringBuffer[arySiz+1]; //[0] unused; [1]..[arySiz] static final String Fre$="$"; static final char Div$=',',Fre0$='$'; //string data fields delimited with Div$ chrs int xsA,xsB,mazMap,advImg,bstImg,feaImg, chrPoo,advCat,trvCat,bstCat,itmPoo,chrGrp,itmGrp, eqpItm,sklItm,splItm,ordWpn,magWpn,magAmr,spiItm,potItm,scrItm,cshItm,dvcItm,fxItm; //Z1$[] groupings //chrPoo's & itmPoo's field pos# named ref constants static final int ChrTyp=1, //ie. between beginning & 1st comma pos ChrWd=2,ChrRv=3,ChrGra=4, //Poo/Grp shared fields (inclg 1) ChrDef=5,ChrWp1=6,ChrWp2=7,ChrHiP=8, //Poo fields ChrNam=5,ChrHit=6,ChrEp=7,ChrCtl=8, //Grp fields ChrCoo=9,ChrSq=X,ChrPst=11,ChrGen=12,ChrImg=13; static final int ItmTyp=1,ItmNat=2, //Poo fields ItmCla=3, //Poo/Grp shared field ItmRdy=4,ItmSrc=5,ItmRep=6, //Poo fields ItmOwn=1,ItmCod=2,ItmLoc=4,ItmOpn=5,ItmBon=6,ItmId=7; //Grp fields static final int Nah=0,MR=7,TagLg=5; static final int Rv=1,Def=2; //tskRol() typ arg: Prf & Stl dcl abv int opt1,sptRnd,sptCoo; static final int Ngo=1,Thf=3,Spt=4,Mov=5; //rndOne opts (Chk=2 set abv) static final int MazWd=24,MazHt=24,MapColWd=8,MapRowHt=8; static final int MaxTopCol=MazWd-MapColWd+1,MaxTopRow=MazHt-MapRowHt+1; static final int LayCoo=C*(MazWd+1)+1,AtlCoo=LayCoo+1,StpCoo=LayCoo+2,TdrCoo=LayCoo+3; //off-maze coos in added col int cooCol,cooRow,atCoo,toCoo,topCooCol=9,topCooRow=9,etyCoo=1212; int atCooCol,atCooRow,toCooCol,toCooRow,rtnCoo,inSid,secDor=5; static final String UnRdy$="slg"; static final String Brk$="brk?"; char key1$,key2$,key3$,key4$,key5$,key6$,key7$; boolean isKey,isLin; int inpVal,txtX,txtY,txtTyp,argLg,txtCodLg=3; int hldVal,hldX,hldY,hldTyp,hldChr; StringBuffer lin$=new StringBuffer(); StringBuffer hld$=new StringBuffer(); int hldArg; //popup shoAdv() holding vars StringBuffer hldArg$=new StringBuffer(); public static void main(String args[]){ Frame f=new Frame(); f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); }; //windowClosing( }); //f.addWindowListener( arhX0Ap p=new arhX0Ap(); //Constructor mth runs here: //so defer Graphics g mth calls post paint() init at main() end p.setSize(1000,1000); f.add(p); f.pack(); //` p.init(); //rev as arhX0Ap() constructor mth f.setSize(330,352); f.setResizable(true); f.setVisible(true); //paint() run now automatically on startup } //main mth arhX0Ap(){ //constructor mth, vs applet's init() this.addKeyListener(new KeyAdapter(){ public void keyPressed(KeyEvent e){ //prov for Apple numpad Enter key key7$=e.getKeyChar(); if(key7$=='\n') keyIn(); } //keyPressed mth public void keyTyped(KeyEvent e){ key7$=e.getKeyChar(); if(key7$!='\n') keyIn(); } //keyTyped mth }); //KeyAdapter class/ addKeyListener args //ini fea frqs a1=FeaIdx$.indexOf('F'); //in FeaIdx$ order frqFea[a1++]=totBfd; frqFea[a1++]=totLar; frqFea[a1++]=totTdr; frqFea[a1]=totStp; //now loading main dta strings array z1$[] //init all StringBuffer elms //note: z1$[0] is left unused - locElm(), etc. may rtn 0 as a "not found" for(a1=1;a1<=arySiz;a1++) //z1$[0] remains null z1$[a1]=new StringBuffer(); a1=1; xsA=a1++; //transient string elm var usage - eg. see shoFld(), pikAds() xsB=a1++; //persistent (during inputs) string elm var usage - eg. see pikPty() wpns mazMap=a1-1; //decr for coo row idx beg at +1 vs +0 a1+=MazHt; advImg=a1; //use: shoMkr()'s (from movChr()) adv anime img# dta eq(a1++,"3,,573,492,39021,22461,2212251,1313331,122111331,022421121,0371121,"+ "1441122,13551,12831,27231,26241,52341,4425,3534"); //gypsy= 0 eq(a1++,"3,,44133,29022,19041,13371,031326,0384,032334,023244,023145,1266,121416,"+ "212325,222121131,23622,43521,3453,3282"); //joyce= 1 eq(a1++,"3,,474,39012,29031,13281,121317,2526,131217,0177,0168,11122215,121254,"+ "14541,11841,25332,42432,33441,2364"); //libbi= 2 eq(a1++,"3,,465,39012,29031,1905,1329,1257,121416,0223251,0141351,0267,123135,"+ "1626,211326,22632,34323,52422,33612"); //kiki= 3 eq(a1++,"3,,483,39021,2904,1419,1257,122226,111336,013227,0168,0258,1113351,"+ "1123431,12741,25332,52332,43422,33621"); //miff= 4 eq(a1++,"3,,483,39021,2904,2904,1338,122316,121416,022245,0141441,1171131,15261,"+ "2211252,2112333,22713,34422,52521,24711"); //lola= 5 eq(a1++,"3,,483,39021,2904,2337,221316,132216,122226,0267,0177,122127,14361,"+ "22641,21723,34323,52422,43521,32811"); //mona= 6 eq(a1++,"3,,375,29022,39012,22371,2418,121137,0267,014127,06261,23541,22632,"+ "12642,1421124,42333,32523,23622,22722"); //cyro= 7 eq(a1++,"3,,483,29031,1905,1905,0447,031335,121425,02311134,01901112,028212,"+ "021341121,15621,12831,25422,52422,42522,33621"); //boot= 8 eq(a1++,"3,,546,39012,29022,24171,12651,121317,022317,014127,0267,116313,1563,"+ "33531,21732,21732,34422,52422,42621"); //pol= 9 eq(a1++,"3,,573,49011,3903,2319,2256,2175,122325,022353,014244,0375,1271121,"+ "24621,31722,34413,52422,42522,34521"); //wat= 10 eq(a1++,"3,,555,393,29022,13371,1222251,12121116,021426,0177,0438,12471,14361,"+ "233112111,21624,24333,42423,42522,32622"); //ajae= 11 eq(a1++,"3,,474,39012,29031,2427,1356,122325,121425,022236,017313,0284,121335,"+ "1223241,1313322,23622,35331,5343,3471"); //reb= 12 eq(a1++,"3,,483,39012,29031,23271,1329,122316,032316,0285,0276,1356,2643,221334,"+ "22632,34323,52323,42522,24531"); //yani= 13 bstImg=a1; //use: shoMkr()'s (from movChr()) bst ink blot img# dta eq(a1++,"3,,,2411124,17133,1313223,17232,17331,2114331,29031,483,11175,09024,"+ "04173,12363,582,53241,5424,44331"); //goblin= 0 eq(a1++,"3,,,,9033,9015,7611,5901,4515,5901,69,78,78,96,3426,19041,09051,09042,"+ "09033"); //ledger= 1 eq(a1++,"3,,,735,564,41111322,0317121,1833,0901131,39021,672,22173,13173,09033,"+ "34143,42234,744,645,546"); //sprite= 2 eq(a1++,"2,,,51902,51614,2511314,081611,0419021,01213433,31251113,11371112,"+ "1628,241118,2514131,131822,03322313,131732,1718,24551"); //runner vine= 3 eq(a1++,"2,,,90152,971,83231,73331,7145,9017,1538,021419,0419021,19061,021905,"+ "190412,33211331,231821,211133213,21338"); //gt scorpion= 4 eq(a1++,"3,,,13137,033432,02311413,031722,211632,122212221,13371,29022,22164,"+ "744,663,582,492,45132,231221121,23721"); //gnome= 5 eq(a1++,"3,,,41235,2315121,2221152,13173,1316211,03311511,05271,09051,29022,"+ "39012,573,492,44142,53241,45231,36141"); //orc= 6 eq(a1++,"3,,,81222,42144,23181,03321411,131712,0128211,01190211,0113172,"+ "13281,1111191,02292,013821,242412,24342,14451,0474"); //plasman= 7 eq(a1++,"2,,,44531,1413332,09242,011115233,18242,0513341,54341,35351,26162,"+ "24281,14291,19061,1907,1907,2906,36251"); //gt snake= 8 eq(a1++,"3,,,13812,05622,06423,031241112,181311,090312,29031,384,2922,1415121,"+ "0339,03192,11283,34251,3336,2463"); //troglodyte= 9 eq(a1++,"3,,,52521,2832,251313,222513,0245121,1219011,0312162,033711,190122,"+ "290112,49011,37122,2751,2823,04191,13272"); //caterwaul= 10 eq(a1++,"3,,,249,07512,0413322,0215241,013416,3813,2922,4722,3741,1851,090141,"+ "01374,393,24162,24531,14541"); //bugabou= 11 eq(a1++,"3,,,735,71133,65112,681,582,49011,3903,2922,222522,124521,11472,0233332,"+ "0144321,015423,6414,5424"); //bandit= 12 eq(a1++,"3,,,53115,113112321,031614,031623,0712131,1311162,29022,29013,384,"+ "465,465,367,285,23163,14262,05541"); //gargoyle= 13 eq(a1++,"2,,,34541,2816,241316,2816,3716,3223241,014633,043712,061901,1217231,"+ "12275,21383,45152,26441,15551,1916"); //torgrim= 14 eq(a1++,"2,,,45233,3313322,37142,46322,5113232,131112323,0901232,0219131,3905,"+ "4904,4904,3905,3905,29051,0412262,03473"); //manticore= 15 eq(a1++,"3,,357,32136,276,31137,18222,09141,090114,0906,1902111,294,39012,"+ "18132,0901113,04344,05334,15243,06252"); //ogre= 16 eq(a1++,"3,,,62223,5712,4214211,4623,5433,591,0139011,021912,1932,051441,5631,"+ "4821,4911,390111,334311,243411"); //witch= 17 eq(a1++,"3,,,438,357,3213123,29022,351411,4614,3903,290112,2922,3651,465,384,"+ "393,24243,13632,04542"); //savage= 18 eq(a1++,"2,,25352,17171,0419021,0908,022904,111905,2906,212903,3905,0908,011537,"+ "1214261,511118,5228,7901,4913,190124"); //saurian= 19 eq(a1++,"2,,,15902,179,12158,566,29015,12185,0219014,09053,05192,1319012,59021,"+ "35171,2519,233414,241433,6614"); //troll= 20 eq(a1++,"2,,845,764,72134,674,1327211,0521132111,0122354,2424113,4214111111,"+ "61217,241131311,16514,1421117,9071,311141411,,12112121312"); //dwimmorlaik= 21 eq(a1++,"2,,33533,2618,112904,190124,197,21185,29024,593,49013,09053,05183,"+ "0111392,54251,5354,3545,2546,2546"); //cyclops= 22 eq(a1++,"2,,62126,4331132,38132,2314223,0424151,090116,04142312,593,29024,"+ "0129014,02483,0319013,09062,19061,2906,1907,151424"); //chimera= 23 eq(a1++,"1,4112515,32115241,31322242,22411211221,134321212,021332221111,"+ "014275,015172111,6171211,3122911,3225511,2362411,211172311,12211151311,"+ "11311242121,114112432,113223322,022244221,3282211"); //fissure= 24 eq(a1++,"3,,,,537,1143213,1242222,1341231,2373,906,537,43611,42432,41631,90114,"+ "02229,05226,1431141,02222412"); //vermin= 25 feaImg=a1; //use: shoMkr()'s (from shoCoo()) elms indexed w FeaIdx$: eq(a1++,"6,,,,,,432,432,11313,02241,0315,11121111,12222,0315,011322"); //'A'= 0 eq(a1++,""); //'B'= 1 eq(a1++,"7,,,,,,,232,232,021112,07,021112,232,232"); //'+'= 2 eq(a1++,"6,,,,,,,,21312,12321,09,12321,21312"); //'-'= 3 eq(a1++,""); //'X'= 4 eq(a1++,"5,,,,,,,,,0272,13331,32123,13331,121111121,23132"); //'D'= 5 eq(a1++,"6,,,,,09,0252,0252,0252,0252,0252,12321,12321,22122,333,414"); //'F'= 6 eq(a1++,"7,,,,,232,12121,11311,11311,21112,21112,12121,12121,11311,07,07"); //'L'= 7 eq(a1++,"6,,,,,315,225,18,09,0441,0441,0441,0351,0261,09,18"); //'T'= 8 eq(a1++,"6,,,,,63,6111,3411,311211,041211,01121211,011214,011214,0117,01152,054"); //'S'= 9 chrPoo=a1; //"Hero(ChrTyp),0/1+8(wd),1(rv),1(gra),0+0(def),hand(wpn1), //nil(wpn2),04(hiPst: 04= standing or lower)" eq(a1++,"Hero,0/1+8,1,1,0+0,hand,nil,04"); eq(a1++,"Thief,0/1+6,1,1,0+0,hand,nil,04"); eq(a1++,"Wizard,0/1+4,1,1,0+0,hand,nil,04"); advCat=a1-1; //advs <= advCat trvCat=a1; eq(a1++,"aTrove,0/1+0,0,0,0-0,nil,nil,04"); bstCat=a1; //bsts >= bstCat eq(a1++,"Goblin,2/5+0,0,02+1:5*5,0+0,1*1,1*D,13"); eq(a1++,"Ledger,1/3+1,0,03+1:5*3,0>2,W*1,nil,12"); eq(a1++,"Sprite,1/4+0,1,04+1:5*4,0+1,1*1,Exp,13"); eq(a1++,"Runner Vine,1/2+0,3,05+1:5*5,0+0,1*1,Tng,32"); eq(a1++,"Gt Scorpion,1<5+0,0,06+1:3*4,1+0,2*1,Psn,42"); eq(a1++,"Gnome,1/2+0,2,07+1:5*2,0+1,1*2,Tmt,13"); eq(a1++,"Orc,2/4+0,1,08+2:5*4,0+0,1*D,1*B,23"); eq(a1++,"Plasman,1/1+0,2,09+2:4*4,0+0,2*1,Shk,33"); eq(a1++,"Gt Snake,1<6+0,1,10+2:3*3,0+0,1*3,Psn,23"); eq(a1++,"Troglodyte,3/4+0,0,11+2:5*3,0+0,1*2,Psn,23"); eq(a1++,"Caterwaul,1/1+1,1,12+2:2*4,0+0,3*1,Tng,33"); eq(a1++,"Bugabou,2/3+0,1,13+2:4*3,1+0,1*3,1*H,14"); eq(a1++,"Bandit,1/1+1,2,14+3:4*3,0+0,1*S,2*B,04"); eq(a1++,"Gargoyle,2/2+0,2,15+3:3*3,2+0,2*2,nil,14"); eq(a1++,"Torgrim,1/1+2,1,16+3:4*2,0+0,1*A,2*2,14"); eq(a1++,"Manticore,1/1+0,2,17+3:5*2,0+1,2*D,3*D,13"); eq(a1++,"Ogre,4/3+0,1,18+3:3*2,1+0,2*H,ibid,24"); eq(a1++,"Witch,2<7+0,3,19+3:2*3,0+2,2*Q,Bgl,04"); eq(a1++,"Savage,2/1-1,1,20+4:4*2,0+0,2*A,1*B,04"); eq(a1++,"Saurian,4/2+0,1,21+4:2*2,2+0,2*2,Psn,34"); eq(a1++,"Troll,3/2+0,2,22+4:3*3,1+0,3*2,Aid,24"); eq(a1++,"Dwimmorlaik,1/2+3,4,23+4:2*3,1>2,3*1,Swn,14"); eq(a1++,"Cyclops,1/1+6,1,24+4:1*3,0+0,2*4,nil,44"); eq(a1++,"Chimera,2/1+5,2,25+4:1*2,2+0,2*3,Fbr,24"); eq(a1++,"Fissure,0/1+0,0,00+0:0*0,0+0,nil,nil,04"); // tgt of Steps (feaVar 2) itmPoo=a1; //"Rulership(ItmTyp),Ech(ItmNat),Ring(ItmCla),Finger(ItmRdy), //trove(ItmSrc),mul(ItmRep)" eq(a1++,"Heirloom,magic,artifact,hand,trove,uni"); eqpItm=a1; eq(a1++,"Sheath,gear,sash,torso,trove,1ea"); //Bon=wpn's ItmCod sklItm=a1; eq(a1++,"Dagger,known,skill,nil,learn,acu"); //Wgt eq(a1++,"Quarterstaff,known,skill,nil,learn,acu"); //Wgt eq(a1++,"Bow,known,skill,nil,learn,acu"); //Wgt eq(a1++,"Hammer,known,skill,nil,learn,acu"); //Wgt eq(a1++,"Sword,known,skill,nil,learn,acu"); //Wgt eq(a1++,"Axe,known,skill,nil,learn,acu"); //Wgt splItm=a1; eq(a1++,"Spellbind,known,spell,nil,learn,1ea"); //neg opt eq(a1++,"Check,known,spell,nil,learn,1ea"); //mov opt eq(a1++,"Explosion,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Shock,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Poison,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Unpoison,known,spell,nil,learn,1ea"); //recoup eq(a1++,"Transmute,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Firebreath,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Drain,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Blast,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Aid,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Heal,known,spell,nil,learn,1ea"); //recoup eq(a1++,"Proof,known,spell,nil,learn,1ea"); //Def eq(a1++,"Steel,known,spell,nil,learn,1ea"); //Wgt eq(a1++,"Tangle,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Swoon,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Balefire,known,spell,nil,learn,1ea"); //atk typ eq(a1++,"Beguile,known,spell,nil,learn,1ea"); //atk typ ordWpn=a1; eq(a1++,"Dagger,standard,=weapon,1t hand,local,mul"); //Wpn,Pch eq(a1++,"Quarterstaff,standard,=weapon,hands,local,mul"); eq(a1++,"Bow,standard,=weapon,hands,local,mul"); eq(a1++,"Hammer,standard,=weapon,1t hand,local,mul"); eq(a1++,"Sword,standard,=weapon,1t hand,local,mul"); eq(a1++,"Axe,standard,=weapon,1t hand,local,mul"); eq(a1++,"Arrows,standard,=ammo,back,local,acu"); magWpn=a1; eq(a1++,"Dagger,magic,+weapon,1t hand,trove,mul"); //Wgt eq(a1++,"Quarterstaff,magic,+weapon,hands,trove,mul"); eq(a1++,"Bow,magic,+weapon,hands,trove,mul"); eq(a1++,"Hammer,magic,+weapon,1t hand,trove,mul"); eq(a1++,"Sword,magic,+weapon,1t hand,trove,mul"); eq(a1++,"Axe,magic,+weapon,1t hand,trove,mul"); eq(a1++,"Arrow,magic,+ammo,back,trove,mul"); magAmr=a1; eq(a1++,"Armor,magic,+armor,torso,trove,mul"); //Def spiItm=a1; eq(a1++,"Zhoom,magic,spice,hand,trove,mul"); eq(a1++,"Dhazh,magic,spice,hand,trove,mul"); eq(a1++,"Ghleze,magic,spice,hand,trove,mul"); eq(a1++,"Fhaze,magic,spice,hand,trove,mul"); eq(a1++,"Bhitz,magic,spice,hand,trove,mul"); eq(a1++,"Yhikez,magic,spice,hand,trove,mul"); potItm=a1; eq(a1++,"Strength,magic,potion,hand,trove,mul"); eq(a1++,"Might,magic,potion,hand,trove,mul"); eq(a1++,"Power,magic,potion,hand,trove,mul"); eq(a1++,"Energy,magic,potion,hand,trove,mul"); eq(a1++,"Foresight,magic,potion,hand,trove,mul"); eq(a1++,"Alertness,magic,potion,hand,trove,mul"); scrItm=a1; //order= genTrv() tbl eq(a1++,"Explosion,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Check,magic,scroll,hands,trove,mul"); //mov opt eq(a1++,"Shock,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Transmute,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Poison,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Firebreath,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Drain,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Tangle,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Steel,magic,scroll,hands,trove,mul"); //Wgt eq(a1++,"Proof,magic,scroll,hands,trove,mul"); //Def eq(a1++,"Blast,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Swoon,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Balefire,magic,scroll,hands,trove,mul"); //atk typ eq(a1++,"Beguile,magic,scroll,hands,trove,mul"); //atk typ cshItm=a1; eq(a1++,"Crowns,standard,cash,hand,trove,acu"); eq(a1++,"Jewel,standard,cash,hand,trove,mul"); dvcItm=a1; //all contraptions= 1 use only eq(a1++,"Gas Bomb,contraption,device,1t hand,trap,mul"); eq(a1++,"Flare,contraption,device,hands,trap,mul"); eq(a1++,"Acid Flask,contraption,device,1t hand,trap,mul"); eq(a1++,"Propeller,contraption,device,2d hand,trap,mul"); eq(a1++,"Psn Arrow,contraption,*ammo,back,trap,mul"); eq(a1++,"Hex Dagger,contraption,*weapon,1t hand,trap,mul"); fxItm=a1; eq(a1++,"Oop,stun,fx,nil,stun,1ea"); //drop wpn fx eq(a1++,"QkDrw,atk,fx,nil,atk,1ea"); //flg to use wpn on rnd rdy'd eq(a1++,"Hits,atk,fx,nil,atk,1ea"); //mult atks ~1ea as Spi co-fx, else acu? eq(a1++,"BatMan,mov,fx,nil,tdr,1ea"); eq(a1++,"Hey,atk,fx,nil,dvc,1ea"); //Flare result: emu offsides % eq(a1++,"SpnWd,dmg,fx,nil,dmg,acu"); //Opn= 997 eq(a1++,"PsnWd,dmg,fx,nil,dmg,acu"); //Opn= 991 eq(a1++,"FvrWd,dmg,fx,nil,dmg,acu"); //fever: Bon=5 (>Bon blks rcvr), Opn= 997 eq(a1++,"ThfAtk,dmg,fx,nil,dmg,1ea"); //owner was hit by rnd1 Thf atk eq(a1++,"WpVul,dmg,fx,nil,ngo,mul"); //Opn= exp rnd#, Bon= mod, Id= wpn typ eq(a1++,"ModSkl,mod,fx,nil,mod,mul"); //wpn skill mod: Opn=exp rnd#, Bon=mod, Id=wpn# eq(a1++,"ModDef,mod,fx,nil,mod,mul"); //def mod: Opn= exp rnd#, Bon= mod eq(a1++,"ModWd,mod,fx,nil,mod,mul"); //Wds mod: Opn= exp rnd#, Bon= mod, Id= deriv eq(a1++,"ModRv,mod,fx,nil,mod,mul"); //Rv mod: Opn= exp rnd#, Bon= mod eq(a1++,"NgoRv,mod,fx,nil,mod,acu"); //Ngo Rv mod: Opn= exp rnd# (~as acu req 997), Bon= mod //spell fx eq(a1++,"Sbd,magic,fx,nil,spell,uni"); //def eq(a1++,"Shk,magic,fx,nil,spell,mul"); //def eq(a1++,"Tmt,magic,fx,nil,spell,mul"); //trove owner->mod #Crs gen'd eq(a1++,"Prf,magic,fx,nil,spell,1ea"); //def eq(a1++,"Stl,magic,fx,nil,spell,1ea"); //atk typ eq(a1++,"Tng,magic,fx,nil,spell,mul"); //imped: Loc=src name, Opn=900 eq(a1++,"Swn,magic,fx,nil,spell,1ea"); //as tgt eq(a1++,"Bgl,magic,fx,nil,spell,1ea"); //ctl: Loc=src name, Opn=997 eq(a1++,"SplMR,Rv,fx,nil,spell,1ea"); //held spell: Loc=tgt name, Opn=900, Bon=atkSpl //spice fx - all: Opn=991 eq(a1++,"Zom,magic,fx,nil,spice,1ea"); eq(a1++,"Daz,magic,fx,nil,spice,1ea"); eq(a1++,"Gle,magic,fx,nil,spice,1ea"); //atk eq(a1++,"Faz,magic,fx,nil,spice,1ea"); //def: Bon=22(X*def>2+dmg lmt), Id=alt dmg eq(a1++,"Bit,magic,fx,nil,spice,1ea"); //co-fx: Hits eq(a1++,"Yik,magic,fx,nil,spice,1ea"); //co-fx: ModRv eq(a1++,"Wha,mod,fx,nil,spice,1ea"); //badUse() disori result //potion fx - all: Opn=997, Id= #times used eq(a1++,"Str,magic,fx,nil,potion,1ea"); eq(a1++,"Mgt,magic,fx,nil,potion,1ea"); eq(a1++,"Pwr,magic,fx,nil,potion,1ea"); //co-fx: ModWd eq(a1++,"Egy,magic,fx,nil,potion,1ea"); eq(a1++,"Fst,magic,fx,nil,potion,1ea"); eq(a1++,"Alr,magic,fx,nil,potion,1ea"); //nego fx eq(a1++,"SeeSeg,award,fx,nil,ngo,mul"); eq(a1++,"SeeTrp,award,fx,nil,ngo,mul"); eq(a1++,"BstGui,award,fx,nil,ngo,1ea"); eq(a1++,"MorTre,award,fx,nil,ngo,mul"); eq(a1++,"AmbBst,award,fx,nil,ngo,mul"); //nxt room cbt: Bon=-#hits, Id=#bsts eq(a1++,"TruNam,award,fx,nil,ngo,mul"); eq(a1++,"BstId,award,fx,nil,ngo,mul"); chrGrp=a1; // "(Poo data: typ..gra),Biltmore(nam),0(dmg),0(ep),Pty/Bst:Acted?=Aa/Bb(ctl), // 0205(mapCoo),1..9/11..19(locSq),3(pst: 24= 2 rounds Rearing),m(sex),0(img)" // "(Poo data: typ..gra),B1(nam),..0(img)" itmGrp=a1+ChrMax; // "(owner's name: 1st n chrs),(type code: 1st n chrs),(class), // (Ready: loc (unready=slung?)),(Id'd/Active: cnt),(Bonus: qty)" //ini all Grp elms as empty for(a1=chrGrp;a1<=arySiz;a1++) eq(a1,Fre$); a1=srcChr=newChr=chrGrp; //active chr ptr must be on chr elm //sample/ initial chr dta //*~ ptySiz=6; eq(a1++,"Hero,8,1,1,Ahero,0,0,A,2502,1,3,m,7"); eq(a1++,"Hero,8,1,1,Bhero,0,0,A,2502,2,3,f,0"); eq(a1++,"Thief,6,2,1,Athief,0,0,A,2502,3,3,m,8"); eq(a1++,"Thief,6,1,1,Bthief,0,0,A,2502,4,3,f,1"); eq(a1++,"Wizar,4,1,1,Awizard,0,0,A,2502,5,3,m,9"); eq(a1++,"Wizar,4,1,1,Bwizard,0,0,A,2502,6,3,f,2"); //*/ trvChr=a1; eq(a1++,"aTrov,100,0,0,trove,hit,ep,ctl,coo,sq,3,gen,img"); //eq(a1++,"Troll,5,2,1,B0,2,0,A,2502,6,3,m,20"); a1=itmGrp; //*~ eq(a1++,"Ahero,Sword,=weapon,1t hand,0,Ok,Id'd"); eq(a1++,"Ahero,Bow,=weapon,slg,0,Ok,Id'd"); eq(a1++,"Ahero,Arrow,=ammo,back,0,12,Id'd"); eq(a1++,"Ahero,Sword,skill,nil,0,+1,nil"); //eq(a1++,"Ahero,Crown,cash,slg,0,234,nil"); //eq(a1++,"Ahero,SeeSe,fx,nil,997,nil,nil"); //eq(a1++,"Ahero,Bgl,fx,B0,997,Ok,nil"); //eq(a1++,"Ahero,Axe,skill,nil,0,+3,nil"); //*/ //*~ eq(a1++,"Bhero,Axe,=weapon,1t hand,0,Ok,Id'd"); eq(a1++,"Bhero,Axe,=weapon,slg,0,Ok,Id'd"); eq(a1++,"Bhero,Axe,skill,nil,0,+1,nil"); //eq(a1++,"Bhero,PsnWd,fx,nil,991,3,nil"); //eq(a1++,"Bhero,Power,potion,slg,0,Ok,1"); //eq(a1++,"Bhero,Jewel,cash,slg,0,90,nil"); //eq(a1++,"Bhero,Jewel,cash,slg,0,80,nil"); //eq(a1++,"Bhero,Jewel,cash,slg,0,60,nil"); //eq(a1++,"Bhero,Armor,+armor,torso,0,+2,1"); //eq(a1++,"Bhero,Prf,fx,nil,997,+3,nil"); //eq(a1++,"Bhero,Stl,fx,nil,1,+1,nil"); //eq(a1++,"Bhero,Bit,fx,nil,01,0,nil"); //eq(a1++,"Bhero,Hits,fx,nil,01,0,nil"); //Bit co-fx //eq(a1++,"Bhero,Egy,fx,nil,997,0,nil"); //*/ //*~ eq(a1++,"Athie,Dagge,=weapon,1t hand,0,Ok,Id'd"); eq(a1++,"Athie,Hamme,=weapon,slg,0,Ok,Id'd"); //eq(a1++,"Athie,SpnWd,fx,nil,997,3,nil"); //eq(a1++,"Athie,BatMan,fx,nil,997,Ok,nil"); //eq(a1++,"Athie,AmbBst,fx,nil,997,-2,2"); //eq(a1++,"Athie,Psn A,*ammo,back,0,0,Id'd"); //eq(a1++,"Athie,Alr,fx,nil,997,Ok,nil"); //*/ //*~ eq(a1++,"Bthie,Bow,=weapon,hands,0,Ok,Id'd"); eq(a1++,"Bthie,Arrow,=ammo,back,0,12,Id'd"); eq(a1++,"Bthie,Quart,=weapon,slg,0,Ok,Id'd"); eq(a1++,"Bthie,Bow,skill,nil,0,+1,nil"); //eq(a1++,"Bthie,Zhoom,spice,slg,0,Ok,1"); //eq(a1++,"Bthie,Hex D,*weapon,slg,0,Ok,Id'd"); //eq(a1++,"Bthie,Arrow,+ammo,back,0,+3,Id'd"); //*/ //*~ eq(a1++,"Awiza,Dagge,=weapon,1t hand,0,Ok,Id'd"); eq(a1++,"Awiza,Dagge,=weapon,slg,0,Ok,Id'd"); eq(a1++,"Awiza,Aid,spell,nil,0,Ok,Uno"); eq(a1++,"Awiza,Check,spell,nil,0,Ok,nil"); //eq(a1++,"Awiza,NgoRv,fx,nil,997,-1,nil"); //eq(a1++,"Awiza,SpnWd,fx,nil,997,1,nil"); //eq(a1++,"Awiza,Sword,+weapon,slg,0,+2,-1"); //eq(a1++,"Awiza,Proof,scroll,slg,0,Ok,Id'd"); //eq(a1++,"Awiza,Gas B,device,slg,0,Ok,Id'd"); //eq(a1++,"Awiza,Acid ,device,slg,0,Ok,Id'd"); //eq(a1++,"Awiza,Flare,device,slg,0,Ok,Id'd"); //eq(a1++,"Awiza,Sheat,sash,slg,0,Dagge,Id'd"); //*/ //*~ eq(a1++,"Bwiza,Dagge,=weapon,1t hand,0,Ok,Id'd"); eq(a1++,"Bwiza,Dagge,=weapon,slg,0,Ok,Id'd"); eq(a1++,"Bwiza,Blast,spell,nil,0,Ok,Uno"); eq(a1++,"Bwiza,Proof,spell,nil,0,Ok,nil"); //eq(a1++,"Bwiza,Fst,fx,nil,997,Ok,nil"); //*/ /*~ //eq(a1++,"B0,BstGui,fx,Awiza,997,Ok,nil"); //eq(a1++,"B0,Bgl,fx,Awiza,997,Ok,nil"); eq(a1++,"B0,Aid,spell,nil,0,Ok,nil"); //*/ //~access req disable trv itms rmv at end of pikPty(),atLrg() //eq(a1++,"trove,Sword,+weapon,0,0,+2,-1"); //eq(a1++,"trove,Arrow,=ammo,0,trial,30,0"); /*~add chr to pty addChr(locElm(chrPoo,ChrTyp,"Savage")); //~calls addItm(), so loc post- itmGrp asgn dtaIn(elmNum,ChrCoo,"2502"); dtaIn(elmNum,ChrSq,"6"); dtaIn(elmNum,ChrCtl,"A"); dtaIn(elmNum,ChrPst,"3"); //*/ bdSiz(false); //no Graphics g.()/ paint() calls here atCoo=AtlCoo; //nec for startup paint() call } //arhX0Ap constructor mth public void paint(Graphics g){ reTrd(); //calls shoBd() -> go() -> (with initial x1=1) sho4th() //keybd inp is then accepted/ listened for here; at called routines' rtn this.requestFocusInWindow(); //permit keybd detect by KeyListener } //paint mth - automatic repaint()s restore keybd focus, if lost void reTrd(){ //reset shoAdv() inps since shoAdv() also ends with a reTrd() hldArg=itmGrp; //hldArg= last code (not keyed) call arg eq(hldArg$,"just looking"); x7=0; //also affects shoMap() (on exit from vuMap()) shoBd(); shoMap(); shoFld(atCoo); //if(txtTyp>1) //~?nec to opn? if(x6>0){ if(y6>1) y6--; } else //back up 1 case (sho last inp prompt) if(x5>0){ if(y5>1) y5--; } else if(x4>0){ if(y4>1) y4--; } else if(x3>0){ if(y3>1) y3--; } else if(x2>0){ if(y2>1) y2--; } else if(y1>1) y1--; go(); } //reTrd mth void keyIn(){ isKey=true; //set false in txt() inpVal=-("?[]"+'\\'+'\'').indexOf(key7$)-1; if(inpVal<0 && x1!=Sho4th){ if(inpVal==-1){ shoKey(); return; } //if(inpVal==-1 if(inpVal==-5){ hldVal=newChr; newChr=hldChr; shoBst(nxtChr(atCoo,isDwn?Foe+Out:Foe)); //asgns hldChr=newChr newChr=hldVal; return; } //if(inpVal==-5 if(inpVal==-2 && (x7==ShoAdv || isFoe(newChr) || valOut(newChr,ChrCoo)!=atCoo)){ //&&(): ini hit shows chr in work // A8=nxtChr(atCoo,Pty+Out); //nxtChr() asgns to newChr var //if(inpVal==2){ //~test ln: good chr, but not in work A8=nxtChr(atCoo,Any+Out); //~test ln: alt (All, if(isNo1) //isNo1 of nxtChr() return; } //if(inpVal==-2 && isLin=false; x7=-inpVal-1; //call shoAdv(), vuMap(), chgBd(): by go() y7=1; } //if(inpVal<0 && Graphics g=getGraphics(); //clear lin$ (prompt+input): FontMetrics ltrSiz=g.getFontMetrics(ltr); A8=ltrSiz.stringWidth(str(lin$).substring(txtCodLg)); g.setColor(hue(BrfBkg)); g.fillRect(txtX,txtY-hlfSqSid*3/4,A8,hlfSqSid-1); if(isLin) if(key7$=='\n' || key7$=='\b' && inp$.length()==argLg){ isLin=false; eq(lin$,str(lin$).substring(argLg)); if(txtTyp==4) inpVal=lin$.length()<1?0:Integer.parseInt(str(lin$)); //Enter alone= 0 } //if(key7$=='\n' else{ if(key7$=='\b') inp$.setLength(Math.max(argLg,inp$.length()-1)); else if(txtTyp!=4 || "0123456789".indexOf(key7$)>=0) inp$.append(key7$); eq(lin$,inp$); g.setColor(hue(BrfFgd)); g.setFont(ltr); g.drawString(str(lin$).substring(txtCodLg),txtX,txtY); } //else(key7$=='\n' if(txtTyp==2){ if(key7$=='+') //allow keypad alt for Bksp key7$='\b'; inpVal=key7$=='\n'?0:+key7$-Asc0; } //if(txtTyp==2 key1$=key2$=key3$=key4$=key5$=key6$='?'; if(x7==0) if(x6>0) key6$=key7$; else if(x5>0) key5$=key7$; else if(x4>0) key4$=key7$; else if(x3>0) key3$=key7$; else if(x2>0) key2$=key7$; else key1$=key7$; if(!isLin) go(); } //keyIn mth void go(){ //director routine: all keybd inp (and reTrd()) is sent here - //these are those routines that accept key input //(note: reverse ordering of x7..x1 cond hierarchy is procedural req) //var lvl 7 routines (popups) if(x7==ShoAdv) shoAdv(hldArg,str(hldArg$)); else if(x7==VuMap) vuMap(); else if(x7==ChgBd) chgBd(); else if(x7==SetPst) setPst(0); else //var lvl 6 routines if(x6==PikChr) pikChr(0,""); else if(x6==TskRol) tskRol(0,0,0,0,""); else if(x6==ADie) aDie(""); else if(x6==Rpt) rpt(""); else //var lvl 5 routines if(x5==PutTrp) putTrp(0); else if(x5==SplPay) splPay(); else if(x5==MovPty) movPty(0,0); else //var lvl 4 routines if(x4==PikAds) pikAds(0); else if(x4==OrdPty) ordPty(0,""); else if(x4==RdyItm) rdyItm(); else if(x4==SelJew) selJew(); else if(x4==UpGra) upGra(); else if(x4==AddAdv) addAdv(); else if(x4==GenTrv) genTrv(0); else if(x4==AtkVs) atkVs(0,""); else if(x4==HitVs) hitVs(); else //var lvl 3 routines if(x3==PikItm) pikItm(0); else if(x3==UseItm) useItm(); else if(x3==BadUse) badUse(); else if(x3==DoItm) doItm(); else if(x3==DoWpn) doWpn(); else if(x3==DoSpl) doSpl(); else if(x3==DoSpi) doSpi(); else if(x3==DoPot) doPot(); else if(x3==DoDvc) doDvc(); else if(x3==FxExp) fxExp(0); else //var lvl 2 routines if(x2==TryNgo) tryNgo(); else if(x2==TryId) tryId(); else if(x2==TryDtp) tryDtp(); else if(x2==DoTrp) doTrp(); else if(x2==AdvAtk) advAtk(); else if(x2==BstAtk) bstAtk(); else if(x2==BstOrg) bstOrg(); else if(x2==AdvOrg) advOrg(); else //var lvl 1 routines if(x1==Sho4th) sho4th(); else if(x1==PikPty) pikPty(); else if(x1==UseOpt) useOpt(); else if(x1==AtLrg) atLrg(); else if(x1==ChkTil) chkTil(); else if(x1==ChkIn) chkIn(); else if(x1==ChkTrp) chkTrp(); else if(x1==ChkBar) chkBar(); else if(x1==ChkBst) chkBst(); else if(x1==SeeBst) seeBst(); else if(x1==RndOne) rndOne(); else if(x1==OneRnd) oneRnd(); else if(x1==ChkVlt) chkVlt(); else if(x1==ChkTrv) chkTrv(); else if(x1==ChkFea) chkFea(); else if(x1==TryTdr) tryTdr(); else if(x1==TryStp) tryStp(); else if(x1==ChkOut) chkOut(); else if(x1==ChkMov) chkMov(); else endGam(); } //go mth void sho4th(){ if(x1!=Sho4th) y1=1; Graphics g=getGraphics(); switch(y1){ case 1: x1=Sho4th; a1=b1=sqSid; c1=d1=X*sqSid; y1++; case 2: g.setColor(StdHue[0]); g.fillRect(a1,b1,c1,d1); g.setColor(StdHue[4]); g.drawRect(a1,b1,c1,d1); g.setColor(StdHue[8]); g.fillRect(a1+4*hlfSqSid,b1+8*hlfSqSid,c1-8*hlfSqSid,d1-14*hlfSqSid); g.setColor(StdHue[0]); g.fillRect(a1+7*hlfSqSid,b1+9*hlfSqSid,c1-14*hlfSqSid,d1-15*hlfSqSid); sqSid=C; hues[FeaFgd]=1; shoMkr(feaImg+5,a1+6*hlfSqSid,b1+2*hlfSqSid); sqSid=120; hues[FeaFgd]=6; shoMkr(feaImg,a1+5*hlfSqSid,b1+7*hlfSqSid); sqSid=50; hues[FeaFgd]=2; shoMkr(feaImg+6,a1+4*hlfSqSid,b1+9*hlfSqSid); sqSid=80; hues[ChrFgd]=7; shoMkr(bstImg+20,a1+13*hlfSqSid,b1+8*hlfSqSid); sqSid=2*hlfSqSid; hues[FeaFgd]=3; //resto defaults hues[ChrFgd]=0; g.setColor(StdHue[0]); g.fillRect(a1+16*hlfSqSid,b1+9*hlfSqSid,c1-16*hlfSqSid,d1-14*hlfSqSid); ltr=new Font("SanSerif",Font.BOLD,sqSid); g.setFont(ltr); hues[BrfFgd]=9; txt("550Arms Reach"); hues[BrfFgd]=8; txt("150Arms Reach"); y1++; hues[BrfFgd]=9; //resto default fitStr(ChkBrf$,hlfSqSid-1,zonWd<<1); //carries over to io font g.setFont(ltr); txt("170fantasy combat adventure game"); txt("1B0initial module of the Beastrove complex"); txt("1C0(DeathMaze* warmed over)"); txt("1E0Freeware version: playtest* release X35."); txt("220ick: Bksp, re: *, start: Enter"); return; case 3: y1++; if(key1$!='\b'){ y1+=2; if(key1$!='*') y1++; sho4th(); return; } //if(key1$!='\b' case 4: g.setColor(StdHue[6]); g.fillRect(a1,b1,c1,d1); g.setColor(StdHue[8]); g.fillRect(a1,b1+d1/2,c1,d1/2); e1=sqSid*2; f1=b1+d1*2/3; g1=a1+c1*2/5; g.setColor(StdHue[3]); g.fillRect(g1,f1,e1,sqSid); g.setColor(StdHue[9]); g.drawRect(g1,f1,e1,sqSid); g.setColor(StdHue[0]); g.fillRect(a1,b1+d1*3/4,c1,d1/4); g.setColor(StdHue[8]); g.fillOval(a1+sqSid*15/2,b1+hlfSqSid,hlfSqSid*5/2,sqSid); g.fillOval(a1+sqSid*5,b1+hlfSqSid*3/4,sqSid*7/2,sqSid*2/3); g.setColor(StdHue[2]); g.fillRoundRect(a1+sqSid*7,b1+sqSid,e1,e1,hlfSqSid,hlfSqSid); f1=d1-sqSid*4; g1=b1+sqSid; g.setColor(NewHue[0]); g.fillOval(a1,g1,c1,f1); g.setColor(StdHue[0]); g.drawOval(a1,g1,c1,f1); g.setColor(NewHue[0]); g.fillRect(a1,b1+sqSid*4,c1,d1-sqSid*7); g.setColor(StdHue[9]); g.fillOval(a1+hlfSqSid,b1+sqSid*7/2,e1,e1); f1=b1+sqSid*7/2; g1=a1+sqSid*3/2; g.setColor(StdHue[0]); g.drawOval(a1+hlfSqSid,f1,e1,e1); g.drawLine(g1,f1,g1,b1+sqSid*5); f1=b1+sqSid*9/2; g.drawLine(a1+hlfSqSid,f1,a1+sqSid*5/2,f1); f1=a1+hlfSqSid; g1=b1+sqSid*5; g.setColor(NewHue[0]); g.fillRect(f1,g1,e1,sqSid); g.setColor(StdHue[5]); g.fillRect(f1,g1,e1,sqSid/4); g.setColor(StdHue[0]); g.drawRect(f1,g1,e1,sqSid/4); e1=sqSid*3; f1=sqSid*4; g.setColor(StdHue[5]); g.fillOval(a1+e1,b1+e1,f1,f1); g.setColor(StdHue[0]); g.drawOval(a1+e1,b1+e1,f1,f1); e1=a1+sqSid*7/2; f1=b1+sqSid*17/4; g1=a1+sqSid*13/2; g.setColor(StdHue[0]); g.drawLine(e1,f1,g1,f1); f1+=sqSid*3/2; g.drawLine(e1,f1,g1,f1); e1=a1+sqSid*5; f1=b1+sqSid*19/4; g.setColor(StdHue[4]); g.fillOval(e1,f1,hlfSqSid,hlfSqSid); g.setColor(StdHue[0]); g.drawOval(e1,f1,hlfSqSid,hlfSqSid); e1=a1+sqSid*3-1; f1=b1+sqSid*5; g.setColor(StdHue[3]); g.fillOval(e1,f1-5,hlfSqSid/2,hlfSqSid); g.setColor(StdHue[0]); g.drawRect(e1,f1,4,1); g.setColor(StdHue[4]); g.drawRect(a1,b1,c1,d1); g1=b1+sqSid*13/2; for(e1=0;e1<50;e1++){ f1=a1+ran(c1/4); if((e1&1)==1) f1+=c1*2/3; h1=g1-ran(hlfSqSid); g.setColor(StdHue[ran(7)+(B9==5?1:0)]); g.fillOval(f1,h1,X+ran(12),X+ran(4)); g.setColor(StdHue[5]); g.fillOval(f1+6,h1+5,5,5); g.setColor(StdHue[0]); g.drawOval(f1+6,h1+5,5,5); } //for(e1=0; zonWd=sqSid; //inset edge hues[BrfFgd]=3; fitStr(" We are plain quiet folk & have no use for adventures.",-(hlfSqSid-4),c1-4); g.setFont(ltr); txt("1C2"+A9$); //A9$ of fitStr() txt("1D2 Nasty disturbing uncomfortable things! Make you late"); txt("1E2 for dinner! I can't think what anybody sees in them."); txt("1F2 We don't want any adventures here, thank you!"); zonWd<<=1; //resto default y1++; hues[BrfFgd]=9; fitStr(ChkBrf$,hlfSqSid-1,zonWd<<1); //carries over to io font g.setFont(ltr); txt("220start: Enter, retry: other"); return; case 5: y1+=2; sho4th(); return; case 6: g.setColor(StdHue[0]); g.fillRect(a1,b1,c1,d1); g.setColor(StdHue[4]); g.drawRect(a1,b1,c1,d1); zonWd=sqSid; //inset edge fitStr(" A variant of SPI's 1979 Magic Capsule Mini-game #2; not",-(hlfSqSid-4),c1-4); g.setFont(ltr); txt("1?2"+A9$); //A9$ of fitStr() txt("132 Game for 1 (to 6) player(s) vs computer-ctrld beasts."); txt("142 For playtest comments visit www.playhob.com."); txt("152 Files arc: arhX35.jar - contains all files below."); txt("162 Game pgm: arhX35.java (source);"); txt("172arhX35.class (byte code), arhX35$1.class (keyLis)."); txt("182 Rules doc: arhX35rul.rtf"); txt("192 This applet can't affect the integrity of your files (see"); txt("1:2Sun's site). It's practically guaranteed this playtest"); txt("1;2code has errors: don't be surprised. Playtesters are"); txt("1<2genuinely appreciated but not compensated. OK to alter"); txt("1=2the program for your own use, at your own risk."); txt("1@2approved by DeathMaze author Greg Costikyan, nor"); txt("1A2copyright holder: elements used without permission."); txt("1B2 Terms orc & dwimmorlaik (natch) from JRRTolkien's"); txt("1C2Lord of the Rings: used without permission."); txt("1D4Copyright 2010 by Droll"); zonWd<<=1; //resto default y1++; fitStr(ChkBrf$,hlfSqSid-1,zonWd<<1); //carries over to io font g.setFont(ltr); txt("220start: Enter, retry: other"); return; case 7: if(key1$!='\n'){ y1-=5; sho4th(); return; } //if(key1$!='\n' y1+=2; //comp for y1-- in reTrd() reTrd(); return; case 8: pikPty(); } //switch(y1 } //sho4th mth void pikPty(){ if(x1!=PikPty) y1=1; switch(y1){ case 1: x1=PikPty; isDon=isDis=false; //ini for new maze/ restart eq(whyEnd$,","); mazBig=1; totRoo=frqRoo=66; totHal=frqHal=40; pktCnt=frqRoo+frqHal; totHalRoo=totBfd=totLar=totTdr=totStp=6; a1=FeaIdx$.indexOf('F'); //in FeaIdx$ order frqFea[a1++]=totBfd; frqFea[a1++]=totLar; frqFea[a1++]=totTdr; frqFea[a1]=totStp; exiCnt=-1; trnCnt=1; opeCnt=exiTrn=0; eq(ope$,","); //",,,dhwhAS,ddddA,hwwh,.." //any hall entrance= hallway, else room a1$.setLength(0); for(a1=1;a1<=MazWd;a1++) //MazWd+1 added col contains Lay, Atl, Stp & TdrCoos a1$.append(Div$); //",,,,,,etc. for(a1=mazMap+1;a1<=mazMap+MazHt;a1++) eq(a1,a1$); b1=AtlCoo/C; c1=mazMap+AtlCoo%C; dtaIn(c1,b1,"hhhhA"); //atL coo sides & ini pty mkr dtaIn(++c1,b1,"wwww"); //stp coo sides dtaIn(++c1,b1,"wwww"); //tdr coo sides topCooCol=topCooRow=9; //center ety coo on opening map scn shoKey(); if(ptySiz<1){ inpVal=3; //addAdv() y1+=2; pikPty(); return; } //if(ptySiz<1 y1++; case 2: y1++; txt("011"); txt("051"); txt("153use 1) reorder group"); txt("163 to remove a generated adventurer"); txt("1110) head for town"); txt("1131) reorder group"); txt("1152) ready items"); txt("1213) add adventurer"); txt("2234) equip party"); return; case 3: a1=inpVal; txt("011"); txt("053"); if(a1<0 || a1>4 || key1$=='\b' || key7$=='\b'){ //Bksp has no effect y1--; pikPty(); return; } //if(a1<0 || y1++; if(a1==0){ while(hav(trvChr,"","")) eq(elmNum,Fre$); useOpt(); } else if(a1==1) ordPty(Pty,"admin reorg"); else if(a1==2) rdyItm(); else if(a1==3) addAdv(); else{ //equip pty y1++; pikPty(); } //else(a1==3 return; case 4: txt("053"); if(a1<3 || key4$=='\b'){ y1-=2; pikPty(); return; } //if(a1!=4 if(a1==3){ a1=0; ptySiz++; pikAds(valOut(srcChr,ChrGra)); return; } //if(a1==3 y1++; case 5: y1+=2; //comp for y1-- in reTrd() shoAdv(itmPoo,"equip the adv"); return; case 6: a1=itmElm; srcChr=newChr; if(key7$=='\b'){ y1-=4; pikPty(); return; } //if(key7$=='\b' if(!(a1>=itmPoo && a1=itmPoo && addItm(trvChr,a1); //instance chosen itm typ to trove holder b1=elmNum; y1++; case 7: c1=itmCat(a1); if(c1!=magWpn && c1!=sklItm){ //chk if ItmBon req y1+=3; pikPty(); return; } //if(c1!=magWpn && y1++; case 8: y1++; txt("253Item bonus + (1..9):"); return; case 9: dtaIn(b1,ItmBon,"+"+inpVal); y1++; case 10: if(!wrdOut(a1,ItmNat).equals("magic")){ //chk if ItmId req y1+=3; pikPty(); return; } //if(!wrdOut(a1,ItmNat).equals("magic" y1++; case 11: y1++; txt("253Item Id (0..9):"); return; case 12: dtaIn(b1,ItmId,inpVal>0?""+inpVal:"Id'd"); y1++; case 13: y1++; if(takItm(srcChr,b1)){ //prc itm pik givItm(srcChr,b1,All); if(b1!=elmNum) //elmNum of givItm() eq(b1,Fre$); //rmv loose trove itm (~wo clr'g all trv) rpt("211OK: "+chrNam(srcChr) +" takes "+wrdOut(a1,ItmTyp) +" "+wrdOut(a1,ItmCla)); } //if(takItm(srcChr,b1 else if(isB6 && c1==magWpn && B7>0 && isB7){ //isB6 of takItm(), _7s of chkWpn() addTo(C7,ItmBon,-1); // //-1 ord aro y1--; //retry pikPty(); } //if(isB6 && else{ eq(b1,Fre$); //rmv loose trove itm (~wo clr'g all trv) rpt("211"+A6$); //A6$= err msg of takItm() } //else(isB6 && return; case 14: y1-=9; //loop to equip choice pikPty(); } //switch(y1 } //pikPty mth void useOpt(){ //party muster if(x1!=UseOpt) y1=1; switch(y1){ case 1: x1=UseOpt; y1++; case 2: txt("011"); txt("053"); isBad=badNgo=badCrs=badRov=badBst=badTrp=badPas=false; txt("111Checking for Skirmish option penalty maze -"); txt("221 0) not applicable 1) check"); break; case 3: txt("011"); a1=inpVal; if(a1<1){ y1+=4; useOpt(); return; } //if(a1<1 txt("111 How many turns did the party use"); txt("131 (as reported at end of previous maze)"); txt("421 to complete their previous maze? "); break; case 4: txt("011"); a1=inpVal/X; b1=lowDic(dic(6,"pnlty chk"),X); //sum 6 dice if(a11){ mazBig=inpVal>2?3:2; totRoo=frqRoo=66/mazBig; totHal=frqHal=40/mazBig; pktCnt=frqRoo+frqHal; totHalRoo=totBfd=totLar=totTdr=6/mazBig; totStp=6/mazBig+1; a1=FeaIdx$.indexOf('F'); //in FeaIdx$ order frqFea[a1++]=totBfd; frqFea[a1++]=totLar; frqFea[a1++]=totTdr; frqFea[a1]=totStp; } //if(!isBad && y1++; case 9: txt("011"); if(!isBad){ d1=etyCoo/C; c1=mazMap+etyCoo%C; dtaIn(c1,d1,"+"); //ety coo mkr } //if(!isBad y1++; case 10: y1++; case 11: y1++; case 12: txt("211Use the Stacking option? 0) no 1) yes:"); break; case 13: isStk=inpVal==1; if(isStk){ isDwn=true; y1+=3; useOpt(); return; } //if(isStk y1++; case 14: txt("211Show Downed beasts? 0) no 1) yes:"); break; case 15: isDwn=inpVal==1; y1++; case 16: atLrg(); return; } //switch(y1 y1++; } //useOpt mth void atLrg(){ if(x1!=AtLrg) y1=1; switch(y1){ case 1: x1=AtLrg; isa1=false; // if(exiCnt>=0) //~allows beg sample chr unusual items for(a1=chrGrp;a1=bstCat) rmvChr(AtlCoo,a1,All); else{ while(hav(a1,"","fx") || hav(a1,"heirloom","artifact")) eq(elmNum,Fre$); dtaIn(a1,ChrHit,"0"); } //else(pri(a1)>=bstCat } //if(valOut(a1,ChrCoo)==AtlCoo else if(C9>0) //not trvChr in coo 0: C9 of valOut() isa1=true; if(isa1){ //atLrg() not accessible while any adv chr still in maze coo chkMov(); return; } //if(isa1 atCoo=AtlCoo; //shoMap() req: allows call from other than chkIn() eg. useOpt(),chkMov() atCooCol=atCoo/C; atCooRow=atCoo%C; shoMap(); //del map coo pty mkr (atCoo>LayCoo but rtnCoo=0) shoFld(AtlCoo); while(locElm(itmGrp,ItmOpn,"fail")>0) //reactivate failed spells dtaIn(elmNum,ItmOpn,"0"); isEva=true; if(isDon){ a1=200/mazBig-trnCnt; if(!isBad && a1>0){ txt("153Advs who began maze gain "+a1+" ep."); b1=nxtChr(AtlCoo,Adv); do if(wrdOut(newChr,ChrImg).charAt(0)!='+') //'+" from addAdv() (when atLrg()) addTo(newChr,ChrEp,a1); while(nxtChr(AtlCoo,Adv)!=b1); } //if(!isBad && } //if(isDon else if(++exiCnt>0){ a1=lowDic(dic(6,"turns+"),X); exiTrn+=a1; trnCnt+=exiTrn; txt("153Exit "+exiCnt+" from maze adds "+a1+" to #turns"); } //if(++exiCnt>0 y1++; case 2: y1++; txt("051"); shoCoo(atCooCol,atCooRow); isPfl=true; txt("181 party at large"); isPfl=false; txt("011"); txt("1110) "+(isDon?"end game":"enter maze")+(isa1?"-Ok?":"")); //isa1 ini false in case 1: txt("1131) reorder group"); txt("1152) ready items"); txt("1213) sell jewels"); txt("1234) raise grades"); txt("1255) add adventurer"); txt("2316) equip party"); return; case 3: a1=inpVal; txt("011"); txt("053"); if(a1<0 || a1>6 || key1$=='\b' || a1==0 && !isa1){ //Bksp has no effect isa1=a1==0?true:false; if(isa1 && !isDon){ a1=b1=nxtChr(atCoo,Adv); do{ a1=nxtChr(atCoo,Adv); if(!has(a1,"","weapon")){ txt("163"+chrNam(a1)+" weapon unready"); break; } //if(!has(a1,"","weapon" }while(a1!=b1); } //if(isa1 && y1--; atLrg(); return; } //if(a1<0 || isa1=false; y1++; if(a1==0){ if(isDon){ eq(whyEnd$,"Party has finished the "+(isBad?"penalty ":"")+"maze!"); endGam(); //final exit not added to exiCnt return; } //if(isDon c1=0; //insure chrs in sqs in rows 1 & 2 for(b1=chrGrp;b16 || valOut(b1,ChrSq)>6){ //~|| valOut(b1,ChrPst)%X6 || txt("051"); while(hav(trvChr,"","")) eq(elmNum,Fre$); toCoo=etyCoo; toCooCol=toCoo/C; toCooRow=toCoo%C; isMov=true; //incl uncons movPty(atCoo,toCoo); //isDis preserved from exit move } //if(a1==0 case 4: if(a1==0){ if(newTil){ //1st maze entry isDon=isBad; //considered to be making their way out from the start inSid=0; chkTil(); } //if(newTil else chkIn(); return; } //if(a1==0 y1++; if(a1==1) ordPty(Pty,"admin reorg"); else if(a1==2) rdyItm(); else if(a1==3) selJew(); else if(a1==4) upGra(); else if(a1==5) addAdv(); else{ //equip pty y1++; atLrg(); } //else(a1==5 return; case 5: txt("053"); if(key4$=='\b'){ y1-=3; atLrg(); return; } //if(key4$=='\b' if(a1<4){ y1-=3; if(a1==2){ y1++; inpVal=2; } //if(a1==2 } //if(a1<4 else y1+=3; atLrg(); return; case 6: y1+=2; //comp for y1-- in reTrd() shoAdv(itmPoo,"equip the adv"); return; case 7: c1=itmElm; srcChr=newChr; //prov for keyTyped() chr chg in shoAdv() if(key7$=='\b'){ y1-=5; atLrg(); return; } //if(key7$=='\b' if(pri(srcChr)>advCat || !(c1>=itmPoo && c1=itmPoo && addItm(trvChr,c1); //instance chosen itm typ to trove holder b1=elmNum; if(wrdOut(b1,ItmCod).equals("Arrow")) addTo(b1,ItmBon,24); y1--; //prc itm pik if(takItm(srcChr,b1)){ givItm(srcChr,b1,All); if(b1!=elmNum) //elmNum of givItm() eq(b1,Fre$); //rmv loose trove itm (wo clr'g all trv) rpt("211OK: "+chrNam(srcChr) +" takes "+wrdOut(c1,ItmTyp) +" "+wrdOut(c1,ItmCla)); } //if(takItm(srcChr,b1 else{ eq(b1,Fre$); //rmv loose trove itm (wo clr'g trv) rpt("211"+A6$); //A6$= err msg of takItm() } //else(takItm(srcChr,b1 return; case 8: if(a1==4){ //raising lvl of existing adv b1=a4; //a4 of upGra() sbr y1++; } //if(a1==4 else{ //adding new 1st lvl adv: a1>4 dtaIn(srcChr,ChrGra,"1"); //insure stats reset for 1st lvl dtaIn(srcChr,ChrEp,"0"); while(hav(srcChr,"","cash")) eq(elmNum,Fre$); while(hav(srcChr,"","+weapon")){ eq(a1$,wrdOut(elmNum,ItmCod)); eq(elmNum,Fre$); addItm(srcChr,locItm(itmPoo,str(a1$),"=weapon")); } //while(hav(srcChr,"","+weapon" if(hav(srcChr,"Armor","+armor")) eq(elmNum,Fre$); ptySiz++; b1=1; y1+=2; } //else(a1==4 pikAds(b1); return; case 9: //subtract Crs & ep req for lvls added c1=valOut(srcChr,ChrGra); d1=0; for(e1=1;e1<=b1;e1++) //add up reqs per lvl d1+=c1++*25+50; addTo(srcChr,ChrEp,-d1); //enter reductions dtaIn(srcChr,ChrGra,""+c1); if(hav(srcChr,"Crowns","cash")) addTo(elmNum,ItmBon,-d1); y1++; case 10: inpVal=a1; //looping: recall upGra() or addAdv() menu choice y1-=7; atLrg(); } //switch(y1 } //atLrg mth void chkTil(){ //uses inSid of atLrg() (set 0) or chkMov() if(x1!=ChkTil) y1=1; switch(y1){ case 1: x1=ChkTil; //genTil() doesn't put tile code into mazMap, but does put any fea$ after pty mkr eq(a1$,genTil(toCooCol,toCooRow,inSid)); //=A6$ of genTil() y1++; if(D6==1 && frqRoo<1){ //D6, frqRoo of genTil() isDon=true; txt("121 Make your way out."); rpt("211You explore the last room & finish the maze!"); return; } //if(D6==1 && case 2: txt("051"); a1=mazMap+toCooRow; dtaIn(a1,toCooCol,str(a1$)+wrdOut(a1,toCooCol)); layTil(toCooCol,toCooRow); y1++; case 3: y1++; case 4: chkIn(); } //switch(y1 } //chkTil mth void chkIn(){ if(x1!=ChkIn) y1=1; switch(y1){ case 1: x1=ChkIn; isBar=isCbt=is1st=isSrp=false; //ini room door barred, cbt flgs opt1=Nah; //ini 1st cbt rd opt var atCoo=toCoo; g1=atCooCol; //hold for passage chks atCooCol=toCooCol; h1=atCooRow; atCooRow=toCooRow; if(atCoo==AtlCoo){ atLrg(); return; } //if(atCoo==AtlCoo a1=mazMap+atCooRow; eq(a1$,wrdOut(a1,atCooCol)); isDin=false; //ini flg for in coo w 'D' mkr do{ //rmv all 'D' mkrs & set flg b1=str(a1$).indexOf('D'); if(b1>=0){ isDin=true; insStr(a1$,b1,b1+1,""); //~use deleteCharAt(b1) } //if(b1>=0 }while(b1>=0); dtaIn(a1,atCooCol,str(a1$)); y1++; case 2: //isPkt=true; //~test ln if(isPkt){ //cnt # empty coos accessible by ope til sides isPkt=false; eq(z1$[xsA],ope$); pktCnt=0; b1=c1=1; while(c1=0); isa1=isStp || isTdr //trp flg ~isa1=!isRov; -> door to hall NA || newTil && inSid>0 && (wrdOut(mazMap+h1,g1).charAt(inSid-(inSid>2?2:-2)-1)=='d' || a1$.charAt(inSid-1)=='d'); if(isDis) //cancel Dis mov fx if moved into new room isDis=isRov; if(isa1) chkTrp(); else chkBst(); } //switch(y1 } //chkIn mth void chkTrp(){ //uses: a1$ of chkIn() if(x1!=ChkTrp) y1=1; switch(y1){ case 1: x1=ChkTrp; trpTyp=Nah; //ini trp occurence flg y1++; case 2: y1++; aDie("door trap "+(isTdr?"(Trapdoor+1) ":"")+(isDin?"(Disturbed+1) ":"")+"check"); if(isInp) return; case 3: a1=a6; //a1=6; //~test lin txt("053"); b1=6; //chk trap on door if(isTdr) //trapdoor %*2 b1--; if(isDin) //ie. 'D' surmounted by newTil b1--; if(a15 || key1$=='\b'){ //Bksp has no effect y1--; if(a1==0) ordPty(Pty,"admin reorg"); else if(a1==1) rdyItm(); else if(a1==2) pikItm(Adv); else chkBar(); return; } //if(a1<3 || y1++; case 6: barOpt=a1-4; if(a1!=4){ chkBst(); return; } //if(a1!=4 for(b1=chrGrp;b1 in rows 1&2 if(atCoo==valOut(b1,ChrCoo)) if(valOut(b1,ChrSq)>6){ txt("163Party members must be in rows 1&2"); y1-=2; chkBar(); return; } //if(valOut(b1,ChrSq)>6 y1++; case 7: y1++; aDie("stakeout"); if(isInp) return; case 8: a1=a6; a1=6; //~test lin if(a1<6){ b1=mazMap+atCooRow; //mark room Disturbed c1=atCooCol; eq(b1$,wrdOut(b1,c1)); d1=str(b1$).indexOf('A'); insStr(b1$,d1,"D"); //ins 'D' pre-'A' pty mkr dtaIn(b1,c1,str(b1$)); bakOut(); shoMap(); shoFld(atCoo); isRov=isDis=true; eq(b1$,wrdOut(mazMap+atCooRow,atCooCol)); isDin=str(b1$).indexOf('D')>=0; } //if(a1<6 y1++; case 9: y1++; if(!isRov){ txt("211Party accosted by lurking beasts."); return; } //if(!isRov case 10: chkBst(); } //switch(y1 } //chkBar mth void chkBst(){ if(x1!=ChkBst) y1=1; switch(y1){ case 1: x1=ChkBst; bstRtg=0; //ini enc /trv lvl a1=mazMap+atCooRow; eq(a1$,wrdOut(a1,atCooCol)); isa1=false; //ini flg to mark coo Disturbed if(isRov || isBar){ y1+=3; chkBst(); return; } //if(isRov y1++; case 2: y1++; txt("011"); txt("1110) scout the room"); txt("1131) reorder group"); txt("1152) ready items"); txt("2213) use items"); return; case 3: a1=inpVal; if(a1<0 || a1>3 || key1$=='\b'){ //Bksp has no effect y1--; chkBst(); return; } //if(a1<0 || if(a1>0){ y1--; txt("011"); if(a1==1) ordPty(Pty,"admin reorg"); else if(a1==2) rdyItm(); else pikItm(Adv); return; } //if(a1>0 y1++; case 4: txt("011"); isc1=rdmChr(atCoo,1,3,Adv)<1 || D6==1 && valOut(elmNum,ChrSq)!=2; //D6 of rdmChr() isd1=false; if(newTil) //for poss scatter by pre-enc ops; old tile encs focus on moved pty grp for(a1=chrGrp;a16 //can't mov >sq9 in tryDtp()= isCbt || rdmChr(atCoo,C9,C9,Any)!=a1 || E6>1 //C9 of valOut(), E6 of rdmChr() || getPst(a1)!=E7){ //E7 of getPst() isd1=true; break; } //if(valOut(a1,ChrSq)>6 || if(isc1 || isd1){ if(isc1){ txt("111Put adv(s) in front row sqs 1..3"); txt("121 - isolated adv must be in sq 2."); } //if(isc1 if(isd1) txt("131 Put conscious chrs upright singly in sqs 1..6."); ordPty(Pty,"march order"); return; } //if(isc1 || y1++; case 5: y1++; if(isRov) tskRol(0,1,isDis?4:5,Nah,"avoid Roving Beast"+(isDis?" (Disturbed+1)":"")); else if(isBar && barOpt==0){ //retreat foiled by stakeout a6=6; isInp=false; } //if(isBar && else aDie("room encounter"); if(isInp) return; case 6: txt("053"); //clr "no door trap" msg a1=isRov?dig(die$,0):a6; //a6 of aDie() //a1=isRov?(isDis?1:6):4; //~test ln b1=isRov?6:4; if(isDis) b1--; //txt("171need "+a1+">="+b1); //~test ln if(a1>=b1){ //immed bst enc seeBst(); return; } //if(a1>=b1 isBar=false; //no barred mod for vac roo or subsq enc if(isRov || !(fea$=='F' || fea$=='L' || isStp || isTdr)){ //no enc y1=20; chkBst(); return; } //if(isRov || y1++; case 7: y1++; //conduct search of feature rooms for beasts, etc. txt("011"); txt("2110) let it be 1) look into it"); return; case 8: if(inpVal==0){ //choose no enc isa1=true; y1=20; chkBst(); return; } //if(inpVal=0 y1++; case 9: y1++; aDie("quick check"); if(isInp) return; case 10: txt("011"); bstRtg++; //+1 to 1st bst roll if(a6>4){ //find bst seeBst(); return; } //if(a6>4 if(a6<2){ //gain trove isCbt=true; bstRtg=4; //typ D treas y1=20; rpt("211Found an unguarded trove!"); return; } //if(a6<2 y1++; case 11: y1++; txt("2110) lay off 1) look closer"); return; case 12: if(inpVal==0){ //choose no enc isa1=true; y1=20; chkBst(); return; } //if(inpVal=0 y1++; case 13: y1++; aDie("thorough search"); if(isInp) return; case 14: txt("011"); bstRtg++; //+2 to 1st bst roll if(a6>5){ //find bst seeBst(); return; } //if(a6>5 y1=20; if(a6<2){ //gain trove isCbt=true; bstRtg=4; //typ D treas rpt("211Found an unguarded trove!"); return; } //if(a6<2 case 20: //no enc y1++; txt("011"); if(isa1){ //mark coo Disturbed if halt fea room srch b1=mazMap+atCooRow; c1=atCooCol; eq(b1$,a1$); if(isTdr || isStp){ b1=mazMap+rtnCoo%C; c1=rtnCoo/C; eq(b1$,wrdOut(b1,c1)); } //if(isTdr insStr(b1$,4,"D"); dtaIn(b1,c1,str(b1$)); txt("121 Room will be left Disturbed."); } //if(isa1 rpt("211No beasts encountered here."); return; case 21: reSet(Pty+Out,Nah); //mrk all pty chrs 'acted' chkVlt(); //always go thru chkTrv() for merged, cleanup pty opts } //switch(y1 } //chkBst mth void seeBst(){ //uses: a1$ of chkBst() if(x1!=SeeBst) y1=1; switch(y1){ case 1: x1=SeeBst; y1++; case 2: //roll bst y1++; namBst=X*(namBst/X+1); eq(b1$,"Beast Table 1st die"); if(bstRtg>0) b1$.append(" +"+bstRtg); aDie(str(b1$)); if(isInp) return; case 3: bstRtg+=a6; //bstRtg=3; //~test ln y1++; b1=0; eq(b1$,"Beast Table 2nd die"); if(fea$=='L') b1+=2; if(badBst && !isRov && fea$=='A') b1++; if(b1>0) b1$.append(" +"+b1); aDie(str(b1$)); if(isInp) return; case 4: a1=Math.min(a6+b1,6); //mod die2 typBst=3*(bstRtg-1); //(principal) beast typ: bstCat-1+typBst(1..24)= pri() elm typBst+=Math.max(1,a1/2); //typBst=8; //~test ln c1=bstCat-1+typBst; eq(b1$,wrdOut(c1,ChrTyp)); y1++; case 5: y1++; txt("111beast= "+b1$); shoBst(c1); eq(c1$,wrdOut(c1,ChrGra)); //chk #s Task formula a1=dig(c1$,5); b1=dig(c1$,7); if(isRov){ if(!badRov || !isDis) a1--; //0 as "no dice" tsk if(!isDis) b1--; } //if(isRov isPfl=true; txt("171#:"+a1+'*'+b1); isPfl=false; isc1=isEva && isRov && !isDis && !isDin; if(isc1){ txt("231Use Evasion: 0) no 1) yes"); return; } //if(isEva && if(isEva && isRov && (isDis || isDin)) txt("124[ no Evasion: Disturbed ]"); case 6: if(isc1 && inpVal==1) isEva=false; else isc1=false; y1++; //det # bsts tskRol(0,a1,Nah,Nah," # appearing"); if(isInp) return; case 7: txt("014"); sumBst=lowDic(tsk(die$),b1); sumBst++; //provides for at least one bst if(isDin && (sumBst&1)>0){ sumBst++; //even # in 'D' mkr coo txt("124(even up in Disturb tile)"); } //if(isDin && //sumBst=3; //~test ln if(!isc1){ y1+=4; seeBst(); return; } //if(!isc1 y1++; case 8: y1++; txt("115# here= "+sumBst); pikChr(Pty,"scout for Evade"); return; case 9: isc1=valOut(newChr,ChrSq)>3; isd1=pri(newChr)>advCat; if(isc1 || isd1){ txt("031"); txt("131scout must be "+(isc1?"in front rank":"adventurer")); y1--; seeBst(); return; } //if(isc1 || srcChr=newChr; y1++; tskRol(srcChr,modRv(srcChr),Nah,Rv,"Evade"); if(isInp) return; case 10: a1=dig(tsk(die$),0); isc1=str(a1$).indexOf('h')<0; sumBst-=(isc1 && a1<6?5:6)-a1; txt("011"); if(sumBst<1){ reSet(Pty+Out,Nah); //mrk all pty chrs 'acted' x1=ChkVlt; y1=1; rpt("211No beasts encountered here."); return; } //if(sumBst<1 y1++; case 11: y1++; txt("111beast= "+b1$); txt("115# here= "+sumBst); isc1=isRov && !isDis && !isDin && has(-srcChr,"Alr","fx"); if(isc1){ txt("031"); rpt("231Use Alertness: 0) no 1) yes"); return; } //if(isc1 case 12: y1++; if(isc1 && inpVal==1) if(chkPot(-srcChr,"Alr")){ eq(c1$,A6$); //_6s of chkPot() if(isA6){ c1$.append(" No beasts met."); reSet(Pty+Out,Nah); //mrk all pty chrs 'acted' x1=ChkVlt; y1=1; } //if(isA6 rpt("231"+c1$); return; } //if(chkPot(-srcChr,"Alr" case 13: y1++; isb1=locDuo(itmGrp,ItmCod,"SeeSe",ItmOpn,"991")>0; if(isb1){ a1=elmNum; //elmNum of locDuo() rpt("221Use SeeSeg fx? 0) yes 1) no"); return; } //if(isb1 case 14: if(isb1 && inpVal!=1){ //~?typBst=sumBst=0; reSet(Pty+Out,Nah); //mrk all pty chrs 'acted' chkVlt(); return; } //if(isb1 && y1++; putBst(); //uses atCoo,typBst,sumBst shoBst(nxtChr(atCoo,Foe)); case 15: y1++; //if isDis, % for switching pty rows 1&2 if(isDis && rdmChr(atCoo,4,6,Pty)>0 && dig(dic(1,"row rev"),0)<4){ a1=elmNum; //elmNum, E6 of rdmChr b1=E6; for(c1=chrGrp;c1=bstCat; f1=locElm(chrGrp,ChrNam,wrdOut(c1,ItmLoc)); isd1=isb1 && (f14; y1++; switch(a1){ case 1: opt1=Ngo; ngoDif=(badNgo || typBst>12?3:4); if(fea$=='F' || fea$=='L'){ isa1=true; txt("141 (no Negotiate in Battlefield or Lair)"); } //if(fea$=='F' || break; case 2: opt1=Thf; isa1=true; if(trpTyp!=Nah) //=trp on door was tripped txt("141 (door trap was tripped)"); else{ for(b1=1;b1<4;b1++) if(rdmChr(atCoo,b1,b1,Adv)>0 && wrdOut(pri(elmNum),ChrTyp).equals("Thief")){ isa1=false; break; } //if(rdmChr(atCoo,b1,b1,Adv)>0 && if(isa1) txt("141 (no Thief in front row)"); } //else(trpTyp!=Nah break; case 3: opt1=Chk; pikItm(Adv); //pik (Check spell) itm return; //redirected to chkVlt() at end of doSpl() if succeed case 4: if(isTdr || isStp){ isa1=true; txt("141 (no support allowed here)"); } //if(isTdr || isStp else{ isa1=true; for(b1=chrGrp;b1=0) insStr(a1$,b1,b1+1,""); //~use deleteCharAt(b1) }while(b1>=0); dtaIn(a1,atCooCol,str(a1$)); oneRnd(); } //switch(y1 } //rndOne mth void oneRnd(){ if(x1!=OneRnd) y1=1; switch(y1){ case 1: x1=OneRnd; rndCnt=1; isCbt=isEva=true; //isSrp=true; //~test ln y1++; //calc enc ep per adv - doesn't chg sumBst= tot enc # not incl lr[3] isa1=fea$=='L'; a1=Integer.parseInt(wrdOut(bstCat-1+typBst,ChrGra).substring(0,2))*sumBst; if(lr[3]>0) //added familiar a1+=Integer.parseInt(wrdOut(bstCat-1+lr[3],ChrGra).substring(0,2)); if(isa1) a1+=a1+1>>1; a1=(a1+mazBig-1)/mazBig; if(opt1!=Spt){ b1=rdmChr(atCoo,9,19,Pty); encEp=(a1+E6/2)/Math.max(1,E6); //rnd up frac>=.5 (prov for 0): E6 of rdmChr() txt("184enc ep"+(isa1?" (Lair bonus)= ":"= ")+encEp); } //if(opt1!=Spt else encEp=-a1; //neg flg rechks #advs in chkVlt() rpt("263combat begins with " +(is1st?"Bst":"Adv")+(isSrp?" surprise":"")+" atks"); return; case 2: txt("053"); if(opt1==Spt && rndCnt>=sptRnd){ isCbt=false; //allow Spt'g chrs' unrestricted reorg chkMov(); //resets opt1=Mov in rndOne() Bgl chk return; } //if(opt1==Spt && isa1=opt1==Mov; if(isa1 || rndCnt<2){ //(mayday spt'g chrs) enter cbt coo a1=nxtChr(atCoo,Any); //chk QkDrw quals do{ //Mov'g chrs marked acted in movPty() b1=Ctl$.indexOf(wrdOut(newChr,ChrCtl)); if(sptRnd==1 || isa1==b1>1) if((hav(newChr,"","weapon") || pri(newChr)<=advCat) && (!has(newChr,"","weapon") || "Hex Dagger".indexOf(wrdOut(elmNum,ItmCod))>=0)){ addItm(newChr,locItm(itmPoo,"QkDrw","fx")); dtaIn(elmNum,ItmOpn,""+(isa1 && b1>1?rndCnt+1:rndCnt)); //elmNum of addItm() } //if((hav(newChr,"","weapon") || }while(nxtChr(atCoo,Any)!=a1); } //if(isa1 || y1++; advAtk(); return; case 3: txt("011"); if(nxtChr(atCoo,Bst)20){ //rechk of advAtk() cbt exit cond.s opt1=Nah; //cancel Spt flg in case spt rnd unreached reSet(Pty+Out,Nah); //mrk all pty chrs 'acted' chkVlt(); return; } //if(nxtChr(atCoo,Bst)0) do if(isOp(newChr) && (hav(newChr,"","weapon") || pri(newChr)<=advCat) && (!has(newChr,"","weapon") || "Hex Dagger".indexOf(wrdOut(elmNum,ItmCod))>=0)){ addItm(newChr,locItm(itmPoo,"QkDrw","fx")); dtaIn(elmNum,ItmOpn,""+(rndCnt+1)); //elmNum of has() or addItm() } //if((hav(newChr,"","weapon") || while(nxtChr(atCoo,Any+Set)!=a1); if(isSrp){ isSrp=false; y1+=2; //skip advOrg on surprise rd rpt("211Adv round 2 follows surprise attack round."); return; } //if(isSrp reSet(Any,Set); //mark all consc chars in coo 'unacted' y1++; bstOrg(); return; case 6: y1++; advOrg(); return; case 7: //upd: end of cbt Rnd reSet(Any,Set); //mark all consc chars in coo 'unacted' y1++; fxExp(1); if(isInp) return; case 8: rndCnt++; y1++; case 9: y1=2; oneRnd(); } //switch(y1 } //oneRnd mth void chkVlt(){ if(x1!=ChkVlt) y1=1; switch(y1){ case 1: x1=ChkVlt; isa1=isCbt; //hold for flg to mark coo chrs acted if(isa1 && bstRtg>5 && has(-srcChr,"TruNam","fx")) eq(elmNum,Fre$); //elmNum of has() y1++; case 2: y1++; txt("011"); txt("053"); //award enc ep to pty mems if(encEp!=0){ if(encEp<0){ //opt1==Spt mayday opt used a1=rdmChr(atCoo,9,19,Pty+Out); encEp=(-encEp+D6/2)/Math.max(1,D6); //rnd up frac: D6 of rdmChr() } //if(encEp<0 a1=rdmChr(atCoo,9,19,Adv); for(a1=1;a1<=E6;a1++) //E6 of rdmChr() //~use D6 w if(Z6[a1]>0) opt for unconscious adv - Z6[] of rdmChr() addTo(Z6[a1],ChrEp,encEp); eq(a1$," Each adv gains "+encEp+" enc ep"); encEp=0; rpt("263"+a1$); return; } //if(encEp!=0 case 3: y1++; fxExp(900); //also shows Bgl'd adv recovery msgs if(isInp) return; case 4: for(a1=chrGrp;a14){ isVlt=true; aDie("trap on trove"); if(isInp) return; } //if(isCbt && case 5: y1++; //a6=6; //~test ln (insure bstRtg>4) if(isVlt) if(a6>5) txt("153Treasure is trapped!"); else isVlt=false; case 6: chkTrv(); } //switch(y1 } //chkVlt mth void chkTrv(){ if(x1!=ChkTrv) y1=1; switch(y1){ case 1: x1=ChkTrv; //isa1=isCbt; isVlt of chkVlt() a1=nxtChr(atCoo,Adv); //make newChr=Adv, for trove chks if(isNo1) //isNo1 of nxtChr() return; y1++; case 2: //ety pt for rtn from tryDtp() blw (sets isCbt for genTrv() nxt) y1++; if(isCbt && !isVlt){ genTrv(bstRtg); return; } //if(isCbt && case 3: isCbt=false; //allow Use of non-cbt spells, reset from tryDtp() call blw isTrv=hav(trvChr,"",""); //incls dropped itms isb1=isTrv || isVlt; y1++; case 4: txt("084"); if(atCoo4?4:inpVal; txt("011"); if(a1<4){ y1--; if(a1==1) ordPty(Pty,"admin reorg"); else if(a1==2){ idDif=4; tryId(); } else if(a1==3) pikItm(Adv); else chkOut(); //a1==0 room finish return; } //if(a1<4 y1++; case 6: if(isVlt){ y1++; txt("163 Detrapper must be in 1st rank."); txt("2111) Try to detrap vault other) See trove items"); } //if(isVlt else{ y1+=3; chkTrv(); } //else(isVlt return; case 7: if(inpVal==1){ //opt to detrap trapped trove txt("053"); if(rdmChr(atCoo,11,19,Pty)>0 || rdmChr(atCoo,1,3,Pty)==0){ txt("163 [ Move to party ground for detrap ]"); y1-=3; chkTrv(); } //if(rdmChr(atCoo,11,19,Pty)>0 else{ y1++; putTrp(0); } //else(rdmChr(atCoo,11,19,Pty)>0 } //if(inpVal==1 else{ y1+=2; chkTrv(); } //else(inpVal==1 return; case 8: y1=2; //restart after detrap if(typBst%3==0) trpDif=3; trpDif=-trpDif; //flg for trove trp tryDtp(); //trp vars of putTrp() return; case 9: y1-=6; rdyItm(); return; } //switch(y1 } //chkTrv mth void chkOut(){ if(x1!=ChkOut) y1=1; switch(y1){ case 1: x1=ChkOut; //isa1=isCbt; isVlt of chkVlt() isb1=hav(trvChr,"",""); of chkTrv() y1++; case 2: y1++; a1=b1=nxtChr(atCoo,Adv); if(isNo1) //isNo1 of nxtChr() return; isc1=true; if(isa1) do{ a1=nxtChr(atCoo,Adv); isc1=has(a1,"","weapon"); }while(isc1 && a1!=b1); if(!isc1) txt("111"+chrNam(a1)+" has no ready weapon."); if(isb1 || !isc1){ txt("221 "+(isb1?"Discard trove items & c":"C")+"ontinue? 0) no 1) yes"); return; } //if(isb1 || case 3: txt("011"); if((isb1 || !isc1) && inpVal==0){ chkTrv(); return; } //if((isb1 || isc1=false; if(!isa1 && has(-srcChr,"BstId","fx")){ //!isa1= no atk (post Ngo) eq(elmNum,Fre$); //rmv fx - elmNum of has() a1=itmGrp; while(a1<=arySiz && locElm(a1,ItmOwn,"trove")>0){ a1=elmNum; if(valOut(a1,ItmId)<0){ //(unId'd) magic itm from trv isc1=true; break; } //if(valOut(a1,ItmId)<0 a1++; } //while(a1<=arySiz && } //if(!isa1 && if(!isc1){ y1+=3; chkOut(); return; } //if(!isc1 y1++; rpt("211"+wrdOut(bstCat-1+typBst,ChrTyp)+" will Id any 1 item for you!"); return; case 4: y1+=2; //comp for y1-- in reTrd() shoAdv(itmGrp,"what to Id?"); //choose owned itm for help return; case 5: if(key7$=='\b' || itmElm0){ rpt("211"+rcd$); return; } //if(rcd$.length()>0 } //if(a1==0 case 7: y1++; if(isb1) txt("111"+c6$); //c6$ of rpt() isc1=locItm(itmGrp,"PsnWd","fx")>0; if(isc1) txt("121Still have Poison fx."); if(isb1 || isc1){ txt("232Finish here anyway? 0) no 1) yes"); return; } //if(isb1 || case 8: if((isb1 || isc1) && inpVal==0){ chkTrv(); return; } //if(isb1 && txt("011"); txt("053"); y1++; fxExp(991); if(isInp) return; case 9: if(isa1) //if post-enc (bst cbt) if(isStp && feaVar>0){ //end of battle w Boss bst (feaVar still set) isCbt=true; tryStp(); return; } //if(isStp else reSet(Pty+Out,Nah); //mark all grp chars in coo 'acted' y1++; case 10: if((isStp || isTdr) && feaVar<1){ x1=ChkFea; y1=1; rpt("211"+(isBad && isStp?"Exit maze": "Deal with "+(isStp?"Steps":"Trapdoor")+" variety")+" (hit any key)"); return; } //if((isStp || clrOut(); chkMov(); //go on to next group or turn } //switch(y1 } //chkOut mth void chkFea(){ //Tdr, Stp activities if(x1!=ChkFea) y1=1; switch(y1){ case 1: x1=ChkFea; if(isStp && isBad){ //auto exit in penalty maze isStp=false; isMov=true; //move all in coo; incl unconsc & trvChr w items movPty(atCoo,AtlCoo); chkMov(); //Stp fea stays return; } //if(isStp && y1++; case 2: txt("011"); txt("051"); txt("053"); y1++; eq(a1$,isStp?"Steps":"Trapdoor"); aDie(str(a1$)+" variety"); if(isInp) return; case 3: feaVar=a6; //feaVar=6; //~test ln eq(xsA,isStp?StpElm$:TdrElm$); eq(b1$,wrdOut(xsA,feaVar)); y1++; if(isTdr){ a1=3; aDie("Need <"+a1+" to avoid "+b1$+" denizen"); if(isInp) return; } //if(isTdr case 4: if(isTdr) isa1=a6>=a1; else{ isa1=str(stpVar$).indexOf(""+feaVar)>=0; stpVar$.append(feaVar); } //else(isTdr //if(isTdr || isStp) isa1=true; //~test ln y1++; if(isStp){ txt("121 "+(isa1?"and, it's associated with one you've seen before." :"- 1st such discovery recorded.")); if(isDon){ isa1=false; txt("131 But, it's now deserted."); } //if(isDon } //if(isStp else txt("121 "+(isa1?"and, dangers lie within." :"but, nothing untoward occurs.")); rpt("211The "+a1$+" lead"+(isStp?"":"s")+" to: "+b1$); return; case 5: //isa1=false; //~test ln if(isa1){ isb1=rdmChr(atCoo,1,3,Adv)<1 || D6==1 && valOut(elmNum,ChrSq)!=2; //D6 of rdmChr() isc1=rdmChr(atCoo,11,19,Pty+Out)>0; if(isb1 || isc1){ txt("011"); if(isb1){ txt("111Move adv(s) to front row (sq 1..3)"); txt("121 - isolated adv must be in sq 2"); } //if(isb1 if(isc1) txt("1"+(isb1?'3':'1')+"1Move chr(s) to party ground (sq 1..9)"); ordPty(Pty+Out,"admin reorg"); return; //y1 unchg'd: comes back here for recheck } //if(isb1 || } //if(isa1 y1++; case 6: txt("011"); if(isa1){ if(isTdr) tryTdr(); else tryStp(); return; } //if(isa1 a1=feaVar; if(isStp) a1+=X; switch(a1){ case 1: //hidden den eq(a1$," At the end of a long, widening passage you enter"); eq(b1$,"what appears to have been a hideout campsite"); eq(c1$,"for a gang of raiders - but the place looks like it's been"); eq(a2$,"abandoned for some time."); break; case 2: //spring cavern eq(a1$," You lower yourselves into a basin in the rock floor"); eq(b1$,"where a natural spring issues from a crevice. The damp-"); eq(c1$,"ness makes some rocks slick, but stones have been"); eq(a2$,"laid to provide for easy access to the pool."); break; case 3: //root cellar eq(a1$," Beneath the covered opening is excavated a musty-"); eq(b1$,"smelling storeroom, having strange ruts in the soft"); eq(c1$,"ground, and odd roots growing out of the walls; but it"); eq(a2$,"appears to have been cleaned out."); break; case 4: //antique armory eq(a1$," Though once a secure cache for martial implements &"); eq(b1$,"accoutrements, this bunker warroom seems to have"); eq(c1$,"been ransacked long ago. Any hideaway compartments"); eq(a2$,"have been turned out."); break; case 5: //garbage pit eq(a1$," This subterranean vault has been battened off for"); eq(b1$,"good reason, as it's no more than a dumping chute"); eq(c1$,"for noisome refuse of all descriptions. Naught but"); eq(a2$,"garbage lies within."); break; case 6: //prison cell eq(a1$," Beneath the floor panel is a small oubliette which"); eq(b1$,"must have been used for detention of slaves or "); eq(c1$,"prisoners. There are chains, shackles and manacles"); eq(a2$,"on the walls and lying around, but all now unused."); break; case 11: //watercourse eq(a1$," The steps wind around to the brink of a rushing"); eq(b1$,"underground stream which cuts through along one rock"); eq(c1$,"wall. You see features of the channel it's carved, but"); eq(a2$,"the outlet passage is too wide to manage."); break; case 12: //faultline eq(a1$," As you explore this alcove, you perceive streaks &"); eq(b1$,"veins of mineral deposits within the stone of the walls -"); eq(c1$,"indicating a structural weakness of the overall complex."); eq(a2$,"No obvious fault appears here, though."); break; case 13: //nasty/bane eq(a1$," Your progress at the end of the path is impeded by an"); eq(b1$,"accumulation of debris from what looks like a whirlwind"); eq(c1$,"once hit here. By the number of bone remnants, it must"); eq(a2$,"have been a dire calamity, but nothing's stirring now."); break; case 14: //heirloom eq(a1$," A jumble of overturned chests and burst-in cabinets"); eq(b1$,"meets your eyes as you emerge into an attic upper"); eq(c1$,"room. Robbers have likely despoiled this place, al-"); eq(a2$,"though little of value seems in evidence: just junk."); break; case 15: //boss/leader eq(a1$," A scrabbling from behind as you step into this small"); eq(b1$,"chamber makes you turn to see a shrunken figure"); eq(c1$,"descending from a balcony-like ledge; who sneers:"); eq(a2$,""+'\"'+"Just wait: our leader'll take care of you!"+'\"'+", as it leaves."); break; case 16: //rumor eq(a1$," In the drab little space you find around you, an assort-"); eq(b1$,"ment of incapacitated & enfeebled outcasts has come to"); eq(c1$,"hole up. This untended asylum holds no interest for you,"); eq(a2$,"but a more active communal site may be elsewhere."); } //switch(a1 y1++; case 7: y1++; txt("053"); txt("111"+a1$); txt("121"+b1$); txt("131"+c1$); txt("141"+a2$); txt("263 Hit any key to conclude "+(isTdr?"Trapdoor.":"Steps.")); return; case 8: reSet(Pty+Out,Nah); //mrk pty acted chkVlt(); } //switch(y1 } //chkFea mth void tryTdr(){ //Tdr, Stp activities if(x1!=TryTdr) y1=1; switch(y1){ case 1: x1=TryTdr; txt("011"); y1=X*feaVar; tryTdr(); return; case 10: //hidden den a1=0; while(dig(dic(1,"cost "+a1),0)<6) if(B9<5) //B9 of dig() a1+=B9; a1=Math.max(20,X*a1); //#Crs ransom req isa1=false; //Ngo tried flg ngoDif=3; y1++; txt("111 You've uncovered the hideout of an unregulated"); txt("121fellowship of ne'er-do-wells who style themselves"); txt("231a band of merry men."); return; case 11: y1++; txt("011"); txt("111 The trapdoor shuts and a hidden voice demands"); txt("121you all ransom yourselves: "+a1+" Crs each, for"); txt("231troubling them to find a new safehole."); return; case 12: y1++; txt("011"); txt("111 Any character without enough coin in his"); txt("121possession to pay his way will be exited at large"); txt("131minus any items then carried (drop any coins if"); txt("241want whole group thrown out)."); return; case 13: y1++; txt("011"); txt("1111) agree @"+a1); txt("1132) reorder group"); txt("1153) ready items"); txt("1214) use an item"); if(!isa1) txt("1235) negotiate: 3-2-1"); txt("246"); return; case 14: b1=inpVal<0 || inpVal>(isa1?4:5)?0:inpVal; txt("011"); if(b1==1){ y1+=2; tryTdr(); return; } //if(b1==1 if(b1<5){ y1--; if(b1==0 || b1==2) ordPty(Pty,"admin reorg"); else if(b1==3) rdyItm(); else pikItm(Adv); } //if(b1<5 else{ y1++; tryNgo(); } //else(b1<5 return; case 15: //prc Ngo result isa1=true; if(tryOut<1){ a1<<=1; txt("111They take offense: now want "+a1+" Crs from each."); } //if(tryOut<1 if(tryOut==1) txt("111They prefer money to talk: "+a1+" Crs from each."); if(tryOut==2){ a1>>=1; txt("111They like you: now want only "+a1+" Crs from each."); } //if(tryOut==2 if(tryOut>2){ a1=X*dig(dic(1,"tribute"),0); txt("111They're impressed: will give "+a1+" Crs to each."); } //if(tryOut>2 y1-=2; rpt("246hit a key"); return; case 16: //deduct Crs, chk for expulsions if(!isa1 || tryOut<3) a1=-a1; b1=chrGrp; c1=AtlCoo/C; d1=mazMap+AtlCoo%C; while(b10){ b1=elmNum; isb1=hav(b1,"Crowns","cash"); if(isb1) addTo(elmNum,ItmBon,a1); if(!isb1 || D7<0) //D7 of addTo() if(a1>0){ addItm(b1,locItm(itmPoo,"Crowns","cash")); addTo(elmNum,ItmBon,a1); } //if(a1>0 else{ eq(b1$,cut(wrdOut(b1,ChrNam))); //expel adv for(e1=itmGrp;e1<=arySiz;e1++) //rmv items if(wrdOut(e1,ItmOwn).equals(str(b1$)) && !wrdOut(pri(e1),ItmRdy).equals("nil")) eq(e1,Fre$); dtaIn(b1,ChrHit,"0"); dtaIn(b1,ChrCoo,""+AtlCoo); eq(a1$,wrdOut(d1,c1)); if(str(a1$).indexOf('A')<0) dtaIn(d1,c1,str(a1$.append('A'))); //ord done by movPty() shoFld(atCoo); } //else(a1>0 b1++; } //while(b14){ eq(b1$,cut(str(a1$))); c1=itmGrp; d1=0; //ini z1[] idx while(c1<=arySiz && locElm(c1,ItmOwn,str(b1$))>0){ c1=elmNum; if("standard,magic,contraption".indexOf(wrdOut(pri(c1),ItmNat))>=0 && "+armor,fx".indexOf(wrdOut(c1,ItmCla))<0) z1[++d1]=c1; c1++; } //while(c1<=arySiz && if(d1>0){ c1=z1[ran(d1)]; if(inScb(c1)) c1=elmNum; //elmNum= Sheath itm elm of inScb() d1=pri(c1); eq(c1$," loses "+wrdOut(d1,ItmNat)+' '+wrdOut(d1,ItmTyp)+' '+wrdOut(d1,ItmCla)); eq(c1,Fre$); } //if(d1>0 } //if(dig(tsk(die$),0)>4 else eq(c1$," holds on to h"+(sex(b1)?"er":"is")+" stuff."); newChr=b1; //pick up where left off y1=nxtChr(atCoo,Adv)==a1?90:y1-1; b1=newChr; //tracking chr: newChr of nxt/locChr() rpt("211"+a1$+c1$); return; case 30: //root cellar a1=b1=nxtChr(atCoo,Adv); //hold starting, tracking chrs dtaIn(trvChr,ChrNam,"pests"); dtaIn(trvChr,ChrPst,"1"); dtaIn(trvChr,ChrImg,"25"); y1++; txt("111 You intrude into a roughly-hewn, branching dugout"); txt("121with remains of casks and sacks scattered around. The"); txt("131group must knock away attacking hordes of ravenous,"); txt("241and maybe infectious, verminous creatures."); return; case 31: y1++; atkSrc=b1; addItm(b1,locItm(itmPoo,"ModSkl","fx")); c1=elmNum; //elmNum of addItm() dtaIn(c1,ItmId,""+Una); dtaIn(c1,ItmBon,"+2"); atkTgt=trvChr; setAtk(Cbt,Una); useItm(); return; case 32: eq(c1,Fre$); //rmv Una atk +2 bon itm isa1=hitSum<1 && dig(dic(1,"fever"),0)>3; if(isa1){ addItm(b1,locItm(itmPoo,"FvrWd","fx")); dtaIn(elmNum,ItmOpn,"997"); dtaIn(elmNum,ItmBon,"5"); } //if(isa1 newChr=b1; //pick up where left off if(nxtChr(atCoo,Adv)==a1){ dtaIn(trvChr,ChrNam,"trove"); dtaIn(trvChr,ChrPst,"3"); dtaIn(trvChr,ChrImg,"0"); y1=90; } //if(nxtChr(atCoo,Adv)==a1 else y1--; b1=newChr; //newChr of nxt/locChr() rpt("211"+chrNam(atkSrc)+(isa1?" is infected with fever.":" wards 'em off.")); return; case 40: //antique armory addItm(trvChr,locItm(itmPoo,"Sheath","sash")); a1=elmNum; dtaIn(a1,ItmId,"-1"); b1=1; //prby for mania c1=0; //#tries cntr isa1=false; //Sheath found flg y1++; txt("111 You enter a disused storeroom of ancient weapons"); txt("121and discarded battle gear. There's a base 1 in 6 chance"); txt("131that an adventurer will fall prey to battle mania from"); txt("241perusal of the room's spooky contents."); return; case 41: y1++; txt("011"); txt("1111) get out now & check group for susceptibility @"+b1); if(!isa1) txt("1212) search through scrap for Sheath (Identify: 4-3-2)"); txt("246"); return; case 42: d1=inpVal<0 || inpVal>2?0:inpVal; txt("011"); if(isa1 || d1==1){ y1+=2; tryTdr(); } //if(isa1 || else{ c1++; atkItm=a1; idDif=4; y1++; tryId(); } //else(isa1 || return; case 43: if(c2!=0) //c2 of tryId() b1=Math.max(b1,tryOut<1?3:(tryOut>1 && c2>0?2:1)); if(tryOut>2){ if(c1<2) //1st try? b1=0; isa1=true; dtaIn(a1,ItmBon,cut(wrdOut(ordWpn-1+dig(dic(1,"wpn typ"),0),ItmTyp))); } //if(tryOut>2 else dtaIn(a1,ItmId,""+d2); //d2 of tryId() y1-=2; tryTdr(); return; case 44: y1++; txt("011"); if(isa1) txt("121 - can pick up Sheath from trove"); else eq(a1,Fre$); eq(a1$,"No one subject to mania."); if(dig(dic(1,"mania"),0)<=b1){ c1=rdmChr(atCoo,9,19,Adv); addItm(c1,locItm(itmPoo,"BatMan","fx")); dtaIn(elmNum,ItmOpn,"997"); //elmNum of addItm() eq(a1$,chrNam(c1)+" possessed by battle mania!"); } //dig(dic(1"mania"),0)<=b1 y1=90; rpt("211"+a1$); return; case 50: //garbage pit a1=rdmChr(atCoo,9,19,Adv); a1=E6; //E6 of rdmChr() System.arraycopy(Z6,1,z1,1,a1); b1=1; //ini sq loc var c1=0; //ini #chrs chk'd cntr y1++; txt("111 You find yourselves among a pile of trash and"); txt("121offal whose stench and revolting mush leave you"); txt("131staggering. Try to avoid being besmirched by it -"); txt("241rendering individuals more offensive than attractive."); return; case 51: txt("011"); do{ d1=0; for(e1=1;e1<=a1;e1++) if(z1[e1]>0 && valOut(z1[e1],ChrSq)==b1){ c1++; d1=z1[e1]; z1[e1]=0; break; //brks for() only } //if(z1[e1]>0 && if(d1<1) b1++; }while(b1<20 && d1<1); if(d1<1){ y1=90; //rout rtn tryTdr(); return; } //if(d1<1 eq(a1$,chrNam(d1)); y1++; case 52: y1++; tskRol(d1,modRv(d1),4,Rv,a1$+" avoid trash"); if(isInp) return; case 53: if(key6$=='\b'){ y1--; tryTdr(); return; } //if(key6$=='\b' e1=dig(tsk(die$),0); y1=c1>=a1 || e1<2?90:y1-2; if(e1>4){ addItm(d1,locItm(itmPoo,"NgoRv","fx")); e1=elmNum; //elmNum of addItm() dtaIn(e1,ItmOpn,"997"); addTo(e1,ItmBon,-1); rpt("211"+a1$+" Negotiate penalty now "+D7+'.'); //D7 of addTo() } //if(e1>4 else if(e1<2) rpt("211"+(sex(d1)?"Sh":"H")+"e manages to keep the rest out of the mess."); else tryTdr(); return; case 60: //prison cell a1=1; //% disease Spent wd isa1=false; //Dtp tried flg y1++; txt("111 You find a holding area with some isolated prison"); txt("121cells. One of the interior cells might yet be occupied."); txt("131Hereabout there's a base 1 in 6 chance that some"); txt("241adventurer will contract a disease from contact."); return; case 61: y1++; txt("011"); txt("1111) leave now & check group for disease"); txt("2212) pick locked cells to free occupant (Detrap: 4-3-2)"); return; case 62: b1=inpVal<0 || inpVal>2?0:inpVal; txt("011"); if(b1==1){ y1+=4; tryTdr(); } //if(b1==1 else{ y1++; pikChr(Adv,"choose detrapper"); } //else(b1==1 return; case 63: if(key6$=='\b'){ y1-=2; tryTdr(); return; } //if(key6$=='\b' y1++; oprChr=newChr; trpTyp=9; trpDif=-4; tryDtp(); return; case 64: //prc Dtp result isa1=tryOut>2; //cell opened if(isa1 && hdg(oprChr,"Bgl")){ isa1=false; txt("121"+wrdOut(elmNum,ItmOwn)+" has "+chrNam(oprChr)+"'s Bgl fx."); } //if(isa1 && y1++; if(isa1){ aDie("beast type"); if(isInp) return; } //if(isa1 case 65: if(isa1){ b1=bstCat+11+Math.max(1,a6/2); //a6 of aDie() namBst=X*(namBst/X+1); addChr(b1); c1=elmNum; //elmNum of addChr() dtaIn(c1,ChrCtl,"a"); dtaIn(c1,ChrCoo,""+atCoo); dtaIn(c1,ChrPst,""+(valOut(b1,ChrHiP)%X-1)); addItm(c1,locItm(itmPoo,"Bgl","fx")); dtaIn(elmNum,ItmOpn,"997"); //elmNum of addItm() dtaIn(elmNum,ItmLoc,wrdOut(oprChr,ChrNam)); genWd(c1); movChr(c1,12); } //if(isa1 a1=tryOut<1?3:(tryOut>2?0:(tryOut>1 && c2>0?2:1)); //c2 of tryDtp() y1++; case 66: y1++; txt("011"); if(isa1) txt("121Freed "+wrdOut(b1,ChrTyp)+" joins the party."); txt("211Chance for disease is now "+a1+'.'); return; case 67: txt("011"); eq(a1$,"No one contracts disease."); if(dig(dic(1,"disease"),0)<=a1){ c1=rdmChr(atCoo,9,19,Adv); addTo(c1,ChrHit,1); addItm(c1,locItm(itmPoo,"SpnWd","fx")); dtaIn(elmNum,ItmOpn,"997"); //elmNum of addItm() addTo(elmNum,ItmBon,1); if(modWd(c1)<1){ dtaIn(c1,ChrPst,"1"); movChr(c1,valOut(c1,ChrSq)); } //if(modWd(c1)<1 eq(a1$,chrNam(c1)+" contracts disease (takes 1 Spent wd)!"); } //dig(dic(1"disease"),0)<=a1 y1=90; rpt("211"+a1$); return; case 90: reSet(Pty+Out,Nah); //mrk pty acted chkVlt(); } //switch(y1 } //tryTdr mth void tryStp(){ //Stp activities if(x1!=TryStp) y1=1; switch(y1){ case 1: x1=TryStp; txt("011"); y1=X*feaVar; tryStp(); return; case 10: //watercourse a1=nxtChr(atCoo,Adv); if(isNo1) //isNo1 of nxtChr() return; y1++; txt("111You have traced the course of an underground"); txt("121waterway to a constricted place where it may be"); txt("231feasible to form a dam and create a flood."); return; case 11: b1=0; //ini #successes cntr y1++; txt("011"); txt("111Two adventurers must work together to get Task"); txt("121results of 2 or less on a number of dice equal to"); txt("231remaining Wounds (all may try)."); return; case 12: y1++; txt("011"); txt("111#successes= "+b1); shoBst(newChr); tskRol(newChr,modWd(newChr),2,Nah,chrNam(newChr)+" damming stream"); if(isInp) return; case 13: isa1=key6$!='\b'; if(isa1 && dig(tsk(die$),0)<3) b1++; if(isa1 && a1!=nxtChr(atCoo,Adv)){ y1--; tryStp(); return; } //if(isa1 && y1++; case 14: y1=90; txt("011"); txt("111#successes= "+b1); if(b1>1){ isDon=true; txt("131 Make your way out."); rpt("221You start a flood and finish the maze!"); } //if(b1>1 else rpt("221You fail to dam the stream. Continue the maze."); return; case 20: //faultline a1=6; //ini #hits req isa1=false; //ini Dtp tried flg y1++; txt("111 You proceed into a cave-like chamber with several"); txt("121columnar rock formations supporting a ceiling with an"); txt("231obvious crack running across it."); return; case 21: sumBst=1; typBst=25; namBst=X*(namBst/X+1); putBst(); //set up 'Fissure' bst chr b1=C5; //C5 of putBst() y1++; txt("011"); txt("111 The party may try to do damage at a critical spot, in"); txt("121an effort to precipitate a collapse here, and a weakening"); txt("131of the overall underground structure. (Offsides attackers"); txt("241might be wounded by the cave-in caused.)"); return; case 22: y1++; txt("011"); txt("1111) reorg party"); txt("1132) ready items"); txt("1153) forget about it"); txt("1214) try to demolish the support= do "+a1+" hits in 1 rd"); if(!isa1) txt("1315) locate the crux of the faultline (Detrap: 4-3-2)"); txt("246"); return; case 23: c1=inpVal<0 || inpVal>5?0:inpVal; txt("011"); if(isa1 || c1<5) if(c1<3){ y1--; if(c1<2) ordPty(Pty,"attack formation"); else rdyItm(); } //if(c1<3 else{ y1=c1<4?90:y1+3; tryStp(); } //else(c1<3 else{ y1++; pikChr(Adv,"choose investigator"); } //else(isa1 || return; case 24: if(key6$=='\b'){ y1-=2; tryStp(); return; } //if(key6$=='\b' y1++; oprChr=newChr; trpTyp=X; trpDif=-4; tryDtp(); return; case 25: //prc Dtp result a1=tryOut>1?(tryOut>2?2:4):6; isa1=true; y1-=3; txt("011"); rpt("211Fissure now req "+a1+" hits to wrack."); return; case 26: dtaIn(b1,ChrWd,""+a1); y1++; reSet(Pty,Set); isCbt=true; //offsides interference applies advAtk(); return; case 27: isCbt=false; //don't gen trv if(modWd(b1)<1) isDon=true; y1=isDon?y1+1:90; txt("011"); c1=0; //ini z1[] siz d1=0; //ini z1[] ptr if(isDon){ c1=rdmChr(atCoo,11,19,Pty); c1=E6; //E6 of rdmChr() System.arraycopy(Z6,1,z1,1,c1); txt("131 Make your way out."); txt("221You dislodge the rock and finish the maze!"); } //if(isDon else txt("221You fail to effect demolition. Continue the maze."); return; case 28: if(++d1<=c1){ setAtk(Dvc,-1); dieWgt=2; diePch=2; isCru=true; atkSrc=trvChr; atkTgt=z1[d1]; atkVs(3,"cave-in"); return; } //if(++d1<=c1 y1++; case 29: rmvChr(atCoo,Foe,All); //rmv Fissure bst while(hav(trvChr,"","")) eq(elmNum,Fre$); shoFld(atCoo); rmvFea(rtnCoo); isStp=false; toCoo=rtnCoo; isMov=true; //move all in coo; incl unconsc movPty(atCoo,toCoo); atCoo=toCoo; atCooCol=atCoo/C; atCooRow=atCoo%C; shoMap(); y1=90; rpt("211The party drags itself out of the destruction!"); return; case 30: //nasty/bane y1++; txt("111 As you work your way upward, you pass scattered"); txt("121warning totems and taboo markers. Within the cavern"); txt("131terminus you find the abode of a now-inactive fearsome"); txt("241creature wrapped in self-absorbed oblivion."); return; case 31: y1++; txt("011"); txt("1111) tiptoe back out & let sleeping dogs lie"); txt("2212) brace yourselves to stir up trouble"); return; case 32: if(inpVal==1){ y1=90; tryStp(); return; } //if(inpVal==1 a1=nxtChr(atCoo,Adv); eq(xsA,SplElm$); b1=SplCst$.length(); c1=0; //ini #spl lvls cntr do if(wrdOut(pri(newChr),ChrTyp).equals("Wizard")) //newChr of nxt/locChr() for(d1=1;d1<=b1;d1++) if(has(newChr,wrdOut(xsA,d1),"spell")) c1+=dig(SplCst$,d1-1); while(nxtChr(atCoo,Adv)!=a1); txt("011"); y1++; tskRol(newChr,c1,2,Nah,"arouse bane"); if(isInp) return; case 33: txt("011"); //eq(die$,"1"); //~test ln if(dig(tsk(die$),0)>2){ y1=90; rpt("211You fail to lure it from its nest."); return; } //if(dig(tsk(die$),0)>2 a1=b1=nxtChr(All,Pty); c1=atCoo; d1=valOut(newChr,ChrCoo); y1++; case 34: while(c1==d1){ b1=nxtChr(All,Pty); if(a1==b1){ y1+=3; tryStp(); return; } //if(a1==b1 d1=valOut(newChr,ChrCoo); } //while(c1==d1 atCoo=d1; shoMap(); shoFld(atCoo); y1++; setAtk(Dvc,-1); eq(aim$,"1"); diePch=2; isDef=isPrf=isDod=false; atkSrc=trvChr; atkTgt=b1; atkVs(3,"Terror attacks"); return; case 35: y1++; txt("084"); if(atCoo3?3:inpVal; txt("011"); if(e1>0){ y1--; if(e1==1) ordPty(Pty,"admin reorg"); else if(e1==2) pikItm(Adv); else if(e1==3) rdyItm(); return; } //if(e1>0 newChr=b1; //pick up where left off b1=nxtChr(All,Pty); d1=valOut(newChr,ChrCoo); y1-=2; tryStp(); return; case 37: isDon=true; txt("053"); txt("011"); atCoo=c1; shoMap(); shoFld(atCoo); y1=90; txt("131 Make your way out."); rpt("221You unleash the weird and finish the maze!"); return; case 40: //heirloom addItm(trvChr,locItm(itmPoo,"Heirloom","artifact")); a1=elmNum; dtaIn(a1,ItmId,"-1"); y1++; txt("111 You pass into an annex where a seemingly-"); txt("121unimportant object has been reposited with much show"); txt("131of veneration. The piece appears unguarded, yet you're"); txt("241hesitant about approaching it."); return; case 41: y1++; txt("011"); txt("1111) never mind the arcane thing"); txt("2212) attempt once to Identify: 4-3-2"); return; case 42: txt("011"); if(inpVal==1){ y1=90; tryStp(); return; } //if(inpVal==1 y1++; atkItm=a1; idDif=4; tryId(); return; case 43: txt("051"); eq(a1,Fre$); isa1=tryOut>1; if(tryOut>2){ y1+=4; tryStp(); return; } //if(tryOut>2 txt("132Heirloom objects if 2D+(# in party)>9"); a1=lowDic(dic(2,"object"),X); b1=rdmChr(atCoo,1,6,Pty); b1=E6; //E6 of rdmChr() //b1=X; //~test ln if(a1+b1=bstCat) rmvChr(atCoo,b1,All); else{ txt("121"+a1$+" loses all fx."); while(hav(b1,"","fx")) eq(elmNum,Fre$); } //else(pri(b1)>=bstCat else txt("121"+a1$+" attunes to heirloom."); newChr=b1; //pick up where left off b1=nxtChr(atCoo,Pty); if(a1!=b1){ y1--; rpt("246"); return; } //if(a1==b1 y1++; case 47: y1=90; txt("011"); if(isa1){ txt("131 Make your way out."); rpt("221You activate the item's powers and finish the maze!"); } //if(isa1 else{ while(hav(trvChr,"heirloom","artifact")) eq(elmNum,Fre$); rpt("221The item vanishes - continue the maze."); } //else(isa1 return; case 50: //boss/leader if(isCbt){ //set in chkOut(): resume after cbt isCbt=false; //prevent recycle in chkOut() by isa1=false in chkVlt() isDon=true; y1=90; txt("131 Make your way out."); rpt("221You slay the Boss and finish the maze!"); return; } //if(isCbt y1++; txt("111 You emerge at a large gallery with all types of armorial"); txt("121decorations hung on the walls. One creature which calls"); txt("231itself Master of the maze challenges you all to combat."); return; case 51: y1++; txt("011"); aDie("leader bst"); if(isInp) return; case 52: sumBst=1; bstRtg=8; typBst=21+Math.max(1,a6/2); //a6 of aDie() //typBst=22; //~test ln namBst=X*(namBst/X+1); putBst(); //set up boss bst chr a1=C5; //C5 of putBst() dtaIn(a1,ChrWd,"10"); y1++; shoBst(a1); txt("011"); txt("1111) decline the offered duel & back out"); txt("2212) attack the leader of this black place"); return; case 53: txt("011"); if(inpVal==2){ reSet(Pty,Set); oneRnd(); //sets isCbt=true } //if(inpVal==2 else{ y1=90; tryStp(); } //else(inpVal==2 return; case 60: //rumor ngoDif=4; dtaIn(trvChr,ChrRv,"0"); //Sbd tgt Rv y1++; txt("111 You step into a shelter or hospice area where a"); txt("121gathering of mixed humanoids eye you open-mouthed."); txt("131They're relatively inoffensive; though a little one snarls"); txt("241at you."); return; case 61: y1++; txt("011"); txt("111 If you can impress on the assembled noncombatants"); txt("121your intention to rid the maze of evil, perhaps they'll"); txt("131spread an amplified evacuation watchword among the"); txt("241other occupants."); return; case 62: y1++; txt("011"); txt("1111) leave in peace"); txt("1132) reorder group"); txt("1153) ready items"); txt("1214) use an item"); txt("2235) negotiate: 4-3-2"); return; case 63: b1=inpVal<0 || inpVal>5?0:inpVal; txt("011"); if(b1==1){ y1=90; tryStp(); return; } //if(b1==1 if(b1<5){ y1--; if(b1==0 || b1==2) ordPty(Pty,"admin reorg"); else if(b1==3) rdyItm(); else pikItm(Adv); } //if(b1<5 else{ y1++; tryNgo(); } //else(b1<5 return; case 64: //prc Ngo result y1++; isa1=tryOut>2; if(!isa1){ a1=dig(tsk(die$),0); b1=Math.abs(dig(dic(2,"react"),0)-dig(die$,1)); isa1=a11?2:-2)):0; f1=+a1$.charAt(a1); if(f1==+'d' && d1==+'w' || f1==+'w' && d1==+'d'){ e1++; txt("14"+(a1+3)+Way$.charAt(a1)+(d1==+'w'?"=back":"=front")); } //if(f1==+'d' && } //for(a1=0; if(e1>0) txt("141 secret door ("+secDor+"):"); } //if(!badPas txt("053"); if(atCoo3; if(isa1) txt("173 hit '>' to shortcut to Entry"); } //else(opt1==Spt y1++; txt("1110) split up= "+(ptPty?"yes":"no")); txt("1141) group to move: "+cut(chrNam(srcChr))+"'s"); if(opt1!=Spt || atCoo!=sptCoo) txt("1249) reorder this group"); txt("2212s,4w,6e,8n3) move dir"); return; case 4: a1=inpVal; a$=key1$; txt("011"); txt("051"); txt("053"); if(a$=='\b' && opt1==Spt){ //cont at cur cbt rnd isCbt=true; //restore flg post- Spt'g reorgs atCoo=sptCoo; atCooCol=atCoo/C; atCooRow=atCoo%C; fea$=cooFea(atCoo); //resto to sptCoo shoMap(); //put csr on atCoo shoFld(atCoo); x1=RndOne; y1=2; //chk Bgl'd chrs rndOne(); return; } //if(a$=='\b' && if(a$=='\b' && atCoo==etyCoo){ //lv maze to atLrg() toCoo=AtlCoo; toCooCol=AtlCoo/C; toCooRow=AtlCoo%C; y1+=3; chkMov(); return; } //if(a$=='\b' && if(a$=='0'){ //toggle split flg ptPty=!ptPty; y1--; chkMov(); return; } //if(a$=='0' if(a1==1){ //pik new focus grp chr y1-=2; chkMov(); return; } //if(a1==1 if(a1==9 && (opt1!=Spt || atCoo!=sptCoo)){ y1--; ordPty(Pty,"admin reorg"); return; } //if(a1==2 y1++; case 5: for(b1=chrGrp;b16 && !ptPty || c1<7 && (rdmChr(atCoo,C9,C9,Any)!=b1 || E6>1 //C9 of valOut(), E6 of rdmChr() || getPst(b1)!=E7)){ //fallen chr: E7 of getPst() txt("134 [ ranks 1&2 upright singly ]"); y1-=2; chkMov(); return; } //if(c1>6 && } //if(atCoo==valOut(b1,ChrCoo) && if(a$=='\b' && fea$=='S'){ //go into steps landing coo isStp=true; rtnCoo=atCoo; toCoo=StpCoo; toCooCol=StpCoo/C; toCooRow=StpCoo%C; y1+=2; chkMov(); return; } //if(a$=='\b' && if(a$=='\b' && fea$=='T'){ //go into trapdoor coo isTdr=true; rtnCoo=atCoo; toCoo=TdrCoo; //isTdr set at chkIn() IAW this toCooCol=TdrCoo/C; toCooRow=TdrCoo%C; y1+=2; chkMov(); return; } //if(a$=='\b' && if(isa1 && a$=='>'){ toCoo=etyCoo; toCooCol=etyCoo/C; toCooRow=etyCoo%C; y1+=2; chkMov(); return; } //if(isa1 && b1=" 38nN4wW6eE2sS".indexOf(a$); //chk mov dir OK if(b1<0){ txt("134 [ reenter direction ]"); y1-=2; chkMov(); return; } //if(b1<0 d1=0; c1=b1<5?-1:(b1>X?1:0); if(c1==0){ d1=b1<8?-1:1; inSid=d1<0?3:1; } //if(c1==0 else inSid=c1<0?4:2; c1=atCooRow+c1; //prospect toCoo d1=atCooCol+d1; if(opt1==Spt && C*d1+c1!=sptCoo){ txt("134 [ only "+sptCoo+" allowed ]"); y1-=2; chkMov(); return; } //if(opt1=Spt && isa1=isTil(d1,c1); if(!isa1 && frqRoo<1){ //~?nec txt("134 [no more: turn back ]"); y1-=2; chkMov(); return; } //if(!isa1 && if(isa1){ e1=rdmChr(C*d1+c1,9,19,Pty); e1=E6; //E6 of rdmChr() if(e1>5 && rdmChr(C*d1+c1,9,19,Pty+Set)==0){ x1=ChkTrv; y1=1; txt("011"); txt("121 (No chance of Roving Beast encounter.)"); txt("211All chrs in this tile are immobile for a turn."); return; } //if(e1>5 && f1=rdmChr(atCoo,1,6,Pty); if(e1>5 || E6+e1>6 && !ptPty){ //E6 of rdmChr() txt("134 [ >6 chrs can't be there ]"); y1-=2; chkMov(); return; } //if(e1>5 || } //if(isa1 eq(b1$,wrdOut(mazMap+c1,d1)); y1++; g1=inSid-(inSid>2?2:-2)-1; //='outSid'-1 e1=+a1$.charAt(g1); f1=isa1?+b1$.charAt(inSid-1):0; if((e1==+'w' || f1==+'w') && badPas) //chk if "no sec door" penalty in effect e1=f1=+'w'; if(e1==+'w' && f1==+'d'){ aDie("secret door try"); if(isInp) return; } //if(e1==+'w' && case 6: //a6=6; //~test ln if(e1==+'w' && f1==+'d' && a6>secDor && chkPot(-srcChr,"Mgt")){ //a6 of aDie() if(isA6) //_A6s of chkPot() a6=0; txt("041"); txt("141"+A6$); } //if(e1==+'w' && if(e1==+'w' && f1==+'d' && a6>secDor){ //a6 of aDie() txt("136 failed"); if(secDor>0) secDor--; //shown on cycle back f1=0; } //if(e1==+'w' && if(e1==+'w' && f1!=+'d' || f1==+'w' && e1!=+'d'){ txt("134 [ path blocked ]"); y1-=3; chkMov(); return; } //if(e1==+'w' && toCooRow=c1; toCooCol=d1; toCoo=C*d1+c1; y1++; case 7: y1++; movPty(atCoo,toCoo); if(ptPty) return; case 8: eq(a1$,a5$); //atCoo$ rev'd from movPty() eq(b1$,b5$); //toCoo$ rev'd from movPty() if(isc5){ //isc5= picking chrs to mov of movPty() if(f5<1){ //f5= #chrs moved of movPty() y1-=5; rpt("253 No one moving."); return; } //if(f5<1 if(isa5 || isb5){ //isa5= no advs left, isb5= no advs moved; of movPty() rmvChr(isa5?atCoo:toCoo,All,All); y1=isa5?9:1; rpt("253 No adv "+(isa5?"behind":"moved")+": others wiped."); return; } //if(isa5 || } //if(isc5 y1++; case 9: //chk isDis, while placing Disturbed mkrs in unTil'd coos if door passed isDis=false; //ini isDis if(isa5 && !(isStp || isTdr)){ //all moved - isa5 of movPty() (~or, rdmChr(atCoo,1,9,Adv)=0; e1=+a1$.charAt(a1); f1=isa1?+c1$.charAt(a1-(a1>1?2:-2)):0; if(isb1 && str(c1$).indexOf('A')<0 //newTil rooms rechkd for at chkIn() isRov set && (!isa1 && e1!=+'w' || isa1 && f1==+'d') && a1!=g1) isDis=true; //on move only - doesn't incl being in room or hall w 'D' mkr if(!isb1 && !isa1 && a1!=g1 && e1==+'d') dtaIn(d1,b1,str(c1$.append('D'))); //add Disturbed mkr to any existing mkrs } //for(a1=0; if(fea$=='T' || fea$=='S'){ //persistent (between turns) fea.s: && !(isStp || isTdr) abv insStr(a1$,4,"D"); dtaIn(mazMap+atCooRow,atCooCol,str(a1$)); if(!(isBad && fea$=='S')) //when isBad, make 'S' permanently persistent rmvFea(atCoo); //toCoo fea$ asgnd in chkTil/In() blw } //if(fea$='T' || } //if(isa5 && if(opt1==Spt){ y1-=7; chkMov(); return; } //if(opt1==Spt if(str(b1$).indexOf('X')>=0){ //insure way out of poss iso coo b1=inSid-1; c1=+b1$.charAt(b1); if(+'w'==c1){ //secret door's front wall becomes door insStr(b1$,b1,b1+1,"d"); dtaIn(mazMap+toCooRow,toCooCol,str(b1$)); } //if(+'w'==c1 } //if(str(b1$).indexOf('X')>=0 if(toCooCol<=MazWd){ //if not atLrg,Tdr,Stp,etc. if(toCooCol=topCooCol+MapColWd) topCooCol=toCooCol-MapColWd+1; if(toCooRow=topCooRow+MapRowHt) topCooRow=toCooRow-MapRowHt+1; } //if(toCooCol<=MazWd //~shoMap(); //alt if toCoo off-map: rmv pty mkr from map //[~if toCoo on-map, shows pty mkr in open area prior to tile placement] if(newTil) //newTil set in movPty() chkTil(); //genTil() after pty mkr placed else chkIn(); } //switch(y1 } //chkMov mth void endGam(){ if(x1!=EndGam) y1=1; switch(y1){ case 1: x1=EndGam; txt("011"); txt("111Game over - "+whyEnd$); txt("121 maze exits (excl final)= "+exiCnt+", turns used= "+trnCnt); if(isNo1) //isNo1 of nxtChr() txt("141Refresh page to restart."); //del'g dummy chr of nxtChr() else{ x1=PikPty; txt("241Hit a key to alter this party for a new maze."); } //else(isNo1 } //switch(y1 } //endGam mth //var lvl 2 routines void tryNgo(){ //uses: x1,ngoDif if(x2!=TryNgo) y2=1; switch(y2){ case 1: x2=TryNgo; c2=0; //reset as "next pass tried?/ result" var tryOut=0; //reset pass achieved var eq(die$,"6"); isa2=x1==RndOne; //flg for typical enc opn isb2=false; //flg for Spellbind cast oprChr=0; //ini negotiator chosen flg (can cancel opt1=Ngo w Bksp) y2++; case 2: y2++; pikChr(Adv,"negotiator"); return; case 3: if(key6$=='\b'){ y2+=67; //rout rtn tryNgo(); return; } //if(key6$=='\b' oprChr=srcChr=newChr; //oprChr: can't chg negotiator eq(a2$,chrNam(oprChr)); txt("053"); if(isa2 && valOut(oprChr,ChrSq)>3){ y2--; txt("153negotiator "+a2$); txt("263 must be in row 1 (hit a key)"); return; } //if(isa2 && seqDic=modRv(oprChr); if(has(oprChr,"NgoRv","fx")) seqDic=Math.max(0,seqDic+valOut(elmNum,ItmBon)); //elmNum of has() if(!wrdOut(pri(oprChr),ChrTyp).equals("Hero")) seqDic>>=1; //or, seqDic/=2; if(isa2) reSet(oprChr,Nah); //Negotiator may not act in rnd1 of battle y2++; case 4: y2++; txt("011"); //if(true){ y2=60; tryNgo(); return; } //~test ln: mingle front ranks -> advAtk() txt("1211) try to approach ("+seqDic+" @"+ngoDif+')'); txt("1242) "+(isa2?"commence attack":"abort")); txt("1313) ready items"); if(!isb2) txt("1344) cast Spellbind"); txt("211"+a2$+" hails opponent:"); return; case 5: e2=inpVal; if(e2<1 || e2>(isb2?3:4)){ y2--; tryNgo(); return; } //if(e2<1 || y2++; if(e2==4) pikItm(Adv); else if(e2==3) rdyItm(); else if(e2==2){ x2=0; //rout rtn go(); } //if(e2==2 else{ y2++; tryNgo(); } //else(e2==2 return; case 6: if(e2==4 && isb2==false && has(-oprChr,"Sbd","fx")){ isb2=true; if(valOut(elmNum,ItmBon)>0) //elmNum of has() seqDic+=C9; //C9 of valOut() } //if(e2==4 && y2-=2; tryNgo(); return; case 7: y2++; txt("011"); tskRol(oprChr,seqDic,ngoDif,Rv,str(a2$)+" approaches foe"); if(isInp) return; case 8: c2=dig(tsk(die$),0); seqDic+=lowDic(rol$,ngoDif); //c2=1; //~test lin if(c2>ngoDif){ //if fail roll to nego, txt("053"); if(isa2){ is1st=true; txt("153Ferocious beasts attack!"); oneRnd(); } //if(isa2 else{ txt("153Ngo failed."); x2=0; //rout rtn go(); } //else(isa2 return; } //if(c2>ngoDif y2++; case 9: c2=-c2; tryOut=1; //1st pass made y2++; txt("011"); txt("1211) try to intimidate ("+seqDic+" @"+(ngoDif-1)+')'); txt("1242) "+(isa2?"attack now":"abort")); txt("1313) reorder party"); txt("1344) ready items"); if(!isb2) txt("1415) cast Spellbind"); txt("211"+a2$+" confronts opponent:"); return; case 10: e2=inpVal; txt("011"); y2++; if(e2==3 || e2<1 || e2>(isb2?4:5)) ordPty(Pty,"nego congress"); else if(e2==5) pikItm(Adv); else if(e2==4) rdyItm(); else if(e2==2){ x2=0; //rout rtn go(); } //if(e2==2 else{ y2++; tryNgo(); } //else(e2==2 return; case 11: if(e2==5 && isb2==false && has(-oprChr,"Sbd","fx")){ isb2=true; if(valOut(elmNum,ItmBon)>0) seqDic+=C9; //C9 of valOut() } //if(e2==5 && y2-=2; tryNgo(); return; case 12: y2++; txt("011"); tskRol(oprChr,seqDic,ngoDif-1,Rv,"dismay opponent"); if(isInp) return; case 13: c2=dig(tsk(die$),0); seqDic+=lowDic(rol$,ngoDif-1); //c2=1; //~test lin if(c2>ngoDif-1){ txt("053"); if(isa2){ addItm(oprChr,locItm(itmPoo,"WpVul","fx")); dtaIn(elmNum,ItmOpn,"1"); dtaIn(elmNum,ItmBon,"1"); dtaIn(elmNum,ItmId,"All"); txt("153They insist on a fight."); //~"You must fight." (Mag7) } //if(isa2 else txt("153Ngo failed."); x2=0; //rout rtn go(); return; } //if(c2>ngoDif-1 y2++; case 14: c2=-c2; tryOut=2; //2nd pass made y2++; txt("011"); txt("1211) try to awe ("+seqDic+" @"+(ngoDif-2)+')'); txt("1242) don't press it"); txt("1313) ready items"); if(!isb2) txt("1344) cast Spellbind"); txt("211"+a2$+" dissuades opponent:"); return; case 15: e2=inpVal; txt("011"); y2++; if(e2==2 || e2<1 || e2>(isb2?3:4)){ y2=50; //gain ep tryNgo(); }else if(e2==4) pikItm(Adv); else if(e2==3) rdyItm(); else{ y2++; tryNgo(); } //else(e2==3 return; case 16: if(e2==4 && isb2==false && has(-oprChr,"Sbd","fx")){ isb2=true; if(valOut(elmNum,ItmBon)>0) seqDic+=C9; //C9 of valOut() } //if(e2==4 && y2-=2; tryNgo(); return; case 17: y2++; txt("011"); tskRol(oprChr,seqDic,ngoDif-2,Rv,"awe opponent"); if(isInp) return; case 18: c2=dig(tsk(die$),0); //c2=1; //~test lin if(c2>ngoDif-2){ txt("053"); if(isa2){ txt("153Incensed beasts attack."); y2=60; //if awe fails -> mingle 1st rows (see blw) tryNgo(); } //if(isa2 else{ txt("153Ngo failed."); x2=0; //rout rtn go(); } //else(isa2 return; } //if(c2>ngoDif-2 y2++; case 19: tryOut=3; //3rd pass made if(!isa2){ y2=50; //jmp to ep awd tryNgo(); return; } //if(!isa2 y2=30; case 30: y2++; genTrv(bstRtg); //acquire awe trove items return; case 31: y2++; aDie("gain from awed beasts"); //acquire awe bonus item if(isInp) return; case 32: txt("011"); if(a6>4 || bstRtg==3 && hdg(oprChr,"BstGui")){ //only 1 BstGui per adv y2=50; rpt("211Beasts offer nothing more."); return; } //if(a6>4 txt("111Beasts provide for you:"); y2=bstRtg+32; tryNgo(); return; case 33: //awe bstRtg 1 eq(b2$,"see next new maze segment & contents"); addItm(oprChr,locItm(itmPoo,"SeeSeg","fx")); //can avoid trp or bst enc y2=41; tryNgo(); return; case 34: //awe bstRtg 2 eq(b2$,"detrappers' Rv+2 ea stage vs next trap encountered"); addItm(oprChr,locItm(itmPoo,"SeeTrp","fx")); dtaIn(elmNum,ItmBon,"+2"); //elmNum of addItm() y2=41; tryNgo(); return; case 35: //awe bstRtg 3 eq(b2$,"room beast joins party as guide (til wounded)"); dtaIn(rdmChr(atCoo,11,19,Bst),ChrCtl,"a"); addItm(elmNum,locItm(itmPoo,"BstGui","fx")); //elmNum of rdmChr() dtaIn(elmNum,ItmLoc,cut(wrdOut(oprChr,ChrNam))); //caster/controller noted e2=elmNum; shoFld(atCoo); elmNum=e2; y2=41; tryNgo(); return; case 36: //awe bstRtg 4 eq(b2$,"add +1 to next treasure table probabilities"); addItm(oprChr,locItm(itmPoo,"MorTre","fx")); dtaIn(elmNum,ItmBon,"+1"); //elmNum of addItm() y2=41; tryNgo(); return; case 37: //awe bstRtg 5 eq(b2$,"next room ambush 2 beasts -2 Wds"); addItm(oprChr,locItm(itmPoo,"AmbBst","fx")); dtaIn(elmNum,ItmId,"2"); //elmNum of addItm()= # tgts dtaIn(elmNum,ItmBon,"-2"); //# wds y2=41; tryNgo(); return; case 38: //awe bstRtg 6 e2=mazMap+(rtnCoo>0?rtnCoo%C:atCooRow); d2=rtnCoo>0?rtnCoo/C:atCooCol; eq(b2$,wrdOut(e2,d2)); if(str(b2$).indexOf('-')<0) insStr(b2$,4,"-"); dtaIn(e2,d2,str(b2$)); y2=50; rpt("221learn shortcut from this room back to entry coo"); return; case 39: //awe bstRtg 7 eq(b2$,"all beasts' Rv=0 in next combat vs bstRtg>5"); addItm(oprChr,locItm(itmPoo,"TruNam","fx")); y2=41; tryNgo(); return; case 40: //awe bstRtg 8 eq(b2$,"return 1 trove magic item to have any party item Id'd"); addItm(oprChr,locItm(itmPoo,"BstId","fx")); y2=41; tryNgo(); return; case 41: dtaIn(elmNum,ItmOpn,"997"); //elmNum of addItm()s y2=50; rpt("221"+b2$); return; case 50: //gain ep y2++; if(!isa2) y2=70; if(!isa2 && tryOut<3){ tryNgo(); return; } //if(!isa2 && e2=X; if(isa2){ e2=Integer.parseInt(wrdOut(bstCat-1+typBst,ChrGra).substring(0,2)); if(ngoDif<4) //Ngo was @3-2-1 e2+=e2+1>>1; //ep +50% } //if(isa2 addTo(oprChr,ChrEp,e2); txt("011"); txt("053"); rpt("263"+a2$+" gains "+e2+" ep"); return; case 51: //opt to attack, or let em go y2++; txt("011"); txt("1211) let them disperse"); txt("1242) attack with surprise"); txt("1313) ready items"); txt("211"+a2$+" dominates opponent:"); return; case 52: e2=inpVal; if(e2==3){ y2--; rdyItm(); return; } //if(e2==3 if(rdmChr(atCoo,9,19,Foe)=chrGrp){ //elmNum of rdmChr() //beasts wait til pty lv in chkOut(): mark room Disturbed e2=mazMap+atCooRow; eq(b2$,wrdOut(e2,atCooCol)); insStr(b2$,b2$.length()-1,"D"); //ins 'D' pre-'A' pty mkr dtaIn(e2,atCooCol,str(b2$)); //but, lv isDis false - no chkOut() fea del } //if(elmNum>0 reSet(Pty+Out,Nah); //mrk all grp chrs 'acted' x2=0; //rout rtn chkVlt(); return; } //if(rdmChr(atCoo,9,19,Foe)0= #tskRol dice for Id, <0= still in coo where found b2=valOut(atkItm,ItmId); e2=Math.abs(b2); d2=seqDic+1; //qual #dice for subsq Id try, if this fails if(b2<0) d2=-d2; if(seqDicmenu? if(seqDicidDif){ //fumble 1st roll y2+=11; //rout rtn txt("111"+a2$+" fumbles initial exam!"); dtaIn(atkItm,ItmId,""+d2); //upd itm Id #dice req if(!isa2){ rpt("246"); return; } //if(!isa2 a2=itmCat(f2); if(a2==magWpn || a2==magAmr){ if(dig(dic(1,"itm degr"),0)>4) badUse(); else rpt("222"+b2$+" remains intact."); return; } //if((a2==magWpn || srcChr=atkSrc=newChr=oprChr; //atkItm val retained itmElm=atkItm; x3=PikItm; y3=5; txt("222 & activates "+b2$); return; } //if(c2>idDif seqDic+=lowDic(rol$,idDif); y2++; case 9: c2=-c2; tryOut=1; //1st pass made y2++; txt("011"); txt("1211) try to identify ("+seqDic+" @"+(idDif-1)+')'); txt("1242) "+(isa2?"give up":"abort")); txt("211"+a2$+" examines "+b2$+" safely."); return; case 10: e2=inpVal; txt("011"); if(e2==2){ y2+=9; //rout rtn dtaIn(atkItm,ItmId,""+d2); if(isa2) rpt("211Identify attempt fails."); else tryId(); return; } //if(e2==2 y2++; case 11: y2++; tskRol(oprChr,seqDic,idDif-1,Rv,"Identify "+b2$); if(isInp) return; case 12: if(key6$=='\b'){ y2--; tryId(); return; } //if(key6$=='\b' c2=dig(tsk(die$),0); //c2=1; //~test ln txt("011"); if(c2>idDif-1){ dtaIn(atkItm,ItmId,""+d2); y2+=7; rpt("211Identify attempt failed."); return; } //if(c2>idDif-1 c2=-c2; tryOut=2; dtaIn(atkItm,ItmId,"Id'd"); txt("111"+b2$+" successfully Identified!"); seqDic+=lowDic(rol$,idDif-1); if(isa2){ y2+=3; tryId(); return; } //if(isa2 y2++; case 13: y2++; txt("011"); txt("1211) try to analyze ("+seqDic+" @"+(idDif-2)+')'); txt("1242) abort"); txt("211"+a2$+" examines "+b2$+" safely."); return; case 14: e2=inpVal; txt("011"); if(e2==2){ y2+=5; //rout rtn tryId(); return; } //if(e2==2 y2++; case 15: y2++; tskRol(oprChr,seqDic,idDif-2,Rv,isa2?"Spent Wds":"Analyze"); //~call splPay() instead? if(isInp) return; case 16: if(key6$=='\b'){ y2--; //~? tryId(); return; } //if(key6$=='\b' c2=dig(tsk(die$),0); //c2=1; //~test ln y2++; isb2=c2<=idDif-2; if(isb2) tryOut=3; else if(isa2){ payDif=0; //fixed, no roll atkSpl=-11; //pot lethal loss of 1 spent wd splPay(); //atkSrc= oprChr abv return; } //if(isa2 case 17: isb2=isb2 || isa2 && splWds<1; //splWds of splPay() (poss Str, etc recov fx) if(b2<0 && (isa2 || tryOut>2)){ //gain ep if still in tile where found if(f2==itmPoo) //heirloom itm e2=20; else{ a2=itmCat(f2); e2=(a2==eqpItm?X: //sheath itm (a2==spiItm?8: (a2==potItm?12: (a2==scrItm?16: (a2==magWpn?20: (a2==magAmr?24:0)))))); if(isa2 && idDif<4) //Id'd @3-2-1 e2+=e2+1>>1; //ep +50% } //else(f2==itmPoo addTo(oprChr,ChrEp,e2); txt("163 "+a2$+" gains "+e2+" ep"); } //if(b2<0 && y2++; case 18: txt("011"); y2++; if(isb2) //~?use rpt() & merge w abv case txt("211"+a2$+(isa2?" is unscathed!":" learns all!")); else txt("211"+a2$+(isa2?" suffers a Wd loss!":" can learn no more.")); return; case 19: x2=0; //rout rtn go(); } //switch(y2 } //tryId mth void tryDtp(){ //uses: x1,oprChr,trpTyp,trpDif if(x2!=TryDtp) y2=1; switch(y2){ case 1: x2=TryDtp; srcChr=newChr=oprChr; a2=trpDif; //Dif<0: trove site trap trpDif=Math.abs(a2); b2=trpTyp; //Typ<0: detect only req trpTyp=Math.abs(b2); reSet(Pty,Set); //mark all consc grp chars in coo 'unacted' h2=0; //reset #detrappers cntr var isa2=x1==ChkTrp || x1==ChkTrv; //flg for typical enc opn if(isa2) isCbt=true; //enforce sq to & stacking restrictions, enable trv gen in chkTrv() tryOut=0; //reset pass achieved var y2++; case 2: eq(a2$,chrNam(oprChr)); reSet(oprChr,Nah); //only 1 detrap try per chr h2++; eq(xsA,TrpElm$); eq(b2$,trpTyp==Dmy?"trap":wrdOut(xsA,trpTyp)); y2++; //try to detect trap seqDic=modRv(oprChr); if(!wrdOut(pri(oprChr),ChrTyp).equals("Thief")) seqDic/=2; if(has(-oprChr,"SeeTrp","fx")) seqDic+=valOut(elmNum,ItmBon); //elmNum of has() tskRol(oprChr,seqDic,trpDif,Rv,str(a2$)+" tries to detect "+(isa2?"trap":str(b2$))); if(isInp) return; case 3: c2=dig(tsk(die$),0); seqDic+=lowDic(rol$,trpDif); if(has(-oprChr,"SeeTrp","fx")) seqDic+=valOut(elmNum,ItmBon); //elmNum of has() //c2=1; //~test lin if(c2>trpDif){ //if fail roll to detect trap, trip trap if(isa2) doTrp(); else{ txt("153Dtp failed."); y2=30; //rout rtn tryDtp(); } //else(isa2 return; } //if(c2>trpDif c2=-c2; //hold as "next pass tried?/ result" var tryOut=1; y2++; case 4: txt("011"); if(b2<0){ y2=20; //ep award case txt("221and avoids it - hit any key"); } //if(b2<0 else{ txt("1211) "+(isa2 && a2>0?"retreat from doorway":"leave it alone")); txt("1242) try to bypass ("+seqDic+" @"+(trpDif-1)+')'); txt("1313) replace detrapper"); txt("1344) ready items"); txt("1415) use an item"); txt("1446) reorder party"); } //else(b2<0 y2++; txt("211"+a2$+" detects "+b2$+(trpTyp<9?" trap.":".")); return; case 5: e2=inpVal; y2++; txt("011"); if(key2$=='\b' || e2<1 || e2>5) ordPty(Pty,"trap dispersal"); else if(e2==5) pikItm(Adv); else if(e2==4) rdyItm(); else if(e2==3) pikChr(Adv+Set,"new detrapper"); else if(e2==2){ y2++; tryDtp(); } //if(e2==2 else{ if(!isa2 || a2<0){ //if Tdr/Stp use, or detrapping a trove isCbt=isVlt=false; y2=30; //rout rtn rpt("211You leave the "+(isa2 && a2<0?"treasure trove":"site")+" alone."); return; } //if(!isa2 || for(e2=chrGrp;e26){ txt("163Party members must be in rows 1&2"); y2-=2; //mod'd for y2++; abv tryDtp(); return; } //if(valOut(e2,ChrSq)>6 f2=mazMap+(rtnCoo>0?rtnCoo%C:atCooRow); //mark room Disturbed g2=rtnCoo>0?rtnCoo/C:atCooCol; eq(c2$,wrdOut(f2,g2)); h2=str(c2$).indexOf('A'); if(h2<0) c2$.append('D'); else insStr(c2$,h2,"D"); //ins 'D' pre-'A' pty mkr (if coo occ'd) dtaIn(f2,g2,str(c2$)); bakOut(); shoMap(); shoFld(atCoo); isCbt=false; y1=1; if(isDin){ isRov=isDis=true; x1=ChkBst; } //if(isDin else x1=ChkVlt; y2=30; //rout rtn tryDtp(); } //else(e2==2 return; case 6: //prc menu choices for new detrapper or reorder if(e2==3 && newChr!=oprChr) if(valOut(newChr,ChrSq)>3) txt("163 detrapper must be in row 1"); else{ oprChr=srcChr=newChr; y2-=2; //-mod blw } //else(valOut(oprChr,ChrSq)>3 else srcChr=oprChr; y2-=2; tryDtp(); return; case 7: if(valOut(oprChr,ChrSq)>3){ txt("153detrapper "+a2$); txt("163 must stay in row 1"); y2-=3; tryDtp(); return; } //if(valOut(oprChr,ChrSq)>3 y2++; tskRol(oprChr,seqDic,trpDif-1,Rv,"Bypass "+(isa2?"trap":str(b2$))); if(isInp) return; case 8: c2=dig(tsk(die$),0); seqDic+=lowDic(rol$,trpDif-1); if(has(-oprChr,"SeeTrp","fx")) seqDic+=valOut(elmNum,ItmBon); //elmNum of has() //c2=1; //~test ln if(c2>trpDif-1){ //if fail roll to bypass trap, trip trap if(isa2) doTrp(); else{ txt("153Dtp failed."); y2=30; //rout rtn tryDtp(); } //else(isa2 return; } //if(c2>trpDif-1 c2=-c2; tryOut=2; y2++; case 9: y2++; if(trpTyp==Dmy){ putTrp(1); return; } //if(trpTyp==Dmy case 10: eq(xsA,TrpElm$); eq(b2$,wrdOut(xsA,trpTyp)); txt("011"); txt("1211) pass around it"); txt("1242) try to disarm ("+seqDic+" @"+(trpDif-2)+')'); txt("1313) replace detrapper"); txt("1344) ready items"); txt("1415) use an item"); txt("1446) reorder party"); y2++; txt("211"+a2$+" circumvents "+b2$+(trpTyp<9?" trap.":".")); return; case 11: e2=inpVal; y2++; txt("011"); if(key2$=='\b' || e2<1 || e2>5) ordPty(Pty,"trap dispersal"); else if(e2==5) pikItm(Adv); else if(e2==4) rdyItm(); else if(e2==3) pikChr(Adv+Set,"new detrapper"); else if(e2==2){ //try disarm y2++; //added to prior y2++ tryDtp(); } //if(e2==2 else{ //gain ep & term y2=20; tryDtp(); } //else(e2==2 return; case 12: //prc menu choices for new detrapper or reorder if(e2==3 && newChr!=oprChr) if(valOut(newChr,ChrSq)>3) txt("163 detrapper must be in row 1"); else{ oprChr=srcChr=newChr; y2-=8; //-mod blw } //else(valOut(oprChr,ChrSq)>3 else srcChr=oprChr; y2-=2; tryDtp(); return; case 13: if(valOut(oprChr,ChrSq)>3){ txt("153detrapper "+a2$); txt("163 must stay in row 1"); y2-=3; tryDtp(); return; } //if(valOut(oprChr,ChrSq)>3 y2++; tskRol(oprChr,seqDic,trpDif-2,Rv,"Disarm "+(isa2?"trap":str(b2$))); if(isInp) return; case 14: c2=dig(tsk(die$),0); //c2=1; //~test ln if(c2>trpDif-2){ //if fail roll to disarm trap, trip trap if(isa2) doTrp(); else{ txt("153Dtp failed."); y2=30; //rout rtn tryDtp(); } //else(isa2 return; } //if(c2>trpDif-2 tryOut=3; y2=isa2?y2+1:20; txt("211"+a2$+" neutralizes "+b2$+(trpTyp<9?" trap.":".")); return; case 15: //acquire trap itm d2=trpTyp<8?dvcItm+dig("3_40125",trpTyp-1):cshItm+1; addItm(trvChr,d2); e2=elmNum; //elmNum of addItm() if(trpTyp>7) dtaIn(e2,ItmBon,""+X*lowDic(dic(4,"Jwl val"),X)); y2=20; rpt("211Trap yields "+wrdOut(d2,ItmTyp)+" (can pick up)."); return; case 20: //gain ep e2=trpTyp<9?3*trpTyp+1:X; if(isa2 && trpDif<4) //Dtp'd @3-2-1 e2+=e2+1>>1; //ep +50% addTo(oprChr,ChrEp,e2); trpTyp=0; //flg for rndOne() Thf atk use if(x1==ChkTrv) //set flgs to genTrv() isVlt=false; //~isCbt=true; moved to case 1: y2=30; rpt("263 "+a2$+" gains "+e2+" ep"); //~"for not [springing trap]" return; case 30: if(has(-oprChr,"SeeTrp","fx")) eq(elmNum,Fre$); //elmNum of has() x2=0; //rout rtn go(); } //switch(y2 } //tryDtp mth void doTrp(){ //uses: trpTyp, (opr)srcChr, atCoo if(x2!=DoTrp) y2=1; switch(y2){ case 1: x2=DoTrp; y2++; if(trpTyp==Dmy){ putTrp(1); return; } //if(trpTyp==Dmy case 2: //trip trap y2++; txt("011"); //trpTyp=4; //~test ln eq(xsA,TrpElm$); txt("211you trip the "+wrdOut(xsA,trpTyp)+" trap! (hit any key)"); return; case 3: if(has(-oprChr,"SeeTrp","fx")) eq(elmNum,Fre$); //elmNum of has() y2++; isa2=locDuo(itmGrp,ItmCod,"SeeSe",ItmOpn,"991")>0; if(isa2){ a2=elmNum; //elmNum of locDuo() rpt("211Use SeeSeg fx? 0) yes 1) no"); return; } //if(isa2 case 4: if(isa2 && inpVal!=1){ isCbt=false; if(x1!=ChkTrv){ //door trp bakOut(); shoMap(); shoFld(atCoo); x2=0; x1=ChkVlt; y1=1; rpt("211"+wrdOut(a2,ItmOwn)+" loses SeeSeg fx."); eq(a2,Fre$); //rmv SeeSeg fx rcd here, vs in clrOut() (since fx NA to bakCoo) } //if(x1!=ChkTrv else{ //trove trp y2=100; doTrp(); } //else(x1!=ChkTrv } //if(isa2 && else{ y2=X*trpTyp; doTrp(); } //else(isa2 && return; case 10: //trpTyp= 1 springboard y2++; setAtk(Dvc,-1); dieWgt=2; //eq(aim$,"21"); //~test ln diePch=2; isCru=true; atkSrc=trvChr; atkTgt=oprChr; atkVs(3,"springboard"); return; case 11: txt("011"); if(isRv){ y2=100; rpt("211You dodge the springboard! (hit a key)"); return; } //if(isRv y2++; case 12: isb2=lowDic(tsk(a4$),diePch)<2; //a4$ of atk/hitVs() if(isb2) //sel tgt chr tgtChr=rdmChr(atCoo,4,6,Any); else tgtChr=rdmChr(atCoo,7,9,Any); txt("111 Thrown into "+(isb2?"next":"back")+" row."); if(tgtChr==0){ y2=100; rpt("214(hit a key)"); return; } //if(tgtChr==0 y2++; case 13: y2++; setAtk(Dvc,-1); dieWgt=2; diePch=2; isCru=true; atkSrc=trvChr; atkTgt=tgtChr; atkVs(3,"flying detrapper"); return; case 14: y2=100; if(isRv) rpt("211You dodge h"+(sex(oprChr)?"er":"im")+"! (hit a key)"); else doTrp(); return; //case 20: //trpTyp= 2 case 30: //trpTyp= 3 a2=dig(dic(1,"aro tgt"),0); b2=a2==5?7:4; if(a2>5 || a2>2 && rdmChr(atCoo,b2,b2+2,Pty)4 || atkTgt=a2<3?oprChr:elmNum; //elmNum of rdmChr() y2=100; //rout rtn setAtk(Cbt,Aro); atkRng=Msl; atkSrc=trvChr; addItm(trvChr,locItm(itmPoo,"Psn Arrow","*ammo")); atkItm=atkAmo=elmNum; //elmNum of addItm() dieWgt=3; doWpn(); return; case 40: //trpTyp= 4 a2=rdmChr(atCoo,4,6,Pty); a2=E6; //E6= consc chrs only of rdmChr() System.arraycopy(Z6,1,z2,1,a2); c2=dig(dic(1,"gas row"),0)<4?1:7; b2=rdmChr(atCoo,c2,c2+2,Pty); b2=E6; System.arraycopy(Z6,1,z2,a2+1,b2); b2+=a2; //last ary elm a2=0; //ini loop cntr y2++; txt("253Gas pervades "+(c2<7?"1st":"3rd")+" rank"); return; case 41: if(++a2>b2){ y2=100; rpt("211No more targets"); return; } //if(++a2>b2 atkSrc=trvChr; dieWgt=5; atkTgt=z2[a2]; setAtk(Dvc,-1); atkMtl=Gas; atkVs(3,"poison gas"); return; //rtns to this case again case 50: //trpTyp= 5 a2=1; //ini sq seq cntr b2=7; //ini blast force y2++; case 51: while(rdmChr(atCoo,a2,a2,Pty)9){ txt("011"); y2=100; rpt("211No more targets"); return; } //if(++a2>9 c2=E6; //E6= consc chrs only of rdmChr() System.arraycopy(Z6,1,z2,1,c2); d2=0; //ini loop cntr y2++; case 52: if(++d2>c2){ a2++; y2--; doTrp(); return; } //if(++d2>c2 y2++; atkSrc=trvChr; atkTgt=z2[d2]; dieWgt=Math.min(2,b2); diePch=3; isCru=true; setAtk(Dvc,-1); atkVs(5-b2/2,"detonation"); return; case 53: b2-=lowDic(tsk(a4$),diePch); //a4$= aim$ of atk/hitVs() y2--; doTrp(); return; case 60: //trpTyp= 6 y2++; a2=0; //ini helper chr flg b2=valOut(oprChr,ChrSq); isa2=rdmChr(atCoo,b2,By,Adv)>=chrGrp; if(isa2){ pikChr(Adv,"adjacent helper? (no= Bksp)"); return; } //isa2 case 61: if(isa2 && key6$!='\b') if(key6$!='?' && newChr!=oprChr && isBy(b2,valOut(newChr,ChrSq))) //chk key$ vs popups a2=newChr; //newChr of pikChr() else{ y2--; doTrp(); return; } //else(isBy(oprChr,newChr) dieWgt=a2<1?4:3; diePch=a2<1?2:1; y2++; case 62: y2++; atkSrc=trvChr; atkTgt=a2<1?oprChr:a2; setAtk(Dvc,-1); atkVs(0,"acid wash"); return; case 63: //eq(a4$,"1"); //~test ln if(lowDic(tsk(a4$),diePch)<1){ //no acid hits y2=a2<1?100:y2-1; a2=0; doTrp(); return; } //if(lowDic(tsk(a4$),diePch)>0 y2++; tskRol(atkTgt,modRv(atkTgt),2,Rv,"Resist acid"); if(isInp) return; case 64: isa2=dig(tsk(die$),0)>2; //failed Rv if(isa2){ b2=0; eq(a2$,cut(wrdOut(atkTgt,ChrNam))); elmNum=itmGrp; while(elmNum<=arySiz && locDuo(elmNum,ItmOwn,str(a2$),ItmCla,"skill")>0) z2[++b2]=elmNum++; //elmNum of locDuo() if(b2>0){ b2=pri(z2[ran(b2)])-sklItm+1; //det wpn code from rdm skl itm addItm(atkTgt,locItm(itmPoo,"ModSkl","fx")); c2=elmNum; //elmNum of addItm() dtaIn(c2,ItmOpn,"997"); dtaIn(c2,ItmBon,"-1"); dtaIn(c2,ItmId,""+b2); } //if(b2>0 else isa2=false; } //if(isa2 y2=a2<1?100:y2-2; a2=0; eq(xsA,WpnElm$); rpt("211"+chrNam(atkTgt) +(isa2?" takes -1 to "+wrdOut(xsA,b2)+" skill!" :" avoids any skill penalty.")); return; case 70: //trpTyp= 7 a2=dig(dic(1,"cut dir"),0)<4?0:4; //ini sq pos side loop cntr b2=a2<4?1:-1; //set step var y2++; case 71: a2+=b2; if(a2<1 || a2>3){ y2=100; rpt("211No more targets"); return; } //if(a2<1 || if(rdmChr(atCoo,a2,a2,Pty)2?4:2; atkSrc=trvChr; dieWgt=3; setAtk(Dvc,-1); atkVs(0,"blade swath"); return; case 73: if(hitSum<1){ y2=100; rpt("211Blade fended off!"); } //if(hitSum<1 else{ y2-=2; doTrp(); } //else(hitSum<1 return; case 80: //trpTyp= 8 a2=(dig(dic(1,"row seq"),0)-1)/2; b2=rdmChr(atCoo,3*a2+1,3*a2+3,Pty); b2=E6; //E6= consc chrs only of rdmChr() System.arraycopy(Z6,1,z2,1,b2); c2=dig(dic(1,"nxt row"),0)<4?a2+1:a2-1; c2=c2<0?2:(c2>2?0:c2); d2=rdmChr(atCoo,3*c2+1,3*c2+3,Pty); d2=E6; System.arraycopy(Z6,1,z2,b2+1,d2); e2=3-(a2+c2); f2=rdmChr(atCoo,3*e2+1,3*e2+3,Pty); f2=E6; System.arraycopy(Z6,1,z2,b2+d2+1,f2); eq(a2$,"fallout rank order= "+(a2+1)+'-'+(c2+1)+'-'+(e2+1)); a2=0; //ini loop cntr b2+=d2+f2; //last ary elm c2=8; //ini fall force tot y2++; rpt("211"+a2$); return; case 81: if(++a2>b2){ y2+=2; rpt("211No more targets"); return; } //if(++a2>b2 y2++; atkSrc=trvChr; atkTgt=z2[a2]; dieWgt=Math.min(4,c2); diePch=3; isBla=true; setAtk(Dvc,-1); atkVs(2,"cave-in"); return; //rtns to this case again case 82: c2-=lowDic(tsk(a4$),diePch); //a4$= aim$ of atk/hitVs() if(c2<1){ //no force left y2++; rpt("211Rain of debris ends!"); return; } //if(c2<1 y2--; doTrp(); return; case 83: y2++; if(isStp || isTdr){ doTrp(); return; } //if(isStp || isTdr //deadfall blocks passage (in sides=walls, mod opeCnt, back out) a2=inSid-1; b2=mazMap+atCooRow; eq(a2$,wrdOut(b2,atCooCol)); insStr(a2$,a2,inSid,"w"); insStr(a2$,4,"X"); //mrk coo as poss closed off from maze dtaIn(b2,atCooCol,str(a2$)); b2=atCooCol+(a2-1)%2; c2=atCooRow+(a2-2)%2; d2=mazMap+c2; eq(b2$,wrdOut(d2,b2)); c2=a2-(a2>1?2:-2); insStr(b2$,c2,c2+1,"w"); dtaIn(d2,b2,str(b2$)); g2=0; //ini til ope coo access cntr for(a2=0;a2<4;a2++){ //chk/ set adj 'D's b2=atCooCol+(a2-1)%2; //%2 result can be neg; vs &1 c2=atCooRow+(a2-2)%2; isa2=isTil(b2,c2); isb2=!isa2 && isA8; //ope coo: isA8= in maze of isTil() d2=mazMap+c2; eq(b2$,wrdOut(d2,b2)); e2=+a2$.charAt(a2); f2=isa2?+b2$.charAt(a2-(a2>1?2:-2)):0; if(isa2 && e2!=+'w' && f2!=+'w'){ g2=0; //reset opeCnt mod flg break; //if other passage(s) to maze, opeCnt unchgd } //if(isa2 && if(isb2 && e2!=+'w') g2++; //#ope coos access from til } //for(a2=0; opeCnt-=g2; case 84: bakOut(); shoMap(); shoFld(atCoo); isCbt=false; //in case of trap on trove x1=ChkVlt; //allow to heal injured y1=1; y2=100; rpt("211The party drags itself out of the destruction!"); return; case 100: txt("011"); if(x1==ChkTrv) //retain Vlt left status for Deadfall isVlt=false; //in case of trap on trove if(trpTyp<8) //post- Deadfall bakOut() movPty() reSets only moved chrs reSet(Pty+Out,Nah); //mark all grp chars in coo 'acted' x2=0; //rout rtn go(); } //switch(y2 } //doTrp mth void advAtk(){ if(x2!=AdvAtk) y2=1; switch(y2){ case 1: x2=AdvAtk; h2=0; //ini atkr sq#/ stack refresh flg y2++; case 2: txt("011"); if(h2>0 && rdmChr(atCoo,h2,h2,Any)>0 && srcChr!=N6) //N6 of rdmChr() movChr(N6,h2); //resto hi pst chr to top of stack a2=nxtChr(atCoo,Bst); if(isNo1) //isNo1 of nxtChr() return; isa2=a220; if(isa2 || is1st && rndCnt<2 || nxtChr(atCoo,Pty+Set) bstAtk() return; } //if(isa2 || y2++; case 3: y2++; txt("011"); txt("112cbt Rnd "+rndCnt+": Choose an activity"); txt("1210) weapon attacks"); txt("1241) use an item"); txt("1312) ready items"); txt("1343) end adv round"); if(opt1==Thf && rndCnt==1) txt("142Thief attacks in effect"); txt("241"); return; case 4: a2=inpVal; txt("011"); if(a2!=0){ y2-=2; if(a2<1 || a2>3) advAtk(); else if(a2==1) pikItm(Adv+Set); else //note: incls SplMR itm pik if(a2==2) rdyItm(); else{ x2=0; //rout rtn go(); } //else(a2==2 return; } //if(a2!=0 y2++; case 5: //wpn atks txt("011"); if(h2>0 && rdmChr(atCoo,h2,h2,Any)>0 && srcChr!=N6) //N6 of rdmChr() movChr(N6,h2); //resto hi pst chr to top of stack a2=nxtChr(atCoo,Bst); if(isNo1) //isNo1 of nxtChr() return; if(a220){ x2=0; //rout rtn if(x1==OneRnd) rpt("211 You have defeated them!"); else go(); return; } //if(a2=bstCat){ isa2=rdmChr(atCoo,h2,By,Foe)>0; if(bstCap(srcChr,Bst1) && isa2 || bstCap(srcChr,Bst2)) //note 'short-circuit' eval prc if(atkTyp!=Mgc && (atkRng==Msl || isa2)) ; //atkTyp,atkWpn,dieWgt,diePch rtn'd by bstCap() else setAtk(Nop,Nah); } //if(g2>=bstCat eq(b2$,atkItm>=itmGrp?wrdOut(b2,ItmTyp):(atkWpn>=Bst1?"beast":"unarmed")); if(a2<2) //sho mkr for prone atkr on top of any stack temporarily movChr(srcChr,h2); if(atkTyp==Nop || !isUp(srcChr) || !isOp(srcChr) || g2>=bstCat && h2>X || a2<2 && !(isStk && atkWpn==Una)){ if(a2<2 && isStk) //~?don't show if !isUp/Op() txt("121 (Prone allowed only Unarmed.)"); y2-=2; rpt("211"+(sex(srcChr)?"Sh":"H")+"e's inactive now."); return; } //if(!isUp(srcChr) || y2++; case 8: txt("011"); a$=wrdOut(g2,ChrTyp).charAt(0); if(g2<=advCat && (a$=='W' && atkWpn>Qsf || a$=='T' && atkWpn>Hmr)){ y2-=3; rpt("211 "+a2$+" can't wield "+wrdOut(b2,ItmTyp)); return; } //if(g2<=advCat && txt("111 "+a2$+" making "+(isc2?"multiple ":"")+b2$+" attack."); if(atkWpn!=Bow){ y2+=4; advAtk(); return; } //if(atkWpn!=Bow if(a2!=3){ y2-=3; rpt("232("+a2$+" must stand to shoot)"); return; } //if(a2!=3 //chk if more than 1 amo itm -> choose 1, else use avail chkWpn(srcChr); e2=Z7[4]; //of chkWpn()= #aro elms f2=Z7[5]; //of chkWpn()= ord, or 1st mag elm isa2=Z7[6]<1; //of chkWpn()= f2==ord if(e2==0){ y2-=3; rpt("232(out of ammo)"); return; } //if(e2==0 if(e2==1){ atkAmo=f2; y2+=4; advAtk(); return; } //if(e2==1 y2++; rpt("2210) use "+(isa2?"from ":"")+wrdOut(f2,ItmBon)+" "+wrdOut(f2,ItmCod) +" 1) pick arrow"); return; case 9: if(inpVal==0){ atkAmo=f2; y2+=3; advAtk(); return; } //if(inpVal==0 y2++; case 10: newChr=srcChr; y2+=2; //comp for y2-- in reTrd() shoAdv(itmGrp,"pick ammo"); return; case 11: if(key7$=='\b'){ y2-=6; advAtk(); return; } //if(key7$=='\b' e2=itmElm; //itmElm of shoAdv() //chk for incidental reTrd(), as well as good val if(e23 && has(srcChr,"Propeller","device")){ e2=elmNum; //elmNum of has() if(dig(dic(1,"Pplr opn"),0)<6){ isa2=true; dtaIn(e2,ItmOpn,"1"); //flg= using now f2=b2<14?11:14; tgtChr=rdmChr(atCoo,f2,f2+3,Any); txt("041"); txt("141"+a2$+" uses Propeller device."); } //if(dig(dic(1,"Pplr opn"),0)<6 else{ eq(e2,Fre$); reSet(srcChr,Nah); //mrk atkg chr acted y2-=7; //w y2-- on if(!isa2 || txt("041"); txt("141"+a2$+"'s Propeller device fails!"); } //else(dig(dic(1,"Pplr opn"),0)<6 } //if(d2==3 && } //else(atkWpn==Bow } //if(rdmChr(atCoo,h2,By,Foe)0) if(z2[e2]==tgtChr){ y2--; //tgt sel loop rpt("211 was prior tgt"); return; } //if(z2[e2]==tgtChr z2[e2]=tgtChr; //log this tgt } //if(isc2 y2++; case 15: //chk for rnd1 Thf atk e2=modRv(srcChr)-modRv(tgtChr); if(e2<1 || opt1!=Thf || atkWpn!=Dag || atkRng>=Msl || !wrdOut(g2,ChrTyp).equals("Thief")){ y2+=2; advAtk(); return; } //if(e2<1 || y2++; tskRol(srcChr,e2,3,Rv,"Thief's Attack"); if(isInp) return; case 16: isThf=dig(tsk(die$),0)<4; y2++; case 17: //chk for "dancing wpn" Wzd atk e2=modRv(srcChr)-modRv(tgtChr); if(e2<1 || h2>3 || b2-h2!=X || !wrdOut(g2,ChrTyp).equals("Wizard") || atkWpn5){ y2-=14; reSet(srcChr,Nah); //mrk atkg chr acted rpt("211Wizard attack attempt fails."); return; } //if(dig(dic(1,"project"),0)>5 drpWpn=4; y2++; case 20: y2++; case 21: y2++; reSet(srcChr,Nah); //mrk atkg chr acted if(atkWpn==Una || atkWpn==Dag && atkRng==Eng){ //QkDrw qual atk (unacted chk in oneRnd()) addItm(srcChr,locItm(itmPoo,"QkDrw","fx")); dtaIn(elmNum,ItmOpn,""+(rndCnt+1)); //elmNum of has() or addItm() // txt("211"+a2$+" gains QkDrw fx."); return; //~don't show QkDrw fx acq } //if(atkWpn==Una || case 22: //set to cycle back, opr wpn itm y2-=isc2?15:17; atkSrc=srcChr; atkTgt=tgtChr; useItm(); } //switch(y2 } //advAtk mth void bstAtk(){ if(x2!=BstAtk) y2=1; switch(y2){ case 1: x2=BstAtk; ise2=false; //ini "msl-using row2 bst has rdy wp1" flg (can only go fwd 1 at a time) txt("011"); y2++; case 2: y2++; case 3: a2=1; //Sq# ptr: chk all Sqs, beg w pty sid y2++; case 4: b2=nxtChr(atCoo,Adv); //chks if pty destroyed if(isNo1) //isNo1 of nxtChr() return; //pik foe srcChr by sq loc while(rdmChr(atCoo,a2,a2,Foe+Set)<1) if(++a2==X) a2++; else if(a2>19){ y2+=9; bstAtk(); return; } //if(a2>19 srcChr=tgtChr=elmNum; //elmNum of rdmChr(): default tgt as well setAtk(Nop,Nah); //default atk amoCnt=-1; //ini Bow user #arrows left: set in bstCap() y2++; case 5: y2++; eq(a2$,chrNam(srcChr)+" "); b2=B7; //B7=pri(srcChr) of chrNam() txt("011"); txt("053"); isa2=false; if(!isOp(srcChr)){ a2$.append("is stunned & "); isa2=true; } //if(!isOp(srcChr else if(b2<=advCat && a21) //_6s of rdmChr() c2=A6+1>E6?Z6[1]:Z6[A6+1]; if(c2>0 && c2!=srcChr && bstCap(srcChr,Bst1)) tgtChr=c2; atkRng=Eng; isa2=true; } //if(rndCnt==1 && else if(b2>=bstCat && has(srcChr,"SplMR","fx")){ //not for Bgl'd c2=elmNum; d2=locElm(chrGrp,ChrNam,wrdOut(c2,ItmLoc)); if(d2>0 && isUp(d2)){ atkItm=c2; tgtChr=d2; setAtk(Mgc,SplAbr$.indexOf(wrdOut(atkItm,ItmBon))/3+1); isa2=true; } //if(d2>0 && else eq(c2,Fre$); } //if(b2>=bstCat && if(isa2){ y2++; //+=2 in addn to abv (note blw too) bstAtk(); return; } //if(isa2 isc2=rdmChr(atCoo,a2,By,Pty)>0; if(b2<=advCat){ //Bgl'd adv: presumed on bst front rank (see Bow notes blw) isa2=has(srcChr,"","weapon"); if(isa2){ atkItm=elmNum; //elmNum of has() d2=pri(atkItm); atkWpn=d2-itmCat(d2)+1; setAtk(Cbt,atkWpn); if(atkWpn==Bow){ givItm(trvChr,atkItm,1); //divest so hav() blw det to Rdy, or Una atk dtaIn(elmNum,ItmOpn,Brk$); dtaIn(elmNum,ItmLoc,""+(isStk?a2:(a2row1 else setAtk(Nop,Nah); } //if(isa2 if(!isa2) if(!has(srcChr,"Tng","fx") && hav(srcChr,"","weapon") && !wrdOut(elmNum,ItmCod).equals("Bow")) //elmNum of hav() setAtk(Rdy,elmNum); else setAtk(Cbt,Una); bstAtk(); return; } //if(b2<=advCat isa2=bstCap(srcChr,Bst1); h2=atkWpn; if(!isc2) //~?(isa2 && !isc2) augment bstCap(Bst1) det isa2=false; //no adj tgt (or Rdy Wpn1 from bstCap()) isb2=bstCap(srcChr,Bst2); if(atkTyp==Rdy && a2>13 && !isa2) //isb2= false w bstCap() atkTyp= Rdy if(ise2 || rdmChr(atCoo,11,13,Foe)>=chrGrp){ //Rdy Wp2 on rnd1 in row2 Ok bstAtk(); //rdy wp2 return; } //if(ise2 || else ise2=true; //log 1 bst w rdy wp1 if(isb2){ //augment bstCap(Bst2) det if(atkTyp==Cbt){ if(atkRng==Msl && isc2 || atkRng==Eng && !isc2) isb2=false; //eng'd, or no adj tgt if(isb2 && atkRng==Msl){ isd2=rdmChr(atCoo,1,3,Pty)3)){ ise2=true; //log 1 bst w rdy wp1 isb2=false; } //if(atkWpn==Bow && if(isb2 && (a2>13 && isd2 || rdmChr(atCoo,1,6,Pty)atkTyp=Mgc if(atkSpl!=Aid && atkRng==Eng && !isc2) isb2=false; //no adj tgt if(isb2 && atkSpl==Tng && valOut(srcChr,ChrSq)!=12 && (rdmChr(atCoo,3,16,Foe)0 && !has(d2,"Swn","fx")){ tgtChr=d2; break; } //if(f2-e2>0 } //for(c2=1; if(f2-e2<1) //default= self, or adj wd'd isb2=false; //no use for Aid } //if(isb2 && } //else(atkTyp==Cbt if(isb2 && isa2 && dig(dic(1,"type atk"),0)<5+lr[4]) isb2=false; } //if(isb2 if(!isb2){ isa2=bstCap(srcChr,Bst1); //re-setAtk() vars (= Rdy wp1 if no wp2 tgt) if(atkTyp==Rdy) //isa2==false ise2=a2>13 && a2<17; if(!isc2 && (isa2 || atkTyp==Rdy && a2>16)){ //augment bstCap(Bst1) det isa2=false; //no adj tgt (or Rdy Wpn1) setAtk(Nop,Nah); } //if(!isc2 && } //if(!isb2 && case 6: y2++; if(atkRng==Msl && isc2 && atkTyp!=Mgc){ atkRng=Eng; //1st priority: engager if(atkWpn==Bow){ //drop Bow givItm(trvChr,atkItm,1); //same code in Tng fx abv dtaIn(elmNum,ItmOpn,Brk$); dtaIn(elmNum,ItmLoc,""+(isStk?a2:(a216==e2>X || e2>X==f2>X)){ tgtChr=d2; break; } //if(has(d2,"Swn","fx" } //for(c2=1; } //if(atkSpl==Swn } //if(atkTyp==Mgc if(tgtChr==srcChr){ //still set to default if(a2>13 && atkTyp!=Mgc){ //3rd priority: typical tgts if(atkWpn==Bow){ //chk for clear shot c2=rdmChr(atCoo,a2-13,a2-13,Any); c2=F6; //F6 of rdmChr()= hi pst in sq if(rdmChr(atCoo,a2-X,a2-X,Pty)>0 && F6>c2) //F6 of rdmChr() tgtChr=N6; //N6 of rdmChr() } //if(atkWpn==Bow if(tgtChr==srcChr) tgtChr=rdmChr(atCoo,1,3,Pty); } //if(a2>13 && else //sbj on row1 but not Eng; or Mgc tgtChr=rdmChr(atCoo,1,6,Pty); if(rdmChr(atCoo,11,19,Pty)>0) //2nd priority: offside tgtChr=elmNum; else if(atkTyp!=Rdy && a2>16) //back rank out of rng of opp gnd tgtChr=0; } //if(tgtChr==srcChr } //if(atkRng==Msl if(tgtChr0 setAtk(Nop,Nah); case 7: //chg atkr posture: rise or drop d2=rdmChr(atCoo,a2,a2,Any); d2=F6; //_6s of rdmChr()= hi pst in sq f2=D6; //= #chrs in sq c2=getPst(srcChr); if(c21 pst stage a2$.append("rises & "); } //if(d2<2 } //if(c21 || c2!=getPst(srcChr)) //sho mkr for atkr on top of any stack temporarily movChr(srcChr,a2); y2++; case 8: y2++; shoBst(srcChr); if(atkTyp==Nop) //msg bst opt a2$.append("does nothing"); else{ eq(b2$,chrNam(tgtChr)); if(atkItm>=itmGrp){ eq(c2$,wrdOut(pri(atkItm),ItmTyp)); if(atkTyp==Rdy) a2$.append("readies "+c2$); else a2$.append("uses "+c2$+" on "+b2$); } //if(atkItm>=itmGrp else //: atkTyp>Rdy a2$.append("attacks "+b2$); } //else(atkTyp==Nop if(amoCnt==0) a2$.append(" (out of arrows)"); case 9: y2++; //a2$.append(" atkWpn="+atkWpn+" atkRng="+atkRng); //~test ln txt("111"+a2$+'.'); if(atkTyp==Rdy && has(srcChr,"QkDrw","fx")) txt("122(quick draw used)"); else{ reSet(srcChr,Nah); //mrk atkg chr acted if(isOp(srcChr) && b2>=bstCat && hav(srcChr,"","weapon") //chk QkDrw qual && (atkWpn==Una || atkWpn==Dag && atkRng==Eng || atkTyp==Nop && (!has(srcChr,"","weapon") || wrdOut(elmNum,ItmCod).equals("Dagge")))){ addItm(srcChr,locItm(itmPoo,"QkDrw","fx")); dtaIn(elmNum,ItmOpn,""+(rndCnt+1)); //elmNum of has() or addItm() } //if(isOp(srcChr) && } //else(atkTyp==Rdy && txt("246"); return; case 10: y2++; atkSrc=srcChr; atkTgt=tgtChr; if(atkTyp>Nop) if(atkTyp==Rdy) makRdy(atkSrc,atkItm); else{ //bst atks= only Cbt wpn (incl Bst1/2, Una), or Mgc spell useItm(); return; } //else(atkTyp==Rdy case 11: y2-=7; bstAtk(); return; case 12: y2++; if(isStk && rdmChr(atCoo,1,3,Foe+Set)>0){ a2=E6; //E6 of rdmChr() System.arraycopy(Z6,1,z2,1,a2); if(rdmChr(atCoo,11,13,Foe+Set)>0){ b2=E6; //E6 of rdmChr() for(c2=1;c2<=a2;c2++){ d2=valOut(z2[c2],ChrSq); for(e2=1;e2<=b2;e2++){ f2=Z6[e2]; g2=valOut(f2,ChrSq); if(isBy(d2,g2) && getPst(f2)>1){ dtaIn(f2,ChrPst,"1"); movChr(f2,g2); reSet(f2,Nah); //mrk chr acted rpt("211"+chrNam(f2)+" drops to make way."); return; } //if(isBy(d2,g2) && } //for(e2=1; } //for(c2=1; } //if(rdmChr(atCoo,11,13,Foe+Set)>0 } //if(isStk && case 13: x2=0; //rout rtn go(); } //switch(y2 } //bstAtk mth void bstOrg(){ if(x2!=BstOrg) y2=1; switch(y2){ case 1: x2=BstOrg; isa2=isb2=false; //ini flgs for: rank chg made, row shift tried i2=0; //ini priority index value a2=isStk?1:0; //max pst oks sq ety: no piling up by Lying bsts if !isStk rcd$.setLength(0); //ini movRpt() rpt() arg$ y2++; case 2: txt("011"); txt("112 beast Movement phase:"); for(e2=0;e2<=z2Siz;e2++) //ini Fld map ary z2[e2]=0; for(e2=chrGrp;e2z2[valOut(e2,ChrSq)]) z2[C9]=b2; //C9 of valOut() } //if(valOut(e2,ChrCoo)==atCoo && isc2=rdmChr(atCoo,11,13,Foe)>0; isd2=true; //front row filled for(b2=11;b2<14;b2++) if(z2[b2]<=a2) isd2=false; //when all bsts immobilized and none engaged, pik closest foe to mov b2=rdmChr(atCoo,9,19,Foe+Set); c2=E6; //E6 of rdmChr() System.arraycopy(Z6,1,z3,1,c2); if(!isa2 && b2>0 && mob(b2)3?Math.abs(g2-1):2; //to row (see case 3:) b2=f2; } //if(G8 back off make way: prevents blockade of sqs 1..3 (1st priority) //~assumes <2 of sqs 17..19 occ'd ise2=false; if(isd2){ c2=rdmChr(atCoo,1,3,Foe+Set); c2=0; while(!ise2 && ++c2<4) ise2=has(Z6[c2],"Bgl","fx") && mob(Z6[c2])>0; //Z6[] of rdmChr() } //if(isd2 if(i2<1 && ise2 && rdmChr(atCoo,11,19,Pty)0){ ise2=z2[14]>a2 && z2[15]>a2 && z2[16]>a2; c2=ise2?14:11; b2=mob(rdmChr(atCoo,c2,c2+2,Foe+Set)); //loads Z6[] for case 4: (as others in case:3) if(b2>0){ c2=G6==E6?Z6[1]:Z6[G6+1]; //_6s of rdmChr() if(!ise2 && pri(b2)>=bstCat && rdmChr(atCoo,11,13,Bst)==b2 && E6<2) //E6 of rdmChr() b2=c2; //mov bak Bgl'd adv vs bst chr (lv 1 bst on row1) d2=ise2?0:1; i2=1; } //if(b2>0 } //if(i2<1 && //bst on opp gnd row1 -> mov bst back (2nd priority) if(b2<1 && i2<2 && !isd2 && mob(rdmChr(atCoo,1,3,Bst+Set))>0){ b2=elmNum; i2=2; } //if(b2<1 && //bst on opp gnd row1 -> mov bst back (2nd priority) if(b2<1 && i2<2 && !isd2 && mob(rdmChr(atCoo,1,3,Bst+Set))>0){ b2=elmNum; i2=2; } //if(b2<1 && //no foe in row1 -> mov foe up (3rd priority) e2=0; if(b2<1 && i2<5){ f2=rdmChr(atCoo,11,13,Bst); if(f2==0 && mob(rdmChr(atCoo,14,16,Bst+Set))>0) e2=elmNum; //elmNum of mob() else e2=mob(rdmChr(atCoo,14,16,Foe+Set)); if(e2>0 && (!isc2 || isc2 && f2==0) && !isd2 && i2<3){ //no foe/ bst in row1 & spc vac b2=e2; i2=3; } //if(e2>0 && } //if(b2<1 && if(e2>0){ //mod Z6[] of rdmChr() iaw bstCap()s [note: lvl6 interf] c2=1; f2=g2=D6; //D6 of rdmChr(): bstCap() lvl6 req reassgn G6=0; //unchgd by bstCap() while(G60)) //atkRng of bstCap(), _7s of chkWpn() && !(bstCap(Z6[c2],Bst2) && atkRng>Eng && (atkTyp==Mgc || h2==Bst1 || Z7[2]>0) || atkTyp==Rdy && h2==Bst1)){ //atkRng, atkTyp of bstCap() c2++; G6++; //last Bst1 cap elm demark } //if(ise2 && else if(c20 //mov Bgl'd pty mem on pty gnd twd foe (4th priority) if(b2<1 && i2<4){ f2=itmGrp; g2=X; //loop reduces to lowest sq numbered Bgl'd adv while(f2<=arySiz && locItm(f2,"Bgl","fx")>0){ f2=elmNum; h2=locElm(chrGrp,ChrNam,wrdOut(f2,ItmOwn)); c2=valOut(h2,ChrSq); if(c20 && i2<5){ //e2 & Z6[] w bstCap() mods from row1 vac= 3rd pri if(b2<1){ i2=5; //slide idx up if(!isd2) //mov (prep'd) bst in row2->row1 (5th priority) D6=G6; //only Wp1 prep'd; vs rtn Nop or Rdy or using msl wpn } //if(b2<1 c2=G6>0?G6:D6; G6=ran(c2); b2=G6>0?Z6[G6]:0; if(c2>1){ //refine rdm choice of qual chrs for advance by comparative alternatives g2=G6; //G6 chgd by rdmChr() blw h2=D6; //D6 chgd by bstCap() & rdmChr() blw System.arraycopy(Z6,1,z3,1,h2); //Z6[] chgd by rdmChr() blw if(bf[6]>0 && z2[12]>a2 && z2[valOut(b2,ChrSq)-3]>a2) //avoid shift of row1 foes for(f2=1;f2<=c2;f2++) if(f2!=g2 && z2[valOut(z3[f2],ChrSq)-3]<=a2){ b2=z3[f2]; g2=f2; break; } //if(f2!=g2 && if(bstCap(b2,Bst2)) for(f2=1;f2<=c2;f2++) //rdy wpn advantage if(f2!=g2 && !bstCap(z3[f2],Bst2)){ b2=z3[f2]; g2=f2; break; } //if(f2!=g2 && if(pri(b2)<=advCat && rdmChr(atCoo,9,13,Bst)=bstCat){ b2=z3[f2]; g2=f2; break; } //if(f2!=g2 && G6=g2; D6=h2; System.arraycopy(z3,1,Z6,1,h2); } //if(c2>1 } //if(e2>0 && //mov bst in row3 up 1 row (6th priority) if(b2<1 && i2<6 && mob(rdmChr(atCoo,17,19,Foe+Set))>0){ b2=elmNum; i2=6; d2=1; } //if(b2<1 && //mov any foe on pty gnd row2..3 (eg Snap Bgl) twd foe (7th priority) if(b2<1 && i2<7) for(c2=4;c2<8;c2+=3) if(mob(rdmChr(atCoo,c2,c2+2,Foe+Set))>0){ b2=elmNum; i2=7; d2=c2==4?3:4; break; } //if(mob(rdmChr(atCoo,c2 y2++; case 4: if(b2<1){ //all active bsts in row1, or no others qual y2+=2; //done if no sq12 shift nec bstOrg(); return; } //if(b2<1 if(G6>1){ c2=Z6[G6]; //swap rdm sel w 1st elm: G6 of rdmChr() calls in case 3: Z6[G6]=Z6[1]; Z6[1]=c2; G6=1; } //if(G6>1 //look for open sq in tgt row b2=Z6[1]; //G6=1 c2=valOut(b2,ChrSq); //at sq e2=(d2<3?2-d2:d2-3)*3+(d2<3?11:1); //row#->1st sq d2=h2=0; //ini d2 as to sq, h2 as sq avail cntr if(z2[12]<=a2 && e2==11 && !isc2) d2=12; else{ g2=ran(6)<4?2:0; //randomize choice order if(z2[e2+g2]>0) //avoid occ flank (esp if isStk) g2=2-g2; do{ ise2=!has(b2,"SplMR","fx") && !hdg(b2,"Tng"); for(f2=e2+g2;f2!=e2+3-(g2<<1);f2+=1-g2) if((f2==18 || z2[f2]<=a2) && isBy(c2,f2)){ h2++; if(ise2 || e2==11 && !isc2 || e2==17){ d2=f2; break; } //if(ise2 || } //if(z2[f2]<=a2 && if(d2<1 && ++G6<=D6){ b2=Z6[G6]; c2=valOut(b2,ChrSq); } //if(d2<1 && }while(d2<1 && G6<=D6); } //else(z2[12]<=a2 && if(d2>0){ txt("041"+dic(1,"chg row")); //msg, with dummy die pause isa2=true; //force to quit y2+=4; bstOrg(); return; } //if(d2>0 if(h2>=D6){ //all sbj chrs could have moved to open spcs, but were held y2--; //proceed to chk nxt priority bstOrg(); return; } //if(h2>=D6 y2++; case 5: //sq reloc: file chg(s) if(isb2){ //shifting tgt row already tried f2=c2>9?2:1; e2=(c2-f2)/3*3+f2; //try shifting src row } //if(isb2 b2=h2=d2=0; //e2 of case 4: abv //reorg tgt row (in case chr tried to chg row & couldn't) for(f2=e2;f20){ //find unacted foe b2=elmNum; h2=f2; } //if(mob(rdmChr(atCoo,f2,f2,Foe+Set)>0 if(isBy(h2,d2) && !has(b2,"SplMR","fx") && !hdg(b2,"Tng")){ txt("041"+dic(1,"org row")); //msg, with dummy die pause isb2=true; //try another row chg i2--; y2+=3; bstOrg(); return; } //if(isBy(h2,d2) && } //for(f2=e2; if(!isb2 && d2>0) //if tgt row can't shift & has avail spc isb2=true; //try src row shift else{ isb2=false; y2-=2; //proceed to chk nxt priority } //else(!isb2 && bstOrg(); return; case 6: isa2=true; //wrap up c2=0; //# of squares in row1 occupied by anything conscious for(d2=11;d2<14;d2++) //chk for mandatory row1 shift if(z2[d2]>0) c2++; if(z2[12]<1 && c2==1 && mob(rdmChr(atCoo,11,13,Foe+Set))>0){ b2=elmNum; d2=12; txt("041"+dic(1,"org row1")); //msg, with dummy die pause y2+=2; bstOrg(); return; } //if(z2[12]<1 && y2++; case 7: ise2=i2<18 && bf[6]<1; //18= 2x X- 2x case 5 i2-- decrs (+val) if(ise2) //shift bst tgt of pty Bow clear shot for(c2=14;c2<17;c2++) if(z2[c2-3]<=a2 //no fr blkr, en Bow user, clr tgt && rdmChr(atCoo,c2-X,c2-X,Pty)>0 && has(N6,"Bow","weapon") && rdmChr(atCoo,c2,c2,Foe+Set)>0 && (!has(N6,"Bow","weapon") || z2[c2-13]>a2)){ if(c2!=14 && rdmChr(atCoo,14,14,Foe+Set)>0) reSet(N6,Nah); //mrk non-tgt chr 'acted': N6 of rdmChr() i2+=X; //loop tracker isb2=true; //shift src row y2-=2; bstOrg(); return; } //if(z2[c2-3]<=a2 && x2=0; //rout rtn go(); return; case 8: y2++; movRpt(b2,d2); reSet(b2,Nah); //mrk moving chr 'acted' if(rcd$.length()>0){ shoBst(b2); rpt("221"+rcd$); //~?row loc return; } //if(rcd$.length()>0 case 9: rcd$.setLength(0); y2-=7; bstOrg(); } //switch(y2 } //bstOrg mth void advOrg(){ if(x2!=AdvOrg) y2=1; switch(y2){ case 1: x2=AdvOrg; y2++; case 2: y2++; txt("011"); txt("112adventurer Movement phase:"); ordPty(Pty+Set,"cbt maneuver"); return; case 3: if(isg4){ //isg4 of ordPty() b2=rdmChr(atCoo,9,19,Adv+Set); c2=E6; //E6 of rdmChr() System.arraycopy(Z6,1,z1,1,c2); e2=0; if(b2>0 && mob(b2)0) //adv engaged by bst(s) break; } //for(a2=1; if(e2==0){ x4=OrdPty; y4=2; //don't reset ordPty() flgs in case 1: ini.s txt("063"); rpt("263one must move to(ward) sq2"); return; } //if(e2==0 } //if(isg4 y2++; case 4: txt("011"); y2++; case 5: x2=0; //rout rtn go(); } //switch(y2 } //advOrg mth //var lvl 3 routines void pikItm(int val){ if(x3!=PikItm) y3=1; switch(y3){ case 1: x3=PikItm; //~adv.s only - similar bst opts in bstAtk() a3=val; //~var inis loc iaw entry pt case 5: y3++; case 2: txt("011"); itmElm=0; y3++; pikChr(a3,"item user"); return; case 3: if(key6$=='\b'){ x3=0; //rout rtn go(); return; } //if(key6$=='\b' srcChr=atkSrc=newChr; if(rdmChr(atCoo,valOut(srcChr,ChrSq),C9,Any)!=srcChr || D6>1) //C9 of valOut(), D6 of rdmChr() movChr(srcChr,C6); //C6 of rdmChr(): sho mkr for atkr on top of any stack temporarily if(isCbt && wrdOut(srcChr,ChrCtl).equals("a") //qual in val arg, but not shoAdv() chgs || !isUp(srcChr) || !isOp(srcChr) || pri(srcChr)>=bstCat){ //~|| !isPst && pst<2 x3=0; //rout rtn rpt("211"+(sex(srcChr)?"s":"")+"he's inactive now"); return; } //if(modWd(srcChr)<1 || if(itmElm>0){ y3+=2; pikItm(0); return; } //if(itmElm>0 y3++; case 4: y3+=2; //comp for y3-- in reTrd() shoAdv(itmGrp,"object to use?"); return; case 5: //entry pt for failed tryId() itm activation if(newChr!=srcChr){ //chks for newChr alt by keyed shoAdv()s y3-=2; pikItm(0); return; } //if(newChr!=srcChr b3=itmElm; atkTgt=-1; //ini var flg to pik tgt if(key7$=='\b' || b3=0 || wrdOut(b3,ItmTyp).equals("Propeller")){ isa3=false; txt("121 Choose 'weapon attack' from combat round menu"); } //if("weapon,ammo".indexOf(wrdOut(b3,ItmCla).substring(1))>=0 || if(d3==splItm) //vs atkSpl>0; excls SplMR atkItm if(wrdOut(atkItm,ItmOpn).equals("fail")){ isa3=false; txt("121 Spell disabled by prior failure."); } //if(wrdOut(atkItm, if(d3==spiItm || d3==potItm){ eq(c3$,d3==spiItm?"spice":"potion"); e3=itmGrp; while(e3<=arySiz && locElm(e3,ItmOwn,str(a3$))>0){ e3=elmNum; if(wrdOut(e3,ItmCla).equals("fx") && wrdOut(pri(e3),ItmSrc).equals(str(c3$))){ isa3=false; txt("121 Already have "+c3$+" fx."); break; } //if(wrdOut(e3,ItmCla).equals("fx") && e3++; } //while(e3<=arySiz && } //if(d3==spiItm || if(isa3 && atkSpl>0) //(non-)cbt spl denial isa3=isCbt?"SbdChkUnpHeaPrfStl".indexOf(str(b3$))<0 //only noncbt :"ExpShkPsnTmtFbrDrnBlaTngSwnBlf".indexOf(str(b3$))<0; //only cbt if(isa3 && (isCbt && d3==potItm || !isCbt && atkTyp==Dvc)) isa3=false; if(isa3){ //spl lim by phase if(x1==RndOne && x2==0) isa3=atkSpl==Chk; if(x2==TryNgo) isa3=atkSpl==Sbd; } //if(isa3 if(isa3) //qual by spl switch(atkSpl){ case Chk: isa3=x1==RndOne && x2==0; break; case Sbd: isa3=x2==TryNgo && !has(-srcChr,"Sbd","fx"); //may cast once only per ngo break; case Bgl: if(hdg(atkSrc,"Bgl")){ f3=elmNum; //elmNum of hdg() isa3=false; txt("121"+wrdOut(f3,ItmOwn)+" has "+chrNam(atkSrc)+"'s Bgl fx."); } //if(hdg(atkSrc, break; case Blf: if(valOut(atkSrc,ChrSq)>X){ isa3=false; txt("121Caster must be on friendly ground."); } //if(valOut(atkSrc,ChrSq)>X break; } //switch(atkSpl //~misc addl qual (eg. tgt of Unp has PsnWd fx) if(isa3){ y3=20; pikItm(0); return; } //if(isa3 if(x2==TryId){ useItm(); return; } //if(x2==TryId y3++; case 11: y3-=9; rpt("211 use disallowed here - hit a key"); return; case 20: //det tgt'g atkRng=Eng; if(d3==splItm && "ExpBlaSwnBlfBgl".indexOf(str(b3$))>=0) atkRng=Msl; eq(c3$,wrdOut(b3,ItmTyp)); if(d3==dvcItm && (atkMtl==Gas || atkMtl==Flr)) atkRng=Msl; e3=Any; //pik tgt chr args default if(atkSpl>0 && "ExpShkPsnTmtFbrDrnBlaTngBlf".indexOf(str(b3$))>=0) e3=Foe; if(atkSpl>0 && "UnpAidHeaSwn".indexOf(str(b3$))>=0) e3+=Out; if("Spellbind,Check,Gas Bomb,Flare,".indexOf(str(c3$))>=0 || d3==spiItm || d3==potItm) //~?others atkTgt=Nah; if(atkTgt>=Nah){ //tgt already pik'd, or not req y3=30; pikItm(0); return; } //if(atkTgt>=Nah y3++; case 21: y3++; pikChr(e3,"choose tgt chr"); return; case 22: if(key6$=='\b'){ x3=0; //abort go(); return; } //if(key6$=='\b' atkTgt=newChr; c3$.setLength(0); //note chks in precedence if(atkSpl==Hea && modWd(atkTgt)<1) eq(c3$,"unconscious tgt can't be Healed"); if(atkSpl==Prf || atkSpl==Stl){ f3=3*(atkSpl-1); if(has(atkTgt,SplAbr$.substring(f3,f3+3),"fx")){ eq(xsA,SplElm$); eq(c3$,"tgt already "+wrdOut(xsA,atkSpl)+"'d"); } //if(has(atkTgt,SplAbr$. } //if(atkSpl==Prf || f3=valOut(atkTgt,ChrSq); g3=valOut(srcChr,ChrSq); if(f3>X!=g3>X && (f3>6 && f316 || g3>6 && g316) || atkRng==Eng && !isBy(f3,g3) || atkMtl==Acd && (f3<11 || f3>13)) eq(c3$,"tgt out of range"); if(c3$.length()>0){ y3--; rpt("211 "+c3$); return; } //if(c3$.length()>0 y3=30; case 30: if(isCbt && x2!=TryDtp) //allow for pot oprChr chg reSet(srcChr,Nah); //mrk user adv acted useItm(); } //switch(y3 } //pikItm mth void useItm(){ //uses atkItm (may be 0 if atkWpn preset), atkSrc (may be trvChr), //isa3 of pikItm, optionally atkTgt if(x3!=UseItm) y3=1; switch(y3){ case 1: x3=UseItm; b3=c3=0; //ini brch cond key3$='?'; //ini adv term flg splWds=0; //ini #Spent Wds if(atkItm5){ x3=0; eq(atkItm,Fre$); txt("041"); rpt("241"+a3$+" fails!"); return; } //if(c3==dvcItm && e3=0; g3=+wrdOut(atkSrc,ChrTyp).charAt(0); if(c3==spiItm && g3==+'T' || c3==potItm && g3==+'H' || c3==scrItm && g3==+'W') e3++; if(valOut(atkItm,ItmId)==0) e3++; if(e3>1 || c3!=spiItm && c3!=potItm && c3!=scrItm){ y3+=2; useItm(); return; } //if(e3>1 || y3++; aDie("item trial"); if(isInp) return; case 3: e3=a6-e3; //a6 of aDie() //e3=5; //~test ln if(e3>4){ //if fail 1D roll for itm use badUse(); return; } //if(e3>4 if(x2==TryId && !isa3){ //tryId() unusable itm (cbt scroll) failure eq(atkItm,Fre$); x3=0; //abort txt("011"); rpt("211 use disallowed here - item lost"); return; } //if(x2==TryId && y3++; case 4: y3++; //txt("263Gotcha. "+wrdOut(b3,ItmTyp)); return; //~test ln if(atkSpl>0){ if(has(atkSrc,"SplMR","fx") && elmNum!=atkItm){ e3=elmNum; f3=locElm(chrGrp,ChrNam,wrdOut(e3,ItmLoc)); //~if(pri(f3)<=advCat && modWd(f3)>0 && !has(f3,"Swn","fx")) //~?bsts never cancel //~addTo(f3,ChrEp,3*dig(SplCst$,valOut(e3,ItmId)-1)); //get ep for cancel eq(b3$,wrdOut(e3,ItmBon)); eq(e3,Fre$); //cancel held fx if not used rpt("211"+chrNam(atkSrc) +" cancelled holding "+b3$+" spell vs "+chrNam(f3)); return; } //if(has(atkSrc,"SplMR","fx") && if(hdg(atkSrc,"Tng")){ //~?(atkSpl==Tng && e3=elmNum; //elmNum of hdg() eq(b3$,wrdOut(e3,ItmOwn)); eq(e3,Fre$); rpt("211"+chrNam(atkSrc)+" released "+b3$+" Tng fx."); return; } //if(hdg(atkSrc, } //if(atkSpl>0 case 5: y3++; isc3=getPst(atkSrc)<2 && D7Rdy && (isc3 || isd3 || has(atkSrc,"Hey","fx"))){ //!isCbt= Steps (feaVar 2) eq(c3$,isc3?"prone":(isd3?"offside":"dazed")); //or on opp gnd or has Flare fx e3=dig(dic(1,str(c3$)),0); if(e3>4 || e3>3 && atkTyp==Mgc || e3>2 && atkTyp==Dvc){ //~?other itms' lims if(atkTyp==Dvc) eq(atkItm,Fre$); atkTyp=Nop; //flg to hlt mult atks in advAtk() x3=0; //rout rtn rpt("233"+c3$+" attacker distracted."); return; } //if(e3>4 || } //if(isCbt && case 6: if(c3!=scrItm){ y3+=3; useItm(); return; } //if(c3!=scrItm isc3=true; //ini scr success flg f3=g3==+'W'?4:(g3==+'T'?3:2); y3++; tskRol(atkSrc,modRv(atkSrc),f3,Rv,"scroll use"); if(isInp) return; case 7: if(key6$=='\b'){ //key6$ of tskRol() key3$=key6$; isc3=false; y3+=6; useItm(); return; } //if(key6$=='\b' e3=dig(tsk(die$),0); if(e3>f3) if(modWd(atkSrc)>1){ splWds=1; addTo(atkSrc,ChrHit,splWds); addItm(atkSrc,locItm(itmPoo,"SpnWd","fx")); dtaIn(elmNum,ItmOpn,"997"); addTo(elmNum,ItmBon,splWds); } //if(modWd(atkSrc)>1 else{ isc3=false; eq(atkItm,Fre$); } //else(modWd(atkSrc)>1 y3++; case 8: y3++; if(isc3) y3+=4; //rout rtn txt("122"+splWds+" Spent Wd lost."); rpt("211Scroll use "+(isc3?"succeeds.":"fails.")); return; case 9: if(c3==splItm){ //vs (atkSpl>0) since setAtk() for SplMR fx, scroll sets atkSpl too y3++; splPay(); } //if(c3==splItm else{ y3+=2; useItm(); } //else(c3==splItm return; case 10: isc3=isb5; //isb5= spl suc of splPay() if(key5$=='\b'){ //key5$ of splPay() key3$=key5$; y3+=3; //rout rtn useItm(); return; } //if(key5$=='\b' y3++; if(isc3 && c3==splItm && d3<=advCat){ //gain ep for spell cast e3=2*dig(SplCst$,b3-c3); addTo(atkSrc,ChrEp,e3); rpt("263 "+chrNam(atkSrc)+" gains "+e3+" ep"); return; } //if(isc3 && case 11: isb3=bf[5]>0 && atkTyp==Cbt && atkRng==Eng && atkTgt>=chrGrp && pri(atkTgt)<=advCat; if(!isb3){ y3+=2; useItm(); return; } //if(!isb3 eq(b3$,"Last stand"); txt("121"+chrNam(atkTgt)+" use "+b3$+" (or Bksp)"); y3++; pikChr(Pty,str(b3$)+" redirect tgt"); //~?new tgt must be consc Pty return; case 12: if(key6$!='\b' && isb3 && !isBy(valOut(atkSrc,ChrSq),valOut(newChr,ChrSq))){ y3--; rpt("231Invalid tgt (hit a key)."); return; } //if(key6$!='\b' && if(key6$!='\b') atkTgt=newChr; y3++; case 13: txt("011"); if(key3$=='\b') reSet(atkSrc,Set); //mrk adv unacted x3=0; //cont rout prog if((c3==splItm || c3==scrItm) && !isc3) //attempt failed or terminated go(); else doItm(); } //switch(y3 } //useItm mth void badUse(){ if(x3!=BadUse) y3=1; switch(y3){ case 1: x3=BadUse; b3=pri(atkItm); c3=itmCat(b3); eq(a3$,wrdOut(b3,ItmTyp)); txt("011"); y3++; case 2: y3=c3==magWpn || c3==magAmr?10 :(c3==spiItm?20:(c3==potItm?30:40)); //40= scrItm rpt("211"+a3$+' '+wrdOut(b3,ItmCla)+" malfunctions!"); return; case 10: //wpn/amr degrade called by tryId() y3=50; addTo(atkItm,ItmBon,-1); d3=D7; //D7 of addTo() if(d3<1) txt("211"+a3$+" destroyed"); else txt("211"+a3$+" magic bonus reduced to "+d3); return; case 20: eq(atkItm,Fre$); //rmv Spice itm y3=50; addItm(atkSrc,locItm(itmPoo,"Wha","fx")); dtaIn(elmNum,ItmOpn,"991"); //elmNum of addItm() txt("211"+chrNam(atkSrc)+" disoriented while in tile."); return; case 30: eq(atkItm,Fre$); //rmv potion itm eq(aim$,"1"); //ini psn wds tally d3=1; //ini #psn wds while(dig(dic(1,"Psn "+d3),0)>2){ d3++; aim$.append('1'); } //while(dig(dic(1, y3++; case 31: y3=50; setAtk(Dvc,-1); atkMtl=Pwd; atkTgt=atkSrc; atkSrc=trvChr; atkVs(Nah,"potion poison"); return; case 40: isa3=wrdOut(atkItm,ItmCod).equals("Trans"); a3=isa3?-3:3; eq(a3$,(isa3?"im":"ex")+"plosion"); eq(atkItm,Fre$); //rmv scroll itm d3=e3=atkSrc; atkSrc=trvChr; setAtk(Mgc,-1); atkSpl=Exp; dieWgt=1; y3++; case 41: newChr=e3; //user hit last do{ atkTgt=e3=nxtChr(atCoo,Any+Out); isb3=!isa3 && modWd(e3)>0 || isa3 && hav(e3,"SpnWd","fx") || hav(e3,"^"+ItmNat,"magic"); }while(!isb3 && d3!=e3); if(!isb3 && d3==e3){ y3=50; badUse(); return; } //if(!isb3 && y3++; atkVs(a3,str(a3$)); return; case 42: rcd$.setLength(0); if(!isRv){ eq(b3$,cut(wrdOut(e3,ChrNam))); f3=itmGrp; while(f3<=arySiz && locElm(f3,ItmOwn,str(b3$))>0){ f3=g3=elmNum; h3=pri(g3); if(wrdOut(h3,ItmNat).equals("magic") //~? && itmCat(g3)!=oddItm && dig(dic(1,"itm sv"),0)>(valOut(f3,ItmId)!=0?4:5)){ if(inScb(g3)){ g3=elmNum; //elmNum= Sheath itm elm of inScb() h3=pri(g3); } //if(inScb(g3) rcd$.append(chrNam(e3)+" loses "+wrdOut(h3,ItmNat)+' ' +wrdOut(h3,ItmTyp)+' '+wrdOut(h3,ItmCla)+Div$); eq(g3,Fre$); } //if(wrdOut(h3,ItmNat).equals("magic") && f3++; } //while(f3<=arySiz && } //if(!isRv if(isa3 && has(e3,"SpnWd","fx")){ f3=elmNum; g3=Math.min(5,valOut(f3,ItmBon)>>1); addTo(f3,ItmBon,-g3); addTo(e3,ChrHit,-g3); //~?or req ord Healing rcd$.append(chrNam(e3)+" has "+g3+" Spent Wound(s) restored!"+Div$); } //if(isa3 && if(e3==d3) y3=50; else y3--; if(rcd$.length()>0){ rpt("211"+rcd$); rcd$.setLength(0); } //if(rcd$.length()>0 else badUse(); return; case 50: x3=0; //rout rtn go(); } //switch(y3 } //badUse mth void doItm(){ //uses: atkItm,atkSpl,atkAmo,atkSrc,atkTgt if(x3!=DoItm) y3=1; switch(y3){ case 1: x3=DoItm; y3++; case 2: if(atkCmp==Wpn){ //incls all atkItm=0 atks (note nxt a3=, b3=) doWpn(); //prc all cbt atks incl Bst1, Una; not only wpn itms return; } //if(atkCmp==Wpn a3=pri(atkItm); b3=itmCat(a3); if(atkSpl>0) doSpl(); else if(b3==spiItm) doSpi(); else if(b3==potItm) doPot(); else if(b3==dvcItm) doDvc(); else{ x3=0; //rout rtn go(); } //else(b3==dvcItm } //switch(y3 } //doItm mth void doWpn(){ //call for any atkCmp==Cbt atk - uses: all atk_ vars; no _2s passed if(x3!=DoWpn) y3=1; switch(y3){ case 1: x3=DoWpn; txt("011"); txt("053"); eq(a3$,chrNam(atkSrc)); a3=B7; //B7=pri(atkSrc) of chrNam() d3=valOut(atkSrc,ChrSq); isa3=has(atkSrc,"Tng","fx"); if(!isa3 || atkWpn==Una || a3>advCat){ //bsts prov in bstAtk() y3+=3; doWpn(); return; } //if(!isa3 || y3++; case 2: y3++; txt("111"+a3$+" is Tangled"); txt("2210) check attack 1) make unarmed attack"); return; case 3: txt("011"); if(inpVal!=1){ reSet(atkSrc,Set); //mrk atkg chr unacted y3+=6; //sbr rtn doWpn(); return; } //if(inpVal!=1 y3++; case 4: if(isa3 && atkTyp==Cbt && has(atkSrc,"","weapon")){ //Tng fx on wpn use givItm(trvChr,elmNum,All); //elmNum of has() if(elmNum>0){ //elmNum of givItm() dtaIn(elmNum,ItmOpn,Brk$); dtaIn(elmNum,ItmLoc,""+(isStk?d3:(d30 setAtk(Cbt,Una); //assumes tgt= adj caster } //if(isa3 if(atkRng==Msl && bf[4]>0){ //% to hit on-side chr isa3=isPty(atkSrc); if(d3>3 && isa3 || d3>13){ b3=rdmChr(atCoo,isa3?1:11,isa3?3:13,isa3?Pty:Foe); if(b3>0 && dig(dic(1,"hit frnd"),0)>=bf[4]){ atkTgt=b3; y3++; rpt("211Missile weapon hits "+chrNam(b3)+"!"); return; } //if(b3>0 && } //if(d3>3 && } //if(bf[4]>0 && if(atkRng==Msl && chkPot(atkTgt,"Egy")){ if(isA6){ //_6s of chkPot() y3+=4; eq(a4$,"1"); //no drop wpn chk req } //if(isA6 else y3++; txt("041"); rpt("241"+A6$); return; } //if(atkRng==Msl && y3++; case 5: y3++; if(atkSrc==trvChr){ eq(xsA,WpnElm$); eq(b3$,wrdOut(xsA,atkWpn)); doWpn(); return; } //if(atkSrc==trvChr //pass'g dieWgt if(atkItm>=itmGrp){ b3=pri(atkItm); eq(b3$,wrdOut(b3,ItmTyp)); if(a3<=advCat){ dieWgt=1; if(hav(atkSrc,str(b3$),"skill")) dieWgt+=valOut(elmNum,ItmBon); //elmNum of hav() if(str(b3$).equals("Hex Dagger")){ addItm(atkSrc,locItm(itmPoo,"Dagger","=weapon")); c3=elmNum; //elmNum of addItm() dtaIn(c3,ItmLoc,wrdOut(atkItm,ItmLoc)); eq(atkItm,Fre$); atkItm=c3; dieWgt=hav(atkSrc,"Dagger","skill")?5*valOut(elmNum,ItmBon):0; } //if(str(B3$).equals("Hex Dagger" if(wrdOut(b3,ItmNat).equals("magic")) if(valOut(atkItm,ItmId)==0) dieWgt+=valOut(atkItm,ItmBon); else dieWgt++; //unId'd wpn used as +1 if(atkAmo>0 && wrdOut(pri(atkAmo),ItmNat).equals("magic")) if(valOut(atkAmo,ItmId)==0) dieWgt+=valOut(atkAmo,ItmBon); else dieWgt++; //unId'd aro used as +1 if(isThf || isWzd) dieWgt+=2; } //if(a3<=advCat dieWgt+=lr[6]; //bsts' dieWgt of bstCap() } //if(atkItm>=itmGrp else{ eq(b3$,atkWpn==Bst2 || atkRng==Msl && has(atkSrc,"Mgt","fx")? "Rocks":(atkWpn==Una?"unarmed":"beast")); if(atkWpn==Una){ c3=modWd(atkSrc); if(c3==99){ genWd(-atkSrc); //rng calc only c3=F6; //F6 of genWd() } //if(c3==99 dieWgt=(c3+3)/4; //rounds up if(has(atkSrc,"Mgt","fx")) if(atkRng==Eng){ if(chkPot(atkSrc,"Mgt") && isA6){ dieWgt=modWd(atkSrc); c3=0; while(has(atkSrc,"Tng","fx")){ c3++; eq(elmNum,Fre$); //elmNum of has() } //while(has(atkSrc,"Tng","fx" } //if(chkPot(atkSrc,"Mgt") && txt("041"); txt("141"+A6$+(isA6 && c3>0?" & Snaps "+c3+" Tangle(s).":".")); } //if(atkRng==Eng else //atkRng=Msl (fx roll in advAtk()) dieWgt=3; //hurl rocks @3*2 } //if(atkWpn==Una } //else(atkItm>=itmGrp if(isPty(atkSrc)!=(d3=0 || atkWpn>0 && str(c3$).indexOf(WpnCod$.charAt(atkWpn-1))>=0) dieWgt+=valOut(c3,ItmBon); } //if(has(atkTgt,"WpVul","fx" dieWgt=Math.max(1,dieWgt); //.max(1, for bf[], lr[] mods dieWgt=Math.max(0,dieWgt+sklMod(atkSrc,atkWpn)); //dieWgt=99; //~test ln case 6: y3++; a3=Nah; atkVs(a3,str(b3$)); return; case 7: if(a4$.length()<1){ //player hit bksp wo inp from atkVs() reSet(atkSrc,Set); //mrk atkg chr unacted y3+=2; doWpn(); return; } //if(a4$.length()<1 y3++; if(atkAmo>=itmGrp && wrdOut(atkAmo,ItmCod).equals("Psn A") && hitSum>0 && modWd(atkTgt)>0){ dtaIn(trvChr,ChrGen,""+atkSrc); //prov for ep attrib atkSrc=trvChr; a3=atkAmo; //hold setAtk(Dvc,Pwd); atkAmo=a3; //rcvr dieWgt=hitSum; a3=Nah; //~?poss SV atkVs(a3,"arrow Poison"); return; } //if(atkAmo>=itmGrp && case 8: /*~?nec - ?can't be generalized //if atkr= trvChr, del atkItm ~repl .equals("Psn A") blw if(atkSrc==trvChr && (atkItm>0 || atkAmo>0)) eq(atkItm,Fre$); else{ //chk amo xfr, brk/drp wpn //*/ elmNum=atkAmo>=itmGrp?atkAmo:atkItm; //ini as flg for poss itm del in givItm(trvChr, //xfr msl wpn itm to trove-chr owner if(atkRng>=Msl){ a3=elmNum; if(a3>=itmGrp) //vs Bst2 msl //~ if(a3==atkAmo && wrdOut(a3,ItmCla).charAt(0)=='=' && dig(dic(1,"brk aro"),0)>5){ //~test cond //~ if(a3==atkAmo && wrdOut(pri(a3),ItmNat).equals("standard") && ran(6)>5){ //~alt if(a3==atkAmo && wrdOut(a3,ItmCod).equals("Psn A")){ //single use itm //~ || wrdOut(a3,ItmCla).charAt(0)=='=' && ran(6)>5)){ //hidden breakage roll //~ addTo(a3,ItmBon,-1); //decr #arrows in itm //~ if(D7<1) //D7 of addTo() eq(a3,Fre$); } //if(a3==atkAmo && else{ givItm(trvChr,a3,1); //~note: thrown wpn result chg-> occ sq if dropped blw if(elmNum>0){ //elmNum of givItm() b3=elmNum; dtaIn(b3,ItmLoc,"0"); //remote trove itms loc=sq0 if(a3==atkItm || wrdOut(a3,ItmCla).charAt(0)=='+') //alt: || wrdOut(pri(a3),ItmRep).equals("mul") atkItm=b3; //prep for drop wpn loc sq chg if nec if(a3==atkAmo) dtaIn(b3,ItmOpn,Brk$); //& chk Aro for breakage when recovered } //if(elmNum>0 } //else(a3==atkAmo && } //if(atkRng>=Msl y3++; //eq(a4$,"6"); //~test ln //check for drop wpn if(atkSrc!=trvChr && dig(tsk(a4$),0)>5 && dig(dic(1,"bad try"),0)>=drpWpn){ //a4$ of hitVs() atkTyp=Nop; //flg to hlt mult atks in advAtk() if(atkItm=Bst1 bkdn? addItm(atkSrc,locItm(itmPoo,"Oop","fx")); dtaIn(elmNum,ItmOpn,""+(rndCnt+1)); //elmNum of addItm() eq(c3$," falters & is stunned."); } //if(atkItm0){ givItm(trvChr,atkItm,1); //~not (,,All) in case of acu(?) wpn if(elmNum>0){ //elmNum of givItm() a3=valOut(atkSrc,ChrSq); dtaIn(elmNum,ItmLoc,""+(isStk?a3:(a30 } //if(elmNum>0 eq(c3$," fumbles & drops "+b3$+'.'); } //else(atkItm=chrGrp?valOut(atkTgt,ChrSq):0; //hold: may chg if !isStk & tgt dies y3++; case 2: switch(atkSpl){ //atkSpl of setAtk() case Sbd: a3=-1; break; case Chk: a3=-1; break; case Exp: dieWgt=1; c3=d3=atkTgt; break; case Shk: eq(aim$,"1"); break; case Psn: b3=900; //PsnWd fx asgn'd in hitVs() (for psn Dvc types) dieWgt=3; break; case Unp: y3=b3; doSpl(); return; case Tmt: a3=-a3; break; case Fbr: dieWgt=4; break; case Drn: a3=-a3; break; case Bla: a3=-a3; break; case Aid: y3=b3; doSpl(); return; case Hea: y3=b3; doSpl(); return; case Prf: y3=b3; doSpl(); return; case Stl: y3=b3; doSpl(); return; case Tng: a3=-a3; break; case Swn: a3=-a3; break; case Blf: dieWgt=6; break; case Bgl: a3=-a3; break; } //switch(atkSpl y3++; case 3: if(atkSpl==Sbd || atkSpl==Chk){ e3=-1; //find bst atkTgt w highest Rv g3=nxtChr(atCoo,Foe); if(g3>=chrGrp) do{ f3=modRv(newChr); if(f3>e3){ e3=f3; atkTgt=newChr; } //if(f3>e3 }while(nxtChr(atCoo,Foe)!=g3); else{ atkTgt=trvChr; e3=modRv(trvChr); } //else(g3>=chrGrp txt("153high beast Rv= "+e3); } //if(atkSpl=Sbd || y3++; case 4: y3++; //common spell loc: subseq spl effect y3= b3 atkVs(a3,wrdOut(pri(atkItm),ItmTyp)); return; case 5: isa3=isRv; isc3=isa3 && d4==2; //d4 of atkVs()= caster holding spell isb3=(atkSpl==Sbd || atkSpl==Chk); //Rv fail rslts pgm'd too if(isa3 && !isb3) y3=900; else y3=b3; doSpl(); return; case 10: //Sbd c3=isa3?0:(dig(dic(1,"Sbd add"),0)-1)/2+1; addItm(atkSrc,locItm(itmPoo,"Sbd","fx")); dtaIn(elmNum,ItmBon,"+"+c3); //log 1 try (bon +0 if fail) y3=900; rpt("263Spellbind bonus +"+c3); return; case 20: //Chk //isa3=true; //~test ln if(isa3){ is1st=true; txt("153 Check resisted - beasts attack!"); } //if(isa3 else{ //Check succeeds: recover Bgl'd advs c3=rdmChr(atCoo,9,19,Foe); for(c3=1;c3<=D6;c3++) //_6s of rdmChr() if(pri(Z6[c3])<=advCat) dtaIn(Z6[c3],ChrCtl,"a"); //mark room Disturbed c3=mazMap+(rtnCoo>0?rtnCoo%C:atCooRow); d3=rtnCoo>0?rtnCoo/C:atCooCol; eq(a3$,wrdOut(c3,d3)); e3=str(a3$).indexOf('A'); if(e3<0) a3$.append('D'); else insStr(a3$,e3,"D"); //ins 'D' pre-'A' pty mkr (if coo occ'd) dtaIn(c3,d3,str(a3$)); //encEp=0; isCbt=false; //~unnec: skips chkVlt() rmvChr(atCoo,Foe,All); //rmv any foe, incl unconsc foe bakOut(); shoMap(); shoFld(atCoo); } //else(isa3 y3=900; doSpl(); return; case 30: //Exp newChr=d3; while(nxtChr(atCoo,Any+Out)!=c3 && modWd(newChr)<1) //brk if c3 or alive ; //hits Swooned chrs if(newChr==c3){ y3=900; doSpl(); return; } //if(newChr==c3 atkTgt=d3=newChr; atkVs(3,"Explosion"); return; case 40: //Shk isa3=isUp(atkTgt); eq(a3$,chrNam(atkTgt)+" is "+(isa3?"stunned":"zapped")); eq(b3$,"."); addItm(atkTgt,locItm(itmPoo,"Shk","fx")); //even if tgt knocked out c3=elmNum; isb3=x2==BstAtk; d3=isa3?1:0; dtaIn(c3,ItmOpn,(isb3?"0":"")+(rndCnt+d3)); if(isa3 && has(atkTgt,"","weapon") && dig(dic(1,"drop wp"),0)>5){ c3=elmNum; //elmNum of has() eq(b3$," & drops "+wrdOut(pri(c3),ItmTyp)+'.'); givItm(trvChr,c3,1); if(elmNum>0){ //elmNum of givItm() c3=valOut(atkTgt,ChrSq); dtaIn(elmNum,ItmLoc,""+(isStk?c3:(c30 } //if(isa3 && y3=900; txt("041"); rpt("241"+a3$.append(b3$)); return; case 70: //Tmt c3=splWds>0?12:5; isa3=isFoe(atkTgt); if(isa3){ addItm(trvChr,locItm(itmPoo,"Tmt","fx")); dtaIn(elmNum,ItmOpn,"991"); dtaIn(elmNum,ItmBon,""+c3); } //if(isa3 else{ d3=rdmChr(atCoo,9,19,Pty+Out); for(d3=1;d3<=D6;d3++) if(hav(Math.abs(Z6[d3]),"Crowns","cash")){ e3=elmNum; f3=(valOut(e3,ItmBon)*c3+9)/X; dtaIn(e3,ItmBon,""+f3); } //if(has(Math.abs(Z6[d3]),"Crowns","cash" } //else(isa3 y3=900; rpt("211Transmutes "+(isa3?"beast":"adventurer")+" Crowns "+(c3>5?"+20%":"-50%")); return; case 80: //Fbr if(isa3 || hitSum<3){ y3=900; doSpl(); return; } //if(hitSum<3 d3=c3-1; //chk sqs to either side if(!isBy(c3,d3) || C8!=D8) //not in same rank: _8s of isBy() d3=c3; e3=c3+1; if(!isBy(c3,e3) || C8!=D8) e3=c3; d3=rdmChr(atCoo,d3,e3,Any); //load Z6[] chr ary e3=E6; //E6 of rdmChr() System.arraycopy(Z6,1,z3,1,e3); d3=1; //ini ary elm ptr f3=atkTgt; //don't atk 1st tgt twice y3++; case 81: y3++; atkTgt=z3[d3]; if(d3<=e3 && f3!=atkTgt){ dieWgt=2; atkVs(3,"Firebreath"); return; } //if(d3<=e3 && case 82: if(++d3>e3) y3=900; else y3--; doSpl(); return; case 90: //Drn y3=900; if(valOut(atkTgt,ChrWd)==99) genWd(atkTgt); dieWgt=modWd(atkTgt); atkVs(Nah,"Drain"); return; case 100: //Bla y3=900; c3=(lowDic(dic(2,"Blast"),X)+2)/3; eq(aim$,"1111".substring(4-c3)); atkVs(Nah,"Blast"); return; case 110: //Aid c3=Math.abs(dig(dic(2,"Aid dif"),0)-dig(die$,1)); y3=500; doSpl(); return; case 120: //Hea c3=1; //ini #wds healed d3=valOut(atkTgt,ChrHit); if(has(atkTgt,"SpnWd","fx")) d3-=valOut(elmNum,ItmBon); //elmNum of has() while(c3<=d3 && dig(dic(1,"Heal "+c3),0)<6) c3++; y3=500; doSpl(); return; case 130: //Prf eq(a3$,"Proof"); isa3=true; //Prf vs Stl flg y3=600; doSpl(); return; case 140: //Stl eq(a3$,"Steel"); isa3=false; //Stl vs Prf flg y3=600; doSpl(); return; case 150: //Tng eq(a3$,chrNam(atkTgt)); addItm(atkTgt,locItm(itmPoo,"Tng","fx")); d3=elmNum; //elmNum of addItm() dtaIn(d3,ItmOpn,"900"); //fx expires in chkVlt(), after cbt dtaIn(d3,ItmLoc,cut(wrdOut(atkSrc,ChrNam))); //ref src chr y3=900; rpt("221"+a3$+" Tangled by "+chrNam(atkSrc)+'.'); return; case 160: //Swn y3=900; eq(a3$,chrNam(atkTgt)); d3=B7; //B7=pri(atkTgt) of chrNam() if(has(atkTgt,"Swn","fx")){ eq(elmNum,Fre$); //elmNum of has() shoBst(atkTgt); movChr(atkTgt,valOut(atkTgt,ChrSq)); rpt("221Swoon Snapped: "+a3$+" reawakens!"); return; } //if(has(atkTgt,"Swn","fx" addItm(atkTgt,locItm(itmPoo,"Swn","fx")); dtaIn(elmNum,ItmOpn,"900"); //fx expires post-cbt in chkVlt(), elmNum of addItm() eq(a4$,a3$); if(d3>=bstCat) a4$.append(" "+wrdOut(d3,ChrTyp)); hitSum=d4=0; //#wds, Crush x4=HitVs; y4=15; hitVs(); return; case 170: //Blf if(isa3){ y3=900; doSpl(); return; } //if(d3<7 || d3=rdmChr(atCoo,c3,c3,Any); //load Z6[] chr ary e3=E6; //E6 of rdmChr() System.arraycopy(Z6,1,z3,1,e3); d3=c3+3; if(d3<7 || d3>13 && d3<17){ d3=rdmChr(atCoo,d3,d3,Any); System.arraycopy(Z6,1,z3,e3+1,E6); //E6 of rdmChr() e3+=E6; } //if(d3<7 || d3=1; //ini ary elm ptr f3=atkTgt; //don't atk 1st tgt twice y3++; case 171: y3++; atkTgt=z3[d3]; if(d3<=e3 && f3!=atkTgt){ atkVs(3,"Balefire"); return; } //if(d3<=e3 && case 172: if(++d3>e3) y3=900; else y3--; doSpl(); return; case 180: //Bgl y3++; if(has(atkTgt,"Bgl","fx")){ eq(elmNum,Fre$); //elmNum of has() dtaIn(atkTgt,ChrCtl,pri(atkTgt)>advCat?"b":"a"); //will be 'acted' doSpl(); return; } //if(has(atkTgt,"Bgl","fx" dtaIn(atkTgt,ChrCtl,wrdOut(atkSrc,ChrCtl)); //will be 'acted' addItm(atkTgt,locItm(itmPoo,"Bgl","fx")); d3=elmNum; //elmNum of addItm() dtaIn(d3,ItmOpn,"997"); //fx expires on maze exit dtaIn(d3,ItmLoc,cut(wrdOut(atkSrc,ChrNam))); //caster/controller noted case 181: y3=900; shoBst(atkTgt); shoFld(atCoo); eq(a3$,chrNam(atkTgt)); d3=B7; //B7=pri(atkTgt) of chrNam() if(!has(atkTgt,"Bgl","fx")){ rpt("221"+a3$+" regains control!"); return; } //if(!has(atkTgt,"Bgl","fx" eq(a4$,a3$); if(d3>=bstCat) a4$.append(" "+wrdOut(d3,ChrTyp)); hitSum=d4=0; //#wds, Crush x4=HitVs; y4=15; hitVs(); return; case 500: if(c3>0 && has(atkTgt,"FvrWd","fx")) c3=lowDic(dic(c3,"fvr blk"),valOut(elmNum,ItmBon)); isa3=atkSpl==Unp; h3=has(atkTgt,"SpnWd","fx")?valOut(elmNum,ItmBon):0; f3=valOut(atkTgt,ChrHit)-h3; //#normal wds (hits taken) if(!isa3){ d3=Math.min(c3,f3); addTo(atkTgt,ChrHit,-d3); txt("111Cured "+d3+" of "+f3+(h3>0?" normal (not Spent)":"")+" wound(s)."); } //if(!isa3 if(has(atkTgt,"PsnWd","fx") || isa3){ //order nec iaw short-circ prcg e3=elmNum; //elmNum of has() g3=e3>0?valOut(e3,ItmBon):0; if(!isa3) c3=Math.max(0,c3-(f3-g3)); d3=c3; if(c3>0 && g3>0){ addTo(e3,ItmBon,-c3); if(D7<1){ //D7= upd qty of addTo() d3+=D7; eq(e3,Fre$); } //if(D7<1 if(isa3) addTo(atkTgt,ChrHit,-d3); } //if(c3>0 && txt("121 "+(isa3?"Neutralized ":"Including ")+(g3>0?d3:0)+" of "+g3 +" Poison wound(s)."); } //if(has(atkTgt,"PsnWd","fx" shoBst(atkTgt); shoFld(atCoo); //in case uncons revived y3=900; rpt("245(hit a key)"); return; case 600: c3=(dig(dic(1,str(a3$)),0)+1)/2; addItm(atkTgt,locItm(itmPoo,isa3?"Prf":"Stl","fx")); d3=elmNum; //elmNum of addItm() dtaIn(d3,ItmBon,"+"+c3); dtaIn(d3,ItmOpn,"997"); shoBst(atkTgt); y3=900; rpt("221"+chrNam(atkTgt)+" gains +"+c3+" "+a3$+" bonus."); return; case 900: if(atkItm>0 && (!isc3 && wrdOut(atkItm,ItmCod).equals("SplMR") || itmCat(pri(atkItm))==scrItm)) eq(atkItm,Fre$); //itm kept til end of exe for poss ref x3=0; //rout rtn if(atkSpl==Chk && !isa3) //Chk succeeded chkVlt(); else go(); } //switch(y3 } //doSpl mth void doSpi(){ if(x3!=DoSpi) y3=1; switch(y3){ case 1: x3=DoSpi; eq(a3$,chrNam(atkSrc)); y3++; case 2: a3=a3-b3; //_3s of doItm() b3=3*a3; eq(b3$,"ZomDazGleFazBitYik".substring(b3,b3+3)); addItm(atkSrc,locItm(itmPoo,str(b3$),"fx")); dtaIn(elmNum,ItmOpn,"991"); //expire post-trove code y3=X*(a3+1); if(y3>X){ doSpi(); return; } //if(y3>X case 10: //Zhoom break; case 20: //Dhazh break; case 30: //Ghleze break; case 40: //Fhaze dtaIn(elmNum,ItmBon,"22"); //X*[def>2]+[2 dmg pt lmt] break; case 50: //Bhitz addItm(atkSrc,locItm(itmPoo,"Hits","fx")); //co-fx dtaIn(elmNum,ItmOpn,"991"); break; case 60: //Yhikez addItm(atkSrc,locItm(itmPoo,"ModRv","fx")); //co-fx dtaIn(elmNum,ItmOpn,"991"); dtaIn(elmNum,ItmBon,"+"+((dig(dic(1,"Rv bon"),0)+5)/3)); break; } //switch(y3 eq(atkItm,Fre$); //rmv source Spice itm x3=0; //rout rtn //eq(b3$,wrdOut(spiItm+a3,ItmTyp)); //~alt rpt("211"+a3$+" gains "+b3$+" spice fx."); } //doSpi mth void doPot(){ if(x3!=DoPot) y3=1; switch(y3){ case 1: x3=DoPot; eq(a3$,chrNam(atkSrc)); y3++; case 2: a3=a3-b3; //_3s of doItm() y3=X*(a3+1); if(y3>X){ doPot(); return; } //if(y3>X case 10: //Strength break; case 20: //Might break; case 30: //Power b3=0; //ini bon cntr y3++; case 31: y3+=2; //comp for y3-- in reTrd() shoAdv(itmGrp,"jewel to use?"); return; case 32: c3=itmElm; if(key7$=='\b'){ if(b3<1){ if(x2==TryId) //acc activ eq(atkItm,Fre$); //rmv source Potion itm x3=0; go(); return; } //if(b3<1 y3++; doPot(); return; } //if(key7$=='\b' if(newChr!=atkSrc || c35){ txt("132(no more allowed)"); y3++; } //if(dig(dic(1,"Pwr opn" else y3--; eq(c3,Fre$); rpt("211Jewels ingested= "+(++b3)); return; case 33: addItm(atkSrc,locItm(itmPoo,"ModWd","fx")); //co-fx c3=elmNum; //elmNum of addItm() dtaIn(c3,ItmOpn,"997"); dtaIn(c3,ItmBon,"+"+b3); //'+'= no auto elim of fx dtaIn(c3,ItmId,"Pwr"); txt("121 fx bonus +"+b3+" Wounds."); break; case 40: //Energy break; case 50: //Foresight break; case 60: //Alertness break; } //switch(y3 d3=3*a3; eq(b3$,"StrMgtPwrEgyFstAlr".substring(d3,d3+3)); addItm(atkSrc,locItm(itmPoo,str(b3$),"fx")); dtaIn(elmNum,ItmOpn,"997"); eq(atkItm,Fre$); //rmv source Potion itm x3=0; //rout rtn rpt("211"+a3$+" gains "+b3$+" potion fx."); } //doPot mth void doDvc(){ if(x3!=DoDvc) y3=1; switch(y3){ case 1: x3=DoDvc; txt("011"); eq(a3$,chrNam(atkTgt)); y3=X*atkMtl; doDvc(); return; case 10: //Gas y3++; txt("211Bomb: 1) both 1st ranks 2) opponent 2nd rank"); return; case 11: isa3=inpVal==1; a3=isa3?3:14; b3=isa3?13:16; a3=rdmChr(atCoo,a3,b3,Any); a3=0; //ini Z6[] elm ptr b3=E6; //E6 of rdmChr() c3=atkSrc; atkSrc=trvChr; dieWgt=5; y3++; case 12: if(++a3>b3){ y3=900; doDvc(); return; } //if(++a3>b3 dtaIn(trvChr,ChrGen,""+c3); //prov for ep attrib atkTgt=Z6[a3]; //Z6[] of rdmChr() atkVs(0,"Gas bomb"); return; case 20: //Flr a3=rdmChr(atCoo,valOut(atkSrc,ChrSq),By,Any); a3=0; //ini Z6[] elm ptr b3=locItm(itmPoo,"ModSkl","fx"); c3=rndCnt+1; y3++; case 21: if(Z6[++a3]<1){ //Z6[] of rdmChr() y3=900; doDvc(); return; } //if(Z6[++a3]<1 atkTgt=Z6[a3]; d3=(Ctl$.indexOf(wrdOut(atkTgt,ChrCtl))&1)-2; addItm(atkTgt,b3); e3=elmNum; //elmNum of addItm() dtaIn(e3,ItmOpn,""+c3); dtaIn(e3,ItmBon,""+d3); dtaIn(e3,ItmId,""+All); addItm(atkTgt,locItm(itmPoo,"Hey","fx")); dtaIn(elmNum,ItmOpn,""+c3); //elmNum of addItm() shoBst(atkTgt); rpt("211"+((a3&1)>0?" ":"")+chrNam(atkTgt)+" skills "+d3+" /poss dazed thru next rd"); return; case 30: //Acd isa3=false; //ini loop flg dieWgt=4; eq(b3$,"flask"); y3++; case 31: y3++; if(modDef(atkTgt)>0){ a3=B7; //B7=mgc arm elm of modDef() if(dig(dic(1,"def loss"),0)>4){ if(a3>0) addTo(a3,ItmBon,-1); else{ addItm(atkTgt,locItm(itmPoo,"ModDef","fx")); dtaIn(elmNum,ItmOpn,"997"); dtaIn(elmNum,ItmBon,"-1"); } //else(a3>0 txt("122"+a3$+" loses -1 from defense permanently!"); } //if(dig(dic(1,"def loss"),0)>4 } //if((modDef(atkTgt)>0 atkVs(0,"Acid "+b3$); return; case 32: if(isa3){ y3=900; doDvc(); return; } //if(isa3 y3++; if(hitSum>1){ addItm(atkTgt,locItm(itmPoo,"ModSkl","fx")); a3=elmNum; //elmNum of addItm() b3=1-hitSum; dtaIn(a3,ItmOpn,"900"); dtaIn(a3,ItmBon,""+b3); dtaIn(a3,ItmId,""+All); shoBst(atkTgt); rpt("211"+a3$+" suffers skills "+b3+" 'til combat ends"); return; } //if(hitSum>1 case 33: isa3=true; a3=valOut(atkTgt,ChrSq)-X; if(rdmChr(atCoo,a3,a3,Any)>=chrGrp){ atkTgt=elmNum; //elmNum of rdmChr() dtaIn(trvChr,ChrGen,""+atkSrc); //prov for ep attrib atkSrc=trvChr; atkMtl=Dmy; dieWgt=3; diePch=1; eq(a3$,chrNam(atkTgt)); eq(b3$,"splash"); y3-=2; } //if(rdmChr(atCoo,a3,a3,Any else y3=900; doDvc(); return; case 900: eq(atkItm,Fre$); x3=0; //rout rtn go(); } //switch(y3 } //doDvc mth void fxExp(int val){ //uses: atCoo fx only //fx exp arg: 0= prefixed rndCnts (eg. 04, 013, 0904, 0913), //1= rndCnt (eg. 4, 13, 904, 913), 900= eo cbt, 991= eo trv, 997= at lrg if(x3!=FxExp) y3=1; switch(y3){ case 1: x3=FxExp; a3=val; //0=eo advAtk, 1=eo spec rnd, 900= eo cbt, 991= eo trv d3=a3<900?rndCnt:a3; rcd$.setLength(0); //ini rpt() arg$ isInp=false; txt("041"); y3++; case 2: for(b3=chrGrp;b30){ c3=elmNum; if(str(a3$).startsWith(wrdOut(c3,ItmOwn)) && (a3>0 || wrdOut(c3,ItmOpn).charAt(0)=='0')){ e3=valOut(c3,ItmOpn); if(a3<900 && e3>900 && e3<991) e3-=900; //~e3%=100; eq(b3$,wrdOut(c3,ItmCod)); if(e3<=d3){ isa3=!str(b3$).equals("QkDrw"); isb3=isb3 || isa3; if(isa3) //don't msg QkDrw loss rcd$.append(chrNam(b3)+" loses "+b3$+" " +wrdOut(pri(c3),ItmSrc)+" fx."+Div$); if(str(b3$).equals("SplMR")){ e3=locElm(chrGrp,ChrNam,wrdOut(c3,ItmLoc)); eq(c3$,wrdOut(c3,ItmBon)); if(pri(e3)<=advCat && isUp(e3)){ f3=3*dig(SplCst$,SplAbr$.indexOf(str(c3$))/3); addTo(e3,ChrEp,f3); //get ep for cancel rcd$.append(chrNam(e3)+" gained "+f3+" ep for held "+c3$+" spell cancel."+Div$); } //if(pri(e3)<=advCat && } //if(str(b3$).equals("SplMR" eq(c3,Fre$); //rmv fx } //if(f3<=d3 if(isCbt && a3==900 && str(b3$).equals("Bgl") && pri(b3)<=advCat) rcd$.append(chrNam(b3)+" suppresses Bgl fx."+Div$); } //if(str(a3$).startsWith(wrdOut(c3,ItmOwn)) && c3++; } //while(c3<=arySiz && if(isb3 && b3!=trvChr) movChr(b3,valOut(b3,ChrSq)); //refresh affected fld mkrs (prior to showing msgs) } //if(valOut(b3,ChrCoo)==atCoo || y3++; isa3=rcd$.length()>0; if(isa3){ isInp=true; rpt("241"+rcd$); return; } //if(isa3 case 3: if(isa3) shoFld(atCoo); //rtn to typ dpy (in case of isStk prone over by movChr()) x3=0; //rout rtn if(isInp) go(); } //switch(y3 } //fxExp mth //var lvl 4 routines void pikAds(int num){ //acts on srcChr if(x4!=PikAds) y4=1; switch(y4){ case 1: x4=PikAds; a4=num; eq(a4$,wrdOut(pri(srcChr),ChrTyp)); //full typ nam b4$.setLength(0); //spells list holder eq(d4$,SplAbr$); eq(e4$,"Wd Rv Dag+Qsf+Bow+Hmr+Swd+Axe+"); f4$.setLength(0); eq(xsA,SplElm$); for(b4=1;b4<19;b4++) if(hav(srcChr,wrdOut(xsA,b4),"spell")){ f4$.append(" ").append(str(d4$).substring(3*(b4-1),3*b4)); } //if(hav(srcChr,wrdOut(xsA,b4),"spell") || //zero util ary for(b4=1;b48){ eq(c4$,str(d4$).substring(3*(b4-9),3*(b4-8))); txt("121known: "+f4$); txt("131added: "+b4$); } //if(b4>8 else eq(c4$,""+z4[b4]); if(a4==0) txt("161proceed: Ent"); else txt("161add to: Ent"); if(b4<9 && z4[b4]>0 || str(b4$).indexOf(str(c4$))>=0) txt("171take off: Bksp"); txt("181next pick: other"); txt("211"+a4+" left: add "+c4$+" to " +(b4<9?str(e4$).substring(4*(b4-1),4*b4):"Spells")); y4++; return; case 3: //chk adder & upd - loop back if(key4$=='\n' && a4>0){ key4$='?'; if(b4<9){ z4[b4]++; a4--; } //if(b4<9 if(b4>8 && str(b4$).indexOf(str(c4$))<0 && str(f4$).indexOf(str(c4$))<0){ b4$.append(c4$).append(" "); z4[9]++; a4--; } //if(b4>8 && } //if(key4$=='\n' else if(key4$=='\b'){ if(b4<9 && z4[b4]>0){ z4[b4]--; a4++; } //if(b4<9 && if(b4>8 && z4[9]>0){ d4=str(b4$).indexOf(str(c4$)); if(d4>=0){ z4[9]--; insStr(b4$,d4,d4+4,""); a4++; } //if(d4>=0 } //if(b4>8 && } //if(key4$=='\b' else b4=b4>25?1: (str(a4$).equals("Hero") && b4>7?1: (str(a4$).equals("Thief") && b4>5?1: (str(a4$).equals("Wizard") && b4==4?9: b4+1))); if(a4>0 || key4$!='\n'){ y4--; pikAds(0); return; } //if(a4>0 || if(z4[1]>0) addTo(srcChr,ChrWd,z4[1]); //allows later adds if(z4[2]>0) addTo(srcChr,ChrRv,z4[2]); eq(xsA,WpnElm$); for(a4=3;a4<9;a4++) if(z4[a4]>0){ addItm(srcChr,locItm(itmPoo,wrdOut(xsA,a4-2),"skill")); dtaIn(elmNum,ItmBon,"+"+(valOut(elmNum,ItmBon)+z4[a4])); } //if(z4[a4]>0 eq(xsA,SplElm$); for(a4=0;a40){ //cbt mov rpts rpt("221"+rcd$); rcd$.setLength(0); return; } //if(rcd$.length()>0 y4++; newChr=srcChr; //keep chr focus pikChr(a4,str(a4$)); return; case 3: if(isCbt){ //chks of front rank - used by advOrg() on rtn c4=rdmChr(atCoo,2,2,Any); c4=E6; //E6= #consc chrs of rdmChr() d4=rdmChr(atCoo,1,3,Pty+Set); d4=E6; e4=rdmChr(atCoo,1,3,Any); e4=E6; f4=rdmChr(atCoo,2,By,Pty+Set); f4=E6; isg4=c4<1 && e4<2 && f4>0 //mov twd sq2 req || !isa4 && (c4<1 && e4<1 || e4<3 && rdmChr(atCoo,1,3,Adv)0 || rdmChr(atCoo,g4,By,Foe)>0)){ y4--; rpt("263Tangled - can't move"); return; } //if(isCbt && //where chr can be discarded isi4=x1==PikPty || x1==AtLrg || (x1==ChkTrv || x1==ChkMov) && pri(srcChr)>=bstCat; y4++; rpt("263hit key for to square" +(isi4?" (0 eliminates)":"")); return; case 4: if(key6$<'0' || key6$>'i' || key6$>'9' && key6$<'a' || key6$=='\b'){ y4-=2; ordPty(0,""); return; } //if(key6$<'0' || b4=inpVal; //=key char asc -Asc0 if(b4>9) //for sq a..i b4-=38; if(isCbt){ //chk if mov Ok isc4=has(srcChr,"Shk","fx"); if(isc4 && (!isg4 || mob(rdmChr(atCoo,9,19,Adv))>0 || rdmChr(atCoo,g4,By,Foe)>0) || b4>X && g40 && F6>h4; //F6 of rdmChr() h4=isb4?N6:0; //N6 of rdmChr() ise4=isb4 && has(h4,"Daz","fx"); ise4=isb4 && (ise4 || isf4) && wrdOut(h4,ChrCtl).equals("A") && !has(h4,"Shk","fx") && (ise4 || !has(h4,"Tng","fx")); if(isb4 && !ise4){ y4-=2; rpt("263 Target square filled."); return; } //if(isb4 && isc4=!isBy(g4,b4); isg4=C8!=D8; //_8s of isBy() = chg'g ranks isb4=isc4 || isb4 && !ise4 || isg4 && (isa4 || ish4 && !isf4); //not adj, occ, bad rank chg //isa4=no rank chg allowed, isc4=last rank chg allowed, ish4=non-Daz rank chg made isc4=isg4 && !isa4; //legality chk'd in isb4 abv - just chkg for last qual here if(isc4) //rev isc4 iaw Daz fx if(isf4 && !ish4) isc4=false; else{ i4=nxtChr(atCoo,Pty+Set); do{ //no restriction to rank chg if unacted chr has Dhazh fx j4=valOut(newChr,ChrSq); if(newChr!=srcChr && has(newChr,"Daz","fx") && (j4<7 || j4>X && j4<14)){ isc4=false; break; } //if(newChr!=srcChr && }while(i4!=nxtChr(atCoo,Pty+Set)); } //else(isf4 i4=rdmChr(atCoo,9,19,Pty+Set); i4=E6; //E6 of rdmChr() isd4=isBy(g4,2) && (isa4 || f4<2) //chr adj to sq2 can't abandon && ((d4==e4 || e4<1) && b4!=2 || c4<1 && e4<2 && b4>3); isd4=isd4 && (isa4 || f4<2) && (c4<1 || g4==2) && b4!=2 && g4<4 && d4<2 || !isg4 && !isa4 && i4>0 && i4<2 && c4<1 && e4<2 && g4>3 || isc4 && (c4<1 && e4<1 && (b4!=2 || Math.abs(3-D8)>Math.abs(3-C8)) || (g4<4 || b4>4) && (c4<1 || g4==2 && c4<2) && d4<(g4<4?2:1)); txt("063"); b4$.setLength(0); //don't use rcd$, to avoid intrf w movRpt() arg if(has(srcChr,"BatMan","fx")){ if(g43) //insure chg row eq(b4$,chrNam(srcChr)+" must move forward."); } //if(has(srcChr,"BatMan","fx" else{ e4=itmGrp; while(e4<=arySiz && locItm(e4,"BatMan","fx")>0){ e4=elmNum; f4=locElm(chrGrp,ChrNam,wrdOut(e4,ItmOwn)); if(isg4 && wrdOut(f4,ChrCtl).equals("A") && valOut(f4,ChrSq)>3){ eq(b4$,"Move "+chrNam(f4)+" first."); break; } //if(isg4 && e4++; } //while(e4<=arySiz && } //else(has(srcChr,"BatMan","fx" if(b4$.length()>0){ y4-=2; rpt("263 "+b4$); return; } //if(b4$.length()>0 if(isb4 || isd4 && !ise4 && x2!=TryDtp){ y4-=2; eq(b4$,isb4?"can't move there":"must move to(ward) sq2"); if(isb4 && isg4 && ish4) b4$.append(": rank chg made"); rpt("263 "+b4$); return; } //if(isb4 || if(isc4 && (rdmChr(atCoo,3,19,Adv)==srcChr && E6<2 && g4<4 //E6 of rdmChr() || E6<1 && pri(srcChr)>=bstCat)){ y4-=2; rpt("263Need adv in front rank"); return; } //if(isc4 && if(x2!=TryDtp){ reSet(srcChr,Nah); //mrk 'acted' if(ise4) //Dhazh allows sqs swap reSet(h4,Nah); if(isc4) isa4=true; if(isg4 && !isf4) ish4=true; } //if(x2!=TryDtp } //if(isCbt if(b4>0 || isi4) if(isCbt){ movRpt(srcChr,b4); if(ise4) //Dhazh allows sqs swap movRpt(h4,g4); } //if(isCbt else movChr(srcChr,b4); if(b4==0 && isi4) rmvChr(atCoo,srcChr,All); y4-=2; ordPty(0,""); } //switch(y4 } //ordPty mth void rdyItm(){ if(x4!=RdyItm) y4=1; switch(y4){ case 1: x4=RdyItm; a4=srcChr; tgtChr=0; //marker for chr to take itm from y4++; case 2: txt("011"); y4++; pikChr(isCbt && tgtChr==0?Pty+Set:Pty+(isCbt || tgtChr==0?0:Out), (tgtChr==0?"acting":"source")+" adv"); return; case 3: if(key6$=='\b'){ key4$='\b'; x4=0; //term sbr go(); return; } //if(key6$=='\b' a4=newChr; if(tgtChr==0){ if(rdmChr(atCoo,valOut(a4,ChrSq),C9,Any)!=a4 || D6>1) //C9 of valOut(), D6 of rdmChr() movChr(a4,C6); //C6 of rdmChr(): sho mkr for atkr on top of any stack temporarily if(has(a4,"Shk","fx")){ //chk active vs stunned y4--; rpt("263"+(sex(a4)?"s":"")+"he's inactive now"); return; } //if(has(a4,"Shk","fx" srcChr=a4; } //if(tgtChr==0 else if(tgtChr*a4==srcChr || pri(a4)>=bstCat){ //takItm() bst taker prov y4--; rpt("263can't take from h"+(sex(a4)?"er":"im")); return; } //if(tgtChr*a4==srcChr || y4++; case 4: txt("053"); if(tgtChr==0){ y4++; txt("153acting: "+chrNam(a4)); txt("163Take item of 0) self 1) neighbor"); txt("273 or trove: 2) pick up 3) put down"); return; } //if(tgtChr==0 if(isCbt && (!isBy(valOut(srcChr,ChrSq),valOut(a4,ChrSq)) || Math.abs(getPst(srcChr)-getPst(a4))>1)){ y4-=2; rpt("263Can't reach h"+(sex(a4)?"er":"im")); return; } //if(isBy(valOut(srcChr, tgtChr=a4; y4++; case 5: if(tgtChr>0 && key4$!='\b') b4=1; else{ b4=inpVal<0 || inpVal>3?0:inpVal; if(b4==1 || key4$=='\b'){ if(b4==1) tgtChr=1; y4-=3; rdyItm(); return; } //if(b4==1 || } //else(tgtChr>0 && if(isCbt && isStk && b4==2 && getPst(srcChr)>1 && rdmChr(atCoo,valOut(srcChr,ChrSq),By,Foe)>0){ y4-=3; txt("063"); txt("173 (unless Lying)"); rpt("263 Stack opt: Engaged can't pick up"); return; } //if(isCbt && y4++; case 6: y4+=2; //comp for y4-- in reTrd() newChr=tgtChr>0?tgtChr:srcChr; shoAdv(b4==2?trvChr:itmGrp,"what to "+(b4<3?"ready?":"drop?")); return; case 7: e4=itmElm; if(key7$=='\b' || e40) //prov for keystroke _Chr chg tgtChr=newChr; else srcChr=newChr; g4=valOut(srcChr,ChrSq); if(isCbt){ //note chks overwrite in incr precedence a4$.setLength(0); if(tgtChr>0){ if(!isRdy(e4)) eq(a4$,"Item must be readied for cbt xchg"); if(!isBy(g4,valOut(tgtChr,ChrSq)) || Math.abs(getPst(srcChr)-getPst(tgtChr))>1) eq(a4$,"Can't reach h"+(sex(tgtChr)?"er":"im")); //allows for keystroke tgt chg in shoAdv() } //if(tgtChr>0 if(b4==2){ d4=valOut(e4,ItmLoc); if(!isBy(g4,d4)) eq(a4$,"Can't reach it"); } //if(b4==2 if(wrdOut(e4,ItmCla).equals("+armor")) eq(a4$,"Can't rdy armor in cbt"); if(a4$.length()>0){ tgtChr=0; y4--; rpt("263"+a4$); return; } //if(a4$.length()>0 } //if(isCbt if(b4==0){ makRdy(srcChr,e4); //incorp'd in givItm() blw for other opts isc4=false; //all other options use givItm() where isc4 is set y4+=3; rdyItm(); return; } //if(b4==0 y4++; c4=All; if(wrdOut(f4,ItmRep).equals("acu")){ txt("183refuse: '0', max: Ent"); txt("463How many? "); } //if(wrdOut(f4,ItmRep).equals("acu" else{ y4++; rdyItm(); } //else(wrdOut(f4,ItmRep).equals("acu" return; case 8: if(lin$.length()>0) //lin$ of key listener c4=inpVal; txt("053"); if(c4==0){ tgtChr=0; y4-=6; rdyItm(); //~alt: rpt("263Tgt says no."); return; } //if(c4==0 y4++; case 9: h4=b4<3?srcChr:trvChr; if(!takItm(h4,e4)){ tgtChr=0; y4-=7; txt("111"+chrNam(h4)+" can't take that now."); rpt("221"+A6$); //A6$ of takItm() return; } //if(!takItm(h4,e4 isb4=wrdOut(e4,ItmOpn).equals(Brk$); //hold src itm flg for pikup brk chk blw d4=valOut(e4,ItmBon); //qty vs bon arg val unused by givItm() if not acu givItm(h4,e4,Math.min(d4,c4)); //incls makRdy() e4=elmNum; //elmNum of givItm() isc4=isA6; //isA6= ItmRep==acu of givItm() if(isc4) d4=F6; //F6= acu #given of givItm() if(b4==3){ if(!(isCbt && isc4)) //=ammo in cbt carries over sq '0' from addItm() dtaIn(e4,ItmLoc,""+(isStk?g4:(g45) c4--; //red bon+, or standard itm bon= -1 dtaIn(e4,ItmOpn,"Ok"); //repl Brk$ flg if(c4brk (cmp badUse()) txt("173 item damaged"); } //if(c40?"takes":(wrdOut(e4,ItmLoc).equals(UnRdy$)?"unreadies":"readies")))) +(isc4 && c4>0?" "+c4+' ':" ")+wrdOut(f4,ItmTyp)+' '+wrdOut(f4,ItmCla)); } //switch(y4 } //rdyItm mth void selJew(){ if(x4!=SelJew) y4=1; switch(y4){ case 1: x4=SelJew; y4++; case 2: y4++; pikChr(Adv,"a jewel owner"); return; case 3: if(key6$=='\b'){ x4=0; //term sbr go(); return; } //if(key6$=='\b' srcChr=newChr; y4++; case 4: y4+=2; //comp for y4-- in reTrd() shoAdv(itmGrp,"jewel to sell?"); return; case 5: if(itmElm=d4); c4=e4-b4; //=pot # added lvls y4++; case 4: txt("153Crowns & ep for "+c4+" more grades"); txt("263 how many to add: "); y4++; return; case 5: a4=Math.max(0,Math.min(c4,inpVal)); if(key4$=='\b'){ y4-=3; upGra(); return; } //if(key4$=='\b' x4=0; //term sbr go(); } //switch(y4 } //upGra mth void addAdv(){ if(x4!=AddAdv) y4=1; switch(y4){ case 1: x4=AddAdv; txt("011"); txt("053"); y4++; case 2: txt("111Adventurer #"+(ptySiz+1)+" type:"); txt("231 1) Hero 2) Thief 3) Wizard Bksp) abort"); break; case 3: a4=inpVal; txt("011"); if(key4$!='\b' && (a4<1 || a4>3) || key4$=='\b' && ptySiz==0){ y4--; txt("131 [ choose again ]"); return; } //if(inpVal<0 if(key4$=='\b'){ x4=0; //term sbr go(); return; } //if(key4$=='\b' addChr(chrPoo+a4-1); srcChr=newChr=elmNum; genWd(srcChr); dtaIn(srcChr,ChrPst,"3"); dtaIn(srcChr,ChrCtl,"a"); dtaIn(srcChr,ChrCoo,""+AtlCoo); //place party at large/ in town y4++; case 4: txt("311name: "); break; case 5: eq(a4$,lin$); txt("011"); //chk for dup nam codes (1st n ltrs) if(locElm(chrGrp,ChrNam,cut(str(a4$)))>0){ if(a4$.length()>0){ isa4=a4$.charAt(0)=='B' && a4$.charAt(1)<':'; txt("131 [ "+a4$+" conflicts with " +(isa4?"beast names":wrdOut(elmNum,ChrNam))+" ]"); } //if(a4$.length()>0 y4--; addAdv(); return; } //if(locElm(chrGrp,ChrNam,cut(a4$))>0 dtaIn(srcChr,ChrNam,str(a4$)); y4++; case 6: txt("211gender: 1) Fem 2) Mas"); break; case 7: a4=inpVal; dtaIn(srcChr,ChrGen,""+"_fm".charAt(a4)); if(a4==2) dtaIn(srcChr,ChrImg,"7"); y4++; case 8: txt("411h"+(sex(srcChr)?"er":"is")+" grade: "); break; case 9: a4=inpVal; txt("011"); if(a4<1){ y4--; txt("131 [ reenter grade ]"); addAdv(); return; } //if(a4<1 dtaIn(srcChr,ChrGra,""+a4); y4++; case 10: txt("411unused experience: "); break; case 11: a4=Math.max(0,inpVal); dtaIn(srcChr,ChrEp,""+a4); a4=1; eq(a4$,wrdOut(pri(srcChr),ChrTyp)); eq(b4$,"1) Dag 2) Qsf 3) Bow 4) Hmr 5) Swd 6) Axe"); eq(xsB,WpnElm$); c4=0; //blank twice-hit wpn choice flag var y4++; case 12: txt("111Weapon #"+a4+":"); txt("221"+b4$); break; case 13: b4=inpVal; if(b4>6) b4=-1; txt("011"); if((b4>2 && str(a4$).equals("Wizard") || b4>4 && str(a4$).equals("Thief")) && b4!=c4){ txt("131 "+a4$+" can't wield "+wrdOut(xsB,b4)); txt("141 - hit "+b4+") again to take it anyway"); c4=b4; b4=-1; } //if(b4>2 if(b4<1){ y4--; addAdv(); return; } //if(b4<1 y4++; case 14: txt("211Weapon magic bonus (0= none): "); break; case 15: c4=inpVal; d4=0; //Id flg if(c4==0) addItm(srcChr,locItm(itmPoo,wrdOut(xsB,b4),"=weapon")); else{ addItm(srcChr,locItm(itmPoo,wrdOut(xsB,b4),"+weapon")); d4=elmNum; dtaIn(d4,ItmBon,"+"+c4); } //else(c4==0 if(b4==3){ addItm(srcChr,locItm(itmPoo,"Arrows","=ammo")); dtaIn(elmNum,ItmLoc,"back"); addTo(elmNum,ItmBon,12); } //if(b4==3 if(d40){ addItm(srcChr,locItm(itmPoo,"Armor","+armor")); b4=elmNum; dtaIn(b4,ItmBon,"+"+a4); } //if(a4>0 else{ y4+=3; addAdv(); return; } //if(a4>0 y4++; case 21: txt("211Armor Identified? 0) yes 1..9) Rv req to ID:"); break; case 22: dtaIn(b4,ItmId,inpVal<1?"Id'd":""+inpVal); y4++; case 23: txt("411crowns: "); break; case 24: a4=inpVal; if(a4>0){ addItm(srcChr,locItm(itmPoo,"Crowns","cash")); addTo(elmNum,ItmBon,a4); } //if(a4>0 y4++; case 25: txt("411#jewels: "); break; case 26: a4=inpVal; if(a4<1){ //skip jewels loop y4+=3; addAdv(); return; } //if(a4<1 b4=1; y4++; case 27: txt("411jewel #"+b4+" val= "); break; case 28: c4=inpVal; //~?chk for good val addItm(srcChr,locItm(itmPoo,"Jewel","cash")); addTo(elmNum,ItmBon,c4); if(++b4<=a4){ //incr cnt & loop (#jewels) y4--; addAdv(); return; } //if(++b4<=a4 y4++; case 29: if(!wrdOut(pri(srcChr),ChrTyp).equals("Wizard")){ y4+=2; addAdv(); return; } //if(!wrdOut(pri(srcChr), eq(xsA,SplElm$); zonWd=ioWd/5; for(a4=1;a4<19;a4++) txt("1"+((a4-1)/5+1)+((a4+4)%5+1)+wrdOut(xsA,a4)); zonWd=2*sqSid; //restore default zone width txt("353Enter initial spell: "); break; case 30: if((Div$+SplElm$+Div$).indexOf(Div$+str(lin$)+Div$)<0){ txt("163 [ type full spell name ]"); y4--; addAdv(); return; } //if(--a4>0 addItm(srcChr,locItm(itmPoo,str(lin$),"spell")); dtaIn(elmNum,ItmId,"Uno"); //flg ini spell - elmNum of addItm() y4++; case 31: txt("011"); if(isCg){ y4+=3; addAdv(); return; } //if(isCg a4=valOut(srcChr,ChrImg); //ini img# y4++; case 32: movChr(srcChr,8); txt("053"); txt("283Ent=take img, other=nxt img"); break; case 33: if(key4$!='\n'){ if(++a4+advImg>=bstImg) a4=0; dtaIn(srcChr,ChrImg,(x1==AtLrg?"+":"")+a4); //'+' ind didn't start maze y4--; addAdv(); return; } //if(key4$!='\n' y4++; case 34: txt("283Hit sq# (1..6) for loc"); break; case 35: movChr(srcChr,Math.min(Math.max(inpVal,1),6)); x4=0; //term sbr go(); return; } //switch(y4 y4++; } //addAdv mth void genTrv(int typ){ //A= typ #1 if(x4!=GenTrv) y4=1; switch(y4){ case 1: x4=GenTrv; a4=typ-1; //a4=7; //~test ln txt("053"); h4=0; //ini mod for prob nums isa4=opt1==Ngo; //flg for Nego awe awds if(isa4 || isRov) //ini tbl prob mod var h4--; else //room bst trea if(has(-srcChr,"MorTre","fx")){ h4=valOut(elmNum,ItmBon); //elmNum of has() eq(elmNum,Fre$); } //if(has(-srcChr,"MorTre","fx" txt("15"+(isRov || isa4 || h4>0?"3 ":"4") +"Treasure type: "+(char)(+'A'+a4) +(isRov?" (Rov)":(isa4?" (Awd)":(h4>0?" (Bon)":"")))); isa4=false; //ini none found flg y4++; case 2: //chk for Crs to add to trove y4++; b4=12*a4+1; //find start of TrvTbl$ type codes c4=dig(TrvTbl$,b4++)+h4; if(badCrs && totCrs>199) c4=0; aDie("Need "+c4+" or less for Crowns"); if(isInp) return; case 3: d4=a6; //d4=1; //~test ln y4++; txt("063"); if(d4<=c4){ c4=lowDic(dic(dig(TrvTbl$,b4),"#Crowns"),X); while(hav(trvChr,"Tmt","fx")){ c4=(valOut(elmNum,ItmBon)*c4+9)/X; eq(elmNum,Fre$); } //while(hav(trvChr,"Tmt","fx" if(badCrs){ c4=Math.max(200-totCrs,c4); totCrs+=c4; } //if(badCrs addItm(trvChr,locItm(itmPoo,"Crowns","cash")); addTo(elmNum,ItmBon,c4); txt("163Found "+c4+" Crowns"); isa4=true; } //if(d4<=c4 else while(hav(trvChr,"Tmt","fx")) eq(elmNum,Fre$); case 4: b4+=2; //chk for Jewels to add to trove c4=dig(TrvTbl$,b4++)+h4; if(badCrs && totCrs>199) c4=0; if(c4<1){ y4+=3; genTrv(0); return; } //if(c4<1 y4++; aDie("Need "+c4+" or less for Jewels"); if(isInp) return; case 5: d4=a6; //d4=1; //~test ln txt("011"); if(d4>c4){ y4+=2; genTrv(0); return; } //if(d4>c4 y4++; c4=dig(TrvTbl$,b4); case 6: if(c4>1) c4=dig(dic(1,"#Jwls"),0)<4?1:2; txt("063"); for(d4=6;d4<=5+c4;d4++){ addItm(trvChr,locItm(itmPoo,"Jewel","cash")); e4=X*lowDic(dic(2,"jewel val"),X); if(badCrs){ e4=Math.max(200-totCrs,e4); totCrs+=e4; } //if(badCrs dtaIn(elmNum,ItmBon,""+e4); txt("1"+d4+"3Found "+e4+" Cr Jewel"); isa4=true; } //for(d4=5; y4++; case 7: e4=5; //ini ln/ cnt var for up to 2 magic items y4++; case 8: b4+=2; elmNum=0; //flg for itm chk @ case 90 //chk for magic item(s) to add to trove c4=dig(TrvTbl$,b4++)+h4; if(c4<1){ y4=90; genTrv(0); return; } //if(c4<1 y4++; aDie("Need "+c4+" or less for magic item"); if(isInp) return; case 9: d4=a6; txt("011"); //d4=1; //~test ln if(d4>c4){ y4=90; genTrv(0); return; } //if(d4>c4 isa4=true; y4++; c4=dig(TrvTbl$,b4); aDie("Magic Item table at +"+c4); if(isInp) return; case 10: if(++e4<7) txt("063"); //~or just txt("0"+e4+'3'); d4=a6+c4; //d4=5; //~test ln y4=d4>8?50: (d4>7?40: (d4>6?30: (d4>4?20:10))); if(y4>X){ genTrv(0); return; } //if(y4>X y4++; aDie("Spice table"); if(isInp) return; case 11: c4=spiItm-1+a6; addItm(trvChr,c4); txt("1"+e4+"3Found Spice: "+wrdOut(c4,ItmTyp)); y4=90; genTrv(0); return; case 20: y4++; aDie("Potion table"); if(isInp) return; case 21: c4=potItm-1+a6; addItm(trvChr,c4); txt("1"+e4+"3Found Potion: "+wrdOut(c4,ItmTyp)); y4=90; genTrv(0); return; case 30: c4=fea$=='L'?1:0; //in Lair? y4++; aDie("Scroll table"); if(isInp) return; case 31: //a6=1; //~test ln d4=scrItm-1+Math.min(a6+c4,4); //scroll spell z1$[] elm lookup if(a6+c4<5){ y4=36; genTrv(0); return; } //if(a6+c4<5 y4++; case 32: y4++; aDie("Scroll table column 2"); if(isInp) return; case 33: d4+=Math.min(a6+c4,4); if(a6+c4<5){ y4=36; genTrv(0); return; } //if(a6+c4<5 y4++; case 34: y4++; aDie("Scroll table column 3"); if(isInp) return; case 35: d4+=a6+c4; if(d4>1) d4--; y4++; case 36: addItm(trvChr,d4); txt("1"+e4+"3Found Scroll: "+wrdOut(d4,ItmTyp)); y4=90; genTrv(0); return; case 40: //magic Weapon table c4=fea$=='F'?1:0; //in Btlfd? d4=1; //weapon bonus y4++; aDie("Weapon type"); if(isInp) return; case 41: f4=a6; y4++; if(f4==3){ aDie("Bow or Arrow"); if(isInp) return; } //if(f4==3 case 42: if(f4==3 && a6<6) f4=7; //arrow rather than Bow y4++; case 43: y4++; aDie("Weapon bonus"); if(isInp) return; case 44: if(a6<2+c4){ txt("111bonus now +"+(++d4)); y4--; genTrv(0); return; } //if(a6<2+c4 y4++; case 45: g4=magWpn-1+f4; addItm(trvChr,g4); dtaIn(elmNum,ItmBon,"+"+d4); txt("1"+e4+"3Found magic +"+d4+' '+wrdOut(g4,ItmTyp)); y4=90; genTrv(0); return; case 50: //magic Armor table c4=isTdr?1:0; //in Tpdr? d4=1; //armor bonus y4++; case 51: y4++; aDie("Armor bonus"); if(isInp) return; case 52: if(a6<2+c4){ txt("111bonus now +"+(++d4)); y4--; genTrv(0); return; } //if(a6<2+c4 addItm(trvChr,locItm(itmPoo,"Armor","+armor")); dtaIn(elmNum,ItmBon,"+"+d4); txt("1"+e4+"3Found magic +"+d4+" Armor"); y4=90; case 90: c4=elmNum; if(c4>0 && wrdOut(pri(c4),ItmNat).equals("magic")) //if addItm() called dtaIn(c4,ItmId,"-1"); //mark itm unId'd in src coo if(b4<12*a4+11){ //<=lg of tbl rtg ety y4=8; //~-=?; genTrv(0); return; } //if(b4<12*a4+11 y4++; if(!isa4) txt("163No treasure found here."); case 91: x4=0; //term sbr go(); } //switch(y4 } //genTrv mth void atkVs(int val,String dta$){ //uses: dieWgt, atkTyp, atkWpn, atkAmo, atkTgt, atkSrc if(x4!=AtkVs) y4=1; switch(y4){ case 1: x4=AtkVs; a4=val; b4=Math.abs(a4); isa4=b4==MR; if(isa4) b4=3; hitSum=0; eq(a4$,dta$); eq(b4$,chrNam(atkTgt)); c4=B7; //B7=pri(atkTgt) of chrNam() shoBst(atkTgt); y4++; case 2: txt("053"); if(a4==Nah){ //chk if no Rv roll req c4$.setLength(0); if(atkRng==Msl && "Rocks,Dagger,Hammer,Axe".indexOf(str(a4$))>=0) c4$.append("thrown "); c4$.append(a4$).append(" vs ").append(b4$); txt("111"+c4$); txt("153 "+chrNam(atkSrc)+" attacks"); y4+=3; atkVs(0,""); return; } //if(a4==Nah y4++; tskRol(atkTgt,modRv(atkTgt),b4,Rv,str(b4$)+" vs "+a4$); if(isInp) return; case 3: d4=dig(tsk(die$),0); //low die of Rv rol$ //d4=1; //~test ln isRv=d4<=b4; //ini flg for Rv roll success txt("011"); y4++; if(isa4){ //isRv=true; d4=1; //eq(rol$,"1111"); //~test ln if(d4==1){ inpVal=0; isc4=lowDic(rol$,1)>dig(SplCst$,atkSpl-1); if(isc4 && isPty(atkTgt)){ rpt("211Choose: 0) reflect spell 1) negate spell"); return; } //if(isc4 && } //if(d4==1 if(d4==3){ //~&& "".indexOf(str(c4$))<0 [specific enforcement exceptions] tskRol(atkSrc,modRv(atkSrc),2,Rv,chrNam(atkSrc)+" spell enforce (bunt)"); if(isInp) return; } //if(d4==3 } //if(isa4 case 4: if(isa4) //if spell MR roll if(isRv){ //if low die= 1..3 apply addl MR table fx if(d4==1){ isc4=isc4 && inpVal!=1; if(isc4) txt("111 spell reflected (hot hit)"); else txt("111 spell negated (a walk)"); } //if(d4==1 if(d4==2){ txt("111 caster holding spell (brush back)"); addItm(atkSrc,locItm(itmPoo,"SplMR","fx")); dtaIn(elmNum,ItmOpn,"900"); b4=3*(atkSpl-1); dtaIn(elmNum,ItmBon,SplAbr$.substring(b4,b4+3)); dtaIn(elmNum,ItmLoc,cut(wrdOut(atkTgt,ChrNam))); } //if(d4==2 if(d4==3){ isRv=dig(tsk(die$),0)>2; if(isRv) txt("111 caster flunks (infield error)"); else txt("121 spell takes effect (put out)"); } //if(d4==3 } //if(isRv else txt("121 spell takes effect (strike out)"); if(isRv){ //chk Rv low die<= val unless voided by MR cond txt("053"); if(isa4){ if(c4<=advCat && d4!=2){ //add ep for making MR b4=3*dig(SplCst$,atkSpl-1); addTo(atkTgt,ChrEp,b4); txt("163 "+b4$+" gains "+b4+" ep"); } //if(c4<=advCat if(d4==1 && isc4){ //MR= reflect spell b4=atkSrc; atkSrc=atkTgt; atkTgt=b4; a3=2; //reflected spell Rv roll= 2; vs MR x3=DoSpl; y3=2; } //if(d4==1 && } //if(isa4 x4=HitVs; y4=17; //term sbr rpt("253 Rv low die="+d4); return; } //if(isRv y4++; case 5: //chk if no dmg req by atk - just Rv roll if(a4<0){ x4=HitVs; y4=17; //term sbr hitVs(); return; } //if(a4<0 y4++; case 6: y4++; b4=atkWpn; //if atkWpn==-1 -> all wpn cases skipped case 7: switch (b4){ case Una: if(has(atkSrc,"Mgt","fx")){ diePch=atkRng>=Msl?2:3; isCru=true; } //if(has(atkSrc,"Mgt","fx" else diePch=1; break; case Dag: diePch=atkRng>=Msl?1:(isThf?3:2); break; case Qsf: diePch=2; isCru=true; break; case Bow: diePch=!isBy(valOut(atkSrc,ChrSq),valOut(atkTgt,ChrSq)) && G8>2?3:2; //G8 of isBy() break; case Hmr: diePch=atkRng>=Msl?2:3; isCru=true; break; case Swd: diePch=3; break; case Axe: diePch=3; break; case Aro: diePch=2; break; case Bst1: //non-itm bst atk: diePch,dieWgt set in bstCap() break; case Bst2: //non-itm bst atk: diePch,dieWgt set in bstCap() break; } //switch (b4 if(has(atkTgt,"WpVul","fx")){ //see also dieWgt mod at doWpn() e4=elmNum; eq(c4$,wrdOut(e4,ItmId)); if(c4$.charAt(0)=='*') if(str(c4$).indexOf("All")>=0 || b4>0 && str(c4$).indexOf(WpnCod$.charAt(b4-1))>=0) diePch=valOut(e4,ItmBon); } //if(has(atkTgt,"WpVul","fx" y4++; case 8: y4++; b4=atkSpl; case 9: switch (b4){ case Exp: isCru=true; isDod=false; diePch=7; break; case Shk: isDef=isPrf=false; diePch=2; break; case Psn: isPsn=true; isDef=false; diePch=3; break; case Fbr: diePch=4; break; case Drn: isDef=isPrf=false; diePch=4; break; case Bla: isBla=true; diePch=3; break; case Blf: diePch=4; break; } //switch (b4 y4++; case 10: y4++; b4=atkMtl; case 11: switch (b4){ case Egy: diePch=4; isDef=isPrf=false; break; case Gas: diePch=1; isDef=isPrf=false; isPsn=true; break; case Acd: diePch=2; break; case Pwd: diePch=4; isDef=isPrf=isDod=false; isPsn=true; break; } //switch (b4 y4++; case 12: y4++; /*~test lns txt("122tgt="+b4$); txt("024"); txt("126 Pch="+diePch); txt("124 atk="+a4$); //*/ //eq(aim$,"511"); //~test ln dieWgt=Math.max(0,dieWgt); isb4=aim$.length()<1; //aim$ not preset to fixed value (eg. "11"), use Task roll if(isb4){ d4=c4<=advCat?-dieWgt:dieWgt; tskRol(atkSrc,d4,Nah,Nah,"Hit"); if(isInp) return; } //if(isb4 case 13: if(isb4){ eq(aim$,die$); if(aim$.length()<1){ //player hit Bksp wo inp (note restricted routs in tskRol()) if(x3==DoWpn){ //~?others x4=HitVs; y4=17; //term sbr hitVs(); } //if(x3==DoWpn else{ y4--; atkVs(0,""); } //else(x3==DoWpn return; } //if(aim$.length()<1 } //if(isb4 if(has(atkSrc,"Propeller","device") && valOut(elmNum,ItmOpn)>0){ //elmNum of has() eq(elmNum,Fre$); aim$.append(dic(aim$.length(),"Pplr fx")); } //if(has(atkSrc,"Propeller","device") && //if(isb4) eq(aim$,"1"); //~test ln y4++; case 14: if(!isb4 || atkCmp!=Wpn || !has(atkSrc,"Stl","fx")){ //if atkr chr under Stl spl ~?atkSrc>0 y4+=3; atkVs(0,""); return; } //if(!isb4 || b4=elmNum; //hold Stl fx elmNum of has() eq(c4$,chrNam(atkSrc)); txt("011"); txt("111"+c4$+"'s basic atk roll= "+aim$); y4++; a4=valOut(b4,ItmBon); //use Stl bon if(isFoe(atkSrc)) a4=-a4; tskRol(atkSrc,a4,Nah,Stl,str(c4$)+" Steel"); if(isInp) return; case 15: aim$.append(die$); //cross-cancelling: combo //chk for Stl bon degrade c4=die$.length()-lowDic(die$,5); //chk for 6s if(c4>0) //Stl deg req addTo(b4,ItmBon,-c4); //red Stl bon y4++; case 16: y4++; txt("011"); if(c4>0) txt("121 "+c4$+"'s Steel bonus degrades to +"+D7); //D7 of addTo() txt("211"+c4$+"'s combined atk roll= "+aim$); //D7 of addTo() return; case 17: hitVs(); } //switch(y4 } //atkVs mth void hitVs(){ //uses: atkSrc,atkTgt,atkTyp(incl atkWpn, etc),a4$ //aim$(die$ only, not rol$ yet) if(x4!=HitVs) y4=1; switch(y4){ case 1: x4=HitVs; txt("011"); y4++; case 2: if(atkTyp==Cbt && atkRng<=Eng && atkWpn=0){ isPar=true; dieNix=5; //apply parry effect for Task die cancelling val } //if(has(atkTgt,"","weapon") if(lr[5]>0 && isFoe(atkSrc)) dieNix=5; //Last ditch lr cond eq(b4$,tsk(aim$)); //mod hit dice roll to Task type result txt("111"+a4$+" atk roll"+(isPar?" (vs parry)= ":"= ")+b4$); //a4$ of atkVs() if(atkCmp==Wpn && diePch<5 && has(atkSrc,"Gle","fx")) diePch++; //calc #hits dealt in atk by Task rol$ hitSum=lowDic(b4$,diePch); //#wds (normal, not spent-type): tracking var eq(a4$,chrNam(atkTgt)); c4=B7; //B7=pri(atkTgt) of chrNam() if(c4>=bstCat) a4$.append(" "+wrdOut(c4,ChrTyp)); //txt("153"+a4$+wrdOut(c4,ChrGra)); //~test ln if(hitSum<1){ y4+=15; rpt("231Attack on "+a4$+" causes no hits."); return; } //if(hitSum<1 d4=isCru?lowDic(b4$,1):0; //calc #hits of Crush dealt in atk if(has(atkSrc,"Zom","fx") && modWd(atkTgt)<2){ //~?atkCmp==Wpn && y4+=13; rpt("231Zhoom spice effect operates."); return; } //if(atkCmp==Wpn && i4=j4=0; //cross-cancelling: ini Def, Prf unNixed vals if(!(isDef && d4n/+n)", A7$ of modDef() g4=str(c4$).indexOf('>'); h4=++g4>0?dig(c4$,g4): (has(atkTgt,"Faz","fx")?valOut(elmNum,ItmBon)/X:0); //elmNum of has() if(h4>0 && !isBla){ //if code calls for low val only hits hitSum=lowDic(b4$,h4); //recalc #hits d4=Math.min(hitSum,d4); //restrict #Crush if(hitSum<1){ y4+=14; rpt("231Attack on "+a4$+" causes no hits."); return; } //if(hitSum<1 } //if(h4>0 && if(e4==0){ c4$.setLength(0); y4+=3; hitVs(); return; } //if(e4==0 y4++; if(f4e4 && has(atkTgt,"Prf","fx")){ //if tgt chr under Prf spl h4=elmNum; //hold Prf fx elm f4=valOut(h4,ItmBon); //use Prf bon tskRol(atkTgt,f4,Nah,Prf,str(a4$)+" Proof"+(g4>0?" @-1":"")); //~?may asgn -f4 tskRol() arg if(isInp) return; } //if(isPrf && case 7: if(f4!=0){ //~vs f4<1: so ?may asgn -f4 tskRol() arg eq(d4$,tsk(die$)); //hold Prf task dice j4=E7-B7; //cross-cancelling: _7s of tsk() } //if(f4!=0 f4=lowDic(d4$,3-g4); //dmg red mod for Prf (2 vs Blast) f4=Math.min(hitSum-e4,f4); //e4= Def dmg red mod e4=Math.max(0,e4-j4); //cross-cancelling f4=Math.max(0,f4-i4); //cross-cancelling hitSum-=e4+f4; //red wds iaw prot y4++; case 8: y4++; txt("021"); if(e4>0) txt("121Defense stops "+e4+" hit"+(e4>1?"s.":".")); if(f4>0) txt("131Proof stops "+f4+" hit"+(f4>1?"s.":".")); if(e4+f4>0){ txt("241 (hit a key)"); return; } //if(e4+f4>0 case 9: y4++; txt("021"); //eq(d4$,"6"); //~test ln //chk for Prf bon degrade g4=d4$.length()-lowDic(d4$,5); //chk for 6s if(g4<1){ //skip Prf deg msg y4++; hitVs(); return; } //if(g4<1 addTo(h4,ItmBon,-g4); //red Prf bon case 10: y4++; //txt for Prf deg txt("231"+a4$+"'s Proof bonus degrades to +"+D7); //D7 of addTo() return; case 11: //chk Thf Dodge cap if(hitSum<1 || !isDod || !wrdOut(c4,ChrTyp).equals("Thief") || isCbt && !wrdOut(atkTgt,ChrCtl).equals("A") || has(atkTgt,"Tng","fx") || has(atkTgt,"Shk","fx")){ y4+=4; hitVs(); return; } //if(!isDod || y4++; txt("021"); txt("1310) no 1..3) #pts to try"); txt("221Use Dodging ability?"); return; case 12: g4=inpVal; if(g4<1 || g4>3){ y4+=3; hitVs(); return; } //if(g4<1 || y4++; h4=atkSrc; //temp hold atkr id i4=atkSpl; //temp hold atk spl atkSrc=atkTgt; atkSpl=-g4; splPay(); return; case 13: atkSrc=h4; //restore held atkr id atkSpl=i4; //restore held atk spl if(!isb5){ y4+=2; hitVs(); return; } //if(!isb5 y4++; tskRol(atkTgt,5*g4,Nah,Nah,str(a4$)+" Dodge"); if(isInp) return; case 14: g4=Math.min(hitSum,lowDic(tsk(die$),3)); hitSum-=g4; //red wds iaw dodge y4++; txt("021"); rpt("221Dodged "+g4+" hit"+(g4==1?".":"s.")); return; case 15: //entry point from doSpl() for knockouts admin txt("021"); isa4=atkSpl==Swn || atkSpl==Bgl; if((isa4 || hitSum>0) && has(atkTgt,"BstGui","fx")){ rmvChr(atCoo,atkTgt,All); atkTgt=trvChr; shoFld(atCoo); y4+=2; rpt("221Affected beast guide flees!"); return; } //if((isa4 || g4=hitSum-d4; //ord dmg excl Crush if(g4>0 && has(atkTgt,"Faz","fx") && hitSum<=valOut(elmNum,ItmBon)%X){ //elmNum of has() h4=elmNum; g4+=valOut(h4,ItmId); hitSum=d4+(g4>>1); dtaIn(h4,ItmId,""+(g4%2)); } //if(g4>0 && if(hitSum>0 && chkPot(atkTgt,"Str")){ if(isA6){ //_6s of chkPot() isb4=has(atkTgt,"FvrWd","fx"); if(isb4){ txt("041"); isb4=valOut(elmNum,ItmBon)>=dig(dic(1,"Fvr blk"),0); //elmNum of has() } //if(isb4 if(!isb4) hitSum--; } //if(isA6 txt("041"); txt("141"+A6$+(isA6 && isb4?" But Fever fx blocks.":"")); } //if(hitSum>0 && g4=0; //(effective) wds taken if(hitSum>0 || isa4){ if(valOut(atkTgt,ChrWd)==99) genWd(atkTgt); g4=modWd(atkTgt); if(!isa4) g4=Math.min(hitSum,g4); } //if(hitSum>0 || if(g4>0 || isa4){ if(!isa4) addTo(atkTgt,ChrHit,g4); //add hits if(isPsn){ addItm(atkTgt,locItm(itmPoo,"PsnWd","fx")); h4=elmNum; //elmNum of addItm() dtaIn(h4,ItmOpn,"991"); addTo(h4,ItmBon,g4); } //if(isPsn if(atkCmp==Wpn && has(atkSrc,"Zom","fx") && modWd(atkTgt)==1){ txt("131 Zhoom spice effect operates - +1 wound."); g4++; addTo(atkTgt,ChrHit,1); //+1 generic wd } //if(atkCmp==Wpn && isb4=modWd(atkTgt)<1; //call here red/ elim Pwr fx (post- ChrHit asgn) if(isb4 || isa4 && atkSpl!=Bgl) //if tgt unc ~rmv fx? (exc Swn) uncChr(atkTgt); shoBst(atkTgt); //award hit ep to adv atkr vs bst i4=atkSrc==trvChr?valOut(trvChr,ChrGen):atkSrc; if(i4>=chrGrp && pri(i4)<=advCat && isFoe(atkTgt)){ h4=(dig(wrdOut(c4,ChrGra),3)+mazBig-1)/mazBig; h4*=g4+(isb4 || isa4?1:0); addTo(i4,ChrEp,h4); txt("053"); txt("163 "+chrNam(i4)+" gains "+h4+" ep"); } //if(i4>=chrGrp && } //if(g4>0 || if((isThf || isWzd) && dig(b4$,0)<2 && !isb4){ addItm(atkTgt,locItm(itmPoo,isThf?"ThfAtk":"Oop","fx")); maxIn(elmNum,ItmOpn,rndCnt); txt("133"+chrNam(atkTgt)+(isThf?" to atk bsts this rd!":" can't atk this rd!")); } //if((isThf || isWzd) && d4=Math.min(g4,d4); if(d4>0) txt("131 incl "+d4+" Crush"); y4++; eq(c4$,atkCmp==Spl?wrdOut(splItm+atkSpl-1,ItmTyp):(isPsn?"poison":"normal")); rpt("221"+a4$+" takes "+g4+' '+c4$+" damage"+(g41?"s.":"."):".")); return; case 16: y4++; a4=0; //ini Egy opn flg (see nxt case) if(atkSrc!=trvChr && atkTyp!=Dvc && atkRng<=Eng && dig(b4$,0)<=diePch && chkPot(atkTgt,"Egy")){ if(isA6){ //_6s of chkPot() atkItm=B6; addItm(atkSrc,locItm(itmPoo,"Oop","fx")); dtaIn(elmNum,ItmOpn,""+(rndCnt+1)); //elmNum of addItm() txt("011"); txt("121 "+A6$+" Attacker stunned."); isCru=isPar=isPsn=isBla=false; //del trigger atk's cond.s isDef=isPrf=isDod=true; setAtk(Dvc,Egy); a4=atkTgt; atkTgt=atkSrc; atkSrc=a4; aim$.setLength(0); dieWgt=1; x3=0; //Egy atk ignores doWpn/Spl() cleanup atkVs(Nah,"Energy fx"); } //if(isA6 else{ txt("041"); rpt("241"+A6$); } //else(isA6 return; } //if(atkSrc!=trvChr && case 17: txt("011"); //erase "no wds" & all other txt("053"); if(a4==atkSrc){ //restore chr asgns pre- Egy fx atkSrc=atkTgt; atkTgt=a4; } //if(a4==atkSrc if(atkTgt==trvChr) dtaIn(trvChr,ChrHit,"0"); if(atkSrc==trvChr) dtaIn(trvChr,ChrGen,"0"); //clr ep awd to attrib fld (see ep awd abv) eq(a4$,aim$); //allow addl prcg of gen'd hit roll aim$.setLength(0); //ini for future atkVs() calls isCru=isPar=isPsn=isBla=false; isDef=isPrf=isDod=true; //presume std Def & Prf apply if possessed x4=0; //term sbr go(); } //switch (y4 } //hitVs mth //var lvl 5 routines void putTrp(int val){ //arg=0: generic trap typ & pik adv; arg=1: spec trap typ only; arg=2: spec typ & pik adv if(x5!=PutTrp) y5=1; switch(y5){ case 1: x5=PutTrp; a5=val; y5++; case 2: if(a5==0){ trpTyp=Dmy; trpDif=4; y5+=5; putTrp(0); return; } //if(a5==0 y5++; aDie("trap type"); if(isInp) return; case 3: b5=a6; if(b5!=2){ y5+=3; putTrp(0); return; } //if(b5!=2 y5++; aDie("trap type 2nd roll"); if(isInp) return; case 4: b5=a6+1; if(b5!=2){ y5+=2; putTrp(0); return; } //if(b5!=2 y5++; aDie("trap type 3rd roll"); if(isInp) return; case 5: b5=a6+2; y5++; case 6: if(badTrp) b5++; trpTyp=b5==2?3:Math.min(8,b5); //trpTyp=7; //~test lin if(a5==1){ y5+=3; putTrp(0); return; } //if(a5==1 trpDif=4; y5++; case 7: y5++; pikChr(Adv,"choose detrapper"); return; case 8: if(valOut(newChr,ChrSq)>3){ txt("132detrapper must be in front row"); y5--; putTrp(0); return; } //if(valOut(srcChr,ChrSq)>3 oprChr=srcChr=newChr; y5++; case 9: x5=0; //term sbr go(); } //switch(y5 } //putTrp mth void splPay(){ //uses: atkSrc, atkSpl (if neg= generic spnWd loss: n<-10= n+10 pot lethal) if(x5!=SplPay) y5=1; switch(y5){ case 1: x5=SplPay; splWds=0; a5=atkSrc; //~note atkSrc=atkTgt problem for Thf Dodge in hitVs() b5=pri(a5); isa5=atkSpl>-X; //non-lethal flg //isa5=false; //~test ln isb5=true; //spell/ pay success flg f5=Math.abs(atkSpl); //if chkg for poss generic spnWd loss, pass "-1", "-2", etc. if(atkSpl>0) //spell being cast (vs generic spnWd loss) c5=dig(SplCst$,f5-1); //cost of spell else if(isa5) c5=f5; //non-lethal generic loss else c5=f5-X; //potentially-lethal generic loss if(payDif<1){ //payDif= 0-> no roll - fixed cost (or loss if pot lethal) splWds=c5; y5+=3; splPay(); return; } //if(payDif<1 if(atkSpl==Bgl || atkSpl==Swn){ d5=valOut(atkTgt,ChrSq); isc5=d5X && d5<14)) //tgt on 1st rank c5++; if(atkSpl==Bgl && has(atkTgt,"Bgl","fx")){ c5++; if(isc5) c5=1; } //if(atkSpl==Bgl && if(atkSpl==Swn){ if(valOut(atkTgt,ChrHit)<1) c5++; if(has(atkTgt,"Swn","fx")) c5=1; } //if(atkSpl==Swn } //if(atkSpl==Bgl || y5++; case 2: y5++; tskRol(a5,c5,Nah,Nah,"Spent Wds"); if(isInp) return; case 3: if(key6$=='\b' && c6<1){ //c6 of tskRol() key5$='\b'; isb5=false; y5+=4; splPay(); return; } //if(key6$=='\b' //eq(die$,"6"); //~test ln splWds=c5-lowDic(tsk(die$),payDif); //spent wds to lose y5++; case 4: y5++; if(splWds>0 && chkPot(a5,"Str")){ if(isA6){ //_6s of chkPot() isc5=has(a5,"FvrWd","fx"); if(isc5){ txt("041"); isc5=valOut(elmNum,ItmBon)>=dig(dic(1,"Fvr blk"),0); //elmNum of has() } //if(isc5 if(!isc5) splWds--; } //if(isA6 txt("041"); txt("241"+A6$+(isA6 && isc5?" But Fever fx blocks.":"")); return; } //if(splWds>0 && case 5: if(splWds>0 && valOut(a5,ChrWd)==99) genWd(a5); d5=modWd(a5); isc5=d5-splWds>0; if(isc5 || !isa5){ //spell/ pay succeeds if(splWds>0){ splWds=Math.min(splWds,d5); addTo(a5,ChrHit,splWds); addItm(a5,locItm(itmPoo,"SpnWd","fx")); dtaIn(elmNum,ItmOpn,"997"); addTo(elmNum,ItmBon,splWds); if(modWd(a5)<1) //=!isc5: call here red/ elim Pwr fx (post- ChrHit asgn) uncChr(a5); } //if(splWds>0 } //if(isc5 || else{ isb5=false; //spell/ pay failed if(atkSpl>0){ //if casting spell eq(xsA,SplElm$); if(has(a5,wrdOut(xsA,f5),"spell")) //loc spell itm dtaIn(elmNum,ItmOpn,"fail"); } //if(atkSpl>0 } //else(isc5 || y5++; case 6: y5++; shoBst(a5); txt("011"); eq(b5$,"Wd cost= "+splWds+": "); b5$.append(isc5?splWds:0).append(" Spent Wd lost"); txt("211"+b5$+(atkSpl>0?" - spell "+(isb5?"cast.":"failed."):".")); return; case 7: payDif=3; //resto defa x5=0; //term sbr go(); } //switch(y5 } //splPay mth void clrOut(){ //uses: rmvChr(atCoo,Foe,All); //rmv any foe, incl unconsc foe if(fea$=='F' || fea$=='L'){ //fea$ asgnd in chkMov() rmvFea(atCoo); fea$='A'; } //if(fea$=='F' || if(isTdr || isStp){ bakOut(); shoFld(atCoo); } //if(isTdr || } //clrOut mth void bakOut(){ //uses: if(isTdr || isStp){ isTdr=isStp=false; a5=toCoo=rtnCoo; //retreat to fea til } //if(isTdr || else{ a5=atCoo; toCoo=bakCoo(atCooCol,atCooRow,inSid); //retreat thru inSid } //else(isTdr || rmvFea(a5); fea$='A'; isMov=true; //move all in coo; incl unconsc & trvChr w items movPty(atCoo,toCoo); atCoo=toCoo; atCooCol=atCoo/C; atCooRow=atCoo%C; } //bakOut mth void movPty(int at,int to){ //uses: //note: moves trvChr as well if not ptPty (isMov or not: since trvChr Wd=100 & Pt=3) if(x5!=MovPty) y5=1; switch(y5){ case 1: x5=MovPty; a5=at; b5=to; if(b5==AtlCoo || b5==StpCoo || b5==TdrCoo) newTil=false; else{ newTil=!isTil(b5/C,b5%C); if(!isA8) //off-maze mov (in auto gen mvmt) ~chk prior to movPty() call? return; //stay put } //else(b5==AtlCoo || f5=0; //reset #chrs moved var isb5=false; //ini any advs moved? flg if(!ptPty){ //if not picking chrs to mov y5+=3; movPty(0,0); return; } //if(!ptPty h5=rdmChr(a5,1,6,Pty); h5=Math.min(6,E6); //E6 of rdmChr() if(!newTil){ e5=rdmChr(b5,9,19,Pty); //e5 not used h5=Math.max(0,Math.min(6-E6,h5)); //#chrs movable: E6 of rdmChr() } //if(!newTil y5++; case 2: y5++; txt("011"); //inp chr(s) to mov txt("131 (moving characters must be in rows 1&2 -"); txt("141 up to "+(h5-f5)+" more characters may be moved)"); txt("211Move character in square # (quit: Bksp): "); return; case 3: if(key5$=='\b' || h5-f5<1){ y5+=2; movPty(0,0); return; } //if(key5$=='\b' c5=inpVal; if(c5<1 || c5>6){ y5--; movPty(0,0); return; } //if(c5<1 || y5++; case 4: for(d5=chrGrp;d50) //if merging pty, chrs enterg occ sqs fall prone dtaIn(d5,ChrPst,"1"); dtaIn(d5,ChrCoo,""+b5); reSet(d5,Nah); //mark chr moved 'acted' f5++; //incr #chrs moved newChr=d5; //used for a$ det nxt case eq(a5$,cut(wrdOut(d5,ChrNam))); //unId'd itms rmv'd from disc coo -> +code elmNum=itmGrp-1; while(++elmNum<=arySiz && locElm(elmNum,ItmOwn,str(a5$))>0) if(valOut(elmNum,ItmId)<0) dtaIn(elmNum,ItmId,""+(-C9)); //C9 of valOut() } //if(!ptPty || } //if(isMov || if(ptPty){ shoFld(a5); //erase moved chr mkr y5-=2; movPty(0,0); return; } //if(ptPty y5++; case 5: y5++; if(f5<1){ movPty(0,0); return; } //if(f5<1 a$=wrdOut(newChr,ChrCtl).toUpperCase().charAt(0); //pty mkr c5=a5/C; //erase vacant atCoo pty mkr d5=mazMap+a5%C; eq(a5$,wrdOut(d5,c5)); isa5=nxtChr(a5,Adv)==0; //no consc advs left there? if(isa5){ //rmv pty mkr in from coo e5=str(a5$).indexOf(a$); if(e5>=0){ insStr(a5$,e5,e5+1,""); //~use a5$.deleteCharAt() dtaIn(d5,c5,str(a5$)); } //if(e5>=0 } //if(isa5 isb5=x1==ChkMov && nxtChr(b5,Adv)==0; if(isb5){ //no adv moved -> wipe movers in chkMov() movPty(0,0); return; } //if(x1==ChkMov && e5=cooFea(b5)!='A'?D8:E8; //place pty mkr in toCoo (if nec): _8s of cooFea() eq(b5$,A8$); if(str(b5$).indexOf(a$)<0){ f5=A8; g5=B8; insStr(b5$,e5,""+a$); dtaIn(mazMap+g5,f5,str(b5$)); } //if(str(b5$).indexOf(a$)<0 case 6: txt("011"); isc5=ptPty; ptPty=isMov=false; //reset split party, move unconsc chrs flgs x5=0; //term sbr if(isc5) go(); //~?to show incidental moves, can use movPty(); shoFld(); chkOut(); } //switch(y5 } //movPty mth //var lvl 6 routines void pikChr(int val,String dta$){ if(x6!=PikChr) y6=1; switch(y6){ case 1: x6=PikChr; a6=val; eq(a6$,dta$); //Bst= bst in bst ctl, Adv= adv in adv ctl, Foe= in bst ctl, Pty= in adv ctl, Any= in atCoo //Out= may be unconscious/ asleep: eg. pikChr(Adv+Out,"take item from") //Set= must be unacted: eg. pikChr(Pty+Set,"next attacker") b6=newChr; //hold chr focus for newChr reasgn blw //times at which posture may be changed isb6=x2==AdvAtk || x2==0 && (x1==AtLrg || x1==ChkBst || x1==ChkMov || x1==ChkTrv); //~?|| TryDtp || TryNgo txt("053"); c6=nxtChr(atCoo,a6); if(isNo1) //isNo1 of nxtChr() return; if(c61?"(acted) ":"now on: "))); txt("163"+b6$+chrNam(newChr)); txt("173"+(isb6?(x2==AdvAtk && a$<'0'?"Pst decl= "+a$+f6:(isc6?"chg Pst: =":"")):"")); txt("183Ent, sq#, quit: Bksp, nxt chr: other"); y6++; txt("256"); return; case 3: txt("053"); e6=",123456789,abcdefghi".indexOf(key6$); if(e6<0){ y6+=3; pikChr(0,""); return; } //if(e6<0 newChr=Math.abs(rdmChr(atCoo,e6,e6,a6)); f6=D6; //D6 of rdmChr() if(f6==1){ shoBst(newChr); key6$='\n'; y6+=4; pikChr(0,""); return; } //if(f6==1 if(f6<1){ y6--; isa6=x4==OrdPty && rdmChr(atCoo,e6,e6,Pty)>0; txt("043"); txt("155[ "+(isa6?"had moved":"no tgt sq"+key6$)+" ]"); pikChr(0,""); return; } //f6<1 y6++; case 4: y6++; txt("011"); //mult tgts in sq for(g6=1;g6<=f6;g6++) txt("1"+((g6-1)/2+2)+""+(4-3*(g6&1))+""+g6+") "+chrNam(Z6[g6])); txt("211hit # of tgt chr (or 0 to halt)"); //^Z6[] of rdmChr() return; case 5: txt("011"); if(inpVal<1 || inpVal>f6){ y6-=3; pikChr(0,""); return; } //if(inpVal<1 || newChr=Math.abs(Z6[inpVal]); //Z6[] of rdmChr() shoBst(newChr); key6$='\n'; y6++; case 6: if(isc6 && key6$=='='){ //decl posture //y6 unchg'd prov for popups over setPst() i/o -> case 2: setPst(newChr); return; } //if(isc6 && if(key6$!='\n' && key6$!='\b'){ y6-=4; pikChr(0,""); return; } //if(key6$!='\n' && y6++; case 7: x6=0; //rout rtn go(); } //switch(y6 } //pikChr mth - rtns newChr (unchgd if no inp) void tskRol(int elm,int num,int val,int typ,String dta$){ if(x6!=TskRol) y6=1; switch(y6){ case 1: x6=TskRol; if(x3+x4+x5<1) //~?del here, & incorp in tryNgo(interf w Sbd bst sv)/Id/Dtp seqDic=0; //~?mov to case 4: (post- Bksp chk) key6$='?'; //reset in case of no inp e6=elm; //elm=0: generic (no chr ctl) roll: sets a6=-a6 if(e6==trvChr) e6=0; a6=num; //num<0: auto stage by 5s h6=val; g6=typ; c6$.setLength(0); if(h6>0) eq(c6$,"(req<="+h6+')'); eq(a6$,dta$); isa6=isd6=false; //flg for disori fx (treat 3s as 6s), player-ctl chr if(e6>0){ isd6=pri(e6)<=advCat && isPty(e6); if(has(e6,"Wha","fx")) isa6=true; if(g6==Rv && !isUp(e6)) a6=0; //unconsc chr uses "no dice" Task if(a6>0 && !isd6) a6=-a6; //(?trv, ) bst, Bgld chr auto stages } //if(e6>0 else a6=-Math.abs(a6); //abs() in case -arg passed isInp=true; //~=a6>1; //~note pos pre 1st return; b6=Math.abs(a6); c6=0; //#rolls cntr isc6=isd6 && (g6==Prf || g6==Stl || g6==Def); //when =1, don't auto roll - allow choice die$.setLength(0); y6++; case 2: y6++; inpVal=b6; //default in case no inp req txt("031"); txt("131"+a6$+" Task= "+die$); txt("136"+c6$); //#req note isd6=a6>1 || isc6; if(isd6){ //1 die Task is rolled wo prompt, =>1 die req (note vol fail opt blw) txt("241#dice to roll? ("+b6+" left)"+(b61 case 3: if(isd6 && key6$=='\b'){ if(c6<1 && !(x2==TryDtp || x2==TryNgo || x4==AtkVs)) y6+=5; else if(b60){ eq(b6$,dic(-d6," rolled")); //dic() call appends to die$ f6=str(die$).indexOf('3'); while(f6>=0 && isa6){ //apply disori fx die$.setCharAt(f6,'6'); f6=str(die$).indexOf('3'); } //while(f6>=0 && if(str(die$).indexOf('6')<0 && b6>d6){ b6-=d6; y6-=3; tskRol(0,0,0,0,""); return; } //if(str(die$).indexOf('6')<0 && } //if(d6>0 if(a6==0) //"no dice" roll= 1*1 w 6 if miss if(dig(dic(1," rolled"),0)>1) eq(die$,"6"); y6++; case 6: y6++; if(a6==0) txt("144 no dice result= "+die$); //"145 as in dic() if(isInp){ isd6=a6>0 && die$.length()==1; if(isd6){ f6=dig(die$,0); isd6=f6>1 && f6<6; } //if(isd6 txt("131"+a6$+" Task= "+die$); txt("136"+c6$); //#req note txt("241done"+(isd6?" ('0': vol fail).":".")); return; } //if(isInp case 7: if(isd6 && key6$=='0'){ a6=0; eq(die$,"6"); txt("031"); y6--; tskRol(0,0,0,0,""); return; } //if(isd6 && y6++; case 8: x6=0; //rout rtn if(isInp) go(); } //switch(y6 } //tskRol mth - rtns die$ void aDie(String dta$){ //uses: srcChr(just as rep for pty) if(x6!=ADie) y6=1; switch(y6){ case 1: x6=ADie; key6$='?'; //reset in case of no inp eq(a6$,"131die roll for "+dta$); txt("031"); //display during dic() time lag txt(str(a6$)); a6=dig(dic(1," rolled"),0); isa6=has(-srcChr,"Fst","fx"); b6=elmNum; //elmNum of has() isInp=isa6; //note pos pre 1st return; y6++; case 2: y6++; txt("031"); txt(str(a6$)+" is "+a6); if(isa6){ txt("241hit 0,-,=(+) to keep, reduce, add:"); return; } //if(isa6 case 3: if(isa6){ isb6="-=".indexOf(key6$)>=0; if(isb6){ isc6=chkPot(-srcChr,"Fst") && isA6; //A6s of chkPot() eq(b6$,A6$); if(isc6) a6=key6$=='-'?Math.max(1,a6-1):Math.min(6,a6+1); } //if(isb6 } //if(isa6 y6++; case 4: y6++; if(isa6 && isb6){ txt("041"); txt("241"+b6$+(isc6?" Mod roll= "+a6:"")); return; } //if(isa6 && case 5: txt("011"); x6=0; //rout rtn if(isInp) go(); } //switch(y6 } //aDie mth - rtns a6(mod die val) void rpt(String dta$){ if(x6!=Rpt) y6=1; switch(y6){ case 1: x6=Rpt; eq(a6$,dta$); a6=a6$.length(); eq(b6$,str(a6$).substring(0,txtCodLg)); b6=txtCodLg; //substring begpos tracker d6=0; //prefix space on alt msgs flg ini y6++; case 2: c6=str(a6$).indexOf(Div$,b6); //substring endpos tracker if(c6<0) c6=a6; eq(c6$,str(a6$).substring(b6,c6)); b6=++c6; if((++d6&1)<1) insStr(c6$,0," "); //offset alt msgs in case identical y6++; case 3: y6++; txt(str(b6$)+c6$); return; //~assumes inp req case 4: if(b6 go() eq(hldArg$,dta$); eq(a7$,hldArg$); b7=a7==trvChr?itmGrp:a7; //1st elm/ nowElm # g7=b7; c7=(ioHt-pflHt)/typHt; //or, =(ioHt*2) for std ltrPt=hlfSqSid key7$='?'; //reset key7$ for branch testing prior to inp itmElm=0; //reset rtn var here - in case of interposed Up-lvl sbrs //clear & outline display areas g.setColor(hue(BrfBkg)); g.fillRect(0,0,ioWd,ioHt); g.setColor(hue(BdrFgd)); g.drawRect(0,0,pflWd,ioHt); g.drawRect(pflWd,0,ioWd-pflWd,ioHt-pflHt); eq(c7$,wrdOut(newChr,ChrNam)); if(a7==itmGrp) //mak b7$ tagLg $ for item recog eq(b7$,cut(str(c7$))); else if(a7==trvChr) eq(b7$,"trove"); else b7$.setLength(0); shoBst(-newChr); if(pri(newChr)>=bstCat){ //adv-ctl bst y7++; shoAdv(0,""); return; } //if(pri(newChr)>=bstCat eq(c7$,wrdOut(newChr,ChrTyp)); txt("151"+(str(c7$).equals("Hero")?"Hro":(str(c7$).equals("Thief")?"Thf":"Wzd")) +": "+wrdOut(newChr,ChrGra)+" + "+valOut(newChr,ChrEp)+" ep"); //~ txt("152"+valOut(newChr,ChrEp)+" ep"); txt("161coo: "+wrdOut(newChr,ChrCoo)); y7++; case 2: if(key7$!='\n' && key7$!='\b'){ //set up sho Itm area & list 1st/ next (ht/typHt) itms IAW Poo/Grp/Trv arg //clr itm window & reset z7[] txt("013"); txt("053"); txt("184 ("+a7$+')'); txt("153 quit: Bksp"+(a7$.charAt(0)=='j'?"/Ent":", take: Ent")+", next chr: [,"); //?"just looking" txt("163 scan items: other"); for(d7=1;d7<=c7+1;d7++) z7[d7]=0; for(d7=1;d7<=c7;d7++){ f7=locElm(b7,1,str(b7$)); //,1, =may be either ItmTyp or ItmOwn div if(f7==0){ if(b7==g7) //chr has no items to show break; b7=g7; if(d7>1) //if any item pik'd & shown on end page break; f7=locElm(b7,1,str(b7$)); //last item was on end line - start over //req since z7[] fully cleared } //if(f7==0 b7=B8+1; //elm after B8 (=last elm checked of locElm()) e7=endElm; //use held vals in case of intervening locElm()s eq(d7$,wrdOut(f7,ItmCla)); //sho itm? isa7=str(d7$).equals("fx"); if(a7!=itmPoo || x1==PikPty && !isa7 || x1==AtLrg && d7$.charAt(0)=='='){ z7[d7]=f7; if(a7!=itmPoo){ h7=pri(f7); eq(e7$,wrdOut(h7,ItmTyp)); } //if(a7!=itmPoo if(a7==itmGrp) txt("1"+d7+"3 "+d7$+": "+e7$+" " +wrdOut(f7,ItmBon)+" " +(isRdy(f7) && !isA8?"rdy":wrdOut(f7,ItmLoc)) //isA8 of isRdy() +(isa7 && valOut(f7,ItmOpn)<991 ?" rd"+wrdOut(f7,ItmOpn) :(itmCat(h7)==splItm?" "+wrdOut(f7,ItmOpn):""))+" " +wrdOut(f7,ItmId)); else if(a7==itmPoo) txt("1"+d7+"3 "+wrdOut(f7,ItmTyp)+", "+d7$); else{ //a7==trvChr h7=valOut(f7,ItmLoc); h7+=h7>X?+'V':Asc0; //11='a',.. txt("1"+d7+"3 "+d7$+": "+e7$+" " +wrdOut(f7,ItmBon)+" " +"sq"+(char)h7); } //else(a7==itmPoo } //if(a7!=itmPoo || else d7--; //so d7= num of shown items, not num of found items if(b7>e7){ //if last elm in itmPoo/Grp was pik'd b7=g7; if(d7>0) //if any item pik'd & shown on end page break; } //if(b7>e7 } //for(d7=1; d7=1; } //if(key7$!='\n' y7++; case 3: if(isb7 || key7$=='\n' || key7$=='\b'){ itmElm=!isb7 && key7$=='\n'? z7[d7-1]: (a7==itmPoo?-1:0); //Poo Bksp rtn val -1 reTrd(); //auto resets x7=0 return; } //if(key7$=='\n' //place itm ptr txt("2"+d7+"3>"); if(z7[++d7]==0) y7--; } //switch(y7 } //shoAdv mth - returns elmNum of itm pik'd as itmElm void vuMap(){ if(x7!=VuMap) y7=1; switch(y7){ case 1: x7=VuMap; txt("051"); //~test lns a7=0; for(b7=itmGrp;b7<=arySiz;b7++) if(z1$[b7].charAt(0)==Fre0$) a7++; txt("161 items free "+a7); y7++; case 2: txt("011"); if(!isBad) txt("112 Step types seen: "+stpVar$); txt("111turn #"+trnCnt); txt("121#left: Bfd "+frqFea[6]+", Lar "+frqFea[7]+", Tdr "+frqFea[8]+", Stp "+frqFea[9] +", Hall "+frqHal+", Room "+frqRoo); txt("053"); txt("153Cursor- "+(isCsr?'I':'O')+" on/off: ="); txt("163Lay tile- "+(isLay?'I':'O')+" on/off: -"); txt("183 ("+topCooCol+','+topCooRow+") top left coo in view"); txt("273shift view: 3/n,w,e,s; quit: Bksp"); y7++; break; case 3: if(key7$=='\b'){ reTrd(); //auto resets x7=0; y7=1 return; } //if(key7$=='\b' if("=-".indexOf(key7$)>=0){ if(key7$=='=') isCsr=!isCsr; if(key7$=='-') isLay=!isLay; } //if("=-".indexOf(key7$)>=0 else{ b7=" 3nNwWeEsS".indexOf(key7$); d7=0; c7=b7<4?-1:(b7>7?1:0); if(c7==0) d7=b7<6?-1:1; c7=topCooRow+c7; d7=topCooCol+d7; if(b7<0 || c7>MaxTopRow || c7<1 || d7>MaxTopCol || d7<1) txt("163 (reenter direction)"); else{ //asgn toCoo (note if new) topCooRow=c7; topCooCol=d7; } //else(b7<0 || } //else("+=".indexOf(key7$)>=0 shoMap(); y7--; vuMap(); } //switch(y7 } //vuMap mth void chgBd(){ if(x7!=ChgBd) y7=1; switch(y7){ case 1: x7=ChgBd; //~a7=0; eq(a7$,"blah"); //~test ln: popup interf y7++; case 2: isa7=isBld; a7=ptDec; y7++; txt("051"); txt("053"); txt("011"); txt("111 / transparent, 0 black, 1 magenta, 2 red, 3 orange,"); txt("121 4 yellow, 5 green, 6 cyan, 7 blue, 8 gray, 9 white"); txt("141"+HueObj$+" [+Bkg#Fgd#]"); txt("163 or preset#1..3 (eg. p3)"); txt("183"+(isa7?"plain":(a7<2?"reduce":"bold"))+" font:Ent, board size:Bksp"); txt("353object's colors (eg. bdr/6): "); return; case 3: if(key7$=='\n' && lin$.length()<1){ Graphics g=getGraphics(); isBld=a7>1 && !isa7?true:false; ptDec=isa7?1:2; ltrPt=Math.max(hlfSqSid-ptDec,1); ltr=new Font("SanSerif",Font.PLAIN,ltrPt+1); //~?only if isBld txt("111 "); //~?only if isBld ltr=new Font("SanSerif",isBld?Font.BOLD:Font.PLAIN,ltrPt); g.setFont(ltr); y7--; chgBd(); return; } //if(key7$=='\n' && if(lin$.length()==5){ a7=HueObj$.indexOf(str(lin$).substring(0,3)); if(a7>=0){ a7=a7/4*2; hues[a7]=dig(lin$,3); hues[++a7]=dig(lin$,4); } //if(a7>=0 } //if(lin$.length()==5 if(lin$.length()==2){ a7=(CsrFgd+1)*(dig(lin$,1)-1)+1; for(b7=BdrFgd;b7<=CsrFgd;b7++) hues[b7]=dig(HueSet$,a7++); } //if(lin$.length()==2 if(lin$.length()>0){ shoBd(); shoMap(); shoFld(atCoo); y7--; chgBd(); return; } //if(inp$.length()>0 y7++; case 4: y7++; txt("053"); txt("011"); txt("141hlfSqSid dim now= "+hlfSqSid+" (rng: 1..30)"); txt("183quit:Bksp/Ent"); txt("453new hlfSqSid dim: "); return; case 5: a7=inpVal<1?hlfSqSid:inpVal; b7=hlfSqSid; hlfSqSid=Math.min(Math.max(a7,1),30); //~?raise max dim bdSiz(a7!=b7); //setSize() calls reTrd() if inpVal!=hlfSqSid (~& appletviewer?) if(a7==b7){ reTrd(); //auto resets x7=0 return; } //if(a7==b7 } //switch(y7 } //chgBd mth void setPst(int elm){ //adv chr i/o if(x7!=SetPst) y7=1; switch(y7){ case 1: x7=SetPst; a7=elm; y7++; case 2: y7++; eq(a7$,chrNam(a7)); eq(b7$,wrdOut(a7,ChrPst)); txt("031"); txt("131to chg "+a7$+"'s posture, hit:"); c7=b7$.length()-1; d7=dig(b7$,c7); if(d7!=1) txt("1411) lie"); if(d7!=3) txt("143 3) stand"); else txt("143 (now standing)"); txt("245"); return; case 3: b7=Math.min(inpVal,valOut(pri(newChr),ChrHiP)%X-1); y7++; if(key7$=='\b' || b7<1 || b7==2 || b7>3 || b7==d7){ y7++; setPst(0); return; } //if(key7$!='\b' insStr(b7$,c7,c7+1,""+b7); //chg to new pst dtaIn(a7,ChrPst,str(b7$)); if(d7<2 || b7<2) shoFld(atCoo); txt("031"); if(isCbt && (b71)){ //mrk acted if drop or stand reSet(a7,Nah); txt("141 - and marked 'acted'."); } //if(isCbt && case 4: y7++; shoBst(a7); txt("144(hit a key)"); txt("231"+a7$+" now " +(b7==1?"Ly":(b7==2?"Crouch":"Stand"))+"ing"); return; case 5: txt("031"); x7=0; go(); } //switch(y7 } //setPst mth //var lvl 5 subroutines int nxtChr(int coo,int val){ A5=coo; B5=val; C5=0; //ini rtn val isNo1=false; if(x1!=PikPty && locChr(All,Adv)0) insStr(A5$,F5,F5+1,""); } //for(E5=0; dtaIn(D5,G5,str(A5$)); if(isStp || isTdr){ isStp=isTdr=false; rmvFea(rtnCoo); //fea$ asgnd in chkMov() } //if(isStp || shoMap(); while(hav(trvChr,"","")) eq(elmNum,Fre$); opt1=Nah; //cancel rndOne opt var x6=x5=x4=x3=x2=0; //assumes x7=0 x1=ChkMov; y1=1; txt("053"); txt("273 no active adv - loc cleared"); } //if(x1!=PikPty && else{ C5=locChr(A5,B5); //=0 if none if(C5>0) newChr=C5; } //else(x1!=PikPty && return C5; //~also acts as rtn to endGam(),chkMov()/txt() calls abv: forced for int() mth } //nxtChr fnc mth - rtns newChr void putBst(){ //uses: atCoo,typBst,sumBst //add bsts by # & typ to chrGp rcds for(A5=1;A5<=sumBst;A5++){ B5=bstCat-1+typBst; addChr(B5); C5=elmNum; //elmNum of addChr() dtaIn(C5,ChrCtl,"B"); dtaIn(C5,ChrCoo,""+atCoo); dtaIn(C5,ChrPst,""+(valOut(B5,ChrHiP)%X-1)); movChr(C5,A5+X); } //for(A5=1; //org bst gp in sqs vs pty A5=11; //1st bst sq B5=X+sumBst; //last bst sq if(sumBst>5) //no org req return; isA5=(bstCap(C5,Bst2) || atkTyp==Rdy) && atkRng==Msl; //bst has row2 atk cap if(isA5 && sumBst>1){ //movChr() at 11..12 to end+1..2 & chg beg=beg+1..2, end=end+1..2 if(dig(dic(1,"back off"),0)<5) do{ movChr(rdmChr(atCoo,A5,A5++,Bst),++B5); isA5=!isA5; }while(!isA5 && B5<16 && dig(dic(1,"again"),0)<4); } //if(!isA5 || //reorg bst 2nd rank if(B5>13 && B5<16 && dig(dic(1,"org row2"),0)<4) //% for rdm row2 chr to go to rdm sq movChr(rdmChr(atCoo,14,B5,Bst),dig(dic(1,"move to"),0)<4?B5+1:16); //reorg bst front rank if(A5==13 || B5==11) //solitary bst must go to 12 movChr(rdmChr(atCoo,A5,A5,Bst),12); else //% for rdm 1 of 2 to go to open sq if((A5>11 || B5<13) && dig(dic(1,"org row1"),0)<4) movChr(rdmChr(atCoo,A5,Math.min(B5,13),Bst),A5>11?11:13); } //putBst mth void rmvChr(int coo,int elm,int val){ //remove trove items, beast or adventurer chr(s) H5=coo; A5=elm; //Foe+Out rmvs all non-adv Foe & any Out, All rmvs any B5=val; //Nah= give itms to trove, All= del itms isA5=A5Out?A5-Out:A5; //base code if (Foe)+Out C5=isA5?chrGrp:A5; //chk 1 or all chrs: beg D5=isA5?itmGrp-1:A5;//": end for(E5=C5;E5<=D5;E5++){ isB5=isFoe(E5) && pri(E5)>=bstCat; if(!isA5 //chr elm# || z1$[E5].charAt(0)!=Fre0$ && valOut(E5,ChrCoo)==H5 && (A5==All || A5>=Out && !isUp(E5) || F5==Foe && isB5)){ I5=valOut(E5,ChrSq); while(hav(E5,"","")){ //in seq - ready or not G5=elmNum; if(B5==All || "skill,spell,fx".indexOf(wrdOut(G5,ItmCla))>=0) eq(G5,Fre$); //del owned itms else{ givItm(trvChr,G5,All); //xfr owned itm to trove if(elmNum>0){ //elmNum of givItm() dtaIn(elmNum,ItmLoc,""+(isStk?I5:(I50 } //else(B5==All || } //while(hav(E5,"","" eq(A5$,cut(wrdOut(E5,ChrNam))); for(G5=itmGrp;G5<=arySiz;G5++) if(z1$[G5].charAt(0)!=Fre0$) if(wrdOut(G5,ItmCod).equals("Tng") && wrdOut(G5,ItmLoc).equals(str(A5$))) eq(G5,Fre$); //del sourced tmp fxs if(E5!=trvChr){ //trvChr stays if(pri(E5)<=advCat) ptySiz--; eq(E5,Fre$); //del chr if(E5==srcChr){ srcChr=locChr(atCoo,Adv); if(srcChr==0) srcChr=newChr=trvChr; } //if(E5==srcChr } //if(E5!=trvChr } //if(!isA5 || } //for(E5=C5; } //rmvChr mth void shoBst(int elm){ //neg arg= shift dpy up, arg=0; hldX=txtX; //sto txt() i/o var vals hldY=txtY; hldTyp=txtTyp; I5=argLg; eq(hld$,lin$); eq(B5$,inp$); Graphics g=getGraphics(); B5=0; if(isPfl){ B5=ioHt-pflHt; g.setColor(hue(PflBkg)); //clear pfl area g.fillRect(0,B5,pflWd,pflHt); g.setColor(hue(BdrFgd)); //outline pfl area g.drawRect(0,B5,pflWd,pflHt); } //if(isPfl A5=bdrWd+sqSid*4/3; B5+=bdrWd+sqSid/4; //~g.setColor(StdHue[8]); //~gray bkg in case of prone dpy (see nxt) //~g.fillRect(A5,B5,sqSid,sqSid); if(H5>=trvCat && H5=trvCat && if(isPfl && H50) //sho vermin trvChr if(isCg) g.drawString(""+A5$.charAt(isB5?0:F5),A5+sqSid*3/8,B5+sqSid*2/3); else shoMkr((isB5?advImg:bstImg)+C5,A5,B5); g.setColor(hue(isB5?AdvFgd:BstFgd)); g.drawRect(A5,B5,sqSid,sqSid); if(!isUp(E5)) //~?nec: no uncons shown g.drawLine(A5,B5,A5+sqSid,B5+sqSid); zonWd=hlfSqSid; //rating dpy spacing B5=modWd(E5); A5=B7; //B7 of modWd() C5=isPfl?5:1; txt("1"+C5+"6"+(A5<99 //when bst, chk if Wds rolled ?"-"+(A5-B5) //show wds remaining :wrdOut(G5,ChrWd))); //show typ bst Wd stat txt("1"+C5+"1wd:"+(A5<99?""+A5:"")); C5++; txt("1"+C5+"1rv:"+modRv(E5)); A5=modDef(E5); txt("1"+C5+"6df:"+A5+(A7$.charAt(1)=='>'?str(A7$).substring(1): //A7$ of modDef() has(E5,"Prf","fx")?wrdOut(elmNum,ItmBon):"+0")); C5++; eq(A5$,""+(char)(valOut(E5,ChrSq)1?"fallen":(A5<+'a'?"set":"acted"))); C5++; if(!isB5) //only bsts show Wpn stats for(A5=0;A5<2;A5++){ eq(A5$,wrdOut(G5,ChrWp1+A5)); B5=WpnCod$.indexOf(A5$.charAt(2))+1; if("123456789".indexOf(A5$.charAt(0))>=0) D5=dig(A5$,0); else if(str(A5$).substring(0,2).equals("W*")) D5=Math.min(2,modWd(E5)); else B5=-1; //spl flg if(B5>=0){ if(isFoe(E5)) D5+=lr[5]; if(B5>0) D5=Math.max(1,D5+lr[6]); else B5=All; //sklMod() for Una,Bst1,Bst2 D5=Math.max(0,D5+sklMod(E5,B5)); insStr(A5$,0,1,""+D5); } //if(B5>=0 else{ D5=SplAbr$.indexOf(str(A5$)); if(D5>=0){ eq(xsA,SplElm$); if(has(E5,wrdOut(xsA,D5/3+1),"spell") && wrdOut(elmNum,ItmOpn).equals("fail")) eq(A5$,"(fail)"); } //if(D5>=0 } //else(B5>=0 txt("1"+C5+(A5<1?'1':'6')+A5$); } //for(A5=0; txt("1"+C5+'.'+chrNam(E5)); //'.'= -2: txt() cod for ctr in pflWd zonWd=2*sqSid; } //else(isPfl && txtX=hldX; txtY=hldY; txtTyp=hldTyp; argLg=I5; eq(lin$,hld$); eq(inp$,B5$); isPfl=false; } //shoBst mth void uncChr(int elm){ A5=elm; B5=itmGrp; //drop any held itms eq(A5$,cut(wrdOut(A5,ChrNam))); while(B5<=arySiz && locElm(B5,ItmOwn,str(A5$))>0){ B5=elmNum; //elmNum of locElm() if(wrdOut(B5,ItmLoc).indexOf("hand")>=0){ givItm(trvChr,B5,All); C5=elmNum; //elmNum of givItm() if(C5>0){ dtaIn(C5,ItmLoc,wrdOut(A5,ChrSq)); //after unc chr plcmt if(itmCat(pri(C5))!=cshItm) dtaIn(C5,ItmOpn,Brk$); } //if(C5>0 } //if(wrdOut(B5,ItmLoc B5++; } //while(B50) movChr(N6,B5); //N6 of rdmChr() else{ eqs(xsA,A5$).append(B5); movChr(xsA,0); //ie. take imaginary chr off this field sq } //else(rdmChr(A5,B5,B5,Any)>0 } //if(B5!=X } //shoFld mth void mixRow(){ for(A5=1;A5<4;A5++) //mingle front rows for battle if(dig(dic(1,"swap sq"),0)<4){ B5=A5+X; C5=0; if(rdmChr(atCoo,A5,A5,Any)>0) //conscious only: unconsc moved onto C5=elmNum; if(rdmChr(atCoo,B5,B5,Any)>0) movChr(elmNum,A5); if(C5>0) movChr(C5,B5); } //if(dig(dic(1, } //mixRow mth //var lvl 6 subroutines void givItm(int own,int elm,int num){ A6=own; //gains transferred itm B6=elm; //itmGrp elm G6=num; //# to give, or All w cond.s here elmNum=0; eq(A6$,wrdOut(B6,ItmCod)); eq(B6$,wrdOut(locElm(chrGrp,ChrNam,wrdOut(B6,ItmOwn)),ChrTyp)); if(str(A6$).equals("Dagge") && "Goblin,Manti".indexOf(str(B6$))>=0 || str(A6$).equals("Hamme") && str(B6$).equals("Bugab")){ eq(B6,Fre$); //del source itm elmNum=0; //elmNum chgd by locElm() return; } //if(str(A6$).equals("Dagge") && C6=pri(B6); isA6=wrdOut(C6,ItmRep).equals("acu"); if(isA6 && G6==0) //cst All= -1 return; if(isA6){ //ItmRep= acu addItm(A6,C6); D6=elmNum; //new or existing owner possession, elmNum of addItm() E6=valOut(B6,ItmBon); if(A9$.charAt(0)=='+') //A9$ of valOut() dtaIn(D6,ItmBon,"+"+valOut(D6,ItmBon)); F6=G6==All?E6:G6; if(A6!=trvChr && wrdOut(B6,ItmCod).equals("Arrow")){ chkWpn(A6); F6=Math.min(F6,Z7[8]); //Z7[8] of chkWpn()= #arrows can take } //if(A6!=trvChr && addTo(B6,ItmBon,-F6); addTo(D6,ItmBon,F6); } //if(isA6 else //ItmRep= mul dtaIn(B6,ItmOwn,cut(wrdOut(A6,ChrNam))); E6=isA6?D6:B6; dtaIn(E6,ItmLoc,UnRdy$); makRdy(A6,E6); elmNum=E6; } //givItm mth - rtns elmNum= elm# of itm rcvd StringBuffer genTil(int col,int row,int sid){ A6=col; B6=row; C6=sid; //(inSid) ety side for coo: 0= unspec, 1..4= WNES H6=mazMap+B6; //sel room or hall D6=1; //default= room if(frqHal>0 && (C*A6+B6==etyCoo //etyCoo must be hall || C6>0 && wrdOut(H6+(C6-3)%2,A6+(C6-2)%2) //%2 result can be neg; vs &1 .charAt(C6-(C6>2?2:-2)-1)=='h' //coming thru hallway || Math.random()<(float)totHalRoo/frqRoo)) //pick hallmarked room D6=0; //= hall instead if(C6<1) C6=ran(4); //use rdm ety sid //make sides A6$.setLength(0); E6=0; if(D6==0){ //ini hallway entrance= C6, exit= E6 E6=ran(4); if(E6==C6) E6=E6==4?1:E6+1; } //if(D6==0 for(F6=1;F6<=4;F6++) if(F6==C6) A6$.append(D6==1?'d':'h'); else if(F6==E6) A6$.append('h'); else A6$.append(ran(X)<5?'d':'w'); /*~chk opeCnt=0 fnc if(D6==0 && trnCnt==0) eq(A6$,"hhww"); //~test ln if(D6==0 && trnCnt==1) eq(A6$,"hhww"); //~test ln if(D6==0 && trnCnt==2) eq(A6$,"hhww"); //~test ln if(D6==0 && trnCnt==3) eq(A6$,"hhww"); //~test ln //if(D6==1 && trnCnt==4) eq(A6$,"dddd"); //~test ln //*/ pktCnt--; if(D6==1){ frqRoo--; E6=ran(frqRoo); //chk for feature in room //E6=frqFea[6]; //~test ln =Bf //E6=frqFea[6]+frqFea[7]; //~test ln =Lr //E6=frqFea[6]+frqFea[7]+frqFea[8]; //~test ln =Tdr //E6=frqFea[6]+frqFea[7]+frqFea[8]+frqFea[9]; //~test ln =Stp //E6=frqFea[6]+frqFea[7]+frqFea[8]+frqFea[9]+1; //~test ln =std room F6=0; for(G6=FeaIdx$.indexOf('F');G60){ I6=+B6$.charAt(inSid-1); isA6=+'w'!=I6; //or= (+'d'==I6 || +'h'==I6) } //if(inSid>0) if(isA6){ for(H6=0;H6<4;H6++){ //compare 4 adj sides in this rot I6=+B6$.charAt(H6); J6=+C6$.charAt(H6); if(+'b'==J6) J6=+'w'; G6+=I6==J6?3: (+'w'!=I6 && +'o'==J6?1: //req order (+'w'!=I6 && +'w'!=J6?2:0)); } //for(H6=0; if(G6>E6){ //sto rot# w highest rating so far D6=F6; E6=G6; } //if(G6>E6 } //if(isA6) if(isLay){ txt("18"+(F6+2)+G6); //show rot rating (under til dpy in pfl area) try{ //delay Thread.sleep(500); } //try catch(InterruptedException e){ }; //catch( } //if(isLay insStr(B6$.append(B6$.charAt(0)),0,1,""); //rotate 90 deg ccw } //for(F6=0 isPfl=false; zonWd=2*sqSid; //txt("141"+B6$); //~test ln insStr(B6$.append(str(B6$).substring(0,D6)),0,D6,""); //rotate to high eval //txt("142"+B6$); //~test ln for(D6=0;D6<4;D6++) //insure border coos' outer sides are walls if(+'b'==C6$.charAt(D6)) B6$.setCharAt(D6,'w'); //txt("143"+B6$); //~test ln D6=str(ope$).indexOf(","+(C*A6+B6)+','); //rmv this coo from ope coos list if(D6>=0) insStr(ope$,D6,str(ope$).indexOf(',',D6+1),""); //mod opeCnt poss maze extensions for(D6=0;D6<4;D6++){ //compare 4 adj sides in this rot E6=+B6$.charAt(D6); F6=+C6$.charAt(D6); if(+'o'==F6 && +'w'!=E6){ //local ways out to ope coos opeCnt++; if(str(ope$).indexOf(","+bakCoo(A6,B6,D6+1)+',')<0) //add adj coo to ope coos list ope$.append(C8).append(','); //C8 of bakCoo() } //if(+'o'==F6 && if(+'d'==F6 || +'h'==F6) //adj ways in to this coo opeCnt--; } //for(D6=0; if(A6$.length()>4) B6$.append(str(A6$).substring(4)); dtaIn(C6,A6,str(B6$)); if(inSid>0){ //chk for poss pocket closure of maze open tiles area D6=(inSid&1)>0?0:1; //flanking coos mods E6=(inSid&1)>0?1:0; F6=A6+(inSid<3?E6:-E6); //onward coo col, row G6=B6+(inSid<3?D6:-D6); isA6=isTil(F6,G6) || !isA8; //isA8 of isTil() for(H6=1;H6<3;H6++){ if(!isTil(A6+D6,B6+E6) && isA8 && (isA6 || isTil(F6+D6,G6+E6))){ //isA8 of isTil() isPkt=true; break; } //if(!isTil(A6+D6,B6+E6) && D6=-D6; E6=-E6; } //for(H6=1; } //if(inSid>0 if(isLay) txt("051"); //clear pfl area //txt("151opeCnt="+opeCnt); //~test ln } //layTil mth public void bdSiz(boolean flg){ isA6=flg; //to call repaint() sqSid=2*hlfSqSid; //may use sqSid=2*hlfSqSid+1 for ctr pix sqs bdWd=12*sqSid+1; bdHt=12*sqSid+1; pflWd=4*sqSid; pflHt=2*sqSid; fldWd=4*sqSid; fldHt=8*sqSid+1; mapWd=MapColWd*sqSid; mapHt=MapRowHt*sqSid; ioWd=bdWd; ioHt=4*sqSid; zonWd=2*sqSid; bdrWd=1; typHt=hlfSqSid-1; ltrPt=Math.max(hlfSqSid-ptDec,1); //` setSize(bdWd+I,bdHt+I); //calls repaint but only operative for applets, //and only actually resizes in Appletviewer if(isA6){ fitStr(ChkBrf$,isBld?-ltrPt:ltrPt,zonWd<<1); //io font: rev ltrPt repaint(); //alternative to setSize() (req -> manl Resizable) for apps } //if(isA6 } //bdSiz mth void shoBd(){ //paint()-external graphics mth call forces complete redraw in AWT; // vs only clipping regions previously obscured by other windows Graphics g=getGraphics(); g.setColor(hue(BrfBkg)); g.fillRect(0,0,ioWd,ioHt); g.setColor(hue(FldBkg)); g.fillRect(0,ioHt,fldWd,fldHt); g.setColor(hue(PflBkg)); g.fillRect(0,ioHt-pflHt,pflWd,pflHt); g.setColor(hue(MapBkg)); g.fillRect(fldWd,ioHt,mapWd,mapHt); g.setColor(hue(BdrFgd)); g.drawRect(0,0,bdWd,bdHt); g.drawRect(0,0,ioWd,ioHt); g.drawRect(0,ioHt,fldWd,fldHt); g.drawRect(0,ioHt-pflHt,bdWd,pflHt); g.drawRect(0,ioHt-pflHt,pflWd,pflHt); } //shoBd mth void addChr(int elm){ //typ$ arg call: addChr(locElm(chrPoo,ChrTyp,typ$)) A6=elm; //copy chrPoo data into chrGrp entry elm nthDiv(A6,ChrDef); B6=begDiv; //req by nxt locElm()'s nthDiv() call - l to r prc'g eqs(locElm(chrGrp,ChrTyp,Fre$),str(z1$[A6]).substring(0,B6)) .append("nam,hit,ep,ctl,coo,sq,pst,gen,img"); //= trvChr dta vals (- nam) B6=elmNum; //new chrGrp chr elm dtaIn(B6,ChrTyp,cut(wrdOut(B6,ChrTyp))); //use short ChrTyp$ ids in chrGrp dta if(A6>=bstCat){ dtaIn(B6,ChrNam,"B"+(++namBst)); dtaIn(B6,ChrGra,wrdOut(B6,ChrGra).substring(0,4)); dtaIn(B6,ChrWd,"99"); dtaIn(B6,ChrImg,""+(A6-bstCat)); eq(A6$,wrdOut(A6,ChrDef)); //addItm() in case of Def Proof bonus if(A6$.charAt(1)=='+' && A6$.charAt(2)>'0'){ addItm(B6,locItm(itmPoo,"Prf","fx")); dtaIn(elmNum,ItmBon,"+"+A6$.charAt(2)); dtaIn(elmNum,ItmOpn,"997"); } //if(A6$.charAt(1)=='+' C6=WpnCod$.indexOf(wrdOut(A6,ChrWp1).charAt(2)); isA6=C6>=0; //ini flg for wpn rdy if(isA6){ addItm(B6,ordWpn+C6); E6=elmNum; dtaIn(E6,ItmLoc,wrdOut(pri(E6),ItmRdy)); } //if(isA6 eq(A6$,wrdOut(A6,ChrWp2)); D6=SplAbr$.indexOf(str(A6$)); if(D6>=0) addItm(B6,splItm+D6/3); else{ D6=WpnCod$.indexOf(A6$.charAt(2)); if(D6>=0){ addItm(B6,ordWpn+D6); E6=elmNum; if(!isA6) dtaIn(E6,ItmLoc,wrdOut(pri(E6),ItmRdy)); if(D6==2){ //Bow addItm(B6,ordWpn+6); //Arrows E6=elmNum; dtaIn(E6,ItmBon,""+ran(6)); //1..6 only dtaIn(E6,ItmLoc,"back"); } //if(D6==2 else if(!isA6) addItm(B6,ordWpn+D6); //2nd Wp2 } //if(D6>=0 else if(isA6) addItm(B6,ordWpn+C6); //2nd Wp1 } //else(D6>=0 } //if(A6>=bstCat elmNum=B6; } //addChr mth void shoMap(){ Graphics g=getGraphics(); g.setColor(hue(MapBkg)); g.fillRect(fldWd,ioHt,mapWd+1,mapHt+1); g.setColor(hue(BdrFgd)); g.drawRect(fldWd,ioHt,mapWd+1,mapHt+1); E6=(atCoo>=LayCoo?rtnCoo:atCoo)/C; F6=(atCoo>=LayCoo?rtnCoo:atCoo)%C; if(x7!=VuMap && isTil(E6,F6) //if atCoo off map, ctr when shoMap && (E6topCooCol+MapColWd-1 || F6topCooRow+MapRowHt-1)){ A6=atCooCol-(MapColWd-1)/2; topCooCol=Math.max(1,Math.min(A6,MaxTopCol)); A6=atCooRow-(MapRowHt-1)/2; topCooRow=Math.max(1,Math.min(A6,MaxTopRow)); } //if(x7!=VuMap && for(A6=0;A6=topCooCol+MapColWd || F6=topCooRow+MapRowHt) return; A6=C6=fldWd+bdrWd+(E6-topCooCol)*sqSid; if(E6>topCooCol) A6-=2; B6=D6=ioHt+bdrWd+(F6-topCooRow)*sqSid; if(F6>topCooRow) B6-=2; C6=sqSid+(C6!=A6 && E60; A6=Math.abs(A6); //parse chr Wd rng code & compute Wd stat eq(A6$,wrdOut(pri(A6),ChrWd)); B6=dig(A6$,0); C6=dig(A6$,2); if(A6$.charAt(1)=='<') C6=-C6; D6=dig(A6$,4); if(A6$.charAt(3)=='-') D6=-D6; if(isA6) eq(B6$,dic(B6,"Wds roll")); else{ B6$.setLength(0); for(E6=1;E6<=B6;E6++) B6$.append('6'); } //else(isA6 E6=lowDic(B6$,X); //sum Wd dice if(C6>1) //mod sum E6=(E6+C6-1)/C6; //rnd up frac if(C6<0) E6=Math.min(E6,-C6-1); //enforce set lim E6+=D6; //+/- adder if(isA6){ E6=Math.max(1,E6+(fea$=='F'?bf[1]:lr[1])); //add any F,L Wd mod dtaIn(A6,ChrWd,""+E6); } //if(isA6 else{ F6=B6+E6; F6=(F6+1)/2; //rnd up frac } //else(isA6 } //genWd mth - rtns E6(#Wds),or F6(avg of rng); sets ChrWd fld boolean bstCap(int elm,int val){ atkSrc=elm; //note: bsts use only Cbt Wpns or Mgc Spls setAtk(Cbt,val); //ini atk cap - note ini asgn: atkWpn= spec Bst1 or Bst2 isA6=true; //ini rtn val atkRng=Msl; //default B6=atkWpn==Bst1?ChrWp1:ChrWp2; //chk dieWgt coding C6=pri(atkSrc); eq(A6$,wrdOut(C6,B6)); if(atkWpn==Bst2 && str(A6$).equals("ibid")) eq(A6$,wrdOut(C6,ChrWp1)); if("123456789".indexOf(A6$.charAt(0))<0) if(str(A6$).substring(0,2).equals("W*")) dieWgt=Math.min(2+bf[1],modWd(atkSrc)); else setAtk(Mgc,SplAbr$.indexOf(str(A6$))/3+1); else dieWgt=dig(A6$,0); C6=valOut(atkSrc,ChrSq); if(atkTyp==Cbt){ //chk diePch coding B6=WpnCod$.indexOf(A6$.charAt(2)); //wpn code ltr idx or Bst1/2 pch dij if(++B6>0){ //chk if wpn itm rdy, else rdy avail wpn, else =Una eq(xsA,WpnElm$); isB6=has(atkSrc,wrdOut(xsA,B6),"weapon"); //chks for "*/+/=weapon" D6=elmNum; //elmNum of has() if(isB6){ atkWpn=B6; //replg Bst1/2 atkItm=D6; } //if(isB6 else if(D6>0 && !has(atkSrc,"Tng","fx") && (B6!=Bow || has(atkSrc,"Arrow","ammo"))){ setAtk(Rdy,D6); return false; } //if(D6>0 && else if(atkWpn==Bst1) atkWpn=Una; else return false; //Wp2 unuseable } //if(++B6>0 else diePch=dig(A6$,2); //atkWpn is Bst1/2 if(isCbt){ //!isCbt= setup in chkBst() isB6=atkWpn==Bst1 || atkWpn==Una || atkWpn==Qsf || atkWpn==Swd; //eng wpns if(isB6 || !isB6 && (C6>16 || C6<(isFoe(atkSrc)?14:4) && (atkWpn==Bst2 || atkWpn==Bow) //Bst2 is Torgrim || getPst(atkSrc)<2)){ //~?allow prone throw atkRng=Eng; if(atkWpn==Bst2 || atkWpn==Bow) isA6=false; } //if(isB6 || } //if(isCbt if(atkWpn==Bow) if(has(atkSrc,"Arrow","ammo")) //chks for "Arrow/s","+/=ammo" atkAmo=elmNum; else{ isA6=false; amoCnt=0; //flg for bstAtk() "out of ammo" msg } //else(has(atkSrc,"Arrow","ammo" } //if(atkTyp==Cbt else{ if("ShkPsnTmtFbrAidTng".indexOf(str(A6$))>=0){ //chk spl rng atkRng=Eng; } //if("Shk..".indexOf( eq(xsA,SplElm$); //chk if spl still useable isB6=has(atkSrc,wrdOut(xsA,atkSpl),"spell"); //atkSpl of setAtk(Mgc,) abv atkItm=elmNum; //elmNum of has() if(!isB6 || wrdOut(atkItm,ItmOpn).equals("fail") || hdg(atkSrc,"Tng") || atkSpl==Bgl && hdg(atkSrc,"Bgl")) isA6=false; //resets atkItm=0 in setAtk() blw } //else(atkTyp==Cbt if(isFoe(atkSrc)!=(C6>X)) //on opp gnd if(atkRng==Msl) if(atkWpn==Bow) isA6=false; else atkRng=Eng; if(!isA6) //only Nop & Rdy (see abv) atk Typs rtnd when false setAtk(Nop,Nah); return isA6; //Bst1/2 (arg) use available } //bstCap mth - rtns: t/f(spec Bst1/2 useable),atkTyp,atkWpn,atkRng,dieWgt,diePch int mob(int elm){ //bstOrg() rout useage= mob(rdmChr()): culls busy/ immobile chrs A6=elm; //sbr actually ops on all chrs in Z6[] ary if(A61?ran(G6):(G6<1?ran(D6):1); //only consc (typic Foe+Set) chrs in ary return elmNum=Z6[G6]; } //mob mth int rdmChr(int coo,int at,int to,int val){ //incorps sqOcc() cap A6=coo; //nec for chkg other coos for chrs B6=at; C6=to; //rng might incl sq #10 =Ok: eg. 5,14 chks 1..5 & 11..14 H6=val; //Bst=0, Adv=1, Foe=2, Pty=3, Any=4, Set=5, Out=10 (see locChr()) //reduce val to Bst..Any rng (can't look for 'Set' & 'Out' at once) I6=H6>=Out?H6-Out: (H6>=Set?H6-Set:H6); D6= //ini Z6[] elm ptr: # spec Bst..Any chrs in Sqs rng E6= //#active chrs in Sqs rng F6= //hi pst in Sqs rng J6= //1st unacted chr in Sqs rng N6=0; //chr elm w hi pst if(B6<1 || B6>19 || C619) return elmNum=0; isA6=C6>X && B60){ K6=elmNum; G6=valOut(K6,ChrSq); isB6=isA6 && G6=B6); if(isC6){ isC6=isUp(K6); L6=pri(K6); M6=Ctl$.indexOf(wrdOut(K6,ChrCtl)); if((I6==Any || (I6&1)==(M6&1) && (I6>Adv || I6==Bst && L6>=bstCat || I6==Adv && L6<=advCat)) && (isC6 || H6>=Out) && M6<(H6=Set?2:4)){ //unconsc chr can't be Set, even if mrkd 'unacted' D6++; if(getPst(K6)>F6){ F6=D7; //D7 of getPst() N6=K6; //note hi pst chr } //if(getPst(K6)>F6 if(J6<1 && M6<2) J6=K6; //note 1st unacted chr if(isC6){ E6++; Z6[D6]=K6; //log as conscious } //if(isC6 else Z6[D6]=-K6; //log as unconscious } //if(I6==Any || } //if(isC6 K6++; } //while(K60 || H6>=Out) if(++I6==A6) break; return elmNum=Z6[G6]; } //rdmChr mth - rtns Z6[] ary of chrGrp elms; D6= #chrs, E6= #conscious chrs, //F6= highest ChrPst val (1..4), N6= hiPst chr, and J6= 1st unacted chr in Sqs rng; //or 0 if unocc, besides elmNum= rdm spec chr elm int locChr(int coo,int val){ //uses: newChr ~at lvl 6 allows for use of has(), etc. A6=coo; //use 0 (or val <101) to chk all coos B6=val; //Bst= bst in bst ctl, Adv= adv in adv ctl, Foe= in bst ctl, //Pty= in adv ctl, Any= in chrGrp; +Set/Out per nxt //Out= may be unconscious/ asleep: eg. pikChr(Adv+Out,"take item from") //Set= must be unacted: eg. pikChr(Pty+Set,"next attacker") G6=B6>=Out?B6-Out:B6>=Set?B6-Set:B6; //can't be both rdy & dest E6=H6=newChr=itmGrp?chrGrp:newChr+1; C6=1; //ini for 1st pas do{ while(E6C && A6!=valOut(E6,ChrCoo) || B6=itmGrp || C6>1 && E6>=H6; if(isA6){ E6=chrGrp; C6++; //flg for 2nd pas or end } //if(isA6 else{ if(G6=bstCat || G6==Bst && F6<=advCat) D6=G6+1; else D6=Ctl$.indexOf(wrdOut(E6,ChrCtl)); //ctl, unacted status isA6=B6!=Any && B6!=Any+Out //Any+Set exc && (G6=Set && B61); if(isA6) E6++; } //else(isA6 }while(C6<3 && isA6); if(C6>2) E6=0; return E6; } //locChr fnc mth boolean takItm(int own,int elm){ //user/ adv tries rdyItm() A6=own; B6=elm; //=itmElm: either itmGrp or itmPoo elm# C6=B6=0; isB6=str(C6$).indexOf("ammo")>=0; if(A6!=trvChr && (isA6 || isB6)){ chkWpn(A6); if(isA6 && (Z7[9]<1 || Z7[3]<1 && str(B6$).indexOf("Bow")<0) || isB6 && Z7[8]<1) //Z7[]s of chkWpn() eq(A6$,"Sbj overloaded"); } //if(isA6 || if(D6>=bstCat && (WpnCod$.indexOf(wrdOut(D6,ChrWp1).charAt(2))<0 || wrdOut(D6,ChrTyp).equals("Manticore") || C6$.charAt(0)!='=')) eq(A6$,"Beasts using normal weapons only"); isA6=wrdOut(C6,ItmRep).equals("uni"); //1ea/uni fxs prev chkd; & nxt if((isA6 || wrdOut(C6,ItmRep).equals("1ea")) && hav(isA6?-A6:A6,str(B6$),str(C6$))) eq(A6$,"Can't have more than 1"); if(x1!=PikPty && wrdOut(C6,ItmRdy).equals("nil")) eq(A6$,"Item immaterial"); return isA6=A6$.length()<1; } //takItm mth - rtns isA6 (success of take), A6$ (error msg) int sklMod(int elm,int val){ A6=elm; B6=val; //atkWpn code, or All C6=0; eq(A6$,cut(wrdOut(A6,ChrNam))); D6=itmGrp; while(D6<=arySiz && locItm(D6,"ModSkl","fx")>0){ D6=elmNum; //elmNum of locItm() if(str(A6$).equals(wrdOut(D6,ItmOwn))){ E6=valOut(D6,ItmId); //incls Una, Bst1/2 if(E6==B6 || E6==All) C6+=valOut(D6,ItmBon); } //if(str(A6$).equals D6++; } //while(D6<=arySiz return C6; } //sklMod fnc mth - rtns C6= tot mods for spec'd skill boolean inScb(int elm){ //uses: elm of (wpn) itm to chk A6=elm; isA6=false; B6=locElm(chrGrp,ChrNam,wrdOut(A6,ItmOwn)); if(has(B6,"Sheath","sash") && wrdOut(A6,ItmLoc).equals(UnRdy$)){ eq(A6$,wrdOut(A6,ItmCod)); eq(B6$,wrdOut(elmNum,ItmBon)); //elmNum of has() if(str(A6$).equals(str(B6$))) isA6=true; } //if(has(atkTgt,"Sheath","sash") && return isA6; } //inScb mth - rtns isA6, elmNum= Sheath elm void reSet(int typ,int val){ //chg chrs' Ctl 'acted' status - uses: atCoo E6=typ; //[Foe, Pty, Any] (+Out) B6=val; //Set, Nah B6=B6==Set?0:2; if(E6>=chrGrp){ //single chr if(isPty(E6)) B6++; dtaIn(E6,ChrCtl,""+Ctl$.charAt(B6)); return; } //if(E6>=chrGrp A6=E6>Out?E6-Out:E6; //Foe, Pty, Any A6=A6==Foe?0:(A6==Pty?1:2); for(C6=chrGrp;C6=0 && ((D6+1)&1)!=A6) //trvChr -> -1 if(E6>Out || isUp(C6)) //~?&& !has(C6,"Shk","fx") dtaIn(C6,ChrCtl,""+Ctl$.charAt(B6+(D6&1))); } //if(valOut(C6,ChrCoo)==atCoo } //reSet mth void movRpt(int elm,int to){ A6=elm; B6=to; eq(B6$,chrNam(A6)); if(has(A6,"Daz","fx")) rcd$.append(B6$+" using Dhazh spice."+Div$); isA6=false; while(has(A6,"Tng","fx")){ isA6=true; eq(elmNum,Fre$); } //while(has(A6,"Tng","fx" if(isA6) rcd$.append(B6$+" Snaps all Tangle holds."+Div$); if(bf[6]>0 && getPst(A6)>1 && !has(A6,"Daz","fx") && dig(dic(1,"fall chk"),0)>=bf[6]){ eq(A6$,wrdOut(A6,ChrPst)); C6=A6$.length(); insStr(A6$,C6-1,C6,"1"); dtaIn(A6,ChrPst,str(A6$)); rcd$.append(B6$+" fell on broken ground."+Div$); } //if(bf[6]>0 && if(hdg(A6,"Tng")){ C6=elmNum; //elmNum of hdg() rcd$.append(B6$+" released " +chrNam(locElm(chrGrp,ChrNam,wrdOut(C6,ItmOwn)))+" Tng fx."+Div$); eq(C6,Fre$); } //if(hdg(A6, if(has(A6,"SplMR","fx")){ C6=elmNum; //elmNum of has() D6=locElm(chrGrp,ChrNam,wrdOut(C6,ItmLoc)); eq(A6$,wrdOut(C6,ItmBon)); rcd$.append(chrNam(A6)+" loses held "+A6$+" spell."+Div$); if(pri(D6)<=advCat && isUp(D6)){ E6=3*dig(SplCst$,SplAbr$.indexOf(str(A6$))/3); addTo(D6,ChrEp,E6); //get ep for cancel rcd$.append(chrNam(D6)+" gained "+E6+" ep for held "+A6$+" spell cancel."+Div$); } //if(pri(D6)<=advCat && eq(C6,Fre$); } //if(has(A6,"SplMR" if(x4!=OrdPty || !ise4){ //NA for Dhazh opn C6=chrGrp; //isStk or not; mostly for those who back up to occ'd sq 8 or h while(C60){ C6=elmNum; //elmNum of locDuo() if(getPst(C6)>1){ insStr(A7$,C7,C7+1,"1"); //_7s of getPst() dtaIn(C6,ChrPst,str(A7$)); } //if(getPst(C6)>1 C6++; } //while(C6 place in to sq if(D6>0 && D6!=X && D6<20){ //if not off-Field E6=(D6+(D6>9?1:2))%3; //sq col F6=(sqSid+bdrWd)/4+E6*(sqSid*5/4); E6=(D6>9?19-D6:D6+8)/3; //sq row G6=ioHt+sqSid*3/8+E6*(sqSid*5/4); if(D6=M6 || locElm(E6,ChrSq,""+D6)==0) if(C6==1) //erasing/ moved from sq if(K6>0 && --E6!=K6) //last chr shown was prone & not highest consc in sq elmNum=M6=K6; else break; //only exit when called by shoFld() else elmNum=A6; //show srcChr mkr last E6=elmNum; //elmNum of locElm() isA6=isPty(E6); isB6=isUp(E6); if(valOut(E6,ChrCoo)==J6 && (isA6 || isDwn || isB6)){ //don't show bst if downed & !isDwn H6=F6; I6=G6; eq(A6$,wrdOut(E6,ChrPst)); L6=dig(A6$,A6$.length()-1); if(L6<2){ //~alt: (isStk &&, for no shifting unless isStk H6+=sqSid/8; I6+=sqSid/8; } //if(L6<2 if(L6>1 || isStk && K6==0 && isB6) //last standing or consc prone K6=E6; g.setColor(hue(isA6?AdvBkg:BstBkg)); g.fillRect(H6,I6,sqSid,sqSid); isA6=pri(E6)<=advCat; if(isCg){ g.setColor(hue(ChrFgd)); g.drawString(""+wrdOut(E6,ChrNam).charAt(isA6?0:endDiv-begDiv-1), H6+sqSid*3/8,I6+sqSid*2/3); } //if(isCg else shoMkr((isA6?advImg:bstImg)+valOut(E6,ChrImg),H6,I6); g.setColor(hue(isA6?AdvFgd:BstFgd)); g.drawRect(H6,I6,sqSid,sqSid); if(!isB6) g.drawLine(H6,I6,H6+sqSid,I6+sqSid); } //if(valOut(E6,ChrCoo)==J6 && } //while(E6!=A6 } //if(D6>0 && D6=B6; } //for(C6=1; dtaIn(A6,ChrSq,""+B6); } //movChr mth boolean chkPot(int elm,String typ$){ A6=elm; //fx owner eq(A6$,typ$); if(!has(A6,str(A6$),"fx")) return false; B6=elmNum; //elmNum of has() if(A6<0) A6=locElm(chrGrp,ChrNam,wrdOut(B6,ItmOwn)); isA6=valOut(B6,ItmId)<1 || dig(dic(1,""+A6$+" opn"),0)<6; if(isA6) addTo(B6,ItmId,1); else eq(B6,Fre$); eq(A6$,chrNam(A6)+(isA6?" uses ":" loses ")+A6$+" potion fx"+(isA6?'.':'!')); return true; } //chkPot mth - rtns isA6(no/go) //var lvl 7 subroutines void addItm(int own,int elm){ //typ$ arg call: addItm(own,locItm(itmPoo,"typ","cla")) A7=own; //gains new itm B7=elm; //itmPoo elm eq(A7$,cut(wrdOut(A7,ChrNam))); eq(B7$,cut(wrdOut(B7,ItmTyp))); eq(C7$,wrdOut(B7,ItmCla)); //if ItmRep=acu -> rtn existing (if any) itmGrp elm# owned isA7="1ea,acu".indexOf(wrdOut(B7,ItmRep))>=0; if(isA7){ elmNum=itmGrp; while(elmNum<=arySiz && locItm(elmNum,str(B7$),str(C7$))>0){ //short-circuit conds prcg if(wrdOut(elmNum,ItmOwn).equals(str(A7$))) return; // rtns with elmNum set elmNum++; } //while(elmNum<=arySiz } //if(isA7 isA7=false; //flg for existing 1ea/acu itm found //add new itm to itmGrp listing - flagged as not ready, tho Identified isB7=wrdOut(B7,ItmRdy).equals("nil"); eqs(locElm(itmGrp,ItmOwn,Fre$),A7$).append(Div$) //=ItmOwn .append(B7$).append(Div$) //=ItmCod .append(C7$).append(Div$) //=ItmCla .append(A7==trvChr?"0":(isB7?"nil":UnRdy$)).append(Div$) //=ItmLoc .append("0").append(Div$) //=ItmOpn .append("Ok").append(Div$) //=ItmBon .append(isB7 || str(C7$).equals("cash")?"nil":"Id'd"); } //addItm mth - rtns elmNum of added itm,isA7 void shoCoo(int col,int row){ cooCol=col; cooRow=row; //note: isTil() chk integral - if(isTil()) shoCoo(); unnec if(!isTil(cooCol,cooRow) && C8<1) //C8 of isTil() return; //skip blank coo if not marked w feature F7=C8; eq(A7$,A8$); //A8$ of isTil() if(isA8){ //isA8= on map: of isTil() A7=fldWd+bdrWd+(cooCol-topCooCol)*sqSid; B7=ioHt+bdrWd+(cooRow-topCooRow)*sqSid; } //if(isA8 else{ A7=bdrWd+sqSid*3/2; B7=bdrWd+ioHt-pflHt+sqSid/4; } //else(isA8 C7=0; //ini A7$ byt ptr Graphics g=getGraphics(); if(isC8){ //isC8 of isTil() g.setColor(hue(MapFgd)); g.fillRect(A7,B7,sqSid,sqSid); g.setColor(hue(MapBkg)); //clear hall or room area C7=Math.max(1,sqSid/(str(A7$).indexOf('h')<0?8:4)); g.fillRect(A7+C7,B7+C7,sqSid-2*C7,sqSid-2*C7); //place hallways & doorways for(C7=0;C7<4;C7++){ //C7= side code -1 G7=+A7$.charAt(C7); if(G7!=+'w'){ D7=sqSid/4; E7=sqSid-2*D7; if(G7==+'d'){ D7=hlfSqSid-sqSid/8; E7=Math.max(1,sqSid/4); } //if(G7==+'d' if(C7==0) g.fillRect(A7,B7+D7,hlfSqSid,E7); else if(C7==1) g.fillRect(A7+D7,B7,E7,hlfSqSid); else if(C7==2) g.fillRect(A7+D7,B7+D7,sqSid-D7,E7); else g.fillRect(A7+D7,B7+D7,E7,sqSid-D7); } //if(G7!=+'w' } //for(C7=0; //g.drawRect(A7,B7,sqSid,sqSid); //~test ln or, g.drawLine(A7,B7,A7,B7); } //if(isC8 if(C70; if(isA7) D7=elmNum; //elmNum of locDuo() elmNum=itmGrp; while(elmNum<=arySiz && locItm(elmNum,"ModWd","fx")>0){ if(str(A7$).equals(wrdOut(elmNum,ItmOwn))){ //elmNum of locItm() G7=valOut(elmNum,ItmBon); modAtr+=G7; if(isA7 && wrdOut(elmNum,ItmId).equals("Pwr")){ //Pwr fx's ModWd co-fx E7=elmNum; F7=G7; } //if(isA7 && } //if(str(A7$).equals elmNum++; } //while(locItm( modAtr=Math.max(0,modAtr); if(isA7){ if(modAtr0) dtaIn(elmNum,ItmBon,""+Math.max(0,valOut(elmNum,ItmBon)-G7)); if(locDuo(itmGrp,ItmOwn,str(A7$),ItmCod,"PsnWd")>0 && valOut(elmNum,ItmBon)>C7) dtaIn(elmNum,ItmBon,""+C7); modWd(A7); return modAtr; } //if(modAtr0){ if(str(A7$).equals(wrdOut(elmNum,ItmOwn))) modAtr+=valOut(elmNum,ItmBon); elmNum++; } //while(elmNum<=arySiz && if(has(A7,"Yik","fx")) modAtr+=valOut(elmNum,ItmBon); if(bstRtg>5 && isFoe(A7)) if(has(-A7+HasEmy,"TruNam","fx")) //any opp of bst has TruNam fx modAtr=0; return modAtr=Math.max(0,modAtr); } //modRv mth int modDef(int elm){ A7=elm; if(has(A7,"Armor","+armor")){ B7=elmNum; //elmNum of has() if(valOut(B7,ItmId)==0) modAtr=valOut(B7,ItmBon); else modAtr=1; } //if(has(A7,"Armor" else modAtr=B7=0; //must pos post-has() for B7 (+arm elm) rtn retention C7=pri(A7); //A7 unchgd by has() eq(A7$,wrdOut(C7,ChrDef)); //must pos post-has() for A7$ rtn retention modAtr+=dig(A7$,0); if(C7>=bstCat) modAtr+=bf[3]; eq(B7$,cut(wrdOut(A7,ChrNam))); elmNum=itmGrp; //mods while(elmNum<=arySiz && locItm(elmNum,"ModDef","fx")>0){ if(str(B7$).equals(wrdOut(elmNum,ItmOwn))) modAtr+=valOut(elmNum,ItmBon); elmNum++; } //while(locItm( return modAtr=Math.max(0,modAtr); } //modDef mth boolean hav(int elm,String typ$,String cla$){ return has(elm,typ$,cla$) || elmNum>0; //note ini asgn: A7= chr, A7$= typ$, B8$= cla$ //hav(srcChr,"Axe","weapon") finds 1st readied, or last unreadied elm (using l to r eval) } //hav mth boolean has(int elm,String typ$,String cla$){ //db ary chk suite: has() - isRdy() - pri() - locItm() - locElm() - val/wrdOut() - nthDiv() A7=elm; eq(A7$,typ$); eq(B7$,cla$); B7=A7>0?A7: //pos chr arg -> chk chr itms only (A7>HasEmy?-A7: //neg chr arg, but HasEmy not added -> chk all on chr sid (--A7= +A7) -A7+HasEmy); //neg chr arg w HasEmy added -> chk all on chr opp sid (--A7= +A7) eq(C7$,""+Div$); if(A7>HasEmy) C7$.append(cut(wrdOut(B7,ChrNam))); if(A7<0){ //exp C7$: to chk all (incl unc) chrs (pty xor foe) in (focus chr's) coo for itm elmNum=chrGrp; eq(D7$,wrdOut(B7,ChrCoo)); eq(E7$,wrdOut(B7,ChrCtl).toUpperCase()); if(A7 B while(elmNum0){ //find remaining chr in this coo if(elmNum!=B7 && wrdOut(elmNum,ChrCtl).toUpperCase().equals(str(E7$))){ //if another on same side C7$.append(Div$).append(cut(wrdOut(elmNum,ChrNam))); } //if(elmNum!=B7 && elmNum++; } //while(elmNum0 && A7$.charAt(0)=='^'){ //chk pri(itm)s' fld; w rdy cap for(C7=itmGrp;C7<=arySiz;C7++) if(z1$[C7].charAt(0)!=Fre0$ && str(C7$).indexOf(Div$+wrdOut(C7,ItmOwn)+Div$)>=0 && wrdOut(pri(C7),dig(A7$,1)).equals(str(B7$))){ B7=C7; if(isRdy(C7)){ D7=C7; break; } //if(isRdy(C7 } //if(z1$[C7].charAt(0)!=Fre0$ && } //if(A7$.length()>0 && ~{} req by Javac viz nxt else post- ifs else{ C7=itmGrp; //use of C7 vs elmNum directly due to pri() in isRdy() while(C7<=arySiz && locItm(C7,str(A7$),cla$)>0){ //note asgn: B8$= cla$ C7=elmNum; if(str(C7$).indexOf(Div$+wrdOut(C7,ItmOwn)+Div$)>=0){ B7=C7; if(isRdy(C7)){ D7=C7; break; } //if(isRdy(C7 } //if(str(C7$).indexOf( C7++; } //while((locItm(elmNum, } //else(A7$.charAt(0)=='+' elmNum=B7; return D7>0; //with elmNum val avail (see hav()) } //has mth int lowDic(StringBuffer dta$,int val){ eq(A7$,dta$); A7=val; B7=C7=0; for(D7=0;D7=0) //dic(0,"") sets die$ to null die$.setLength(0); if(A7==0) return die$; txt("043"); txt("143"+A7$+":"); for(C7=1;C7<5;C7++){ //# of face changes for dice txt("044"); B7$.setLength(0); for(D7=0;D720) //dpy only 20 chrs of die$ eqs(B7$,str(B7$).substring(0,20)).append(".."); txt("144"+B7$); try{ //delay Thread.sleep(C); } //try catch(InterruptedException e){ }; //catch(InterruptedException } //for(C7=1; B7$.setLength(0); //~to sho prev (all) dice in order: del ln for(C7=0;C720) //dpy only 20 chrs of die$ eqs(B7$,str(B7$).substring(0,20)).append(".."); txt("544"+B7$); //~to sho prev (all) dice in order: +die$) //~ltr=new Font("SanSerif",Font.PLAIN,ltrPt); try{ //delay Thread.sleep(500); } //try catch(InterruptedException e){ }; //catch(InterruptedException return die$; } //dic mth void addTo(int elm,int num,int val){ A7=elm; B7=num; C7=val; D7=valOut(A7,B7)+C7; isA7=D7>0 && A9$.charAt(0)<'0'; //<'0'= '+', A9$ of valOut() dtaIn(A7,B7,(isA7?"+":"")+D7); } //addTo mth void rmvFea(int coo){ //rmv fea code chr(s) from spec'd coo A7=coo; B7=A7%C; //coo row A7=A7/C; //coo col C7=mazMap+B7; eq(A7$,wrdOut(C7,A7)); D7=3; E7=FeaIdx$.indexOf('D'); while(++D7E7) insStr(A7$,D7,D7+1,""); dtaIn(C7,A7,str(A7$)); } //rmvFea mth void makRdy(int own,int elm){ //itm elm>= itmGrp //note: uses generic unready loc of "slung"; if desired to use actual loc //of unready item, sbr will need to be rout lvl for player input A7=own; B7=elm; if(A7==trvChr){ dtaIn(B7,ItmLoc,"0"); //default sq0 loc for trvChr return; } //if(A7==trvChr if(isRdy(B7)){ //if currently rdy, unrdy itm dtaIn(B7,ItmLoc,UnRdy$); return; } //if(isRdy(B7 eq(A7$,wrdOut(pri(B7),ItmRdy)); //note type item's location when ready if(str(A7$).equals("hand")) eq(A7$,"2d hand"); if("nil,back".indexOf(str(A7$))>=0){ //if itm always ready dtaIn(B7,ItmLoc,str(A7$)); //rdy sel itm return; } //if(str(A7$).equals("nil, //unrdy other itm(s) if in prospect loc eq(B7$,A7$); eq(C7$,cut(wrdOut(A7,ChrNam))); C7=1; do{ D7=itmGrp; while(locElm(D7,ItmLoc,str(B7$))>0){ D7=elmNum; if(wrdOut(D7,ItmOwn).equals(str(C7$))){ dtaIn(D7,ItmLoc,UnRdy$); break; } //if(wrdOut(elmNum, D7++; } //while(locElm(elmNum, if(str(A7$).equals("hands") && str(B7$).equals("1t hand")){ eq(B7$,"2d hand"); C7++; } //if(str(A7$).equals("hands" if(str(A7$).equals(str(B7$)) && str(B7$).equals("hands")){ eq(B7$,"1t hand"); C7++; } //if(str(A7$).equals(str(B7$)) && if(str(A7$).equals(str(B7$)) && (str(B7$).equals("2d hand") || str(B7$).equals("1t hand"))){ eq(B7$,"hands"); C7++; } //if(str(A7$).equals(str(B7$)) && }while(--C7>0); dtaIn(B7,ItmLoc,str(A7$)); //rdy sel itm } //makRdy mth void chkWpn(int elm){ A7=elm; eq(A7$,cut(wrdOut(A7,ChrNam))); Z7[1]=Z7[2]=B7=C7=E7=F7=G7=0; D7=itmGrp; while(D7<=arySiz && locElm(D7,ItmOwn,str(A7$))>0){ D7=elmNum; H7=pri(D7); if(wrdOut(H7,ItmTyp).indexOf("Arrow")>=0){ //finds =/+/* aro B7++; isA7=wrdOut(H7,ItmRep).equals("acu"); F7+=isA7?valOut(D7,ItmBon):1; if(C7=0 else if(wrdOut(D7,ItmCla).indexOf("weapon")>=0){ //finds =/+/* wpn Z7[++E7]=D7; //wpns held (slots filled) if(wrdOut(D7,ItmCod).equals("Bow")) G7++; //# of Bows held } //if(wrdOut(D7,ItmCla).indexOf("weapon" D7++; } //while(D7<=arySiz && Z7[4]=B7; Z7[5]=C7; Z7[6]=isB7?0:1; Z7[7]=F7; D7=(F7+11)/12; //(+11 to round up) #slots covered by arrows E7=2-E7; Z7[3]=E7-Math.max(0,D7-G7); Z7[8]=12*(E7+G7)-F7; Z7[9]=E7; } //chkWpn mth - rtns Z7[1] 1st wpn elm, [2] 2nd wpn elm, [3] #non-Bow wpns can take, //[4] arrow #elms, [5] ord, or 1st mag arrow elm, [6] 0/1 [5]= ord/mag, //[7] #arrows held, [8] #arrows can take, [9] #Bows can take= #slots open int getPst(int elm){ //chk chr's Pst - uses: chr elm# A7=elm; eq(A7$,wrdOut(A7,ChrPst)); C7=A7$.length()-1; D7=dig(A7$,C7); //pst now B7=valOut(pri(A7),ChrHiP); E7=B7%X-1; //nml pst B7=B7/X; //#rnds HiP cap return D7; } //getPst mth - rtns C7 pst byt pos, D7 pst now, E7 nml pst, //F7 #rds HiP cap, A7$ upd fld ety String chrNam(int elm){ //condenses bst names from namBst var eg. "B142" to "B2" A7=elm; if(A7=itmGrp || z1$[A7].charAt(0)==Fre0$) return ""; B7=pri(A7); eq(A7$,wrdOut(A7,ChrNam)); //~?general truncate of overly-long names C7=endDiv-begDiv-1; return B7>=bstCat && isFoe(A7)?"B"+A7$.charAt(C7):str(A7$); } //chrNam mth - alters elmNum boolean hdg(int elm,String obj$){ return locDuo(itmGrp,ItmCod,obj$,ItmLoc,cut(wrdOut(elm,ChrNam)))>0; } //hdg mth void shoKey(){ hldTyp=txtTyp; //kicks out to keyListener() vs go() - must sto txt() var vals hldX=txtX; hldY=txtY; E7=argLg; eq(hld$,lin$); eq(A7$,inp$); //isLin not chgd by txt("1s Graphics g=getGraphics(); //clear & outline display area A7=fldWd; B7=bdHt-2*sqSid; C7=8*sqSid+1; D7=2*sqSid; g.setColor(hue(BrfBkg)); g.fillRect(A7,B7,C7,D7); g.setColor(hue(BdrFgd)); g.drawRect(A7,B7,C7,D7); txt("1F4 - hot keys -"); txt("1G3 [ : chk advs"); txt("1G5' : chk bsts"); txt("1H3 ] : review map"); txt("1H5"+'\\'+" : color, resize bd"); txt("1I4 ? : see this list"); txtTyp=hldTyp; txtX=hldX; txtY=hldY; argLg=E7; eq(lin$,hld$); eq(inp$,A7$); } //shoKey mth int pktSiz(int coo,StringBuffer dta$){ A7=coo; eq(C7$,dta$); //all-maze pockets' entries listing (may be >1 ety per pkt) H7=A7/C; I7=A7%C; B7=1; eq(B7$,","+A7+','); L7=Math.max(MazHt,MazWd); for(E7=1;E7H7-E7 && C7I7-E7 && D7=0 || isA7 && str(A7$).indexOf(str(E7$))>=0)){ J7++; isB7=true; B7$.append(str(D7$).substring(1)); K7=str(C7$).indexOf(str(D7$)); if(K7>=0) insStr(C7$,K7,str(C7$).indexOf(',',K7+1),""); break forLbl; } //if((F7==C7 || } //for(G7=D7-1; } //if(!(C7>H7-E7 && isA7=false; }while(isB7); if(J7<1) break; B7+=J7; } //for(E7=1; return B7; } //pktSiz mth - rtns: C7$(ope$ list of pkt etys wo dup ety(s) for coo's pkt) StringBuffer tsk(StringBuffer dta$){ eq(A7$,dta$); rol$.setLength(0); A7=A7$.length(); B7=E7=0; for(C7=1;C7<7;C7++) for(D7=0;D7=dieNix){ E7++; //# of cancelling dice if(dig(rol$,B7)=dieNix } //if(dig(A7$,D7)==C7 eq(rol$,str(rol$).substring(B7)); txt("043"); txt("144 "+rol$); txt("143Task dice:"); dieNix=6; //resto default return rol$; } //tsk mth - rtns rol$,B7(# of dice cancelled) //var lvl 8 subroutines boolean isRdy(int elm){ //db ary chk suite: has() - isRdy() - pri() - locItm() - locElm() - val/wrdOut() - nthDiv() A8=elm; //unchgd by pri() if(A8arySiz) return false; isA8=wrdOut(pri(A8),ItmRdy).equals("nil"); return isA8 || !wrdOut(A8,ItmLoc).equals(UnRdy$); //~note: use blw in case of unready loc other than generic "slung" //~return wrdOut(A8,ItmLoc).equals(wrdOut(pri(A8),ItmRdy)); } //isRdy mth - rtns isA8, elmNum of pri() int pri(int elm){ //db ary chk suite: has() - isRdy() - pri() - locItm() - locElm() - val/wrdOut() - nthDiv() A8=elm; return A8>=itmGrp? locItm(itmPoo,wrdOut(A8,ItmCod),wrdOut(A8,ItmCla)): locElm(chrPoo,ChrTyp,wrdOut(A8,ChrTyp)); } //pri mth - rtns elmNum of locItm/Elm int locDuo(int elm,int num,String obj$,int val,String dta$){ elmNum=elm; D8=val; eq(B8$,dta$); while(locElm(elmNum,num,obj$)>0){ //ini asgns C8=num, A8$=obj$ if(wrdOut(elmNum,D8).equals(str(B8$))) break; if(++elmNum>endElm) return elmNum=0; } //while(locElm(elmNum, return elmNum; //=0 if obj$ not found of locElm() } //locDuo mth int locItm(int elm,String typ$,String cla$){ //db ary chk suite: has() - isRdy() - pri() - locItm() - locElm() - val/wrdOut() - nthDiv() elmNum=elm; C8=elmNum0){ //note ini asgn A8$=typ$, C8 unchgd in locElm() //.indexOf allows for generic class; eg. (=/+/*) "weapon" if(wrdOut(elmNum,ItmCla).indexOf(str(B8$))>=0) break; if(++elmNum>endElm) return elmNum=0; } //while(locElm(elmNum, return elmNum; //=0 if obj$ not found of locElm() } //locItm mth int locElm(int elm,int num,String obj$){ //db ary chk suite: has() - isRdy() - pri() - locItm() - locElm() - val/wrdOut() - nthDiv() begElm=elm; C8=num; eq(A8$,obj$); elmNum=0; //default val for none found endElm=begElm>=itmGrp?arySiz: (begElm>=chrGrp?itmGrp-1: (begElm>=itmPoo?chrGrp-1: itmPoo-1)); isA8=str(A8$).equals("") || A8$.length()>=TagLg; isB8=str(A8$).equals(Fre$); //looking for empty elm ~not req - for speed for(B8=begElm;B8<=endElm;B8++) if(isB8 || z1$[B8].charAt(0)!=Fre0$) //~not req - for speed if(isA8 && wrdOut(B8,C8).startsWith(str(A8$)) || !isA8 && wrdOut(B8,C8).equals(str(A8$))){ //~!isA8 && not req - for speed elmNum=B8; break; } //if(isA8 && return elmNum; } //locElm mth - rtns elmNum, shoAdv() uses B8 int itmCat(int elm){ A8=elm; //elm within itmPoo return A8=A8>=fxItm?fxItm :A8>=dvcItm?dvcItm :A8>=cshItm?cshItm :A8>=scrItm?scrItm :A8>=potItm?potItm :A8>=spiItm?spiItm :A8>=magWpn?magWpn :A8>=ordWpn?ordWpn :A8>=splItm?splItm :A8>=sklItm?sklItm:eqpItm; } //itmCat mth void txt(String dta$){ eq(lin$,dta$); eq(inp$,lin$); //note: lin$ & inp$ passed thru KeyListener eq(A8$,str(lin$).substring(txtCodLg)); argLg=lin$.length(); //note: argLg & txtTyp passed thru KeyListener txtTyp=dig(lin$,0); A8=dig(lin$,1); B8=dig(lin$,2); if(B8>0) txtX=(B8-1)*zonWd+bdrWd+1; else{ ctrStr(str(A8$),B8==-2?pflWd:bdWd); txtX=C9; //C9 of ctrStr() } //else(B8>0 txtY=A8*(ioHt-hlfSqSid*3/4)/8; if(A8>8) //below brf area txtY+=hlfSqSid/2; if(hlfSqSid<5) txtY++; if(A8>4 && hlfSqSid>2) txtY+=hlfSqSid/2; Graphics g=getGraphics(); if(txtTyp==0){ //clear rect space //clear from desig zone right & down to btm of area (which area: deter by line#) txtX--; txtY-=hlfSqSid*3/4; A8=txtYpflWd?ioWd-txtX:pflWd-txtX; B8=txtYioHt-pflHt && txtX2) isLin=true; //ini as false, & leaves keyTyped() false } //txt mth void maxIn(int elm,int num,int val){ A8=val; if(A8>valOut(elm,num)) //note ini asgn: A9=elm; B9=num dtaIn(A9,B9,""+A8); else A8=C9; //C9 of valOut() } //maxIn mth - rtns A8: val left in dta fld void dtaIn(int elm,int num,String dta$){ eq(A8$,dta$); nthDiv(elm,num); //note ini asgn: A9=elm; B9=num insStr(z1$[A9],begDiv,endDiv,A8$); if(A9>=itmGrp && B9==ItmBon && wrdOut(A9,B9).equals("0")) eq(A9,Fre$); } //dtaIn mth boolean isBy(int sq1,int sq2){ A8=sq1; B8=sq2; if(A8==0 || B8==0) return false; C8=(A8>9?19-A8:A8+8)/3; //sq1 row: [sq19] 0-1-2 | 3-4-5 [sq 9] D8=(B8>9?19-B8:B8+8)/3; //sq2 row G8=Math.abs(C8-D8); if(G8>1) return false; E8=(A8+(A8>9?1:2))%3; //sq1 col: lft=0 - ctr=1 - rgt=2 F8=(B8+(B8>9?1:2))%3; //sq2 col H8=Math.abs(E8-F8); return H8<2; } //isBy mth - rtns C8 D8 sq1/ E8 F8 sq2 row & col codes,G8 row dif,H8 col dif boolean isTil(int col,int row){ A8=col; B8=row; A8$.setLength(0); isB8=A8<1 || A8>MazWd+1 || B8<1 || B8>MazHt; //coo is outside xsCol isA8=!(isB8 || A8>MazWd); //coo is in maze if(!isB8) A8$.append(wrdOut(mazMap+B8,A8)); C8=A8$.length(); isC8=C8>0 && "hwd".indexOf(A8$.charAt(0))>=0; return isA8 && isC8; } //isTil mth void shoMkr(int elm,int atX,int atY){ A8=elm; //img$ elm# in z1$[] B8=atX; //Graphics pix loc C8=atY; //if((hlfSqSid&1)<1){ B8--; C8--; } //~test ln D8=-1; //img$ chr ptr (incrs to 0 blw) E8=z1$[A8].length(); F8=0; //img col# ptr G8=1; //img row# ptr H8=0; //mkr pix col# ptr I8=0; //mkr pix row# ptr J8=sqSid/ImgHt; //mkr rect pix ht for 1st img row isA8=A8=0){ //'0'..'9' F8+=M8; //here, vs pre- O8= for P8=F8 blw O8=N8=F8*sqSid/ImgWd-H8; //mkr rect pix wd for img col seg if(isA8 && O8<1) O8=1; if(D8>0 && M8>0 && (isA8 || hues[L8]>=0)){ //don't draw bkg if transparent (-1) g.setColor(hue(isA8?K8:L8)); g.fillRect(B8+H8,C8+I8,O8,R8); } //if(D8>0 && H8+=N8; isA8=!isA8; //1st val in gp= bkg, last val in gp may be fgd or bkg } //if(M8>=0 else{ //',' if(D8==1){ P8=F8; Q8=P8*sqSid/ImgWd; } //if(D8==1 F8=P8; //rtn col ptr to mkr left side H8=Q8; I8+=J8; J8=++G8*sqSid/ImgHt-I8; //mkr rect pix ht for nxt img row isA8=false; } //else(M8>=0 } //while(++D8C8) return A8$.charAt(D8); return 'A'; } //cooFea mth boolean isPty(int elm){ A8=elm; return wrdOut(A8,ChrCtl).toUpperCase().equals("A"); } //isPty mth boolean isFoe(int elm){ A8=elm; return wrdOut(A8,ChrCtl).toUpperCase().equals("B"); } //isFoe mth boolean sex(int elm){ A8=elm; return wrdOut(A8,ChrGen).equals("f"); } //sex mth //var lvl 9 subroutines int valOut(int elm,int num){ //db ary chk suite: has() - isRdy() - pri() - locItm() - locElm() - val/wrdOut() - nthDiv() A$=wrdOut(elm,num).charAt(0); //A9,B9 of nthDiv() return C9="+-0123456789".indexOf(A$)<0?0 :Integer.parseInt(str(A9$).substring(A$=='+'?1:0)); //A9$ of wrdOut() } //valOut mth String wrdOut(int elm,int num){ //db ary chk suite: has() - isRdy() - pri() - locItm() - locElm() - val/wrdOut() - nthDiv() nthDiv(elm,num); //note ini asgns: A9=elm, B9=num eq(A9$,str(z1$[A9]).substring(begDiv,endDiv)); return str(A9$); } //wrdOut mth void nthDiv(int elm,int num){ //db ary chk suite: has() - isRdy() - pri() - locItm() - locElm() - val/wrdOut() - nthDiv() A9=elm; B9=num; begDiv=0; for(C9=B9;C9>0;C9--){ endDiv=str(z1$[A9]).indexOf(Div$,begDiv); if(C9>1) if(endDiv<0) ; //~?note error of num>#Divs vs use last div as blw else begDiv=endDiv+1; } //for(C9=B9; if(endDiv<0) endDiv=z1$[A9].length(); } //nthDiv mth - 1st field num= 1 void setAtk(int typ,int val){ A9=typ; B9=val; //-1, 0, Rdy itm, or atkWpn/Spl/Mtl val atkTyp=A9; atkAmo=0; atkCmp=atkWpn=atkSpl=atkMtl=-1; switch(A9){ case Nop: atkItm=0; break; case Rdy: atkItm=B9; break; case Cbt: atkCmp=Wpn; atkWpn=B9; if(B9==Una || B9==Bst1 || B9==Bst2) atkItm=0; break; case Mgc: atkCmp=Spl; atkSpl=B9; if(B9<0) atkItm=0; break; case Dvc: atkCmp=Mtl; atkMtl=B9; if(B9<0) atkItm=0; } //switch(A9 } //setAtk mth int dig(StringBuffer dta$,int loc){ return dig(str(dta$),loc); //note ini asgn: A9$=dta$, A9=loc } //dig mth w StringBuffer arg int dig(String dta$,int loc){ eq(A9$,dta$); A9=loc; return B9=+A9$.charAt(A9)-Asc0; } //dig mth w String arg int ran(int num){ A9=num; if(A9<2) //+ or 0 only return B9=A9; B9=(int)(A9*Math.random()); return ++B9; //=(int)Math.floor(A9*Math.random()+1) } //ran mth - rtns: B9= rdm int in rng 1..A9 String ctrStr(String dta$,int val){ A9=val; //fit wd Graphics g=getGraphics(); FontMetrics ltrSiz=g.getFontMetrics(ltr); B9=ltrSiz.stringWidth(dta$); C9=(A9-B9)>>1; //lft/rgt spc return dta$; } //ctrStr mth void fitStr(String dta$,int num,int val){ eq(A9$,dta$); A9=num; //max Pt siz: -num= Bold B9=val; //fit wd Graphics g=getGraphics(); ltrPt=Math.abs(A9)+1; do{ ltr=new Font("SanSerif",A9>0?Font.PLAIN:Font.BOLD,--ltrPt); FontMetrics ltrSiz=g.getFontMetrics(ltr); C9=ltrSiz.stringWidth(dta$); isA9=dta$.equals(ChkBrf$) && ltrSiz.getHeight()>sqSid; }while(ltrPt>1 && (isA9 || C9>B9)); D9=(B9-C9)>>1; //lft/rgt spc } //fitStr mth //var lvl 0 subroutines Color hue(int val){ return StdHue[hues[val]]; } //hue mth String cut(String dta$){ return dta$.substring(0,Math.min(dta$.length(),TagLg)); } //cut mth void insStr(StringBuffer sbj$,int at,StringBuffer ins$){ insStr(sbj$,at,at,ins$); } //insStr mth void insStr(StringBuffer sbj$,int at,String ins$){ insStr(sbj$,at,at,ins$); } //insStr mth void insStr(StringBuffer sbj$,int at,int to,StringBuffer ins$){ insStr(sbj$,at,to,str(ins$)); } //insStr mth void insStr(StringBuffer sbj$,int at,int to,String ins$){ //equiv to sbj$.delete(at,to); sbj$.insert(at,ins$) eq(A0$,sbj$); eqs(sbj$,str(A0$).substring(0,at)) .append(ins$) .append(str(A0$).substring(to)); } //insStr mth //StringBuffer <-> String utilities: StringBuffer eqs(int elm,StringBuffer obj$){ return eqs(z1$[elm],obj$); } //eqs fnc mth w int (array elm) arg StringBuffer eqs(StringBuffer sbj$,StringBuffer obj$){ return eqs(sbj$,str(obj$)); } //eqs fnc mth w StringBuffer arg StringBuffer eqs(int elm,String obj$){ return eqs(z1$[elm],obj$); } //eqs fnc mth w int (array elm) arg StringBuffer eqs(StringBuffer sbj$,String obj$){ eq(sbj$,obj$); return sbj$; } //eqs fnc mth w String arg void eq(int elm,StringBuffer obj$){ eq(z1$[elm],obj$); } //eq mth w int (array elm) arg void eq(StringBuffer sbj$,StringBuffer obj$){ eq(sbj$,str(obj$)); } //eq mth w StringBuffer arg void eq(int elm,String obj$){ eq(z1$[elm],obj$); } //eq mth w int (array elm) arg void eq(StringBuffer sbj$,String obj$){ sbj$.setLength(0); sbj$.append(obj$); /* eq(a1$,"Wonderful"); eq(a1$,cut(str(a1$))); //note: eq() mth's sbj$.setLength(0) has no bad effect on obj$ arg calcs txt("153"+a1$); //shows "Wonde" //*/ } //eq mth w String arg String str(StringBuffer sbj$){ //When used without assigning= a String var, doesn't alloc mry to copy Buffer, //just refs existing Buffer (per API detail: Implementation advice) for efficiency. return sbj$.toString(); } //str fnc mth - cnv bfr to str: allows for str-only opns on bfr contents } //Applet's cla