From decwrl!purdue!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!zephyr!tektronix!tekgen!tekred!saab!billr Thu Aug 3 07:41:05 PDT 1989 Article 634 of comp.sources.games: Path: decwrl!purdue!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!zephyr!tektronix!tekgen!tekred!saab!billr From: billr@saab.CNA.TEK.COM (Bill Randle) Newsgroups: comp.sources.games Subject: v07i024: omega3 - rogue like dungeon exploration (ver. 0.75), Part05/20 Message-ID: <4246@tekred.CNA.TEK.COM> Date: 13 Jul 89 13:16:39 GMT Sender: news@tekred.CNA.TEK.COM Lines: 1991 Approved: billr@saab.CNA.TEK.COM Submitted-by: "Laurence R. Brothers" Posting-number: Volume 7, Issue 24 Archive-name: omega3/Part05 Supersedes: omega2: Volume 5, Issue 11-29,38-40 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'oeffect3.c' <<'END_OF_FILE' X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */ X/* oeffect3.c */ X X#include "oglob.h" X X/* if know id, then summon that monster; else (if < 0) get one. */ Xvoid summon(blessing,id) Xint blessing,id; X{ X int i,looking=TRUE,x,y; X pml tml; X X if (id < 0) { X if (blessing > 0) { X id = monsterlist(); X xredraw(); X } X /* for (id ==0) case, see below -- get a "fair" monster */ X else if (blessing < 0) id = random_range(NUMMONSTERS); X } X for(i=0;((i<8) && looking);i++) { X x = Player.x+Dirs[0][i]; X y = Player.y+Dirs[1][i]; X looking = ((! inbounds(x,y)) || X (Level->site[x][y].locchar != FLOOR) || X (Level->site[x][y].creature != NULL)); X } X X if (! looking) { X if ((blessing == 0) && (id < 0)) X Level->site[x][y].creature = m_create(x,y,WANDERING,difficulty()); X else Level->site[x][y].creature = make_creature(id); X Level->site[x][y].creature->x = x; X Level->site[x][y].creature->y = y; X tml = ((pml) malloc(sizeof(mltype))); X tml->m = Level->site[x][y].creature; X if (blessing > 0) X m_status_reset(tml->m,HOSTILE); X else if (blessing < 0) X m_status_set(tml->m,HOSTILE); X tml->next = Level->mlist; X Level->mlist = tml; X } X} X X X Xint itemlist(itemindex,num) Xint itemindex,num; X{ X int i,itemno; X X menuclear(); X for(i=0;i num)||(itemno<0)) itemno = ABORT; X return(itemno); X} X Xint monsterlist() X{ X int i,itemno; X do { X clearmsg(); X print1("Summon monster: "); X menuclear(); X for(i=0;i NUMMONSTERS-1)) { X print3("How about trying a real monster?"); X morewait(); X } X } while ((itemno < 0) || (itemno > NUMMONSTERS-1)); X return(itemno); X} X X X X/* uncurse all items, cure diseases, and neutralize poison */ Xvoid cleanse(blessing) X{ X int i; X X if (blessing > -1) { X if (blessing > 0) X for(i=0;iused) && X (Player.possessions[i]->blessing < 0)) { X Player.possessions[i]->used = FALSE; X item_use(Player.possessions[i]); X Player.possessions[i]->blessing = 0; X Player.possessions[i]->used = TRUE; X item_use(Player.possessions[i]); X } X } X X if (Player.status[POISONED] > 0) { X Player.status[POISONED] = 0; X } X if (Player.status[DISEASED] > 0) { X Player.status[DISEASED] = 0; X } X showflags(); X mprint("You feel radiant!"); X } X else { X Player.status[POISONED] += 10; X Player.status[DISEASED] += 10; X mprint("You feel besmirched!"); X showflags(); X } X} X Xvoid annihilate(blessing) Xint blessing; X{ X pml ml; X int i; X X if (blessing == 0) { X mprint("Lightning strikes flash all around you!!!"); X for(i=0;i<9;i++) X if (Level->site[Player.x+Dirs[0][i]][Player.y+Dirs[1][i]].creature != X NULL) X m_death(Level->site[Player.x+Dirs[0][i]][Player.y+Dirs[1][i]].creature); X } X if (blessing > 0) { X mprint("A thousand bolts of lightning flash throughout the level!!!"); X for(ml=Level->mlist;ml!=NULL;ml=ml->next) X if (ml->m != NULL) X m_death(ml->m); X } X else { X mprint("You are hit by a bolt of mystic lightning!"); X p_death("self-annihilation"); X } X} X X X X Xvoid sleep_monster(blessing) Xint blessing; X{ X pml ml; X int x=Player.x,y=Player.y; X struct monster *target; X X if (blessing == 0) setspot(&x,&y); X X if (blessing < 0) X sleep_player(abs(blessing)+2); X else if (blessing > 0) { X mprint("A silence pervades the area."); X for (ml=Level->mlist;ml!=NULL;ml=ml->next) { X m_status_reset(ml->m,AWAKE); X ml->m->wakeup = 0; X } X } X else { X target = Level->site[x][y].creature; X if (target != NULL) { X if (target->uniqueness == COMMON) { X strcpy(Str1,"The "); X strcat(Str1,target->monstring); X } X else strcpy(Str1,target->monstring); X if (! m_immunityp(target,SLEEP)) { X strcat(Str1," seems to have fallen asleep."); X m_status_reset(target,AWAKE); X target->wakeup = 0; X } X else strcat(Str1," is bright eyed, and bushy tailed!"); X mprint(Str1); X } X else mprint("Nothing to sleep there!"); X } X} X Xvoid sleep_player(amount) Xint amount; X{ X if (Player.status[SLEPT] == 0) { /* prevent player from sleeping forever */ X mprint("You feel sleepy..."); X if (! p_immune(SLEEP)) { X Player.status[SLEPT] += random_range(amount*2)+2; X } X else mprint("but you shrug off the momentary lassitude."); X } X} X X Xvoid hide(x,y) Xint x,y; X{ X if (inbounds(x,y)) { X lset(x,y,SECRET); X mprint("You feel knowledgeable."); X } X} X Xvoid clairvoyance(vision) Xint vision; X{ X int i,j; X int x = Player.x, y = Player.y; X mprint("Clairvoyance... "); X setspot(&x,&y); X for(i=x-vision;isite[i][j].showchar = ' '; X lreset(i,j,SECRET); X dodrawspot(i,j); X } X } X levelrefresh(); X} X Xvoid aggravate() X{ X pml tm; X X for (tm=Level->mlist;tm!=NULL;tm=tm->next){ X m_status_set(tm->m,AWAKE); X m_status_set(tm->m,HOSTILE); X } X} X X X X Xvoid learnspell(blessing) Xint blessing; X{ X int i,spell,done=FALSE; X if (blessing < 0) { X for(i=NUMSPELLS;((i>-1) && (! done));i--) X if (Spells[i].known) { X done = TRUE; X Objects[SCROLLID+1].known = TRUE; X mprint("You feel forgetful."); X Spells[i].known = FALSE; X } X if (i == ABORT) X mprint("You feel fortunate."); X } X else { X Objects[SCROLLID+1].known = TRUE; X spell = random_range(NUMSPELLS); X print1("Spell Research"); X if ((random_range(4*Spells[spell].powerdrain)+ X Spells[spell].powerdrain) < X (4*Player.iq+8*Player.level)) { X nprint1(" -- Research successful: "); X nprint1(spellid(spell)); X if (Spells[spell].known) { X print2("...is now easier to cast."); X Spells[spell].powerdrain = ((int) ((Spells[spell].powerdrain+1)/2)); X } X else { X print2("...is added to your repertoire"); X Spells[spell].known = TRUE; X gain_experience(Spells[spell].powerdrain*10); X } X } X else nprint1(" -- Research unsuccessful."); X } X} X X Xvoid amnesia() X{ X int i,j; X for (j=0;jsite[x][y].creature; X if (target != NULL) { X if (target->uniqueness == COMMON) { X strcpy(Str1,"The "); X strcat(Str1,target->monstring); X } X else strcpy(Str1,target->monstring); X if (! m_immunityp(target,NORMAL_DAMAGE)) { X strcat(Str1," was blasted!"); X mprint(Str1); X m_damage(target,amount,NORMAL_DAMAGE); X target->wakeup = 0; X } X else { X strcat(Str1," does not seem affected."); X mprint(Str1); X } X } X } X} X X X X Xvoid disintegrate(x,y) Xint x,y; X{ X struct monster *target; X if (! inbounds(x,y)) mprint("You feel a sense of wastage."); X else if ((x==Player.x)&&(y==Player.y)) { X if (Player.possessions[O_CLOAK] != NULL) { X mprint("Your cloak disintegrates!"); X dispose_lost_objects(1,Player.possessions[O_CLOAK]); X } X else if (Player.possessions[O_ARMOR] != NULL) { X mprint("Your armor disintegrates!"); X dispose_lost_objects(1,Player.possessions[O_ARMOR]); X } X else { X mprint("Uh, oh...."); X mprint("Zzzap! You've been disintegrated!"); X p_damage(250,UNSTOPPABLE,"disintegration"); X } X } X else if ((target = Level->site[x][y].creature) != NULL) { X if (target->uniqueness == COMMON) { X strcpy(Str1,"The "); X strcat(Str1,target->monstring); X } X else strcpy(Str1,target->monstring); X strcat(Str1," disintegrates!"); X mprint(Str1); X m_damage(target,100,UNSTOPPABLE); X if (target->hp > 0) mprint("It was partially protected by its armor."); X } X else if (Level->site[x][y].locchar == ALTAR) { X mprint("Zzzzap! the altar seems unaffected..."); X mprint("But an angry deity retaliates...."); X disintegrate(Player.x,Player.y); X } X else if (Level->site[x][y].p_locf == L_TRAP_PIT) { X if (Current_Environment == Current_Dungeon) { X mprint("A hole is blasted in the base of the pit!"); X Level->site[x][y].locchar = '^'; X Level->site[x][y].p_locf = L_TRAP_DOOR; X Level->site[x][y].aux = S_DISINTEGRATE; X } X else mprint("The hole just gets deeper...."); X } X else if (Level->site[x][y].locchar == FLOOR) { X mprint("You zap a hole in the floor!"); X Level->site[x][y].locchar = '^'; X Level->site[x][y].p_locf = L_TRAP_PIT; X } X else if ((Level->site[x][y].locchar == WALL) || X (Level->site[x][y].locchar == OPEN_DOOR) || X (Level->site[x][y].locchar == CLOSED_DOOR) || X (Level->site[x][y].locchar == PORTCULLIS) || X (Level->site[x][y].locchar == STATUE)) { X mprint("The site is reduced to rubble!"); X if (Level->site[x][y].locchar == WALL) X tunnelcheck(); X Level->site[x][y].p_locf = L_RUBBLE; X Level->site[x][y].locchar = RUBBLE; X lreset(x,y,SECRET); X } X else if ((Level->site[x][y].locchar == RUBBLE) || X (Level->site[x][y].locchar == TRAP)) { X mprint("The site is blasted clear!"); X Level->site[x][y].p_locf = L_NO_OP; X Level->site[x][y].locchar = FLOOR; X lreset(x,y,SECRET); X } X else if (Level->site[x][y].locchar == HEDGE) { X if (Level->site[x][y].p_locf == L_TRIFID) { X mprint("The trifid screams as it disintgrates!"); X gain_experience(50); X Level->site[x][y].p_locf = L_NO_OP; X Level->site[x][y].locchar = FLOOR; X lreset(x,y,SECRET); X } X else if (Level->site[x][y].p_locf == L_HEDGE) { X mprint("The hedge is blasted away!"); X Level->site[x][y].p_locf = L_NO_OP; X Level->site[x][y].locchar = FLOOR; X lreset(x,y,SECRET); X } X else mprint("The blast has no effect."); X } X else mprint("The blast has no effect."); X} X Xvoid acid_cloud() X{ X mprint("You are caught in an acid cloud!"); X if (Player.possessions[O_CLOAK] != NULL) { X damage_item(Player.possessions[O_CLOAK]); X mprint("You are burned by acid."); X p_damage(3,ACID,"an acid cloud"); X } X else if (Player.possessions[O_ARMOR] != NULL) { X mprint("You are burned by acid."); X p_damage(3,ACID,"an acid cloud"); X damage_item(Player.possessions[O_ARMOR]); X } X else { X mprint("The acid eats away at your bare skin!"); X p_damage(25,ACID,"an acid cloud"); X } X} X X X X/* teleport player */ Xvoid p_teleport(type) Xint type; X{ X int x=Player.x,y=Player.y; X drawspot(x,y); X if (type < 0) { X x = random_range(WIDTH); X y = random_range(LENGTH); X if ((Level->site[x][y].locchar != FLOOR) && X (Level->site[x][y].locchar != OPEN_DOOR)) { X mprint("You teleported into a solid object...."); X mprint("You are dead!"); X p_death("teleportation into a solid object"); X } X else { X Player.x = x; X Player.y = y; X } X } X else if (type == 0) X findspace(&(Player.x),&(Player.y),-1); X else { X setspot(&Player.x,&Player.y); X if ((Level->site[Player.x][Player.y].locchar != FLOOR) || X (Level->site[Player.x][Player.y].creature != NULL)) { X mprint("You feel deflected."); X p_teleport(0); X } X } X screencheck(Player.y); X roomcheck(); X} X X Xvoid p_poison(toxicity) Xint toxicity; X{ X mprint("You feel sick."); X if (! p_immune(POISON)) X Player.status[POISONED]+=toxicity; X else mprint("The sickness fades!"); X showflags(); X} X Xvoid apport(blessing) Xint blessing; X{ X int i,index,x=Player.x,y=Player.y; X if (blessing > -1) { X mprint("Apport from:"); X setspot(&x,&y); X if (Level->site[x][y].things != NULL) X pickup_at(x,y); X else mprint("There's nothing there to apport!"); X } X else { X mprint("You have a sense of loss."); X for(i=0;i