bool SceneFileHandler::subSceneFileType(SceneFileType &fileType) { bool retCode = false; std::list<IDString>::iterator sI; FileTypeMap ::iterator smI; IDString suffix; for( sI = fileType.suffixList().begin(); sI != fileType.suffixList().end(); ++sI) { suffix.set(sI->str()); suffix.toLower(); smI = the()._suffixTypeMap.find(suffix); if (smI != the()._suffixTypeMap.end()) { the()._suffixTypeMap.erase(smI); retCode = true; } } return retCode; }
void MainApplication::mainRenderLoop(void* args) { OSG::osgSleep(5000); //Render while(true) { //Sync data the()->getApplicationThread()->getChangeList()->applyAndClear(); //Draw the()->getMainWindow()->draw(); } }
static void convert_arg (char c) { const char *str; switch (c) { case 'p': str = plname; break; case 'c': str = (flags.female && urole.name.f) ? urole.name.f : urole.name.m; break; case 'r': str = rank_of(u.ulevel, Role_switch, flags.female); break; case 'R': str = rank_of(MIN_QUEST_LEVEL, Role_switch, flags.female); break; case 's': str = (flags.female) ? "sister" : "brother"; break; case 'S': str = (flags.female) ? "daughter" : "son"; break; case 'l': str = ldrname(); break; case 'i': str = intermed(); break; case 'o': str = the(artiname(urole.questarti)); break; case 'n': str = neminame(); break; case 'g': str = guardname(); break; case 'G': str = align_gtitle(u.ualignbase[A_ORIGINAL]); break; case 'H': str = homebase(); break; case 'a': str = align_str(u.ualignbase[A_ORIGINAL]); break; case 'A': str = align_str(u.ualign.type); break; case 'd': str = align_gname(u.ualignbase[A_ORIGINAL]); break; case 'D': str = align_gname(A_LAWFUL); break; case 'C': str = "chaotic"; break; case 'N': str = "neutral"; break; case 'L': str = "lawful"; break; case 'x': str = Blind() ? "sense" : "see"; break; case 'Z': str = dungeons[0].dname; break; case '%': str = "%"; break; default: str = ""; break; } strcpy(cvt_buf, str); }
/* * creature (usually player) tries to touch (pick up or wield) an artifact obj. * Returns 0 if the object refuses to be touched. * This routine does not change any object chains. * Ignores such things as gauntlets, assuming the artifact is not * fooled by such trappings. */ int touch_artifact(struct obj *obj, struct monst *mon) { const struct artifact *oart = get_artifact(obj); boolean badclass, badalign, self_willed, yours; if (!oart) return 1; yours = (mon == &youmonst); /* all quest artifacts are self-willed; it this ever changes, `badclass' will have to be extended to explicitly include quest artifacts */ self_willed = ((oart->spfx & SPFX_INTEL) != 0); if (yours) { badclass = self_willed && ((oart->role != NON_PM && !Role_if (oart->role)) || (oart->race != NON_PM && !Race_if (oart->race))); badalign = (oart->spfx & SPFX_RESTR) && oart->alignment != A_NONE && (oart->alignment != u.ualign.type || u.ualign.record < 0); } else if (!is_covetous(mon->data) && !is_mplayer(mon->data)) { badclass = self_willed && oart->role != NON_PM && oart != &artilist[ART_EXCALIBUR]; badalign = (oart->spfx & SPFX_RESTR) && oart->alignment != A_NONE && (oart->alignment != sgn(mon->data->maligntyp)); } else { /* an M3_WANTSxxx monster or a fake player */ /* special monsters trying to take the Amulet, invocation tools or quest item can touch anything except for `spec_applies' artifacts */ badclass = badalign = FALSE; } /* weapons which attack specific categories of monsters are bad for them even if their alignments happen to match */ if (!badalign && (oart->spfx & SPFX_DBONUS) != 0) { struct artifact tmp; tmp = *oart; tmp.spfx &= SPFX_DBONUS; badalign = !!spec_applies(&tmp, mon); } if (((badclass || badalign) && self_willed) || (badalign && (!yours || !rn2(4)))) { int dmg; char buf[BUFSZ]; if (!yours) return 0; pline("You are blasted by %s power!", s_suffix(the(xname(obj)))); dmg = dice((Antimagic ? 2 : 4), (self_willed ? 10 : 4)); sprintf(buf, "touching %s", oart->name); losehp(dmg, buf, KILLED_BY); exercise(A_WIS, FALSE); } /* can pick it up unless you're totally non-synch'd with the artifact */ if (badclass && badalign && self_willed) { if (yours) pline("%s your grasp!", Tobjnam(obj, "evade")); return 0; } return 1; }
static const char * convert_arg(char c) { switch (c) { case 'p': return msg_from_string(u.uplname); case 'c': return (u.ufemale && urole.name.f) ? urole.name.f : urole.name.m; case 'r': return rank_of(u.ulevel, Role_switch, u.ufemale); case 'R': return rank_of(MIN_QUEST_LEVEL, Role_switch, u.ufemale); case 's': return (u.ufemale) ? "sister" : "brother"; case 'S': return (u.ufemale) ? "daughter" : "son"; case 'l': case 'n': { int i = c == 'l' ? urole.ldrnum : urole.neminum;; return msgcat(type_is_pname(&mons[i]) ? "" : "the ", mons[i].mname); } case 'i': return urole.intermed; case 'o': return the(artiname(urole.questarti)); case 'g': return mons[urole.guardnum].mname; case 'G': return align_gtitle(u.ualignbase[A_ORIGINAL]); case 'H': return urole.homebase; case 'a': return align_str(u.ualignbase[A_ORIGINAL]); case 'A': return align_str(u.ualign.type); case 'd': return align_gname(u.ualignbase[A_ORIGINAL]); case 'D': return align_gname(A_LAWFUL); case 'C': return "chaotic"; case 'N': return "neutral"; case 'L': return "lawful"; case 'x': return Blind ? "sense" : "see"; case 'Z': return msg_from_string(gamestate.dungeons[0].dname); case '%': return "%"; default: return ""; } }
bool ThreadManager::terminate (void) { bool returnValue = the()->shutdown(); delete _pThreadManager; _pThreadManager = NULL; return returnValue; }
bool FieldContainerFactory::initializeFactory(void) { bool returnValue = the()->initialize(); // CHECKCHECK // clear changelist from prototypes, move this to a different place soon OSG::Thread::getCurrentChangeList()->clearAll(); return returnValue; }
//----------------------------------------------------------------------------- // name: render() // desc: ... //----------------------------------------------------------------------------- t_CKUINT AudicleFaceTnT::render( void * d ) { EM_log( CK_LOG_FINEST, "AudicleFaceTNT: rendering objects..." ); EM_pushlog(); int i; map<Shred_Stat *, Shred_Stat *>::iterator iter; Chuck_Stats::instance()->get_shreds( m_shreds, m_done ); Shred_Stat * stat = NULL; m_now = the()->shreduler()->now_system; m_earliest = m_now - m_window; // set a now time for the check_active test // log EM_log( CK_LOG_FINEST, "num shreds: %d", m_shreds.size() ); // get activations m_drawing_active_set = true; //hack for( i = 0; i < m_shreds.size(); i++ ) fetch_shred_activations ( m_shreds[i] ); m_drawing_active_set = false; //hack for( iter = m_done.begin(); iter != m_done.end(); iter++ ) { stat = (*iter).second; fetch_shred_activations ( stat ); } m_now = the()->shreduler()->now_system; m_earliest = m_now - m_window; EM_poplog(); if ( m_show_mode == SHOW_TIMING_HISTORY ) return render_timing_history(); else return render_cycle_heatmap (); return 0; }
bool FModSoundManager::uninit(void) { SLOG << "FModSoundManager Uninitializing." << std::endl; FMOD_RESULT result; result = the()->_FModSystem->release(); FMOD_ERRCHECK(result,"FModSoundManager: release()"); SLOG << "FModSoundManager Successfully Uninitialized." << std::endl; return true; }
bool Allocator::detach() { if( refCnt.dec_and_test_null() ) { if( this == the() ) setAllocator( 0L, true ); delete this; return true; } return false; }
void Func::Finger_it() { InstrList_Finger the(m_instr_list); POSITION pos = m_instr_list.begin(); for (;pos!=m_instr_list.end();++pos) { Instruction * p = *pos;//list->; if (p->type == i_CplxBegin) { the.Finger_check_partern(p); } } }
// 初步构造instr_list和expr_list void CCodeList::CreateInstrList_raw(INSTR_LIST* instr_list, AsmCodeList* asmlist, int EBP_base) { this->m_instr_list = instr_list; this->m_asmlist = asmlist; this->m_EBP_base = EBP_base; PINSTR p_begin = new INSTR; //new_INSTR p_begin->type = i_Begin; PINSTR p_end = new INSTR; //new_INSTR 总是同时new p_end->type = i_End; p_begin->begin.m_end = p_end; // 指向它 InstrAddTail(p_begin); // 在前面加一条i_Begin signed int esp_level = 3; POSITION pos = this->m_asmlist->GetHeadPosition(); while (pos) { AsmCode* cur = this->m_asmlist->GetNext(pos); assert(cur); assert(cur->linear); CCodeList_Maker the(this,cur); if (cur->xcpu.opcode != C_JCASE) { // 唯一的例外,C_JCASE前不加label PINSTR p = new INSTR; //new_INSTR p->type = i_Label; p->label.label_off = cur->linear; // 在每条指令前加一个label InstrAddTail(p); } if (esp_level != 3 && esp_level < cur->esp_level) {//这是一个pop cur->xcpu.opcode; PINSTR p = new INSTR; //new_INSTR p->type = i_EspReport; p->espreport.esp_level = cur->esp_level; p->espreport.howlen = cur->esp_level - esp_level; InstrAddTail(p); } the.AddTail_Cur_Opcode(); esp_level = cur->esp_level; } InstrAddTail(p_end); // 在后面加一条i_End }
/* hero is hit by something other than a monster */ int thitu(int tlev, int dam, struct obj *obj, const char *name) { /* if null, then format `obj' */ const char *onm, *killer; boolean is_acid; /* TODO: credit the monster that fired the object with the kill */ if (!name) { if (!obj) panic("thitu: name & obj both null?"); name = (obj->quan > 1L) ? doname(obj) : mshot_xname(obj); killer = killer_msg_obj(DIED, obj); } else { killer = killer_msg(DIED, an(name)); } onm = (obj && obj_is_pname(obj)) ? the(name) : (obj && obj->quan > 1L) ? name : an(name); is_acid = (obj && obj->otyp == ACID_VENOM); if (get_player_ac() + tlev <= rnd(20)) { if (Blind || !flags.verbose) pline("It misses."); else pline("You are almost hit by %s.", onm); return 0; } else { if (Blind || !flags.verbose) pline("You are hit!"); else pline("You are hit by %s%s", onm, exclam(dam)); if (obj && objects[obj->otyp].oc_material == SILVER && hates_silver(youmonst.data)) { dam += rnd(20); pline("The silver sears your flesh!"); exercise(A_CON, FALSE); } if (is_acid && Acid_resistance) pline("It doesn't seem to hurt you."); else { if (is_acid) pline("It burns!"); if (Half_physical_damage) dam = (dam + 1) / 2; losehp(dam, killer); exercise(A_STR, FALSE); } return 1; } }
/* returns ms elapsed */ int shCreature::utilizeWreck (shObject *obj) { if (Hero.canSee (this)) { I->p ("%s utilizes %s.", the (), AN (obj)); } shObject *cells = createObject ("energy cells", 0); if (isPet ()) { mLevel->putObject (cells, mX, mY); } else { addObjectToInventory (cells); } return FULLTURN; }
std::string Strategy::PrintOne(const INSTR_LIST& list, const Instruction * pinstr, Func* pFunc) const { INSTR_LIST::const_iterator pos = list.begin(); while (pos!=list.end()) { const Instruction *p = *pos;//list.; ++pos; if (p == pinstr) { CFunc_Prt the(pFunc); //TODO: unused pos1 ?? //POSITION pos1 = list.Find(pinstr); std::string s = the.prt_the_instr(p); return s; } } return ""; }
const char * shMonster::an () { char *buf = GetBuf (); if (!Hero.canSee (this) and !Hero.canHearThoughts (this)) { strncpy (buf, hasMind () ? "someone" : "something", SHBUFLEN); } else if (isUnique ()) { return the (); } else if (Hero.is (kXenosHunter) and isXenos ()) { snprintf (buf, SHBUFLEN, "a xenos scum"); } else if (Hero.is (kXenosHunter) and isHeretic ()) { snprintf (buf, SHBUFLEN, "a heretic"); } else { snprintf (buf, SHBUFLEN, isvowel (myIlk ()->mName[0]) ? "an %s" : "a %s", myIlk ()->mName); } return buf; }
void ShellContent::start_shell() { _console = NULL; // instantiate _shell = new Chuck_Shell(); // instantiate shell UI _console = new Audicle_Shell_UI(); // initialize shell UI if( !_console->init() ) { EM_log( CK_LOG_SYSTEM, "(audicle) error starting shell UI..." ); return; } // initialize if( !_shell->init( the() , _console ) ) { EM_log( CK_LOG_SYSTEM, "(audicle) error starting shell..." ); return; } EM_log( CK_LOG_SYSTEM, "(audicle) shell started..." ); //start shell thread // g_shell = _shell; // _shell->run(); #ifndef __PLATFORM_WIN32__ pthread_create( &_shell_tid, NULL, shell_cb, _shell ); #else _shell_tid = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)shell_cb, _shell, 0, 0 ); #endif }
PUBLIC type tc_expr(tree t, env e) #endif { switch (t->x_kind) { case REF: return ref_type((sym) t->x_tag, t->x_params, e, t); case INGEN: return ref_type((sym) t->x_tag, list2(t->x_param1, t->x_param2), e, t); case PREGEN: return ref_type((sym) t->x_tag, list1(t->x_param), e, t); case NUMBER: return nat_type; case SEXPR: { def d; frame params; if (! open_sref(t->x_ref, e, &d, ¶ms)) return err_type; if ((tok) t->x_ref->x_sref_decor != empty) { tc_error(t->x_loc, "Decoration ignored in schema reference"); tc_e_etc("Expression: %z", t); tc_e_end(); } if (t->x_ref->x_sref_renames != nil) { tc_error(t->x_loc, "Renaming ignored in schema reference"); tc_e_etc("Expression: %z", t); tc_e_end(); } if (! aflag && d->d_abbrev) return mk_power(mk_abbrev(d, params)); else return mk_power(seal(mk_sproduct(d->d_schema), params)); } case POWER: { type tt1, tt2; if (! anal_power(tt1 = tc_expr(t->x_arg, e), &tt2, t->x_arg)) { tc_error(t->x_loc, "Argument of \\power must be a set"); tc_e_etc("Expression: %z", t); tc_e_etc("Arg type: %t", tt1); tc_e_end(); } return mk_power(mk_power(tt2)); } case TUPLE : { type a[MAX_ARGS]; int n = 0; tree u; for (u = t->x_elements; u != nil; u = cdr(u)) { if (n >= MAX_ARGS) panic("tc_expr - tuple too big"); a[n++] = tc_expr(car(u), e); } return mk_cproduct(n, a); } case CROSS: { type a[MAX_ARGS]; type tt1, tt2; int n = 0; tree u; for (u = t->x_factors; u != nil; u = cdr(u)) { if (n >= MAX_ARGS) panic("tc_expr - product too big"); tt1 = tc_expr(car(u), e); if (! anal_power(tt1, &tt2, car(u))) { tc_error(t->x_loc, "Argument %d of \\cross must be a set", n+1); tc_e_etc("Expression: %z", t); tc_e_etc("Arg %d type: %t", n+1, tt1); tc_e_end(); } a[n++] = tt2; } return mk_power(mk_cproduct(n, a)); } case EXT: case SEQ: case BAG: { type elem_type; type tt; tree u; if (t->x_elements == nil) elem_type = new_typevar(t); else { elem_type = tc_expr(car(t->x_elements), e); for (u = cdr(t->x_elements); u != nil; u = cdr(u)) { if (unify(elem_type, tt = tc_expr(car(u), e))) elem_type = type_union(elem_type, arid, tt, arid); else { tc_error(t->x_loc, "Type mismatch in %s display", (t->x_kind == EXT ? "set" : t->x_kind == SEQ ? "sequence" : "bag")); tc_e_etc("Expression: %z", car(u)); tc_e_etc("Has type: %t", tt); tc_e_etc("Expected: %t", elem_type); tc_e_end(); } } } switch (t->x_kind) { case EXT: return mk_power(elem_type); case SEQ: return (aflag ? rel_type(num_type, elem_type) : mk_seq(elem_type)); case BAG: return (aflag ? rel_type(elem_type, num_type) : mk_bag(elem_type)); } } case THETA: return theta_type(t, e, (type) NULL, t); case BINDING: { tree u; env e1 = new_env(e); for (u = t->x_elements; u != nil; u = cdr(u)) add_def(VAR, (sym) car(u)->x_lhs, tc_expr(car(u)->x_rhs, e), e1); return mk_sproduct(mk_schema(e1)); } case SELECT: { type a = tc_expr(t->x_arg, e); if (type_kind(a) != SPRODUCT) { tc_error(t->x_loc, "Argument of selection must have schema type"); tc_e_etc("Expression: %z", t); tc_e_etc("Arg type: %t", a); tc_e_end(); mark_error(); return err_type; } switch (t->x_field->x_kind) { case IDENT: return (comp_type(a, (sym) t->x_field, t, t->x_loc)); case THETA: return (theta_type(t->x_field, e, a, t)); default: bad_tag("tc_expr.SELECT", t->x_field->x_kind); return (type) NULL; } } case APPLY: return tc_apply(APPLY, t, t->x_arg1, t->x_arg2, e); case INOP: return tc_apply(INOP, t, simply(t->x_op, t->x_loc), pair(t->x_rand1, t->x_rand2), e); case POSTOP: return tc_apply(POSTOP, t, simply(t->x_op, t->x_loc), t->x_rand, e); case LAMBDA: { env e1 = tc_schema(t->x_bvar, e); type dom = tc_expr(char_tuple(t->x_bvar), e1); type ran = tc_expr(t->x_body, e1); return (aflag ? rel_type(dom, ran) : mk_pfun(dom, ran)); } case COMP: case MU: { env e1 = tc_schema(t->x_bvar, e); type a = tc_expr(exists(t->x_body) ? the(t->x_body) : char_tuple(t->x_bvar), e1); return (t->x_kind == COMP ? mk_power(a) : a); } case LETEXPR: return tc_expr(t->x_body, tc_letdefs(t->x_defs, e)); case IF: { type a, b; tc_pred(t->x_if, e); a = tc_expr(t->x_then, e); b = tc_expr(t->x_else, e); if (unify(a, b)) return type_union(a, arid, b, arid); else { tc_error(t->x_loc, "Type mismatch in conditional expression"); tc_e_etc("Expression: %z", t); tc_e_etc("Then type: %t", a); tc_e_etc("Else type: %t", b); tc_e_end(); return err_type; } } default: bad_tag("tc_expr", t->x_kind); /* dummy */ return (type) NULL; } }
bool FModSoundManager::init(void) { SLOG << "FModSoundManager Initializing." << std::endl; FMOD_RESULT result; unsigned int version; int numdrivers; FMOD_SPEAKERMODE speakermode; FMOD_CAPS caps; char name[256]; /* Create a System object and initialize. */ result = FMOD::System_Create(&the()->_FModSystem); FMOD_ERRCHECK(result,"FModSoundManager: System_Create()"); result = the()->_FModSystem->getVersion(&version); FMOD_ERRCHECK(result,"FModSoundManager: getVersion()"); if (version < FMOD_VERSION) { SWARNING << "FModSoundManager: init: Error! You are using an old version of FMOD " << version << ". This program requires " << FMOD_VERSION << std::endl; return false; } result = the()->_FModSystem->getNumDrivers(&numdrivers); FMOD_ERRCHECK(result,"FModSoundManager: getNumDrivers()"); if (numdrivers == 0) { result = the()->_FModSystem->setOutput(FMOD_OUTPUTTYPE_NOSOUND); FMOD_ERRCHECK(result,"FModSoundManager: setOutput()"); } else { result = the()->_FModSystem->getDriverCaps(0, &caps, 0, 0, &speakermode); FMOD_ERRCHECK(result,"FModSoundManager: getDriverCaps()"); result = the()->_FModSystem->setSpeakerMode(speakermode); /* Set the user selected speaker mode. */ FMOD_ERRCHECK(result,"FModSoundManager: setSpeakerMode()"); if (caps & FMOD_CAPS_HARDWARE_EMULATED) /* The user has the 'Acceleration' slider set to off! This is really bad for latency!. */ { /* You might want to warn the user about this. */ result = the()->_FModSystem->setDSPBufferSize(1024, 10); FMOD_ERRCHECK(result,"FModSoundManager: setDSPBufferSize()"); } result = the()->_FModSystem->getDriverInfo(0, name, 256, 0); FMOD_ERRCHECK(result,"FModSoundManager: getDriverInfo()"); if (strstr(name, "SigmaTel")) /* Sigmatel sound devices crackle for some reason if the format is PCM 16bit. PCM floating point output seems to solve it. */ { result = the()->_FModSystem->setSoftwareFormat(48000, FMOD_SOUND_FORMAT_PCMFLOAT, 0,0, FMOD_DSP_RESAMPLER_LINEAR); FMOD_ERRCHECK(result,"FModSoundManager: setSoftwareFormat()"); } } result = the()->_FModSystem->init(100, FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED, 0); if (result == FMOD_ERR_OUTPUT_CREATEBUFFER) /* Ok, the speaker mode selected isn't supported by this soundcard. Switch it back to stereo... */ { result = the()->_FModSystem->setSpeakerMode(FMOD_SPEAKERMODE_STEREO); FMOD_ERRCHECK(result,"FModSoundManager: setSpeakerMode()"); result = the()->_FModSystem->init(100, FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED, 0);/* ... and re-init. */ FMOD_ERRCHECK(result,"FModSoundManager: init()"); } SLOG << "FModSoundManager Successfully Initialized. Using FMod version: " << version << std::endl; return true; }
int dosit() { static const char *sit_message = "sit on the %s."; register struct trap *trap; register int typ = levl[u.ux][u.uy].typ; if(Levitation) { pline("You're sitting on air."); return 0; } if(OBJ_AT(u.ux, u.uy)) { register struct obj *obj; obj = level.objects[u.ux][u.uy]; You("sit on %s.", the(xname(obj))); if(!Is_box(obj)) pline("It's not very comfortable..."); } else if ((trap = t_at(u.ux, u.uy)) != 0) { if (u.utrap) { exercise(A_WIS, FALSE); /* you're getting stuck longer */ if(u.utraptype == TT_BEARTRAP) { You("can't sit down with your %s in the bear trap.", body_part(FOOT)); u.utrap++; } else if(u.utraptype == TT_PIT) { if(trap->ttyp == SPIKED_PIT) { You("sit down on a spike. Ouch!"); losehp(1, "sitting on an iron spike", KILLED_BY); exercise(A_STR, FALSE); } else You("sit down in the pit."); u.utrap += rn2(5); } else if(u.utraptype == TT_WEB) { You("sit in the spider web and get entangled further!"); u.utrap += rn1(10, 5); } else if(u.utraptype == TT_LAVA) { /* Must have fire resistance or they'd be dead already */ You("sit in the lava!"); u.utrap += rnd(4); losehp(d(2,10), "sitting in lava", KILLED_BY); } else if(u.utraptype == TT_INFLOOR) { You("can't maneuver to sit!"); u.utrap++; } } else { You("sit down."); dotrap(trap); } } else if(Underwater || Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) pline("There are no cushions floating nearby."); else You("sit down in the muddy bottom."); } else if(is_pool(u.ux, u.uy)) { You("sit in the water."); if (!rn2(10) && uarm) (void) rust_dmg(uarm, "armor", 1, TRUE); #ifdef POLYSELF /* Note: without POLYSELF, this can't _happen_ without */ /* water walking boots.... */ if (!rn2(10) && uarmf && uarmf->otyp != WATER_WALKING_BOOTS) (void) rust_dmg(uarm, "armor", 1, TRUE); #endif #ifdef SINKS } else if(IS_SINK(typ)) { You(sit_message, defsyms[S_sink].explanation); Your("%s gets wet.", humanoid(uasmon) ? "rump" : "underside"); #endif } else if(IS_ALTAR(typ)) { You(sit_message, defsyms[S_altar].explanation); altar_wrath(u.ux, u.uy); } else if(typ == STAIRS) { You(sit_message, "stairs"); } else if(typ == LADDER) { You(sit_message, "ladder"); } else if (is_lava(u.ux, u.uy)) { /* must be WWalking */ You(sit_message, "lava"); pline("The lava burns you!"); losehp(d((Fire_resistance ? 2 : 10), 10), "sitting on lava", KILLED_BY); } else if (is_ice(u.ux, u.uy)) { You(sit_message, defsyms[S_ice].explanation); if (!Cold_resistance) pline("The ice feels cold."); } else if (typ == DRAWBRIDGE_DOWN) { You(sit_message, "drawbridge"); } else if(IS_THRONE(typ)) { You(sit_message, defsyms[S_throne].explanation); if (rnd(6) > 4) { switch (rnd(13)) { case 1: (void) adjattrib(rn2(A_MAX), -rn1(4,3), FALSE); losehp(rnd(10), "cursed throne", KILLED_BY_AN); break; case 2: (void) adjattrib(rn2(A_MAX), 1, FALSE); break; case 3: pline("A%s electric shock shoots through your body!", (Shock_resistance) ? "" : " massive"); losehp(Shock_resistance ? rnd(6) : rnd(30), "electric chair", KILLED_BY_AN); exercise(A_CON, FALSE); break; case 4: You("feel much, much better!"); if(u.uhp >= (u.uhpmax - 5)) u.uhpmax += 4; u.uhp = u.uhpmax; make_blinded(0L,TRUE); make_sick(0L,FALSE); heal_legs(); flags.botl = 1; break; case 5: take_gold(); break; case 6: if(u.uluck + rn2(5) < 0) { You("feel your luck is changing."); change_luck(1); } else makewish(); break; case 7: { register int cnt = rnd(10); pline("A voice echoes:"); verbalize("Thy audience hath been summoned, %s!", flags.female ? "Dame" : "Sire"); while(cnt--) (void) makemon(courtmon(), u.ux, u.uy); break; } case 8: pline("A voice echoes:"); verbalize("By thy Imperious order, %s...", flags.female ? "Dame" : "Sire"); do_genocide(1); break; case 9: pline("A voice echoes:"); verbalize("A curse upon thee for sitting upon this most holy throne!"); if (Luck > 0) { make_blinded(Blinded + rn1(100,250),TRUE); } else rndcurse(); break; case 10: if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (level.flags.nommap) { pline( "A terrible drone fills your head!"); make_confused(HConfusion + rnd(30), FALSE); } else { pline("An image forms in your mind."); do_mapping(); } } else { Your("vision becomes clear."); HSee_invisible |= FROMOUTSIDE; newsym(u.ux, u.uy); } break; case 11: if (Luck < 0) { You("feel threatened."); aggravate(); } else { You("feel a wrenching sensation."); tele(); /* teleport him */ } break; case 12: You("are granted an insight!"); if (invent) { int ret, cval = rn2(5); /* agrees w/seffects() */ /* use up `cval' "charges"; 0 is special case */ do { ret = ggetobj("identify", identify, cval); if (ret < 0) break; /* quit */ } while (ret == 0 || (cval -= ret) > 0); } break; case 13: Your("mind turns into a pretzel!"); make_confused(HConfusion + rn1(7,16),FALSE); break; default: impossible("throne effect"); break; } } else You("feel somehow out of place..."); if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ)) { /* may have teleported */ pline("The throne vanishes in a puff of logic."); levl[u.ux][u.uy].typ = ROOM; if(Invisible) newsym(u.ux,u.uy); } #ifdef POLYSELF } else if (lays_eggs(uasmon) || u.umonnum == PM_QUEEN_BEE) { struct obj *uegg; if (!flags.female) { pline("Males can't lay eggs!"); return 0; } if (u.uhunger < (int)objects[EGG].oc_nutrition) { You("don't have enough energy to lay an egg."); return 0; } uegg = mksobj(EGG, FALSE, FALSE); uegg->spe = 1; uegg->quan = 1; uegg->owt = weight(uegg); uegg->corpsenm = (u.umonnum==PM_QUEEN_BEE ? PM_KILLER_BEE : monsndx(uasmon)); uegg->known = uegg->dknown = 1; You("lay an egg."); dropy(uegg); stackobj(uegg); morehungry((int)objects[EGG].oc_nutrition); #endif } else if (u.uswallow) pline("There are no seats in here!"); else pline("Having fun sitting on the %s?", surface(u.ux,u.uy)); return(1); }
int dosit() { static const char sit_message[] = "VERB_SITZEN auf OBJECT KASUS_DATIV ARTIKEL_BESTIMMTER %s."; /* EN static const char sit_message[] = "sit on the %s."; */ register struct trap *trap; register int typ = levl[u.ux][u.uy].typ; #ifdef STEED if (u.usteed) { You("VERB_SITZEN bereits auf KASUS_DATIV %s.", mon_nam(u.usteed)); /* EN You("are already sitting on %s.", mon_nam(u.usteed)); */ return (0); } #endif if(!can_reach_floor()) { if (Levitation) You("VERB_SCHLAGEN Purzelbäume."); /* EN You("tumble in place."); */ else You("VERB_SITZEN auf Luft."); /* EN You("are sitting on air."); */ return 0; } else if (is_pool(u.ux, u.uy) && !Underwater) { /* water walking */ goto in_water; } if(OBJ_AT(u.ux, u.uy)) { register struct obj *obj; obj = level.objects[u.ux][u.uy]; You("VERB_SITZEN auf OBJECT KASUS_DATIV %s.", the(xname(obj))); /* EN You("sit on %s.", the(xname(obj))); */ if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH)) pline("Das ist nicht sehr bequem ..."); /* EN pline("It's not very comfortable..."); */ } else if ((trap = t_at(u.ux, u.uy)) != 0 || (u.utrap && (u.utraptype >= TT_LAVA))) { if (u.utrap) { exercise(A_WIS, FALSE); /* you're getting stuck longer */ if(u.utraptype == TT_BEARTRAP) { pline("Mit KASUS_DATIV PRONOMEN_POSSESSIV %s in KASUS_DATIV ARTIKEL_BESTIMMTER NOUN_BEARTRAP SUBJECT_IM_SATZ VERB_KOENNEN PRONOMEN_PERSONAL OBJECT PRONOMEN_PERSONAL nicht hinsetzen.", body_part(FOOT)); /* EN You_cant("sit down with your %s in the bear trap.", body_part(FOOT)); */ u.utrap++; } else if(u.utraptype == TT_PIT) { if(trap->ttyp == SPIKED_PIT) { You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL auf einen Stachel. Aua!"); /* EN You("sit down on a spike. Ouch!"); */ losehp(1, "durch Sitzen auf einen Eisenstachel", KILLED_WITHOUT_PREPOSITION); /* EN losehp(1, "sitting on an iron spike", KILLED_BY); */ exercise(A_STR, FALSE); } else You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL in die Grube."); /* EN You("sit down in the pit."); */ u.utrap += rn2(5); } else if(u.utraptype == TT_WEB) { You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL ins Spinnenetz und VERB_VERHEDDERN OBJECT PRONOMEN_PERSONAL noch mehr!"); /* EN You("sit in the spider web and get entangled further!"); */ u.utrap += rn1(10, 5); } else if(u.utraptype == TT_LAVA) { /* Must have fire resistance or they'd be dead already */ You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL in die Lava!"); /* EN You("sit in the lava!"); */ u.utrap += rnd(4); losehp(d(2,10), "durch Sitzen in Lava", KILLED_WITHOUT_PREPOSITION); /* EN losehp(d(2,10), "sitting in lava", KILLED_BY); */ } else if(u.utraptype == TT_INFLOOR) { You("VERB_CAN OBJECT PRONOMEN_PERSONAL nicht richtig hinsetzen!"); /* EN You_cant("maneuver to sit!"); */ u.utrap++; } } else { You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL hin."); /* EN You("sit down."); */ dotrap(trap, 0); } } else if(Underwater || Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) pline("Hier gibt es keine Sitzkissen."); /* EN There("are no cushions floating nearby."); */ else You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL auf den schlammigen Untergrund."); /* EN You("sit down on the muddy bottom."); */ } else if(is_pool(u.ux, u.uy)) { in_water: You("VERB_SITZEN im Wasser."); /* EN You("sit in the water."); */ if (!rn2(10) && uarm) (void) rust_dmg(uarm, "NOUN_ARMOR", 1, TRUE, &youmonst); /* EN (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst); */ if (!rn2(10) && uarmf && uarmf->otyp != WATER_WALKING_BOOTS) (void) rust_dmg(uarm, "NOUN_ARMOR", 1, TRUE, &youmonst); /* EN (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst); */ #ifdef SINKS } else if(IS_SINK(typ)) { You(sit_message, defsyms[S_sink].explanation); Your("%s VERB_WERDEN nass.", humanoid(youmonst.data) ? "NOUN_HINTERTEIL" : "NOUN_UNTERSEITE"); /* EN Your("%s gets wet.", humanoid(youmonst.data) ? "rump" : "underside"); */ #endif } else if(IS_ALTAR(typ)) { You(sit_message, defsyms[S_altar].explanation); altar_wrath(u.ux, u.uy); } else if(IS_GRAVE(typ)) { You(sit_message, defsyms[S_grave].explanation); } else if(typ == STAIRS) { You(sit_message, "NOUN_STUFEs"); /* EN You(sit_message, "stairs"); */ } else if(typ == LADDER) { You(sit_message, "NOUN_LADDER"); /* EN You(sit_message, "ladder"); */ } else if (is_lava(u.ux, u.uy)) { /* must be WWalking */ You(sit_message, "NOUN_LAVA"); /* EN You(sit_message, "lava"); */ burn_away_slime(); if (likes_lava(youmonst.data)) { pline_The("NOUN_LAVA fühlt sich warm an."); /* EN pline_The("lava feels warm."); */ return 1; } pline_The("NOUN_LAVA VERB_VERBRENNEN OBJECT PRONOMEN_PERSONAL!"); /* EN pline_The("lava burns you!"); */ losehp(d((Fire_resistance ? 2 : 10), 10), "durch Sitzen auf Lava", KILLED_WITHOUT_PREPOSITION); /* EN "sitting on lava", KILLED_BY); */ } else if (is_ice(u.ux, u.uy)) { You(sit_message, defsyms[S_ice].explanation); if (!Cold_resistance) pline_The("NOUN_ICE fühlt sich kalt an."); /* EN if (!Cold_resistance) pline_The("ice feels cold."); */ } else if (typ == DRAWBRIDGE_DOWN) { You(sit_message, "NOUN_DRAWBRIDGE"); /* EN You(sit_message, "drawbridge"); */ } else if(IS_THRONE(typ)) { You(sit_message, defsyms[S_throne].explanation); if (rnd(6) > 4) { switch (rnd(13)) { case 1: (void) adjattrib(rn2(A_MAX), -rn1(4,3), FALSE); losehp(rnd(10), "ADJEKTIV_CURSED NOUN_THRON", KILLED_BY_AN); /* EN losehp(rnd(10), "cursed throne", KILLED_BY_AN); */ break; case 2: (void) adjattrib(rn2(A_MAX), 1, FALSE); break; case 3: pline("SUBJECT ARTIKEL_UNBESTIMMTER%s elektrischer NOUN_SCHLAG VERB_SCHIESSEN OBJECT durch PRONOMEN_POSSESSIV NOUN_BODY!", /* EN pline("A%s electric shock shoots through your body!", */ (Shock_resistance) ? "" : " massiver"); /* EN (Shock_resistance) ? "n" : " massive"); */ losehp(Shock_resistance ? rnd(6) : rnd(30), "ADJEKTIV_ELEKTRISCH NOUN_STUHL", KILLED_BY_AN); /* EN "electric chair", KILLED_BY_AN); */ exercise(A_CON, FALSE); break; case 4: Du_fuehlst_dich("viel, viel besser!"); /* EN You_feel("much, much better!"); */ if (Upolyd) { if (u.mh >= (u.mhmax - 5)) u.mhmax += 4; u.mh = u.mhmax; } if(u.uhp >= (u.uhpmax - 5)) u.uhpmax += 4; u.uhp = u.uhpmax; make_blinded(0L,TRUE); make_sick(0L, (char *) 0, FALSE, SICK_ALL); heal_legs(); flags.botl = 1; break; case 5: take_gold(); break; case 6: if(u.uluck + rn2(5) < 0) { You("VERB_FUEHLEN, NEUER_SATZ SUBJECT_IM_SATZ wie PRONOMEN_POSSESSIV NOUN_LUCK sich ändert."); /* EN You_feel("your luck is changing."); */ change_luck(1); } else makewish(); break; case 7: { register int cnt = rnd(10); pline("Eine Stimme ertönt:"); /* EN pline("A voice echoes:"); */ verbalize("Euer Auditorium erwartet Euch bereits, %s!", /* EN verbalize("Thy audience hath been summoned, %s!", */ flags.female ? "Gebieterin" : "Gebieter"); /* EN flags.female ? "Dame" : "Sire"); */ while(cnt--) (void) makemon(courtmon(), u.ux, u.uy, NO_MM_FLAGS); break; } case 8: pline("Eine Stimme ertönt:"); /* EN pline("A voice echoes:"); */ verbalize("Wie es Euch beliebt, %s...", /* EN verbalize("By thy Imperious order, %s...", */ flags.female ? "Gebieterin" : "Gebieter"); /* EN flags.female ? "Dame" : "Sire"); */ do_genocide(5); /* REALLY|ONTHRONE, see do_genocide() */ break; case 9: pline("Eine Stimme ertönt:"); /* EN pline("A voice echoes:"); */ verbalize("SATZBEGINN MODIFIER_VERB_IMPERATIV VERB_SEIN verflucht dafür, NEUER_SATZ dass SUBJECT_IM_SATZ PRONOMEN_PERSONAL OBJECT PRONOMEN_PERSONAL auf diesem allerheiligsten Thron niedergelassen VERB_HABEN!"); /* EN verbalize("A curse upon thee for sitting upon this most holy throne!"); */ if (Luck > 0) { make_blinded(Blinded + rn1(100,250),TRUE); } else rndcurse(); break; case 10: if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (level.flags.nommap) { pline( "Ein schreckliches Dröhnen erfüllt KASUS_AKKUSATIV PRONOMEN_POSSESSIV NOUN_KOPF!"); /* EN "A terrible drone fills your head!"); */ make_confused(HConfusion + rnd(30), FALSE); } else { pline("Ein Bild formt sich in KASUS_DATIV PRONOMEN_POSSESSIV NOUN_GEDANKEs."); /* EN pline("An image forms in your mind."); */ do_mapping(); } } else { Your("NOUN_BLICK klärt sich."); /* EN Your("vision becomes clear."); */ HSee_invisible |= FROMOUTSIDE; newsym(u.ux, u.uy); } break; case 11: if (Luck < 0) { Du_fuehlst_dich("bedroht."); /* EN You_feel("threatened."); */ aggravate(); } else { Du_spuerst("einen reißenden Schmerz."); /* EN You_feel("a wrenching sensation."); */ tele(); /* teleport him */ } break; case 12: Dir_wird("eine Einsicht gewährt!"); /* EN You("are granted an insight!"); */ if (invent) { /* rn2(5) agrees w/seffects() */ identify_pack(rn2(5)); } break; case 13: Your("NOUN_VERSTAND verknotet sich zu einer Bretzel!"); /* EN Your("mind turns into a pretzel!"); */ make_confused(HConfusion + rn1(7,16),FALSE); break; default: impossible("throne effect"); break; } } else { if (is_prince(youmonst.data)) Du_fuehlst_dich("hier sehr wohl."); /* EN You_feel("very comfortable here."); */ else Du_fuehlst_dich("irgendwie fehl am Platz ..."); /* EN You_feel("somehow out of place..."); */ } if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ)) { /* may have teleported */ levl[u.ux][u.uy].typ = ROOM; pline_The("NOUN_THRON VERB_AUFLOESEN sich in ein Logikwölkchen SATZKLAMMER."); /* EN pline_The("throne vanishes in a puff of logic."); */ newsym(u.ux,u.uy); } } else if (lays_eggs(youmonst.data)) { struct obj *uegg; if (!flags.female) { pline("Männchen können keine Eier legen!"); /* EN pline("Males can't lay eggs!"); */ return 0; } if (u.uhunger < (int)objects[EGG].oc_nutrition) { You("VERB_HAVE nicht genug Energie um ein Ei zu legen."); /* EN You("don't have enough energy to lay an egg."); */ return 0; } uegg = mksobj(EGG, FALSE, FALSE); uegg->spe = 1; uegg->quan = 1; uegg->owt = weight(uegg); uegg->corpsenm = egg_type_from_parent(u.umonnum, FALSE); uegg->known = uegg->dknown = 1; attach_egg_hatch_timeout(uegg); You("VERB_LEGEN ein Ei."); /* EN You("lay an egg."); */ dropy(uegg); stackobj(uegg); morehungry((int)objects[EGG].oc_nutrition); } else if (u.uswallow) pline("Hier gibt es keine Sitzmöglichkeiten!"); /* EN There("are no seats in here!"); */ else pline("Spaß daran, %s zu sitzen?", auf_dem_Boden(u.ux,u.uy)); /* EN pline("Having fun sitting on the %s?", surface(u.ux,u.uy)); */ return(1); }
int dosit() { static const char sit_message[] = "sit on the %s."; register struct trap *trap; register int typ = levl[u.ux][u.uy].typ; #ifdef STEED if (u.usteed) { You("are already sitting on %s.", mon_nam(u.usteed)); return (0); } #endif if(!can_reach_floor()) { if (Levitation) You("tumble in place."); else You("are sitting on air."); return 0; } else if (is_pool(u.ux, u.uy) && !Underwater) { /* water walking */ goto in_water; } if(OBJ_AT(u.ux, u.uy)) { register struct obj *obj; obj = level.objects[u.ux][u.uy]; You("sit on %s.", the(xname(obj))); if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH)) pline("It's not very comfortable..."); } else if ((trap = t_at(u.ux, u.uy)) != 0 || (u.utrap && (u.utraptype >= TT_LAVA))) { if (u.utrap) { exercise(A_WIS, FALSE); /* you're getting stuck longer */ if(u.utraptype == TT_BEARTRAP) { You_cant("sit down with your %s in the bear trap.", body_part(FOOT)); u.utrap++; } else if(u.utraptype == TT_PIT) { if(trap->ttyp == SPIKED_PIT) { You("sit down on a spike. Ouch!"); losehp(1, "sitting on an iron spike", KILLED_BY); exercise(A_STR, FALSE); } else You("sit down in the pit."); u.utrap += rn2(5); } else if(u.utraptype == TT_WEB) { You("sit in the spider web and get entangled further!"); u.utrap += rn1(10, 5); } else if(u.utraptype == TT_LAVA) { /* Must have fire resistance or they'd be dead already */ You("sit in the lava!"); u.utrap += rnd(4); losehp(d(2,10), "sitting in lava", KILLED_BY); } else if(u.utraptype == TT_INFLOOR) { You_cant("maneuver to sit!"); u.utrap++; } } else { You("sit down."); dotrap(trap, 0); } } else if(Underwater || Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) There("are no cushions floating nearby."); else You("sit down on the muddy bottom."); } else if(is_pool(u.ux, u.uy)) { in_water: You("sit in the water."); if (!rn2(10) && uarm) (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst); if (!rn2(10) && uarmf && uarmf->otyp != WATER_WALKING_BOOTS) (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst); #ifdef SINKS } else if(IS_SINK(typ)) { You(sit_message, defsyms[S_sink].explanation); Your("%s gets wet.", humanoid(youmonst.data) ? "rump" : "underside"); #endif } else if(IS_ALTAR(typ)) { You(sit_message, defsyms[S_altar].explanation); altar_wrath(u.ux, u.uy); } else if(IS_GRAVE(typ)) { You(sit_message, defsyms[S_grave].explanation); } else if(typ == STAIRS) { You(sit_message, "stairs"); } else if(typ == LADDER) { You(sit_message, "ladder"); } else if (is_lava(u.ux, u.uy)) { /* must be WWalking */ You(sit_message, "lava"); burn_away_slime(); if (likes_lava(youmonst.data)) { pline_The("lava feels warm."); return 1; } pline_The("lava burns you!"); losehp(d((Fire_resistance ? 2 : 10), 10), "sitting on lava", KILLED_BY); } else if (is_ice(u.ux, u.uy)) { You(sit_message, defsyms[S_ice].explanation); if (!Cold_resistance) pline_The("ice feels cold."); } else if (typ == DRAWBRIDGE_DOWN) { You(sit_message, "drawbridge"); } else if(IS_THRONE(typ)) { You(sit_message, defsyms[S_throne].explanation); if (rnd(6) > 4) { switch (rnd(13)) { case 1: (void) adjattrib(rn2(A_MAX), -rn1(4,3), FALSE); losehp(rnd(10), "cursed throne", KILLED_BY_AN); break; case 2: (void) adjattrib(rn2(A_MAX), 1, FALSE); break; case 3: pline("A%s electric shock shoots through your body!", (Shock_resistance) ? "n" : " massive"); losehp(Shock_resistance ? rnd(6) : rnd(30), "electric chair", KILLED_BY_AN); exercise(A_CON, FALSE); break; case 4: You_feel("much, much better!"); if (Upolyd) { if (u.mh >= (u.mhmax - 5)) u.mhmax += 4; u.mh = u.mhmax; } if(u.uhp >= (u.uhpmax - 5)) u.uhpmax += 4; u.uhp = u.uhpmax; make_blinded(0L,TRUE); make_sick(0L, (char *) 0, FALSE, SICK_ALL); heal_legs(); flags.botl = 1; break; case 5: take_gold(); break; case 6: if(u.uluck + rn2(5) < 0) { You_feel("your luck is changing."); change_luck(1); } else makewish(); break; case 7: { register int cnt = rnd(10); pline("A voice echoes:"); verbalize("Thy audience hath been summoned, %s!", flags.female ? "Dame" : "Sire"); while(cnt--) (void) makemon(courtmon(), u.ux, u.uy, NO_MM_FLAGS); break; } case 8: pline("A voice echoes:"); verbalize("By thy Imperious order, %s...", flags.female ? "Dame" : "Sire"); do_genocide(5); /* REALLY|ONTHRONE, see do_genocide() */ break; case 9: pline("A voice echoes:"); verbalize("A curse upon thee for sitting upon this most holy throne!"); if (Luck > 0) { make_blinded(Blinded + rn1(100,250),TRUE); } else rndcurse(); break; case 10: if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (level.flags.nommap) { pline( "A terrible drone fills your head!"); make_confused(HConfusion + rnd(30), FALSE); } else { pline("An image forms in your mind."); do_mapping(); } } else { Your("vision becomes clear."); HSee_invisible |= FROMOUTSIDE; newsym(u.ux, u.uy); } break; case 11: if (Luck < 0) { You_feel("threatened."); aggravate(); } else { You_feel("a wrenching sensation."); tele(); /* teleport him */ } break; case 12: You("are granted an insight!"); if (invent) { /* rn2(5) agrees w/seffects() */ identify_pack(rn2(5)); } break; case 13: Your("mind turns into a pretzel!"); make_confused(HConfusion + rn1(7,16),FALSE); break; default: impossible("throne effect"); break; } } else { if (is_prince(youmonst.data)) You_feel("very comfortable here."); else You_feel("somehow out of place..."); } if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ)) { /* may have teleported */ levl[u.ux][u.uy].typ = ROOM; pline_The("throne vanishes in a puff of logic."); newsym(u.ux,u.uy); } } else if (lays_eggs(youmonst.data)) { struct obj *uegg; if (!flags.female) { pline("Males can't lay eggs!"); return 0; } if (u.uhunger < (int)objects[EGG].oc_nutrition) { You("don't have enough energy to lay an egg."); return 0; } uegg = mksobj(EGG, FALSE, FALSE); uegg->spe = 1; uegg->quan = 1; uegg->owt = weight(uegg); uegg->corpsenm = egg_type_from_parent(u.umonnum, FALSE); uegg->known = uegg->dknown = 1; attach_egg_hatch_timeout(uegg); You("lay an egg."); dropy(uegg); stackobj(uegg); morehungry((int)objects[EGG].oc_nutrition); } else if (u.uswallow) There("are no seats in here!"); else pline("Having fun sitting on the %s?", surface(u.ux,u.uy)); return(1); }
//returns strings corresponding to items and aScopeModifier (a string corresponding to container // where these items are) QStringList Command::parseCommandInput(const QString & aLine, const QString & aSuffix, QString & aScopeModifier) { aScopeModifier = ""; QString line = aLine.toLower(); //remove articles QRegExp the("^the "); line = line.replace(the, ""); line = line.replace(" the ", ""); line = line.replace(QRegExp("\\s+"), " "); //if a_suffix is specified then find first use of a_suffix in line //everything after it will be a scope modifier QString scopeModifier; int scopeStart = line.indexOf(aSuffix); if (scopeStart >= 0) { int actualStart = scopeStart + aSuffix.length(); //cut line if(actualStart < line.length()) { scopeModifier = line.right(line.length() - actualStart); line = line.left(actualStart); } } //strip indices like 1., 2., etc QRegExp index("\\d+\\."); line = line.replace(index, ""); //'and' is the same as ',' line = line.replace(" and ", ", "); //now skip the first word, it is a command QRegExp skipFirstWord("^\\w+\\s+(.*)"); if(skipFirstWord.exactMatch(line)) line = skipFirstWord.cap(1); else { QStringList empty; return empty; } //split by commas QStringList items = line.split(','); //each item may be prefixed with 'all' or a number int length = items.size(); QRegExp all("^all\\s+(.+)"); QRegExp numbered("^(\\d+)\\s+(.+)"); QStringList results; for( int i = 0; i < length; i++) { QString item = items[i]; item = item.trimmed(); if(all.exactMatch(item)) { results.append("all;" + all.cap(1)); continue; } if(numbered.exactMatch(item)) { results.append(numbered.cap(1) + ";" + numbered.cap(2)); continue; } //otherwise results.append("1;" + item); } aScopeModifier = scopeModifier; return results; }
void ConsoleWindow::drawUILayer() { glLineWidth ( 3.0 ); // _contentWindow.outlineRounded(0.05); // _cubeWindow.outlineRounded(0.05); Audicle* audi = Audicle::instance(); double glomod = fabs( -1.0 + 2.0 * ( m_time * 0.6 - floor(m_time * 0.6 ) ) ); double xdiv = 0.5 * ( _cubeWindow.right() + _contentWindow.left() ) ; glBegin(GL_LINES); glColor4d ( 0.2,0.2, 0.2, 1.0 ); glVertex2d ( xdiv, _cubeWindow.top() - _marginSize ); glVertex2d ( xdiv, _cubeWindow.bottom() + _marginSize ); glEnd(); _sizeBox.outlineRounded(); glLineWidth(1.5); _curLabel.draw( 0.75 ); _curDisplay.draw( 0.75 ); if ( _active ) { _prevLabel.draw( 0.75 ); _prevDisplay.draw( 0.75 ); } static char buffer[256]; double time = the()->shreduler()->now_system; int sr = Digitalio::sampling_rate(); //m_sampling_rate; int samp = (int) time; int sec = samp / sr; int min = ( sec / 60 ) ; int hr = ( min / 60 ) ; int day = ( hr / 24 ); samp = samp % sr; sec = sec % 60; min = min % 60; hr = hr % 24; if ( day ) sprintf(buffer, "%dd:%02d:%02d:%02d.%05d", day, hr, min, sec, samp ); else if ( hr ) sprintf(buffer, "%02d:%02d:%02d.%05d", hr, min, sec, samp ); else if ( min ) sprintf(buffer, "%02d:%02d.%05d", min, sec, samp ); else if ( sec ) sprintf(buffer, "%02d.%05d", sec, samp ); else sprintf(buffer, "%05d", samp ); _timeDisplay.setLabel( buffer ) ; _timeDisplay.fitLabel( 1 ); _timeDisplay.setw( _timeDisplay.w() * 0.70 ); _timeDisplay.filledRounded( 0.03f ); _timeDisplay.drawLabel( 0.75, 1 ); _timeDisplay.outlineRounded( 0.03f ); glPushName( _timeLabel.id() ); Color4D tdark = Color4D( 0.6, 0.9, 0.6, 1.0 ); Color4D tglow = tdark.interp( _timeLabel.col(), glomod * 1.2 ); tglow[3] = 1.0; _timeLabel.setCol( tglow ); glBegin( GL_POLYGON ); _timeLabel.roundVerts( ); glEnd( ); _timeLabel.drawLeadedLabel( 0.75f, 0.15f ); _timeLabel.outlineRounded( ); glPopName(); if ( _active ) { glLineWidth( 3.0 ); glPushMatrix(); double cubh = _cubeSides[0].h(); glTranslated ( _cubeWindow.center()[0] - cubh * 3.5 , _cubeWindow.center()[1] + cubh * 1.5, 0 ); if ( _cube_swapping ) { double w = ( m_time - _cube_swap_start ) / _cube_swap_span ; if ( w > 1.0 ) { _cube_swapping = false ; for ( int i = 0 ; i < 6 ; i++ ) _swapPos[i] = _cubeSides[i].pos(); } else if ( w > 0 ) { for ( int i = 0; i < 6 ; i++ ) { glPushMatrix(); glPushName( _cubeSides[i].id() ); Point2D animp = _swapPos[i].interp ( _cubeSides[i].pos() , w ); glTranslated( animp[0] - _cubeSides[i].pos()[0], \ animp[1] - _cubeSides[i].pos()[1], 0 ); _cubeSides[i].drawQuad( 0.75 ); glPopName(); glPopMatrix(); } } } if ( !_cube_swapping ) { for ( int i = 0 ; i < 6; i++ ) { glPushName( _cubeSides[i].id() ); _cubeSides[i].drawQuad( 0.75 ); glPopName(); } } t_CKUINT cur = audi->look_here(); Point2D _cube_spot( cubh * 6.0 , -cubh * 1.5 ); glPushMatrix(); glTranslated ( _cube_spot[0], _cube_spot[1], 0 ); glScaled ( 1.5, 1.5, 1.5 ); glRotatef ( -30, 1.0, 0.0, 0.0 ); glRotatef ( 30, 0.0, 1.0 ,0.0 ); glPushMatrix(); glTranslated( 0, 0, -0.5 * cubh ); glTranslated(-_cubeSides[cur].center()[0], -_cubeSides[cur].center()[1], 0.0 ); glPushName( _cubeSides[cur].id() ); Color4D dark = _cubeSides[cur].col().scale(0.75); Color4D glow = dark.interp( _cubeSides[cur].col(), glomod * 1.1 ); glow[3] = 1.0; _cubeSides[cur].setCol( glow ); glBegin( GL_QUADS); _cubeSides[cur].quadVerts( ); glEnd( ); _cubeSides[cur].drawLabel( 0.75 ); _cubeSides[cur].outlineQuad( ); // _cubeSides[cur].drawQuad( 0.75 ); glPopName(); glPopMatrix(); glPushMatrix(); glRotatef ( 90, 1.0 , 0, 0 ); t_CKUINT up = audi->look_from( cur, Audicle::UP ) ; glTranslated( 0, 0, -0.5 * cubh ); glTranslated(-_cubeSides[up].center()[0], -_cubeSides[up].center()[1], 0.0 ); glPushName( _cubeSides[up].id() ); _cubeSides[up].drawQuad( 0.75 ); glPopName(); glPopMatrix(); glPushMatrix(); glRotatef ( -90, 0.0 , 1.0 , 0 ); t_CKUINT rt = audi->look_from( cur, Audicle::RIGHT ); glTranslated( 0, 0, -0.5 * cubh ); glTranslated(-_cubeSides[rt].center()[0], -_cubeSides[rt].center()[1], 0.0 ); glPushName( _cubeSides[rt].id() ); _cubeSides[rt].drawQuad( 0.75 ); glPopName(); glPopMatrix(); glPopMatrix(); glPopMatrix(); } }
/* pick a lock on a chest or door with a given object */ int pick_lock(struct obj *pick, const struct nh_cmd_arg *arg) { int picktyp, c; coord cc; schar dx, dy, dz; struct rm *door; struct obj *otmp; const char *qbuf; if (!getargdir(arg, NULL, &dx, &dy, &dz)) return 0; cc.x = youmonst.mx + dx; cc.y = youmonst.my + dy; if (!isok(cc.x, cc.y)) return 0; picktyp = pick->otyp; pick->lastused = moves; /* Check whether we're resuming an interrupted previous attempt. For a floor pick, we have u.utracked[tos_lock] as a non-zeroobj and dx and dy as 0. For a door, we have u.utracked_location[tl_lock] specifying the location and u.utracked[tos_lock] as &zeroobj. */ if (u.uoccupation_progress[tos_lock] && ((u.utracked_location[tl_lock].x == cc.x && u.utracked_location[tl_lock].y == cc.y && u.utracked[tos_lock] == &zeroobj) || (dx == 0 && dy == 0 && u.utracked[tos_lock] != &zeroobj))) { static const char no_longer[] = "Unfortunately, you can no longer %s %s."; if (nohands(youmonst.data)) { const char *what = (picktyp == LOCK_PICK) ? "pick" : "key"; if (picktyp == CREDIT_CARD) what = "card"; pline(msgc_interrupted, no_longer, "hold the", what); return reset_pick(); } else if (u.utracked[tos_lock] != &zeroobj && !can_reach_floor()) { pline(msgc_interrupted, no_longer, "reach the", "lock"); return reset_pick(); } else { const char *action = lock_action(); if (turnstate.continue_message) pline(msgc_occstart, "You resume your attempt at %s.", action); one_occupation_turn(picklock, "picking the lock", occ_lock); return 1; } } if (nohands(youmonst.data)) { pline(msgc_cancelled, "You can't hold %s -- you have no hands!", doname(pick)); return 0; } if ((picktyp != LOCK_PICK && picktyp != CREDIT_CARD && picktyp != SKELETON_KEY)) { impossible("picking lock with object %d?", picktyp); return 0; } if (!dx && !dy) { /* pick lock on a container */ const char *verb; boolean it; int count; if (dz < 0) { pline(msgc_cancelled, "There isn't any sort of lock up %s.", Levitation ? "here" : "there"); return 0; } else if (is_lava(level, youmonst.mx, youmonst.my)) { pline(msgc_cancelled, "Doing that would probably melt your %s.", xname(pick)); return 0; } else if (is_pool(level, youmonst.mx, youmonst.my) && !Underwater) { /* better YAFM - AIS */ pline(msgc_cancelled, "Canals might have locks, but this water doesn't."); return 0; } count = 0; c = 'n'; /* in case there are no boxes here */ for (otmp = level->objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere) if (Is_box(otmp)) { ++count; if (!can_reach_floor()) { pline(msgc_cancelled, "You can't reach %s from up here.", the(xname(otmp))); return 0; } it = 0; if (otmp->obroken) verb = "fix"; else if (!otmp->olocked) verb = "lock", it = 1; else if (picktyp != LOCK_PICK) verb = "unlock", it = 1; else verb = "pick"; qbuf = msgprintf( "There is %s here, %s %s?", safe_qbuf("", sizeof ("There is here, unlock its lock?"), doname(otmp), an(simple_typename(otmp->otyp)), "a box"), verb, it ? "it" : "its lock"); c = ynq(qbuf); if (c == 'q') return 0; if (c == 'n') continue; if (otmp->obroken) { pline(msgc_cancelled, "You can't fix its broken lock with %s.", doname(pick)); return 0; } else if (picktyp == CREDIT_CARD && !otmp->olocked) { /* credit cards are only good for unlocking */ pline(msgc_cancelled, "You can't do that with %s.", doname(pick)); return 0; } u.utracked[tos_lock] = otmp; u.uoccupation_progress[tos_lock] = 0; break; } if (c != 'y') { if (!count) pline(msgc_cancelled, "There doesn't seem to be any sort of lock here."); return 0; /* decided against all boxes */ } } else { /* pick the lock in a door */ struct monst *mtmp; if (u.utrap && u.utraptype == TT_PIT) { pline(msgc_cancelled, "You can't reach over the edge of the pit."); return 0; } door = &level->locations[cc.x][cc.y]; if ((mtmp = m_at(level, cc.x, cc.y)) && canseemon(mtmp)) { if (picktyp == CREDIT_CARD && (mx_eshk(mtmp) || mtmp->data == &mons[PM_ORACLE])) verbalize(msgc_npcvoice, "No checks, no credit, no problem."); else pline(msgc_mispaste, "I don't think %s would appreciate that.", mon_nam(mtmp)); return 0; } if (mtmp && (mtmp->m_ap_type == M_AP_FURNITURE) && (mtmp->mappearance == S_hcdoor || mtmp->mappearance == S_vcdoor) && !Protection_from_shape_changers) { stumble_onto_mimic(mtmp, dx, dy); return 1; } if (!IS_DOOR(door->typ)) { if (is_drawbridge_wall(cc.x, cc.y) >= 0) pline(msgc_cancelled, "You %s no lock on the drawbridge.", Blind ? "feel" : "see"); else pline(msgc_mispaste, "You %s no door there.", Blind ? "feel" : "see"); return 0; } switch (door->doormask) { case D_NODOOR: pline(msgc_cancelled, "This doorway has no door."); return 0; case D_ISOPEN: pline(msgc_cancelled, "You cannot lock an open door."); return 0; case D_BROKEN: pline(msgc_cancelled, "This door is broken."); return 0; default: /* credit cards are only good for unlocking */ if (picktyp == CREDIT_CARD && !(door->doormask & D_LOCKED)) { pline(msgc_cancelled, "You can't lock a door with a credit card."); return 0; } /* At this point, the player knows that the door is a door, and whether it's locked, but not whether it's trapped; to do this, we set the mem_door_l flag and call map_background, which will clear it if necessary (i.e. not a door after all). */ level->locations[cc.x][cc.y].mem_door_l = 1; map_background(cc.x, cc.y, TRUE); u.utracked[tos_lock] = &zeroobj; u.utracked_location[tl_lock] = cc; u.uoccupation_progress[tos_lock] = 0; } } one_occupation_turn(picklock, "picking the lock", occ_lock); return 1; }
/* Called every turn during chest-forcing. The caller must set u.utracked[tos_lock] to the chest in question. */ static int forcelock(void) { struct monst *shkp; boolean costly; struct obj *otmp; struct obj *box = u.utracked[tos_lock]; if (!obj_with_u(box)) return reset_pick(); if (!uwep_can_force()) /* prints the messages; ensures uwep != NULL */ return reset_pick(); if (u.uoccupation_progress[tos_lock]++ >= 50 || nohands(youmonst.data)) { pline(msgc_failrandom, "You give up your attempt to force the lock."); if (!nohands(youmonst.data)) exercise(is_blade(uwep) ? A_DEX : A_STR, TRUE); return reset_pick(); } if (is_blade(uwep)) { if (rn2(1000 - (int)uwep->spe) > (992 - greatest_erosion(uwep) * 10) && !uwep->cursed && !obj_resists(uwep, 0, 99)) { /* for a +0 weapon, probability that it survives an unsuccessful attempt to force the lock is (.992)^50 = .67 */ pline(msgc_substitute, "%sour %s broke!", (uwep->quan > 1L) ? "One of y" : "Y", xname(uwep)); useup(uwep); pline_implied(msgc_failcurse, "You can't exactly force that lock now."); exercise(A_DEX, TRUE); return reset_pick(); } } else /* blunt */ wake_nearby(FALSE); /* due to hammering on the container */ if (rn2(100) >= objects[uwep->otyp].oc_wldam * 2) return 1; /* still busy */ pline(msgc_actionok, "You succeed in forcing the lock."); box->olocked = 0; box->obroken = 1; costly = (*u.ushops && costly_spot(youmonst.mx, youmonst.my)); shkp = costly ? shop_keeper(level, *u.ushops) : 0; if (!is_blade(uwep) && !rn2(3)) { long loss = 0L; pline(msgc_substitute, "In fact, you've totally destroyed %s.", the(xname(box))); /* Put the contents on ground at the hero's feet. */ while ((otmp = box->cobj) != 0) { obj_extract_self(otmp); if (!rn2(3) || otmp->oclass == POTION_CLASS) { chest_shatter_msg(otmp); if (costly) loss += stolen_value(otmp, youmonst.mx, youmonst.my, (boolean) shkp->mpeaceful, TRUE); if (otmp->quan == 1L) { obfree(otmp, NULL); continue; } useup(otmp); } if (box->otyp == ICE_BOX && otmp->otyp == CORPSE) { otmp->age = moves - otmp->age; /* actual age */ start_corpse_timeout(otmp); } place_object(otmp, level, youmonst.mx, youmonst.my); stackobj(otmp); } if (costly) loss += stolen_value(box, youmonst.mx, youmonst.my, (boolean) shkp->mpeaceful, TRUE); if (loss) pline(msgc_unpaid, "You owe %ld %s for objects destroyed.", loss, currency(loss)); delobj(box); } else { if (costly) { struct obj *cobjbak = box->cobj; box->cobj = (struct obj *)0; verbalize(msgc_unpaid, "You damage it, you bought it!"); bill_dummy_object(box); box->cobj = cobjbak; } } exercise(is_blade(uwep) ? A_DEX : A_STR, TRUE); return reset_pick(); }
void nh_timeout() { register struct prop *upp; int sleeptime; int m_idx; int baseluck = (flags.moonphase == FULL_MOON) ? 1 : 0; if (flags.friday13) baseluck -= 1; if (u.uluck != baseluck && moves % (u.uhave.amulet || u.ugangr ? 300 : 600) == 0) { /* Cursed luckstones stop bad luck from timing out; blessed luckstones * stop good luck from timing out; normal luckstones stop both; * neither is stopped if you don't have a luckstone. * Luck is based at 0 usually, +1 if a full moon and -1 on Friday 13th */ register int time_luck = stone_luck(FALSE); boolean nostone = !carrying(LUCKSTONE) && !stone_luck(TRUE); if(u.uluck > baseluck && (nostone || time_luck < 0)) u.uluck--; else if(u.uluck < baseluck && (nostone || time_luck > 0)) u.uluck++; } if(u.uinvulnerable) return; /* things past this point could kill you */ if(Stoned) stoned_dialogue(); if(Slimed) slime_dialogue(); if(Vomiting) vomiting_dialogue(); if(Strangled) choke_dialogue(); if(u.mtimedone && !--u.mtimedone) { if (Unchanging) u.mtimedone = rnd(100*youmonst.data->mlevel + 1); else rehumanize(); } if(u.ucreamed) u.ucreamed--; /* Dissipate spell-based protection. */ if (u.usptime) { if (--u.usptime == 0 && u.uspellprot) { u.usptime = u.uspmtime; u.uspellprot--; find_ac(); if (!Blind) Norep("The %s haze around you %s.", hcolor(NH_GOLDEN), u.uspellprot ? "becomes less dense" : "disappears"); } } #ifdef STEED if (u.ugallop) { if (--u.ugallop == 0L && u.usteed) pline("%s stops galloping.", Monnam(u.usteed)); } #endif for(upp = u.uprops; upp < u.uprops+SIZE(u.uprops); upp++) if((upp->intrinsic & TIMEOUT) && !(--upp->intrinsic & TIMEOUT)) { switch(upp - u.uprops){ case STONED: if (delayed_killer && !killer) { killer = delayed_killer; delayed_killer = 0; } if (!killer) { /* leaving killer_format would make it "petrified by petrification" */ killer_format = NO_KILLER_PREFIX; killer = "killed by petrification"; } done(STONING); break; case SLIMED: if (delayed_killer && !killer) { killer = delayed_killer; delayed_killer = 0; } if (!killer) { killer_format = NO_KILLER_PREFIX; killer = "turned into green slime"; } done(TURNED_SLIME); break; case VOMITING: make_vomiting(0L, TRUE); break; case SICK: You("die from your illness."); killer_format = KILLED_BY_AN; killer = u.usick_cause; if ((m_idx = name_to_mon(killer)) >= LOW_PM) { if (type_is_pname(&mons[m_idx])) { killer_format = KILLED_BY; } else if (mons[m_idx].geno & G_UNIQ) { killer = the(killer); Strcpy(u.usick_cause, killer); killer_format = KILLED_BY; } } u.usick_type = 0; done(POISONING); break; case FAST: if (!Very_fast) You_feel("yourself slowing down%s.", Fast ? " a bit" : ""); break; case CONFUSION: HConfusion = 1; /* So make_confused works properly */ make_confused(0L, TRUE); stop_occupation(); break; case STUNNED: HStun = 1; make_stunned(0L, TRUE); stop_occupation(); break; case BLINDED: Blinded = 1; make_blinded(0L, TRUE); stop_occupation(); break; case INVIS: newsym(u.ux,u.uy); if (!Invis && !BInvis && !Blind) { You(!See_invisible ? "are no longer invisible." : "can no longer see through yourself."); stop_occupation(); } break; case SEE_INVIS: set_mimic_blocking(); /* do special mimic handling */ see_monsters(); /* make invis mons appear */ newsym(u.ux,u.uy); /* make self appear */ stop_occupation(); break; case WOUNDED_LEGS: heal_legs(); stop_occupation(); break; case HALLUC: HHallucination = 1; (void) make_hallucinated(0L, TRUE, 0L); stop_occupation(); break; case SLEEPING: if (unconscious() || Sleep_resistance) HSleeping += rnd(100); else if (Sleeping) { You("fall asleep."); sleeptime = rnd(20); fall_asleep(-sleeptime, TRUE); HSleeping += sleeptime + rnd(100); } break; case LEVITATION: (void) float_down(I_SPECIAL|TIMEOUT, 0L); break; case STRANGLED: killer_format = KILLED_BY; killer = (u.uburied) ? "suffocation" : "strangulation"; done(DIED); break; case FUMBLING: /* call this only when a move took place. */ /* otherwise handle fumbling msgs locally. */ if (u.umoved && !Levitation) { slip_or_trip(); nomul(-2, "fumbling"); nomovemsg = ""; /* The more you are carrying the more likely you * are to make noise when you fumble. Adjustments * to this number must be thoroughly play tested. */ if ((inv_weight() > -500)) { You("make a lot of noise!"); wake_nearby(); } } /* from outside means slippery ice; don't reset counter if that's the only fumble reason */ HFumbling &= ~FROMOUTSIDE; if (Fumbling) HFumbling += rnd(20); break; case DETECT_MONSTERS: see_monsters(); break; case PREGNANT: { char buf[BUFSZ]; if (!flags.female) { strcpy(buf, body_part(STOMACH)); if (!strcmp(buf, "stomach")) strcpy(buf, "belly"); pline("Something bursts out of your %s!"); killer_format = KILLED_BY; killer = "male childbirth"; done(DIED); } mksobj_at(PLACENTA, u.ux, u.uy, FALSE, FALSE); pline("BABIES!"); /* TODO */ stop_occupation(); break; } } } run_timers(); }
string CreatureName::title() const { if (firstName) return *firstName + " the " + name; else return the(); }
/* #sit command */ int dosit() { /*JP static const char sit_message[] = "sit on the %s."; */ static const char sit_message[] = "%sに座った."; register struct trap *trap = t_at(u.ux, u.uy); register int typ = levl[u.ux][u.uy].typ; if (u.usteed) { /*JP You("are already sitting on %s.", mon_nam(u.usteed)); */ You("もう%sに座っている.", mon_nam(u.usteed)); return 0; } if (u.uundetected && is_hider(youmonst.data) && u.umonnum != PM_TRAPPER) u.uundetected = 0; /* no longer on the ceiling */ if (!can_reach_floor(FALSE)) { if (u.uswallow) /*JP There("are no seats in here!"); */ pline("ここには椅子がない!"); else if (Levitation) /*JP You("tumble in place."); */ You("その場で宙返りした."); else /*JP You("are sitting on air."); */ You("空中に座った."); return 0; } else if (u.ustuck && !sticks(youmonst.data)) { /* holding monster is next to hero rather than beneath, but hero is in no condition to actually sit at has/her own spot */ if (humanoid(u.ustuck->data)) /*JP pline("%s won't offer %s lap.", Monnam(u.ustuck), mhis(u.ustuck)); */ pline("%sはひざを出さなかった.", Monnam(u.ustuck)); else /*JP pline("%s has no lap.", Monnam(u.ustuck)); */ pline("%sにはひざがない.", Monnam(u.ustuck)); return 0; } else if (is_pool(u.ux, u.uy) && !Underwater) { /* water walking */ goto in_water; } if (OBJ_AT(u.ux, u.uy) /* ensure we're not standing on the precipice */ && !uteetering_at_seen_pit(trap)) { register struct obj *obj; obj = level.objects[u.ux][u.uy]; if (youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) { #if 0 /*JP*/ You("coil up around your %shoard.", (obj->quan + money_cnt(invent) < u.ulevel * 1000) ? "meager " : ""); #else You("%sお宝のまわりでとぐろを巻いた.", (obj->quan + money_cnt(invent) < u.ulevel * 1000) ? "わずかな" : ""); #endif } else { /*JP You("sit on %s.", the(xname(obj))); */ You("%sに座った.", the(xname(obj))); if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH)) /*JP pline("It's not very comfortable..."); */ pline("あまり座りごこちがよくない..."); } } else if (trap != 0 || (u.utrap && (u.utraptype >= TT_LAVA))) { if (u.utrap) { exercise(A_WIS, FALSE); /* you're getting stuck longer */ if (u.utraptype == TT_BEARTRAP) { /*JP You_cant("sit down with your %s in the bear trap.", */ pline("%sが熊の罠にはさまっているので座れない.", body_part(FOOT)); u.utrap++; } else if (u.utraptype == TT_PIT) { if (trap && trap->ttyp == SPIKED_PIT) { /*JP You("sit down on a spike. Ouch!"); */ You("トゲの上に座った.いてっ!"); losehp(Half_physical_damage ? rn2(2) : 1, /*JP "sitting on an iron spike", KILLED_BY); */ "鉄のトゲの上に座って", KILLED_BY); exercise(A_STR, FALSE); } else /*JP You("sit down in the pit."); */ You("落し穴の中で座った."); u.utrap += rn2(5); } else if (u.utraptype == TT_WEB) { /*JP You("sit in the spider web and get entangled further!"); */ You("くもの巣の中で座ったら,ますます絡まった!"); u.utrap += rn1(10, 5); } else if (u.utraptype == TT_LAVA) { /* Must have fire resistance or they'd be dead already */ /*JP You("sit in the lava!"); */ You("溶岩の中に座った!"); if (Slimed) burn_away_slime(); u.utrap += rnd(4); /*JP losehp(d(2, 10), "sitting in lava", */ losehp(d(2, 10), "溶岩の中に座って", KILLED_BY); /* lava damage */ } else if (u.utraptype == TT_INFLOOR || u.utraptype == TT_BURIEDBALL) { /*JP You_cant("maneuver to sit!"); */ You("座るような動作ができない!"); u.utrap++; } } else { /*JP You("sit down."); */ You("座った."); dotrap(trap, 0); } } else if (Underwater || Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) /*JP There("are no cushions floating nearby."); */ pline("近くに浮いているクッションはない."); else /*JP You("sit down on the muddy bottom."); */ You("どろどろした底に座った."); } else if (is_pool(u.ux, u.uy)) { in_water: /*JP You("sit in the water."); */ You("水の中で座った."); if (!rn2(10) && uarm) /*JP (void) water_damage(uarm, "armor", TRUE); */ (void) water_damage(uarm, "鎧", TRUE); if (!rn2(10) && uarmf && uarmf->otyp != WATER_WALKING_BOOTS) /*JP (void) water_damage(uarm, "armor", TRUE); */ (void) water_damage(uarm, "鎧", TRUE); } else if (IS_SINK(typ)) { You(sit_message, defsyms[S_sink].explanation); /*JP Your("%s gets wet.", humanoid(youmonst.data) ? "rump" : "underside"); */ Your("%sは濡れた.", humanoid(youmonst.data) ? "尻" : "下部"); } else if (IS_ALTAR(typ)) { You(sit_message, defsyms[S_altar].explanation); altar_wrath(u.ux, u.uy); } else if (IS_GRAVE(typ)) { You(sit_message, defsyms[S_grave].explanation); } else if (typ == STAIRS) { /*JP You(sit_message, "stairs"); */ You(sit_message, "階段"); } else if (typ == LADDER) { /*JP You(sit_message, "ladder"); */ You(sit_message, "はしご"); } else if (is_lava(u.ux, u.uy)) { /* must be WWalking */ /*JP You(sit_message, "lava"); */ You(sit_message, "溶岩"); burn_away_slime(); if (likes_lava(youmonst.data)) { /*JP pline_The("lava feels warm."); */ pline("溶岩は暖かい."); return 1; } /*JP pline_The("lava burns you!"); */ You("溶岩で燃えた!"); losehp(d((Fire_resistance ? 2 : 10), 10), /* lava damage */ /*JP "sitting on lava", KILLED_BY); */ "溶岩に座って", KILLED_BY); } else if (is_ice(u.ux, u.uy)) { You(sit_message, defsyms[S_ice].explanation); if (!Cold_resistance) /*JP pline_The("ice feels cold."); */ pline("氷は冷たく感じた."); } else if (typ == DRAWBRIDGE_DOWN) { /*JP You(sit_message, "drawbridge"); */ You(sit_message, "跳ね橋"); } else if (IS_THRONE(typ)) { You(sit_message, defsyms[S_throne].explanation); if (rnd(6) > 4) { switch (rnd(13)) { case 1: (void) adjattrib(rn2(A_MAX), -rn1(4, 3), FALSE); /*JP losehp(rnd(10), "cursed throne", KILLED_BY_AN); */ losehp(rnd(10), "呪われた玉座で", KILLED_BY_AN); break; case 2: (void) adjattrib(rn2(A_MAX), 1, FALSE); break; case 3: #if 0 /*JP*/ pline("A%s electric shock shoots through your body!", (Shock_resistance) ? "n" : " massive"); #else pline("%s電気があなたの体を走り抜けた!", (Shock_resistance) ? "" : "激しい"); #endif /*JP losehp(Shock_resistance ? rnd(6) : rnd(30), "electric chair", */ losehp(Shock_resistance ? rnd(6) : rnd(30), "電気椅子で", KILLED_BY_AN); exercise(A_CON, FALSE); break; case 4: /*JP You_feel("much, much better!"); */ You_feel("とても,とても元気になったような気がした!"); if (Upolyd) { if (u.mh >= (u.mhmax - 5)) u.mhmax += 4; u.mh = u.mhmax; } if (u.uhp >= (u.uhpmax - 5)) u.uhpmax += 4; u.uhp = u.uhpmax; make_blinded(0L, TRUE); make_sick(0L, (char *) 0, FALSE, SICK_ALL); heal_legs(); context.botl = 1; break; case 5: take_gold(); break; case 6: if (u.uluck + rn2(5) < 0) { /*JP You_feel("your luck is changing."); */ pline("運が向いてきた気がする."); change_luck(1); } else makewish(); break; case 7: { int cnt = rnd(10); /* Magical voice not affected by deafness */ /*JP pline("A voice echoes:"); */ pline("声が響いた:"); #if 0 /*JP*/ verbalize("Thy audience hath been summoned, %s!", flags.female ? "Dame" : "Sire"); #else verbalize("%sよ!汝の聴衆召喚されし.", flags.female ? "女" : "男"); #endif while (cnt--) (void) makemon(courtmon(), u.ux, u.uy, NO_MM_FLAGS); break; } case 8: /* Magical voice not affected by deafness */ /*JP pline("A voice echoes:"); */ pline("声が響いた:"); #if 0 /*JP*/ verbalize("By thine Imperious order, %s...", flags.female ? "Dame" : "Sire"); #else verbalize("%sよ!汝の傲慢聞きいれようぞ.", flags.female ? "女" : "男"); #endif do_genocide(5); /* REALLY|ONTHRONE, see do_genocide() */ break; case 9: /* Magical voice not affected by deafness */ /*JP pline("A voice echoes:"); */ pline("声が響いた:"); verbalize( /*JP "A curse upon thee for sitting upon this most holy throne!"); */ "聖なる玉座に座りし汝に呪いあれ!"); if (Luck > 0) { make_blinded(Blinded + rn1(100, 250), TRUE); } else rndcurse(); break; case 10: if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (level.flags.nommap) { /*JP pline("A terrible drone fills your head!"); */ pline("恐しいブンブンという音が頭に響いた!"); make_confused((HConfusion & TIMEOUT) + (long) rnd(30), FALSE); } else { /*JP pline("An image forms in your mind."); */ pline("あるイメージが頭に浮んだ."); do_mapping(); } } else { /*JP Your("vision becomes clear."); */ Your("視界は冴え渡った."); HSee_invisible |= FROMOUTSIDE; newsym(u.ux, u.uy); } break; case 11: if (Luck < 0) { /*JP You_feel("threatened."); */ You("脅迫されているような気がした."); aggravate(); } else { /*JP You_feel("a wrenching sensation."); */ You("ねじられたような感覚を感じた."); tele(); /* teleport him */ } break; case 12: /*JP You("are granted an insight!"); */ You("洞察力を得た!"); if (invent) { /* rn2(5) agrees w/seffects() */ identify_pack(rn2(5), FALSE); } break; case 13: /*JP Your("mind turns into a pretzel!"); */ Your("心はクネクネになった!"); make_confused((HConfusion & TIMEOUT) + (long) rn1(7, 16), FALSE); break; default: impossible("throne effect"); break; } } else { if (is_prince(youmonst.data)) /*JP You_feel("very comfortable here."); */ You("ここはとても落ち着く."); else /*JP You_feel("somehow out of place..."); */ You("何か場違いの気がした..."); } if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ)) { /* may have teleported */ levl[u.ux][u.uy].typ = ROOM; /*JP pline_The("throne vanishes in a puff of logic."); */ pline("玉座はふっと消えた."); newsym(u.ux, u.uy); } } else if (lays_eggs(youmonst.data)) { struct obj *uegg; if (!flags.female) { #if 0 /*JP*/ pline("%s can't lay eggs!", Hallucination ? "You may think you are a platypus, but a male still" : "Males"); #else pline("%s雄は卵を産めない!", Hallucination ? "あなたは自分がカモノハシだと思っているかもしれないが,やっぱり" : ""); #endif return 0; } else if (u.uhunger < (int) objects[EGG].oc_nutrition) { /*JP You("don't have enough energy to lay an egg."); */ You("卵を産むだけのエネルギーがない."); return 0; } uegg = mksobj(EGG, FALSE, FALSE); uegg->spe = 1; uegg->quan = 1L; uegg->owt = weight(uegg); /* this sets hatch timers if appropriate */ set_corpsenm(uegg, egg_type_from_parent(u.umonnum, FALSE)); uegg->known = uegg->dknown = 1; /*JP You("lay an egg."); */ You("卵を産んだ."); dropy(uegg); stackobj(uegg); morehungry((int) objects[EGG].oc_nutrition); } else { /*JP pline("Having fun sitting on the %s?", surface(u.ux, u.uy)); */ pline("%sに座って楽しいかい?", surface(u.ux,u.uy)); } return 1; }
static int arti_invoke(struct obj *obj) { const struct artifact *oart = get_artifact(obj); if (!oart || !oart->inv_prop) { if (obj->oclass == WAND_CLASS) return do_break_wand(obj); else if (obj->oclass == GEM_CLASS || obj->oclass == TOOL_CLASS) return dorub(obj); else if (obj->otyp == CRYSTAL_BALL) use_crystal_ball(obj); else pline("Nothing happens."); return 1; } if (oart->inv_prop > LAST_PROP) { /* It's a special power, not "just" a property */ if (obj->age > moves) { /* the artifact is tired :-) */ pline("You feel that %s %s ignoring you.", the(xname(obj)), otense(obj, "are")); /* and just got more so; patience is essential... */ obj->age += (long) dice(3,10); return 1; } obj->age = moves + rnz(100); switch(oart->inv_prop) { case TAMING: { struct obj pseudo; boolean unused_known; pseudo = zeroobj; /* neither cursed nor blessed */ pseudo.otyp = SCR_TAMING; seffects(&pseudo, &unused_known); break; } case HEALING: { int healamt = (u.uhpmax + 1 - u.uhp) / 2; long creamed = (long)u.ucreamed; if (Upolyd) healamt = (u.mhmax + 1 - u.mh) / 2; if (healamt || Sick || Slimed || Blinded > creamed) pline("You feel better."); else goto nothing_special; if (healamt > 0) { if (Upolyd) u.mh += healamt; else u.uhp += healamt; } if (Sick) make_sick(0L,NULL,FALSE,SICK_ALL); if (Slimed) Slimed = 0L; if (Blinded > creamed) make_blinded(creamed, FALSE); iflags.botl = 1; break; } case ENERGY_BOOST: { int epboost = (u.uenmax + 1 - u.uen) / 2; if (epboost > 120) epboost = 120; /* arbitrary */ else if (epboost < 12) epboost = u.uenmax - u.uen; if (epboost) { pline("You feel re-energized."); u.uen += epboost; iflags.botl = 1; } else goto nothing_special; break; } case UNTRAP: { if (!untrap(TRUE)) { obj->age = 0; /* don't charge for changing their mind */ return 0; } break; } case CHARGE_OBJ: { struct obj *otmp = getobj(recharge_type, "charge"); boolean b_effect; if (!otmp) { obj->age = 0; return 0; } b_effect = obj->blessed && (Role_switch == oart->role || !oart->role); recharge(otmp, b_effect ? 1 : obj->cursed ? -1 : 0); update_inventory(); break; } case LEV_TELE: level_tele(); break; case CREATE_PORTAL: { int i, num_ok_dungeons, last_ok_dungeon = 0; d_level newlev; extern int n_dgns; /* from dungeon.c */ struct nh_menuitem *items; items = malloc(n_dgns * sizeof(struct nh_menuitem)); num_ok_dungeons = 0; for (i = 0; i < n_dgns; i++) { if (!dungeons[i].dunlev_ureached) continue; items[num_ok_dungeons].id = i+1; items[num_ok_dungeons].accel = 0; items[num_ok_dungeons].role = MI_NORMAL; items[num_ok_dungeons].selected = FALSE; strcpy(items[num_ok_dungeons].caption, dungeons[i].dname); num_ok_dungeons++; last_ok_dungeon = i; } if (num_ok_dungeons > 1) { /* more than one entry; display menu for choices */ int n; int selected[1]; n = display_menu(items, num_ok_dungeons, "Open a portal to which dungeon?", PICK_ONE, selected); free(items); if (n <= 0) goto nothing_special; i = selected[0] - 1; } else { free(items); i = last_ok_dungeon; /* also first & only OK dungeon */ } /* * i is now index into dungeon structure for the new dungeon. * Find the closest level in the given dungeon, open * a use-once portal to that dungeon and go there. * The closest level is either the entry or dunlev_ureached. */ newlev.dnum = i; if (dungeons[i].depth_start >= depth(&u.uz)) newlev.dlevel = dungeons[i].entry_lev; else newlev.dlevel = dungeons[i].dunlev_ureached; if (u.uhave.amulet || In_endgame(&u.uz) || In_endgame(&newlev) || newlev.dnum == u.uz.dnum) { pline("You feel very disoriented for a moment."); } else { if (!Blind) pline("You are surrounded by a shimmering sphere!"); else pline("You feel weightless for a moment."); goto_level(&newlev, FALSE, FALSE, FALSE); } break; } case ENLIGHTENING: enlightenment(0); break; case CREATE_AMMO: { struct obj *otmp = mksobj(level, ARROW, TRUE, FALSE); if (!otmp) goto nothing_special; otmp->blessed = obj->blessed; otmp->cursed = obj->cursed; otmp->bknown = obj->bknown; if (obj->blessed) { if (otmp->spe < 0) otmp->spe = 0; otmp->quan += rnd(10); } else if (obj->cursed) { if (otmp->spe > 0) otmp->spe = 0; } else otmp->quan += rnd(5); otmp->owt = weight(otmp); hold_another_object(otmp, "Suddenly %s out.", aobjnam(otmp, "fall"), NULL); break; } } } else { long eprop = (u.uprops[oart->inv_prop].extrinsic ^= W_ARTI), iprop = u.uprops[oart->inv_prop].intrinsic; boolean on = (eprop & W_ARTI) != 0; /* true if invoked prop just set */ if (on && obj->age > moves) { /* the artifact is tired :-) */ u.uprops[oart->inv_prop].extrinsic ^= W_ARTI; pline("You feel that %s %s ignoring you.", the(xname(obj)), otense(obj, "are")); /* can't just keep repeatedly trying */ obj->age += (long) dice(3,10); return 1; } else if (!on) { /* when turning off property, determine downtime */ /* arbitrary for now until we can tune this -dlc */ obj->age = moves + rnz(100); } if ((eprop & ~W_ARTI) || iprop) { nothing_special: /* you had the property from some other source too */ if (carried(obj)) pline("You feel a surge of power, but nothing seems to happen."); return 1; } switch(oart->inv_prop) { case CONFLICT: if (on) pline("You feel like a rabble-rouser."); else pline("You feel the tension decrease around you."); break; case LEVITATION: if (on) { float_up(); spoteffects(FALSE); } else float_down(I_SPECIAL|TIMEOUT, W_ARTI); break; case INVIS: if (BInvis || Blind) goto nothing_special; newsym(u.ux, u.uy); if (on) pline("Your body takes on a %s transparency...", Hallucination ? "normal" : "strange"); else pline("Your body seems to unfade..."); break; } } return 1; }