当前位置: 首页>>代码示例>>C++>>正文


C++ GetMType函数代码示例

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


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


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