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


C++ Object::AddMOB方法代码示例

本文整理汇总了C++中Object::AddMOB方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::AddMOB方法的具体用法?C++ Object::AddMOB怎么用?C++ Object::AddMOB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Object的用法示例。


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

示例1: MOBType


//.........这里部分代码省略.........
  // Up and Down shafts are handled specially.

  switch (Skill("DynamicPhase")) {
    case (0): { // Entrance
      if (mojo == 0)
        mojo = 100000;

      Object* next = new Object(parent);
      next->SetShortDesc(names[1]);
      next->SetDesc(descs[1]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", 1); // Major Shaft
      next->SetSkill("DynamicMojo", mojo - 1000);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a solid passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a solid passage leading ") + dirb + ".\n").c_str());
      door1->AddAct(ACT_SPECIAL_LINKED, door2);
      door1->AddAct(ACT_SPECIAL_MASTER, door2);
      door1->SetSkill("Open", 1000);
      door1->SetSkill("Enterable", 1);
      door2->AddAct(ACT_SPECIAL_LINKED, door1);
      door2->AddAct(ACT_SPECIAL_MASTER, door1);
      door2->SetSkill("Open", 1000);
      door2->SetSkill("Enterable", 1);

    } break;
    case (1): { // Major Shaft
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }

      if (mojo <= 0)
        break; // End of Tunnel

      int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      Object* next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", mojo - 1000);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a solid passage leading ") + dir + ".\n").c_str());
开发者ID:steaphangreene,项目名称:acidmud,代码行数:67,代码来源:object_dynamic.cpp


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