• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetMType函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetMType函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMType函数的具体用法?C++ GetMType怎么用?C++ GetMType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetMType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: if

bool monster::make_fungus()
{
    char polypick = 0;
    std::string tid = type->id;
    if (tid == "mon_ant" || tid == "mon_ant_soldier" || tid == "mon_ant_queen" || tid == "mon_fly" || tid == "mon_bee" || tid == "mon_dermatik")
    {
        polypick = 1;
    }else if (tid == "mon_zombie" || tid == "mon_zombie_shrieker" || tid == "mon_zombie_electric" || tid == "mon_zombie_spitter" || tid == "mon_zombie_dog" ||
              tid == "mon_zombie_brute" || tid == "mon_zombie_hulk"){
        polypick = 2;
    }else if (tid == "mon_boomer" || tid == "mon_zombie_gasbag"){
        polypick = 3;
    }else if (tid == "mon_triffid" || tid == "mon_triffid_young" || tid == "mon_triffid_queen"){
        polypick = 4;
    }
    switch (polypick) {
        case 1: // bugs, why do they all turn into fungal ants?
            poly(GetMType("mon_ant_fungus"));
            return true;
        case 2: // zombies, non-boomer
            poly(GetMType("mon_zombie_fungus"));
            return true;
        case 3:
            poly(GetMType("mon_boomer_fungus"));
            return true;
        case 4:
            poly(GetMType("mon_fungaloid"));
            return true;
        default:
            return true;
    }
}
开发者ID:SlewedQuasar890,项目名称:Cataclysm-DDA,代码行数:32,代码来源:monster.cpp


示例2: select

        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.
        }
开发者ID:8Z,项目名称:Cataclysm-DDA,代码行数:27,代码来源:wish.cpp


示例3: select

        virtual void select(int entnum, uimenu *menu) override
        {
            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());
            if( hallucination ) {
                wprintw( w_info, _( " (hallucination)" ) );
            }

            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"));
        }
开发者ID:Camkitsune,项目名称:Cataclysm-DDA,代码行数:29,代码来源:wish.cpp


示例4: if

bool monster::make_fungus()
{
    if( is_hallucination() ) {
        return true;
    }
    char polypick = 0;
    std::string tid = type->id;
    if (type->in_species("FUNGUS")) { // No friendly-fungalizing ;-)
        return true;
    }
    if (tid == "mon_ant" || tid == "mon_ant_soldier" || tid == "mon_ant_queen" || tid == "mon_fly" ||
      tid == "mon_bee" || tid == "mon_dermatik") {
        polypick = 1;
    } else if (tid == "mon_zombie" || tid == "mon_zombie_shrieker" || tid == "mon_zombie_electric" ||
      tid == "mon_zombie_spitter" || tid == "mon_zombie_dog" || tid == "mon_zombie_brute" ||
      tid == "mon_zombie_hulk" || tid == "mon_zombie_soldier" || tid == "mon_zombie_tough" ||
      tid == "mon_zombie_scientist" || tid == "mon_zombie_hunter" || tid == "mon_zombie_child"||
      tid == "mon_zombie_bio_op" || tid == "mon_zombie_survivor" || tid == "mon_zombie_fireman" ||
      tid == "mon_zombie_cop" || tid == "mon_zombie_fat" || tid == "mon_zombie_rot" ||
      tid == "mon_zombie_swimmer" || tid == "mon_zombie_grabber" || tid == "mon_zombie_technician" ||
      tid == "mon_zombie_brute_shocker") {
        polypick = 2; // Necro and Master have enough Goo to resist conversion.
        // Firefighter, hazmat, and scarred/beekeeper have the PPG on.
    } else if (tid == "mon_zombie_necro" || tid == "mon_zombie_master" || tid == "mon_zombie_fireman" ||
      tid == "mon_zombie_hazmat" || tid == "mon_beekeeper") {
        return true;
    } else if (tid == "mon_boomer" || tid == "mon_zombie_gasbag" || tid == "mon_zombie_smoker") {
        polypick = 3;
    } else if (tid == "mon_triffid" || tid == "mon_triffid_young" || tid == "mon_triffid_queen") {
        polypick = 4;
    }
    switch (polypick) {
        case 1: // bugs, why do they all turn into fungal ants?
            poly(GetMType("mon_ant_fungus"));
            return true;
        case 2: // zombies, non-boomer
            poly(GetMType("mon_zombie_fungus"));
            return true;
        case 3:
            poly(GetMType("mon_boomer_fungus"));
            return true;
        case 4:
            poly(GetMType("mon_fungaloid"));
            return true;
        default:
            return false;
    }
}
开发者ID:reverieAlice,项目名称:Cataclysm-DDA,代码行数:48,代码来源:monster.cpp


示例5: GetMType

item Single_item_creator::create_single(int birthday, RecursionList &rec) const
{
    item tmp;
    if (type == S_ITEM) {
        if (id == "corpse") {
            tmp.make_corpse("corpse", GetMType("mon_null"), birthday);
        } else {
            tmp = item(id, birthday);
        }
    } else if (type == S_ITEM_GROUP) {
        if (std::find(rec.begin(), rec.end(), id) != rec.end()) {
            debugmsg("recursion in item spawn list %s", id.c_str());
            return item(null_item_id, birthday);
        }
        rec.push_back(id);
        Item_spawn_data *isd = item_controller->get_group(id);
        if (isd == NULL) {
            debugmsg("unknown item spawn list %s", id.c_str());
            return item(null_item_id, birthday);
        }
        tmp = isd->create_single(birthday, rec);
    } else if (type == S_NONE) {
        return item(null_item_id, birthday);
    }
    if (modifier.get() != NULL) {
        modifier->modify(tmp);
    }
    // TODO: change the spawn lists to contain proper references to containers
    tmp = tmp.in_its_container();
    return tmp;
}
开发者ID:3721assistant,项目名称:Cataclysm-DDA,代码行数:31,代码来源:item_group.cpp


示例6: pgettext

void trapfunc::shadow(int x, int y)
{
 g->u.add_memorial_log(pgettext("memorial_male", "Triggered a shadow trap."),
                       pgettext("memorial_female", "Triggered a shadow trap."));
 monster spawned(GetMType("mon_shadow"));
 int tries = 0, monx, mony, junk;
 do {
  if (one_in(2)) {
   monx = rng(g->u.posx - 5, g->u.posx + 5);
   mony = (one_in(2) ? g->u.posy - 5 : g->u.posy + 5);
  } else {
   monx = (one_in(2) ? g->u.posx - 5 : g->u.posx + 5);
   mony = rng(g->u.posy - 5, g->u.posy + 5);
  }
 } while (tries < 5 && !g->is_empty(monx, mony) &&
          !g->m.sees(monx, mony, g->u.posx, g->u.posy, 10, junk));

 if (tries < 5) {
  g->add_msg(_("A shadow forms nearby."));
  spawned.sp_timeout = rng(2, 10);
  spawned.spawn(monx, mony);
  g->add_zombie(spawned);
  g->m.remove_trap(x, y);
 }
}
开发者ID:noppa354,项目名称:Cataclysm-DDA,代码行数:25,代码来源:trapfunc.cpp


示例7: spawned

void trapfunc::snake(int x, int y)
{
 g->u.add_memorial_log(_("Triggered a shadow snake trap."));
 if (one_in(3)) {
  monster spawned(GetMType("mon_shadow_snake"));
  int tries = 0, monx, mony, junk;
  do {
   if (one_in(2)) {
    monx = rng(g->u.posx - 5, g->u.posx + 5);
    mony = (one_in(2) ? g->u.posy - 5 : g->u.posy + 5);
   } else {
    monx = (one_in(2) ? g->u.posx - 5 : g->u.posx + 5);
    mony = rng(g->u.posy - 5, g->u.posy + 5);
   }
  } while (tries < 5 && !g->is_empty(monx, mony) &&
           !g->m.sees(monx, mony, g->u.posx, g->u.posy, 10, junk));

  if (tries < 5) {
   g->add_msg(_("A shadowy snake forms nearby."));
   spawned.spawn(monx, mony);
   g->add_zombie(spawned);
   g->m.remove_trap(x, y);
   return;
  }
 }
 //~ the sound a snake makes
 g->sound(x, y, 10, _("ssssssss"));
 if (one_in(6))
  g->m.remove_trap(x, y);
}
开发者ID:Deadjack,项目名称:Cataclysm-DDA,代码行数:30,代码来源:trapfunc.cpp


示例8: while

void mdeath::worm(monster *z) {
    if (g->u_see(z))
        g->add_msg(_("The %s splits in two!"), z->name().c_str());

    std::vector <point> wormspots;
    int wormx, wormy;
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            wormx = z->posx() + i;
            wormy = z->posy() + j;
            if (g->m.has_flag("DIGGABLE", wormx, wormy) &&
                    !(g->u.posx == wormx && g->u.posy == wormy)) {
                wormspots.push_back(point(wormx, wormy));
            }
        }
    }
    int worms = 0;
    while(worms < 2 && wormspots.size() > 0) {
        monster worm(GetMType("mon_halfworm"));
        int rn = rng(0, wormspots.size() - 1);
        if(-1 == g->mon_at(wormspots[rn])) {
            worm.spawn(wormspots[rn].x, wormspots[rn].y);
            g->add_zombie(worm);
            worms++;
        }
        wormspots.erase(wormspots.begin() + rn);
    }
}
开发者ID:9600bauds,项目名称:Cataclysm-DDA,代码行数:28,代码来源:mondeath.cpp


示例9: add_msg

void mdeath::ratking(monster *z)
{
    g->u.rem_disease("rat");
    if (g->u_see(z)) {
        add_msg(m_warning, _("Rats suddenly swarm into view."));
    }

    std::vector <point> ratspots;
    int ratx, raty;
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            ratx = z->posx() + i;
            raty = z->posy() + i;
            if (g->m.move_cost(ratx, raty) > 0 && g->mon_at(ratx, raty) == -1 &&
                !(g->u.posx == ratx && g->u.posy == raty)) {
                ratspots.push_back(point(ratx, raty));
            }
        }
    }
    int rn;
    monster rat(GetMType("mon_sewer_rat"));
    for (int rats = 0; rats < 7 && !ratspots.empty(); rats++) {
        rn = rng(0, ratspots.size() - 1);
        rat.spawn(ratspots[rn].x, ratspots[rn].y);
        g->add_zombie(rat);
        ratspots.erase(ratspots.begin() + rn);
    }
}
开发者ID:Waladil,项目名称:Cataclysm-DDA,代码行数:28,代码来源:mondeath.cpp


示例10: add_msg

void mdeath::ratking(monster *z)
{
    g->u.remove_effect("rat");
    if (g->u_see(z)) {
        add_msg(m_warning, _("Rats suddenly swarm into view."));
    }

    std::vector <point> ratspots;
    int ratx, raty;
    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            ratx = z->posx() + i;
            raty = z->posy() + j;
            if (g->is_empty(ratx, raty)) {
                ratspots.push_back(point(ratx, raty));
            }
        }
    }
    monster rat(GetMType("mon_sewer_rat"));
    for (int rats = 0; rats < 7 && !ratspots.empty(); rats++) {
        int rn = rng(0, ratspots.size() - 1);
        point rp = ratspots[rn];
        ratspots.erase(ratspots.begin() + rn);
        rat.spawn(rp.x, rp.y);
        g->add_zombie(rat);
    }
}
开发者ID:EkarusRyndren,项目名称:Cataclysm-DDA,代码行数:27,代码来源:mondeath.cpp


示例11: new_monster

/** Create a new monster of the given type. */
monster *create_monster(std::string mon_type, int x, int y) {
    monster new_monster(GetMType(mon_type), x, y);
    if(!g->add_zombie(new_monster)) {
        return NULL;
    } else {
        return &(g->zombie(g->mon_at(x, y)));
    }
}
开发者ID:Chase-san,项目名称:Cataclysm-DDA,代码行数:9,代码来源:catalua.cpp


示例12: game_monster_type

// mtype = game.monster_type(name)
static int game_monster_type(lua_State *L) {
    const char* parameter1 = (const char*) lua_tostring(L, 1);

    mtype** monster_type = (mtype**) lua_newuserdata(L, sizeof(mtype*));
    *monster_type = GetMType(parameter1);
    luah_setmetatable(L, "mtype_metatable");

    return 1; // 1 return values

}
开发者ID:Devanon,项目名称:Cataclysm-DDA,代码行数:11,代码来源:catalua.cpp


示例13: one_in

void defense_game::spawn_wave(game *g)
{
 g->add_msg("********");
 int diff = initial_difficulty + current_wave * wave_difficulty;
 bool themed_wave = one_in(SPECIAL_WAVE_CHANCE); // All a single monster type
 g->u.cash += cash_per_wave + (current_wave - 1) * cash_increase;
 std::vector<std::string> valid;
 valid = pick_monster_wave(g);
 while (diff > 0) {
// Clear out any monsters that exceed our remaining difficulty
  for (int i = 0; i < valid.size(); i++) {
   if (GetMType(valid[i])->difficulty > diff) {
    valid.erase(valid.begin() + i);
    i--;
   }
  }
  if (valid.empty()) {
   g->add_msg(_("Welcome to Wave %d!"), current_wave);
   g->add_msg("********");
   return;
  }
  int rn = rng(0, valid.size() - 1);
  mtype *type = GetMType(valid[rn]);
  if (themed_wave) {
   int num = diff / type->difficulty;
   if (num >= SPECIAL_WAVE_MIN) {
// TODO: Do we want a special message here?
    for (int i = 0; i < num; i++)
     spawn_wave_monster(g, type);
    g->add_msg( special_wave_message(type->name).c_str() );
    g->add_msg("********");
    return;
   } else
    themed_wave = false; // No partially-themed waves
  }
  diff -= type->difficulty;
  spawn_wave_monster(g, type);
 }
 g->add_msg(_("Welcome to Wave %d!"), current_wave);
 g->add_msg("********");
}
开发者ID:8Z,项目名称:Cataclysm-DDA,代码行数:41,代码来源:defense.cpp


示例14: goo

void trapfuncm::goo(monster *z, int x, int y)
{
 if (z->type->id == "mon_blob") {
  z->speed += 15;
  z->hp = z->speed;
 } else {
  z->poly(GetMType("mon_blob"));
  z->speed -= 15;
  z->hp = z->speed;
 }
 g->m.remove_trap(x, y);
}
开发者ID:Deadjack,项目名称:Cataclysm-DDA,代码行数:12,代码来源:trapfunc.cpp


示例15: jackson

void mdeath::jackson(monster *z) {
    for( size_t i = 0; i < g->num_zombies(); i++ ) {
        monster *candidate = &g->zombie( i );
        if(candidate->type->id == "mon_zombie_dancer" ) {
            candidate->poly(GetMType("mon_zombie_hulk"));
            candidate->remove_effect("controlled");
        }
        if (g->u_see(z->posx(), z->posy())) {
            add_msg(m_warning, _("The music stops!"));
        }
    }
}
开发者ID:EkarusRyndren,项目名称:Cataclysm-DDA,代码行数:12,代码来源:mondeath.cpp


示例16: if

bool monster::make_fungus()
{
    char polypick = 0;
    std::string tid = type->id;
    if (type->in_species("FUNGUS")) { // No friendly-fungalizing ;-)
        return true;
    }
    if (tid == "mon_ant" || tid == "mon_ant_soldier" || tid == "mon_ant_queen" || tid == "mon_fly" ||
      tid == "mon_bee" || tid == "mon_dermatik") {
        polypick = 1;
    } else if (tid == "mon_zombie" || tid == "mon_zombie_shrieker" || tid == "mon_zombie_electric" ||
      tid == "mon_zombie_spitter" || tid == "mon_zombie_dog" || tid == "mon_zombie_brute" ||
      tid == "mon_zombie_hulk" || tid == "mon_zombie_soldier" || tid == "mon_zombie_tough" ||
      tid == "mon_zombie_scientist" || tid == "mon_zombie_hunter" || tid == "mon_zombie_child"||
      tid == "mon_zombie_bio_op" || tid == "mon_zombie_survivor" || tid == "mon_zombie_fireman" ||
      tid == "mon_zombie_cop" || tid == "mon_zombie_fat") {
        polypick = 2;
    } else if (tid == "mon_boomer" || tid == "mon_zombie_gasbag") {
        polypick = 3;
    } else if (tid == "mon_triffid" || tid == "mon_triffid_young" || tid == "mon_triffid_queen") {
        polypick = 4;
    }
    switch (polypick) {
        case 1: // bugs, why do they all turn into fungal ants?
            poly(GetMType("mon_ant_fungus"));
            return true;
        case 2: // zombies, non-boomer
            poly(GetMType("mon_zombie_fungus"));
            return true;
        case 3:
            poly(GetMType("mon_boomer_fungus"));
            return true;
        case 4:
            poly(GetMType("mon_fungaloid"));
            return true;
        default:
            return false;
    }
}
开发者ID:3721assistant,项目名称:Cataclysm-DDA,代码行数:39,代码来源:monster.cpp


示例17: wish_monster_callback

void game::wishmonster( const tripoint &p )
{
    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( const auto &montype : montypes ) {
        wmenu.addentry( i, true, 0, "%s", montype.second->nname().c_str() );
        wmenu.entries[i].extratxt.txt = montype.second->sym;
        wmenu.entries[i].extratxt.color = montype.second->color;
        wmenu.entries[i].extratxt.left = 1;
        ++i;
    }

    do {
        wmenu.query();
        if ( wmenu.ret >= 0 ) {
            monster mon = monster(GetMType(wmenu.ret));
            mon.reset_last_load();
            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);
                }
                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;
}
开发者ID:Acherontius,项目名称:Cataclysm-DDA,代码行数:51,代码来源:wish.cpp


示例18: select

        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);

            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"));
        }
开发者ID:CptJean-Luc,项目名称:Cataclysm-DDA,代码行数:24,代码来源:wish.cpp


示例19: wish_monster_callback

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->name.c_str() );
        wmenu.entries[i].extratxt.txt = string_format("%c", 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) {
                mon.spawn(spawn.x, spawn.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;
}
开发者ID:CptJean-Luc,项目名称:Cataclysm-DDA,代码行数:45,代码来源:wish.cpp


示例20: rng

void mdeath::blobsplit(monster *z)
{
    int speed = z->speed - rng(30, 50);
    g->m.spawn_item(z->posx(), z->posy(), "slime_scrap", 1, 0, calendar::turn, rng(1, 4));
    if (speed <= 0) {
        if (g->u_see(z)) {
            //  TODO:  Add vermin-tagged tiny versions of the splattered blob  :)
            add_msg(m_good, _("The %s splatters apart."), z->name().c_str());
        }
        return;
    }
    monster blob(GetMType((speed < 50 ? "mon_blob_small" : "mon_blob")));
    blob.speed = speed;
    // If we're tame, our kids are too
    blob.friendly = z->friendly;
    if (g->u_see(z)) {
        if(z->type->dies.size() == 1) {
            add_msg(m_good, _("The %s splits in two!"), z->name().c_str());
        } else {
            add_msg(m_bad, _("Two small blobs slither out of the corpse."), z->name().c_str());
        }
    }
    blob.hp = blob.speed;
    std::vector <point> valid;

    for (int i = -1; i <= 1; i++) {
        for (int j = -1; j <= 1; j++) {
            bool moveOK = (g->m.move_cost(z->posx() + i, z->posy() + j) > 0);
            bool monOK = g->mon_at(z->posx() + i, z->posy() + j) == -1;
            bool posOK = (g->u.posx != z->posx() + i || g->u.posy != z->posy() + j);
            if (moveOK && monOK && posOK) {
                valid.push_back(point(z->posx() + i, z->posy() + j));
            }
        }
    }

    int rn;
    for (int s = 0; s < 2 && !valid.empty(); s++) {
        rn = rng(0, valid.size() - 1);
        blob.spawn(valid[rn].x, valid[rn].y);
        g->add_zombie(blob);
        valid.erase(valid.begin() + rn);
    }
}
开发者ID:Waladil,项目名称:Cataclysm-DDA,代码行数:44,代码来源:mondeath.cpp



注:本文中的GetMType函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetMailTemplateId函数代码示例发布时间:2022-05-30
下一篇:
C++ GetMSTimeDiffToNow函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap