//-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ if(button == 0) { summon(bichoActive + 1); if(bichoActive >= bichosTotal - 1) { summon(0); } } if(button == 2) { debug = !debug; } }
//-------------------------------------------------------------- void ofApp::update(){ // bicho is dead, spawn a new one. if(!myBicho[bichoActive].isAlive) { // activate new bicho bichoActive = bichoNext; // init values // should create a new seed here for posX posY. myBicho[bichoActive].seedX = ofRandom(100) / 100; ofLog(OF_LOG_NOTICE, "seedX: " + ofToString(myBicho[bichoActive].seedX)); myBicho[bichoActive].seedY = ofRandom(100) / 100; ofLog(OF_LOG_NOTICE, "seedY: " + ofToString(myBicho[bichoActive].seedY)); myBicho[bichoActive].bichoOpacity = 0; myBicho[bichoActive].isFadingIn = true; myBicho[bichoActive].isAlive = true; myBicho[bichoActive].bichoSound.play(); } if(!debug) { if(ofGetElapsedTimef() - lastStop > 10) { summon(ofRandom(bichosTotal)); lastStop = ofGetElapsedTimef() + ofRandom(10); } } // update active bicho myBicho[bichoActive].update(bSpeed,positionX,positionY,bOffset,scalemin,scalemax); }
//-------------------------------------------------------------- void ofApp::keyPressed(int key){ if (key == '<') { if (bichoActive > 0) { summon(bichoActive - 1);} } if (key == '>') { if (bichoActive < bichosTotal) { summon(bichoActive + 1);} } if (key == '0') { summon(0);} if (key == '1') { summon(1);} if (key == '2') { summon(2);} if (key == '3') { summon(3);} if (key == '4') { summon(4);} }
/* Has all kinds of effects in different circumstances. Eventually will be more interesting */ void s_ritual(void) { pob symbol; int i,roomno; int x,y; mprint("You begin your ritual...."); mprint("You enter a deep trance. Time Passes..."); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); if (RitualHour == hour()) mprint("Your mental fatigue prevents from completing the ritual!"); else if (random_range(100) > Player.iq+Player.pow+Player.level) mprint("Your concentration was broken -- the ritual fails!"); else { mprint("You charge the ritual with magical energy and focus your will."); mprint("Time Passes..."); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); RitualHour = hour(); /* set of random conditions for different ritual effects */ if (Current_Environment == E_CITY) { mprint("Flowing waves of mystical light congeal all around you."); mprint("'Like wow, man! Colors!'"); mprint("Appreciative citizens throw you spare change."); Player.cash +=random_range(50); } else if ( (roomno=Level->site[Player.x][Player.y].roomnumber) >= ROOMBASE ) { if (RitualRoom == roomno) mprint("For some reason the ritual doesn't work this time..."); else { RitualRoom = roomno; switch (RitualRoom) { case RS_TREASURE: /* ransacked treasure chamber */ mprint("Your spell sets off frenetic growth all around you!"); for(i=0; i<8; i++) { Level->site[Player.x+Dirs[0][i]][Player.y+Dirs[1][i]].locchar = HEDGE; Level->site[Player.x+Dirs[0][i]][Player.y+Dirs[1][i]].p_locf = L_TRIFID; lset(Player.x+Dirs[0][i], Player.y+Dirs[1][i], CHANGED); } break; case RS_HAREM: /* harem */ case RS_BOUDOIR: /* boudoir */ mprint("A secret panel opens next to the bed...."); if (random_range(2)) summon(0,INCUBUS); /* succubus/incubus */ else summon(0,SATYR); /* satyr/nymph */ break; case RS_SHRINE: /*shrine to high magic */ mprint("A storm of mana coaelesces around you."); mprint("You are buffeted by bursts of random magic."); p_damage(random_range(Player.pow),UNSTOPPABLE,"high magic"); mprint("Continue ritual? Could be dangerous.... [yn] "); if (ynq()=='y') s_wish(); else mprint("The mana fades away to nothingness."); x = Player.x; y = Player.y; while (x >= 0 && Level->site[x - 1][y].roomnumber == RS_SHRINE) x--; while (y >= 0 && Level->site[x][y - 1].roomnumber == RS_SHRINE) y--; for (i = 0; Level->site[x][y].roomnumber == RS_SHRINE;) { Level->site[x][y].roomnumber = RS_ZORCH; lset(x, y, CHANGED); x++; i++; if (Level->site[x][y].roomnumber != RS_SHRINE) { x -= i; i = 0; y++; } } break; case RS_MAGIC_LAB: /* magician's lab */ mprint("Your magical activity sets off a latent spell in the lab!"); cast_spell(random_range(NUMSPELLS)); break; case RS_PENTAGRAM: /* pentagram room */ mprint("A smoky form begins to coalesce...."); summon(-1,-1); mprint("Fortunately, it seems confined to the pentagram."); m_status_reset(Level->mlist->m,MOBILE); break; case RS_OMEGA_DAIS: /* blue omega room */ mprint("The Lords of Destiny look upon you...."); if (Player.level > 10) { mprint("A curtain of blue flames leaps up from the omega."); morewait(); l_adept(); } else { if (Player.patron == DESTINY) { mprint("Your patrons take pity on you."); if ((Player.rank[PRIESTHOOD]<SPRIEST) && (! find_item(&symbol,OB_SYMBOL_DESTINY,-1))) { symbol = ((pob) checkmalloc(sizeof(objtype))); *symbol = Objects[OB_SYMBOL_DESTINY]; symbol->known = 2; symbol->charge = 17; gain_item(symbol); mprint("You feel uplifted."); } else gain_experience(min(1000,Player.xp)); } else if (random_range(3)==1) { mprint("You feel Fated."); gain_experience(Player.level*Player.level*10); Player.hp = max(Player.hp, Player.maxhp); } else if (random_range(2)) { mprint("You feel Doomed."); Player.hp = 1; Player.mana = 0; Player.xp = 0; } else mprint("The Lords of Destiny laugh at you!"); } break; default: mprint("Well, not much effect. Chalk it up to experience."); gain_experience(Player.level*5); break; } } } else { if (RitualRoom == Level->site[Player.x][Player.y].roomnumber) mprint("The ritual fails for some unexplainable reason."); else { mprint("The ritual seems to be generating some spell effect."); RitualRoom = Level->site[Player.x][Player.y].roomnumber; switch (RitualRoom) { case RS_WALLSPACE: shadowform(); break; case RS_CORRIDOR: haste(0); break; case RS_PONDS: breathe(0); break; case RS_ADEPT: hero(1); break; default: mprint("The ritual doesn't seem to produce any tangible results..."); gain_experience(Player.level*6); } } } } }
void s_summon(void) { summon(0,-1); }
/* various kinds of wishes */ void wish(int blessing) { int i; char wishstr[80]; clearmsg(); print1("What do you wish for? "); if (blessing < 0) deathprint(); else strcpy(wishstr,msgscanstring()); if (blessing < 0 || strcmp(wishstr,"Death")==0) { print2("As you wish, so shall it be."); p_death("a deathwish"); } if (strcmp(wishstr,"Power")==0) { print2("You feel a sudden surge of energy"); Player.mana=calcmana()*10; } else if (strcmp(wishstr,"Skill")==0) { print2("You feel more competent."); if (gamestatusp(CHEATED)) gain_experience(10000); else gain_experience(min(10000,Player.xp)); } else if (strcmp(wishstr,"Wealth")==0) { print2("You are submerged in shower of gold pieces!"); Player.cash += 10000; } else if (strcmp(wishstr,"Balance")==0) { print2("You feel neutral."); Player.alignment = 0; } else if (strcmp(wishstr,"Chaos")==0) { print2("You feel chaotic."); Player.alignment -= 25; } else if (strcmp(wishstr,"Law")==0) { print2("You feel lawful."); Player.alignment += 25; } else if (strcmp(wishstr,"Location")==0) strategic_teleport(1); else if (strcmp(wishstr,"Knowledge")==0) { print2("You feel more knowledgeable."); i = random_range(NUMSPELLS); if (Spells[i].known) Spells[i].powerdrain = (max(1,Spells[i].powerdrain/2)); else Spells[i].known = TRUE; } else if (strcmp(wishstr,"Health")==0) { print2("You feel vigorous"); Player.hp = max( Player.hp, Player.maxhp); Player.status[DISEASED] = 0; Player.status[POISONED] = 0; Player.food = 43; /* Wish for Health when starving does some good. PGM */ } else if (strcmp(wishstr,"Destruction")==0) annihilate(gamestatusp(CHEATED)); else if (strcmp(wishstr,"Acquisition")==0) acquire(gamestatusp(CHEATED)); else if (strcmp(wishstr,"Summoning")==0) summon(gamestatusp(CHEATED),-1); else if (strcmp(wishstr,"Stats") == 0 && gamestatusp(CHEATED)) { Player.str = Player.maxstr = Player.con = Player.maxcon = Player.agi = Player.maxagi = Player.dex = Player.maxdex = Player.iq = Player.maxiq = Player.pow = Player.maxpow = 200; calc_melee(); } else print2("You feel stupid."); dataprint(); showflags(); }