virtual void select(int entnum, uimenu *menu) { if ( ! started ) { started = true; setup(menu); } if (entnum != lastent) { lastent = entnum; tmp = monster(GetMType(entnum)); if (friendly) { tmp.friendly = -1; } } werase(w_info); tmp.print_info(g, w_info); std::string header = string_format("#%d: %s", entnum, GetMType(entnum)->name.c_str() ); mvwprintz(w_info, 1, ( getmaxx(w_info) - header.size() ) / 2, c_cyan, "%s", header.c_str() ); mvwprintz(w_info, getmaxy(w_info) - 3, 0, c_green, "%s", msg.c_str()); msg = padding; mvwprintw(w_info, getmaxy(w_info) - 2, 0, "[/] find, [f] friendly, [q]uit"); //wrefresh(w_info); // for some reason this makes everything disappear on first run? Not needed, at any rate. }
virtual void select(int entnum, uimenu *menu) override { if ( ! started ) { started = true; setup(menu); } if (entnum != lastent) { lastent = entnum; tmp = monster( mtypes[ entnum ]->id ); if (friendly) { tmp.friendly = -1; } } werase(w_info); wrefresh(w_info); tmp.print_info( w_info, 2, 5, 1 ); std::string header = string_format("#%d: %s (%d)%s", entnum, tmp.type->nname().c_str(), group, (hallucination ? _(" (hallucination)") : "")); mvwprintz(w_info, 0, ( getmaxx(w_info) - header.size() ) / 2, c_cyan, "%s", header.c_str()); mvwprintz(w_info, getmaxy(w_info) - 3, 0, c_green, "%s", msg.c_str()); msg = padding; mvwprintw(w_info, getmaxy(w_info) - 2, 0, _("[/] find, [f]riendly, [h]allucination, [i]ncrease group, [d]ecrease group, [q]uit")); }
virtual void select(int entnum, uimenu *menu) { if ( ! started ) { started = true; setup(menu); } if (entnum != lastent) { lastent = entnum; tmp = monster(GetMType(entnum)); if (friendly) { tmp.friendly = -1; } } werase(w_info); tmp.print_info( w_info, 6, 5, 1 ); std::string header = string_format("#%d: %s", entnum, GetMType(entnum)->nname().c_str()); mvwprintz(w_info, 1, ( getmaxx(w_info) - header.size() ) / 2, c_cyan, "%s", header.c_str()); mvwprintz(w_info, getmaxy(w_info) - 3, 0, c_green, "%s", msg.c_str()); msg = padding; mvwprintw(w_info, getmaxy(w_info) - 2, 0, _("[/] find, [f]riendly, [i]ncrease group, [d]ecrease group, [q]uit")); }
void Test::testMonsterRange(const Parameters ¶ms, int startRed, int endRed, int yellow, int blue, int trialCount) { ofstream file("monsterResults.csv"); if (file.fail()) { cout << " *** FAILED TO OPEN RESULTS FILE, IN USE BY ANOTHER APPLICATION ***" << endl; cin.get(); return; } file << "Monster"; for (int subsetSize = 1; subsetSize <= 16; subsetSize++) file << ",s" << subsetSize; file << endl; for (int red = startRed; red <= endRed; red++) { yellow = red; //blue = red; Monster monster("temp", red, yellow, blue, 0); file << "standard " << red << "-" << yellow << "-" << blue; for (int subsetSize = 1; subsetSize <= 16; subsetSize++) { cout << "testing " << red << "-" << yellow << "-" << blue << ", subset=" << subsetSize << endl; file << ","; file << testMonsterSubsetDifficulty(params, monster, subsetSize, 4, 4, trialCount); } file << endl; } }
void select( int entnum, uilist *menu ) override { if( ! started ) { started = true; setup( menu ); } if( entnum != lastent ) { lastent = entnum; tmp = monster( mtypes[ entnum ]->id ); if( friendly ) { tmp.friendly = -1; } } werase( w_info ); wrefresh( w_info ); tmp.print_info( w_info, 2, 5, 1 ); std::string header = string_format( "#%d: %s (%d)%s", entnum, tmp.type->nname(), group, ( hallucination ? _( " (hallucination)" ) : "" ) ); mvwprintz( w_info, 0, ( getmaxx( w_info ) - header.size() ) / 2, c_cyan, header ); mvwprintz( w_info, getmaxy( w_info ) - 3, 0, c_green, msg ); msg = padding; input_context ctxt( menu->input_category ); mvwprintw( w_info, getmaxy( w_info ) - 2, 0, _( "[%s] find, [f]riendly, [h]allucination, [i]ncrease group, [d]ecrease group, [%s] quit" ), ctxt.get_desc( "FILTER" ), ctxt.get_desc( "QUIT" ) ); }
void debug_menu::wishmonster( const tripoint &p ) { std::vector<const mtype *> mtypes; uimenu wmenu; wmenu.w_x = 0; wmenu.w_width = TERMX; // disabled due to foldstring crash //( TERMX - getmaxx(w_terrain) - 30 > 24 ? getmaxx(w_terrain) : TERMX ); wmenu.pad_right = ( wmenu.w_width - 30 ); wmenu.return_invalid = true; wmenu.selected = uistate.wishmonster_selected; wish_monster_callback cb( mtypes ); wmenu.callback = &cb; int i = 0; for( const auto &montype : MonsterGenerator::generator().get_all_mtypes() ) { wmenu.addentry( i, true, 0, montype.nname() ); wmenu.entries[i].extratxt.txt = montype.sym; wmenu.entries[i].extratxt.color = montype.color; wmenu.entries[i].extratxt.left = 1; ++i; mtypes.push_back( &montype ); } do { wmenu.query(); if( wmenu.ret >= 0 ) { monster mon = monster( mtypes[ wmenu.ret ]->id ); if( cb.friendly ) { mon.friendly = -1; } if( cb.hallucination ) { mon.hallucination = true; } tripoint spawn = ( p == tripoint_min ? g->look_around() : p ); if( spawn != tripoint_min ) { const std::vector<tripoint> spawn_points = closest_tripoints_first( cb.group, spawn ); int num_spawned = 0; for( const tripoint &spawn_point : spawn_points ) { if( g->critter_at( spawn_point ) == nullptr ) { ++num_spawned; mon.spawn( spawn_point ); g->add_zombie( mon, true ); } } input_context ctxt( "UIMENU" ); cb.msg = string_format( _( "Spawned %d/%d monsters, choose another or [%s] to quit." ), num_spawned, int( spawn_points.size() ), ctxt.get_desc( "QUIT" ).c_str() ); uistate.wishmonster_selected = wmenu.ret; wmenu.redraw(); } } } while( wmenu.ret >= 0 ); }
void LegacyCharacter::Load( moPropBagRef propBag ) { moPropStringRef name ( g_name ); // name of character moPropIntRef monster ( g_monster ); // is this character a monster or pc? (bool value) moPropIntRef status ( g_status ); // normal, delayed or readied action (Character::Status) moPropIntRef maxHP ( g_maxHP ); // Maximum hitpoints the character has moPropIntRef damage ( g_damage ); // Current damage moPropIntRef stabilized ( g_stabilized ); // Applies to dying character moPropIntRef justdropped ( g_justdropped ); // True if character just dropped this round moPropIntRef init ( g_init ); // init modifier moPropIntRef spot ( g_spot ); // spot modifier moPropIntRef listen ( g_listen ); // listen modifier moPropIntRef will ( g_will ); // will modifier moPropIntRef position ( g_position ); // the initiative position moPropIntRef initRoll ( g_initRoll ); // the actual rolls moPropIntRef spotRoll ( g_spotRoll ); moPropIntRef listenRoll ( g_listenRoll ); moPropIntRef willRoll ( g_willRoll ); name .Link( propBag ); monster .Link( propBag ); status .Link( propBag ); maxHP .Link( propBag ); damage .Link( propBag ); stabilized .Link( propBag ); justdropped .Link( propBag ); init .Link( propBag ); spot .Link( propBag ); listen .Link( propBag ); will .Link( propBag ); position .Link( propBag ); initRoll .Link( propBag ); spotRoll .Link( propBag ); listenRoll .Link( propBag ); willRoll .Link( propBag ); if( name.HasProp() ) f_name = static_cast<moWCString>(name).c_str(); if( status.HasProp() ) f_status = static_cast<InternalStatus>( static_cast<int>(status) ); if( monster.HasProp() ) f_monster = monster? true: false; if( maxHP.HasProp() ) f_maxHP = maxHP; if( damage.HasProp() ) f_damage = damage; if( stabilized.HasProp() ) f_stabilized = stabilized? true: false; if( justdropped.HasProp() ) f_justdropped = justdropped? true: false; if( init.HasProp() ) f_init = init; if( spot.HasProp() ) f_spot = spot; if( listen.HasProp() ) f_listen = listen; if( will.HasProp() ) f_will = will; if( position.HasProp() ) f_position = position; if( initRoll.HasProp() ) f_initRoll = initRoll; if( spotRoll.HasProp() ) f_spotRoll = spotRoll; if( listenRoll.HasProp() ) f_listenRoll = listenRoll; if( willRoll.HasProp() ) f_willRoll = willRoll; }
void game::wishmonster( const tripoint &p ) { std::vector<const mtype*> mtypes; uimenu wmenu; wmenu.w_x = 0; wmenu.w_width = TERMX; // disabled due to foldstring crash //( TERMX - getmaxx(w_terrain) - 30 > 24 ? getmaxx(w_terrain) : TERMX ); wmenu.pad_right = ( wmenu.w_width - 30 ); wmenu.return_invalid = true; wmenu.selected = uistate.wishmonster_selected; wish_monster_callback *cb = new wish_monster_callback( mtypes ); wmenu.callback = cb; int i = 0; for( const auto &montype : MonsterGenerator::generator().get_all_mtypes() ) { wmenu.addentry( i, true, 0, "%s", montype->nname().c_str() ); wmenu.entries[i].extratxt.txt = montype->sym; wmenu.entries[i].extratxt.color = montype->color; wmenu.entries[i].extratxt.left = 1; ++i; mtypes.push_back( montype ); } do { wmenu.query(); if ( wmenu.ret >= 0 ) { monster mon = monster( mtypes[ wmenu.ret ]->id ); if (cb->friendly) { mon.friendly = -1; } if (cb->hallucination) { mon.hallucination = true; } tripoint spawn = ( p == tripoint_min ? look_around() : p ); if( spawn != tripoint_min ) { std::vector<tripoint> spawn_points = closest_tripoints_first( cb->group, spawn ); for( auto spawn_point : spawn_points ) { mon.spawn( spawn_point ); add_zombie(mon, true); } cb->msg = _("Monster spawned, choose another or 'q' to quit."); uistate.wishmonster_selected = wmenu.ret; wmenu.redraw(); } } } while ( wmenu.keypress != 'q' && wmenu.keypress != KEY_ESCAPE && wmenu.keypress != ' ' ); delete cb; cb = NULL; return; }
int main() { SortedVector<Monster, LessPolicy> v; Monster monster(1, "gobline"); Monster monster2(0, "slime"); Monster monster3(45, "satern"); v.push_back(monster); v.push_back(monster2); v.push_back(monster3); v.disp(); }
void game::wishmonster(int x, int y) { const std::map<std::string, mtype *> montypes = MonsterGenerator::generator().get_all_mtypes(); uimenu wmenu; wmenu.w_x = 0; wmenu.w_width = TERMX; // disabled due to foldstring crash //( TERMX - getmaxx(w_terrain) - 30 > 24 ? getmaxx(w_terrain) : TERMX ); wmenu.pad_right = ( wmenu.w_width - 30 ); wmenu.return_invalid = true; wmenu.selected = uistate.wishmonster_selected; wish_monster_callback *cb = new wish_monster_callback(); wmenu.callback = cb; int i = 0; for (std::map<std::string, mtype *>::const_iterator mon = montypes.begin(); mon != montypes.end(); ++mon) { wmenu.addentry( i, true, 0, "%s", mon->second->nname().c_str() ); wmenu.entries[i].extratxt.txt = mon->second->sym; wmenu.entries[i].extratxt.color = mon->second->color; wmenu.entries[i].extratxt.left = 1; ++i; } do { wmenu.query(); if ( wmenu.ret >= 0 ) { monster mon = monster(GetMType(wmenu.ret)); if (cb->friendly) { mon.friendly = -1; } point spawn = ( x == -1 && y == -1 ? look_around() : point ( x, y ) ); if (spawn.x != -1) { std::vector<point> spawn_points = closest_points_first( cb->group, spawn ); for( auto spawn_point : spawn_points ) { mon.spawn(spawn_point.x, spawn_point.y); add_zombie(mon); } cb->msg = _("Monster spawned, choose another or 'q' to quit."); uistate.wishmonster_selected = wmenu.ret; wmenu.redraw(); } } } while ( wmenu.keypress != 'q' && wmenu.keypress != KEY_ESCAPE && wmenu.keypress != ' ' ); delete cb; cb = NULL; return; }
// private set ups void Animation::setupEnter(){ Point* p1 = new Point(-9.75, -5.0); Point* p2 = new Point(-9.25, -5.0); Point* p3 = new Point(-8.75, -5.0); Point* p4 = new Point(-8.25, -5.0); Point* p5 = new Point(-7.75, -5.0); Point* p6 = new Point(-7.25, -5.0); Point* p7 = new Point(-6.75, -5.0); Point* p8 = new Point(-6.25, -5.0); Point* p9 = new Point(-5.75, -5.0); Point* p10 = new Point(-5.25, -5.0); Point* p11 = new Point(-4.75, -5.0); Point* p12 = new Point(-4.25, -5.0); Point* p13 = new Point(-3.75, -5.0); Point* p14 = new Point(-3.25, -5.0); Point* p15 = new Point(-2.75, -5.0); Point* p16 = new Point(-2.25, -5.0); Point* p17 = new Point(-1.75, -5.0); Point* p18 = new Point(-1.25, -5.0); Rectangle1 nostep(5.0, 5.0, Point(-10.75, -5.0), "data/character/nostep",UserManager::getProfile().getColor()); Rectangle1 step(5.0, 5.0, Point(-10.25, -5.0), "data/character/step",UserManager::getProfile().getColor()); Rectangle1 draw1(5.0, 5.0, Point(-1.25, -5.0), "data/character/draw1",UserManager::getProfile().getColor()); Rectangle1 draw2(5.0, 5.0, Point(-1.25, -5.0), "data/character/draw2",UserManager::getProfile().getColor()); Rectangle1 draw3(5.0, 5.0, Point(-1.25, -5.0), "data/character/draw3",UserManager::getProfile().getColor()); Rectangle1 defense(5.0, 5.0, Point(-1.25, -5.0), "data/character/defensivestance",UserManager::getProfile().getColor()); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p1); step.setPoint(p2); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p3); step.setPoint(p4); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p5); step.setPoint(p6); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p7); step.setPoint(p8); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p9); step.setPoint(p10); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p11); step.setPoint(p12); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p13); step.setPoint(p14); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p15); step.setPoint(p16); enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p17); step.setPoint(p18); enter.push_back(nostep); enter.push_back(step); enter.push_back(draw1); enter.push_back(draw2); enter.push_back(draw3); enter.push_back(defense); Rectangle1 monster(5.0, 5.0, Point(10.5, -6), "data/monster/" + mon); enemyEnter.push_back(monster); Point* point = new Point(10.0, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(9.5, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(9.0, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(8.5, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(8.0, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(7.5, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(7.0, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(6.5, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(6.0, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(5.5, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(4.0, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(3.5, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(3.0, -6); monster.setPoint(point); enemyEnter.push_back(monster); point = new Point(2.5, -6); monster.setPoint(point); enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); }
void CSystemTestDlg::OnBnClickedLocateMonster() { TCHAR buff[MAX_PATH] = {0}; if(pScreen) { CCgxMonster monster(pScreen); int alive = monster.countAlive(); swprintf(buff, sizeof(TCHAR)* MAX_PATH, TEXT("Found number of monster is: %d"), alive); _out(buff); for(int i = 0; i < NUMBER_OF_MONSTER; ++i) { if(monster.isAlive(i)) { swprintf(buff, sizeof(TCHAR)*MAX_PATH, TEXT("Alive index: %d"), i); _out(buff); CHWNDScreen::flashRECT(&monster.monsterRECTs[i]); } } } }
// Verify that the named monster has the expected effective speed, which is greatly reduced // due to wasted motion from shambling. // This is an assertion that an average (i.e. no fleet) survivor with no encumbrance // will be able to out-walk (not run, walk) the given monster // if their speed is higher than the monster's speed stat. void check_shamble_speed( const std::string monster_type, const tripoint &destination ) { // Scale the scaling factor based on the ratio of diagonal to cardinal steps. const float slope = (destination.x < destination.y) ? (destination.x / destination.y) : (destination.y / destination.x); const float diagonal_multiplier = 1.0 + (OPTIONS["CIRCLEDIST"] ? (slope * 0.41) : 0.0); const float mon_speed = (float)monster( mtype_id( monster_type ) ).get_speed(); INFO( monster_type << " " << destination ); // Wandering makes things nondeterministic, so look at the distribution rather than a target number. statistics move_stats; for( int i = 0; i < 10; ++i ) { move_stats.add( turns_to_destination( monster_type, {0, 0, 0}, destination ) ); if( ((move_stats.avg() * mon_speed) / (10000.0 * diagonal_multiplier)) == Approx(1.0).epsilon(0.04) ) { break; } } CHECK( ((move_stats.avg() * mon_speed) / (10000.0 * diagonal_multiplier)) == Approx(1.0).epsilon(0.04) ); }
void game::monster_wish() { WINDOW* w_list = newwin(25, 30, 0, 0); WINDOW* w_info = newwin(25, 50, 0, 30); int a = 0, shift = 1, result_selected = 0; int ch = '.'; bool search = false, friendly = false; std::string pattern; std::string info; std::vector<int> search_results; monster tmp; do { werase(w_info); werase(w_list); mvwprintw(w_list, 0, 0, _("Spawn a: ")); if (search) { if (ch == '\n') { search = false; ch = '.'; } else if (ch == KEY_BACKSPACE || ch == 127) { if (pattern.length() > 0) pattern.erase(pattern.end() - 1); } else if (ch == '>' || ch == KEY_NPAGE) { search = false; if (!search_results.empty()) { result_selected++; if (result_selected > search_results.size()) result_selected = 0; shift = search_results[result_selected]; a = 0; if (shift + 23 > mtypes.size()) { a = shift + 23 - mtypes.size(); shift = mtypes.size() - 23; } } } else if (ch == '<' || ch == KEY_PPAGE) { search = false; if (!search_results.empty()) { result_selected--; if (result_selected < 0) result_selected = search_results.size() - 1; shift = search_results[result_selected]; a = 0; if (shift + 23 > mtypes.size()) { a = shift + 23 - mtypes.size(); shift = mtypes.size() - 23; } } } else { pattern += ch; search_results.clear(); } if (search) { for (int i = 1; i < mtypes.size(); i++) { if (mtypes[i]->name.find(pattern) != std::string::npos) { shift = i; a = 0; result_selected = 0; if (shift + 23 > mtypes.size()) { a = shift + 23 - mtypes.size(); shift = mtypes.size() - 23; } search_results.push_back(i); } } } } else { // Not searching; scroll by keys if (ch == 'j') a++; if (ch == 'k') a--; if (ch == 'f') friendly = !friendly; if (ch == '/') { search = true; pattern = ""; search_results.clear(); } if (( ch == '>' || ch == KEY_NPAGE ) && !search_results.empty()) { result_selected++; if (result_selected > search_results.size()) result_selected = 0; shift = search_results[result_selected]; a = 0; if (shift + 23 > mtypes.size()) { a = shift + 23 - mtypes.size(); shift = mtypes.size() - 23; } } else if (( ch == '<' || ch == KEY_PPAGE ) && !search_results.empty()) { result_selected--; if (result_selected < 0) result_selected = search_results.size() - 1; shift = search_results[result_selected]; a = 0; if (shift + 23 > mtypes.size()) { a = shift + 23 - mtypes.size(); shift = mtypes.size() - 23; } } } if (!search_results.empty()) mvwprintz(w_list, 0, 11, c_green, "%s ", pattern.c_str()); else if (pattern.length() > 0) mvwprintz(w_list, 0, 11, c_red, _("%s not found! "),pattern.c_str()); if (a < 0) { a = 0; shift--; if (shift < 1) shift = 1; } if (a > 22) { a = 22; shift++; if (shift + 23 > mtypes.size()) shift = mtypes.size() - 23; } for (int i = 1; i < 24; i++) { nc_color col = c_white; if (i == a + 1) col = h_white; mvwprintz(w_list, i, 0, col, mtypes[i-1+shift]->name.c_str()); wprintz(w_list, mtypes[i-1+shift]->color, " %c%", mtypes[i-1+shift]->sym); } tmp = monster(mtypes[a + shift]); if (friendly) tmp.friendly = -1; tmp.print_info(this, w_info); wrefresh(w_info); wrefresh(w_list); if (search) ch = getch(); else ch = input(); } while (ch != '\n'); clear(); delwin(w_info); delwin(w_list); refresh_all(); wrefresh(w_terrain); point spawn = look_around(); if (spawn.x == -1) return; tmp.spawn(spawn.x, spawn.y); z.push_back(tmp); }