示例#1
0
Class::Class(const ClassType &t) :
_classType(t)
{
	if (__classType == ClassType.Wizard){
		_rock = Skill("Meteor", Skill::SkillType::Rock);
		_paper = Skill("Earthquake", Skill::SkillType::Paper);
		_scissors = Skill("Blizzard", Skill::SkillType::Scissors);
		_weapon = Weapon("Staff");
		_name = "Mage"
	}
示例#2
0
u16 Skill::Secondary::GetValues(void) const
{
    switch(Level())
    {
	case Level::BASIC:	return _skillvalues[Skill() - 1].values.basic;
	case Level::ADVANCED:	return _skillvalues[Skill() - 1].values.advanced;
	case Level::EXPERT:	return _skillvalues[Skill() - 1].values.expert;
	default: break;
    }
    return 0;
}
示例#3
0
void Object::DynamicInit() {
  switch (Skill("DynamicInit")) {
    case (2): { // Cyberpunk City
      DynamicInit2();
    } break;
    case (1): { // Dwarven Mine
      DynamicInit1();
    } break;
    default: {
      fprintf(stderr, "Unknown dynamic-type (%d) init requested!\n", Skill("DynamicInit"));
    } break;
  }
  SetSkill("DynamicInit", 0);
}
bool BotTacticalSpotsCache::FindMiddleRangeTacticalSpot( const Vec3 &origin, const Vec3 &enemyOrigin, vec3_t result ) {
	TacticalSpotsRegistry::AdvantageProblemParams problemParams( enemyOrigin.Data() );
	problemParams.SetMinSpotDistanceToEntity( WorldState::CLOSE_RANGE_MAX );
	problemParams.SetMaxSpotDistanceToEntity( WorldState::MIDDLE_RANGE_MAX );
	problemParams.SetOriginDistanceInfluence( 0.3f );
	problemParams.SetEntityDistanceInfluence( 0.4f );
	problemParams.SetEntityWeightFalloffDistanceRatio( 0.5f );
	problemParams.SetTravelTimeInfluence( 0.7f );
	problemParams.SetMinHeightAdvantageOverOrigin( -16.0f );
	problemParams.SetMinHeightAdvantageOverEntity( -64.0f );
	problemParams.SetHeightOverOriginInfluence( 0.6f );
	problemParams.SetHeightOverEntityInfluence( 0.8f );
	problemParams.SetCheckToAndBackReachability( false );

	float searchRadius = WorldState::MIDDLE_RANGE_MAX;
	float distanceToEnemy = ( origin - enemyOrigin ).LengthFast();
	if( distanceToEnemy < WorldState::CLOSE_RANGE_MAX ) {
		searchRadius += WorldState::CLOSE_RANGE_MAX;
	} else if( distanceToEnemy > WorldState::MIDDLE_RANGE_MAX ) {
		searchRadius += distanceToEnemy - WorldState::MIDDLE_RANGE_MAX;
	} else {
		searchRadius *= 1.0f + 0.5f * Skill();
	}

	return FindForOrigin( problemParams, origin, searchRadius, result );
}
bool BotTacticalSpotsCache::FindRunAwayJumppadOrigin( const Vec3 &origin, const Vec3 &enemyOrigin, vec3_t result[2] ) {
	ReachableEntities reachableEntities;
	FindReachableClassEntities( origin, 128.0f + 384.0f * Skill(), "trigger_push", reachableEntities );

	trace_t trace;
	const auto *pvsCache = EntitiesPvsCache::Instance();
	edict_t *enemyEnt = const_cast<edict_t *>( self->ai->botRef->selectedEnemies.Ent() );
	for( const auto &entAndScore: reachableEntities ) {
		edict_t *ent = game.edicts + entAndScore.entNum;
		if( !pvsCache->AreInPvs( enemyEnt, ent ) ) {
			continue;
		}

		G_Trace( &trace, enemyEnt->s.origin, nullptr, nullptr, ent->target_ent->s.origin, enemyEnt, MASK_AISOLID );
		if( trace.fraction == 1.0f || trace.ent > 0 ) {
			continue;
		}

		// Copy trigger origin
		VectorCopy( ent->s.origin, result[0] );
		// Copy trigger destination
		VectorCopy( ent->target_ent->s.origin, result[1] );
		return true;
	}

	return false;
}
bool BotTacticalSpotsCache::FindRunAwayElevatorOrigin( const Vec3 &origin, const Vec3 &enemyOrigin, vec3_t result[2] ) {
	ReachableEntities reachableEntities;
	FindReachableClassEntities( origin, 128.0f + 384.0f * Skill(), "func_plat", reachableEntities );

	trace_t trace;
	const auto *pvsCache = EntitiesPvsCache::Instance();
	edict_t *enemyEnt = const_cast<edict_t *>( self->ai->botRef->selectedEnemies.Ent() );
	edict_t *gameEdicts = game.edicts;
	for( const auto &entAndScore: reachableEntities ) {
		edict_t *ent = gameEdicts + entAndScore.entNum;
		// Can't run away via elevator if the elevator has been always activated
		if( ent->moveinfo.state != STATE_BOTTOM ) {
			continue;
		}

		if( !pvsCache->AreInPvs( enemyEnt, ent ) ) {
			continue;
		}

		G_Trace( &trace, enemyEnt->s.origin, nullptr, nullptr, ent->moveinfo.end_origin, enemyEnt, MASK_AISOLID );
		if( trace.fraction == 1.0f || trace.ent > 0 ) {
			continue;
		}

		// Copy trigger origin
		VectorCopy( ent->s.origin, result[0] );
		// Drop origin to the elevator bottom
		result[0][2] = ent->r.absmin[2] + 16;
		// Copy trigger destination
		VectorCopy( ent->moveinfo.end_origin, result[1] );
		return true;
	}

	return false;
}
示例#7
0
文件: bot.cpp 项目: DenMSC/qfusion
Bot::Bot(edict_t *self_, float skillLevel_)
    : Ai(self_, PREFERRED_TRAVEL_FLAGS, ALLOWED_TRAVEL_FLAGS),
      dangersDetector(self_),
      botBrain(self_, skillLevel_),
      skillLevel(skillLevel_),
      nextBlockedEscapeAttemptAt(0),
      blockedEscapeGoalOrigin(INFINITY, INFINITY, INFINITY),
      rocketJumpMovementState(self_),
      combatMovePushTimeout(0),
      vsayTimeout(level.time + 10000),
      isWaitingForItemSpawn(false),
      isInSquad(false),
      defenceSpotId(-1),
      offenseSpotId(-1),
      builtinFireTargetCache(self_),
      scriptFireTargetCache(self_)
{
    // Set the base brain reference in Ai class, it is mandatory
    this->aiBaseBrain = &botBrain;
    // Set the route cache reference in Ai class, it is mandatory
    // Use a separate instance of a route cache
    this->routeCache = AiAasRouteCache::NewInstance();
    self->r.client->movestyle = Skill() > 0.33f ? GS_NEWBUNNY : GS_CLASSICBUNNY;
    SetTag(self->r.client->netname);
}
bool BotTacticalSpotsCache::FindFarRangeTacticalSpot( const Vec3 &origin, const Vec3 &enemyOrigin, vec3_t result ) {
	TacticalSpotsRegistry::AdvantageProblemParams problemParams( enemyOrigin.Data() );
	problemParams.SetMinSpotDistanceToEntity( WorldState::MIDDLE_RANGE_MAX );
	problemParams.SetMaxSpotDistanceToEntity( WorldState::FAR_RANGE_MAX );
	problemParams.SetOriginDistanceInfluence( 0.0f );
	problemParams.SetEntityDistanceInfluence( 0.3f );
	problemParams.SetEntityWeightFalloffDistanceRatio( 0.25f );
	problemParams.SetTravelTimeInfluence( 0.8f );
	problemParams.SetMinHeightAdvantageOverOrigin( -192.0f );
	problemParams.SetMinHeightAdvantageOverEntity( -512.0f );
	problemParams.SetHeightOverOriginInfluence( 0.3f );
	problemParams.SetHeightOverEntityInfluence( 0.5f );
	problemParams.SetCheckToAndBackReachability( false );

	float searchRadius = 192.0f + 768.0f * Skill();
	float distanceToEnemy = ( origin - enemyOrigin ).LengthFast();
	float minSearchDistanceToEnemy = distanceToEnemy - searchRadius;
	float maxSearchDistanceToEnemy = distanceToEnemy + searchRadius;
	if( minSearchDistanceToEnemy < WorldState::MIDDLE_RANGE_MAX ) {
		searchRadius += WorldState::MIDDLE_RANGE_MAX - minSearchDistanceToEnemy;
	} else if( maxSearchDistanceToEnemy > WorldState::FAR_RANGE_MAX ) {
		searchRadius += maxSearchDistanceToEnemy - WorldState::FAR_RANGE_MAX;
	}

	return FindForOrigin( problemParams, origin, searchRadius, result );
}
示例#9
0
  Skillset random_skills(Security::Mask s) {
    // For now, ignore the clearance

    (void)s;
    Skillset r;
    for (uint c = 0; c < r.skills.size(); ++c) {
      r.get((Category)c) = Skill(rand() % 10);
    }
    return r;
  }
示例#10
0
bool BotTacticalSpotsCache::FindCoverSpot( const Vec3 &origin, const Vec3 &enemyOrigin, vec3_t result ) {
	const float searchRadius = 192.0f + 512.0f * Skill();
	TacticalSpotsRegistry::CoverProblemParams problemParams( enemyOrigin.Data(), 32.0f );
	problemParams.SetOriginDistanceInfluence( 0.0f );
	problemParams.SetTravelTimeInfluence( 0.9f );
	problemParams.SetMinHeightAdvantageOverOrigin( -searchRadius );
	problemParams.SetHeightOverOriginInfluence( 0.3f );
	problemParams.SetCheckToAndBackReachability( false );

	auto *tacticalSpotsRegistry = TacticalSpotsRegistry::Instance();
	if( BotHasAlmostSameOrigin( origin ) ) {
		TacticalSpotsRegistry::OriginParams originParams( self, searchRadius, RouteCache() );
		return tacticalSpotsRegistry->FindCoverSpots( originParams, problemParams, (vec3_t *)result, 1 ) != 0;
	}
	TacticalSpotsRegistry::OriginParams originParams( origin.Data(), searchRadius, RouteCache() );
	return tacticalSpotsRegistry->FindCoverSpots( originParams, problemParams, (vec3_t *)result, 1 ) != 0;
}
示例#11
0
bool BotTacticalSpotsCache::FindSniperRangeTacticalSpot( const Vec3 &origin, const Vec3 &enemyOrigin, vec3_t result ) {
	TacticalSpotsRegistry::AdvantageProblemParams problemParams( enemyOrigin.Data() );
	problemParams.SetMinSpotDistanceToEntity( WorldState::FAR_RANGE_MAX );
	problemParams.SetOriginDistanceInfluence( 0.0f );
	problemParams.SetTravelTimeInfluence( 0.8f );
	problemParams.SetMinHeightAdvantageOverOrigin( -1024.0f );
	problemParams.SetMinHeightAdvantageOverEntity( -1024.0f );
	problemParams.SetHeightOverOriginInfluence( 0.3f );
	problemParams.SetHeightOverEntityInfluence( 0.1f );
	problemParams.SetCheckToAndBackReachability( false );

	float searchRadius = 192.0f + 768.0f * Skill();
	float distanceToEnemy = ( origin - enemyOrigin ).LengthFast();
	// If bot is not on sniper range, increase search radius (otherwise a point in a sniper range can't be found).
	if( distanceToEnemy - searchRadius < WorldState::FAR_RANGE_MAX ) {
		searchRadius += WorldState::FAR_RANGE_MAX - distanceToEnemy + searchRadius;
	}

	return FindForOrigin( problemParams, origin, searchRadius, result );
}
示例#12
0
const char* Skill::Secondary::GetName(void) const
{
    const char* name_skill[] =
    {
        _("Basic Pathfinding"), _("Advanced Pathfinding"), _("Expert Pathfinding"),
        _("Basic Archery"), _("Advanced Archery"), _("Expert Archery"),
        _("Basic Logistics"), _("Advanced Logistics"), _("Expert Logistics"),
        _("Basic Scouting"), _("Advanced Scouting"), _("Expert Scouting"),
        _("Basic Diplomacy"), _("Advanced Diplomacy"), _("Expert Diplomacy"),
        _("Basic Navigation"),_("Advanced Navigation"), _("Expert Navigation"),
        _("Basic Leadership"), _("Advanced Leadership"), _("Expert Leadership"),
        _("Basic Wisdom"), _("Advanced Wisdom"), _("Expert Wisdom"),
        _("Basic Mysticism"), _("Advanced Mysticism"), _("Expert Mysticism"),
        _("Basic Luck"), _("Advanced Luck"), _("Expert Luck"),
        _("Basic Ballistics"), _("Advanced Ballistics"), _("Expert Ballistics"),
        _("Basic Eagle Eye"), _("Advanced Eagle Eye"), _("Expert Eagle Eye"),
        _("Basic Necromancy"), _("Advanced Necromancy"), _("Expert Necromancy"),
        _("Basic Estates"), _("Advanced Estates"), _("Expert Estates")
    };

    return isValid() ? name_skill[(Level() - 1) + (Skill() - 1) * 3] : "unknown";
}
示例#13
0
void Mob::setSkills(std::vector<std::pair<int, short int> > &skillList)
{
	std::for_each(skillList.begin(), skillList.end(), [&](std::pair<int, short int> p) {
		skills.push_back(std::pair<Skill, int>(Skill(p.first, Peasant, 100), p.second));
	});
}
示例#14
0
文件: bot.cpp 项目: DenMSC/qfusion
void Bot::RegisterVisibleEnemies()
{
    if(G_ISGHOSTING(self) || GS_MatchState() == MATCH_STATE_COUNTDOWN || GS_ShootingDisabled())
        return;

    CheckIsInThinkFrame(__FUNCTION__);

    // Compute look dir before loop
    vec3_t lookDir;
    AngleVectors(self->s.angles, lookDir, nullptr, nullptr);

    float fov = 110.0f + 69.0f * Skill();
    float dotFactor = cosf((float)DEG2RAD(fov / 2));

    struct EntAndDistance
    {
        int entNum;
        float distance;

        EntAndDistance(int entNum_, float distance_): entNum(entNum_), distance(distance_) {}
        bool operator<(const EntAndDistance &that) const { return distance < that.distance; }
    };

    // Do not call inPVS() and G_Visible() for potential targets inside a loop for all clients.
    // In worst case when all bots may see each other we get N^2 traces and PVS tests
    // First, select all candidate targets along with distance to a bot.
    // Then choose not more than BotBrain::maxTrackedEnemies nearest enemies for calling OnEnemyViewed()
    // It may cause data loss (far enemies may have higher logical priority),
    // but in a common good case (when there are few visible enemies) it preserves data,
    // and in the worst case mentioned above it does not act weird from player POV and prevents server hang up.
    // Note: non-client entities also may be candidate targets.
    StaticVector<EntAndDistance, MAX_EDICTS> candidateTargets;

    for (int i = 1; i < game.numentities; ++i)
    {
        edict_t *ent = game.edicts + i;
        if (botBrain.MayNotBeFeasibleEnemy(ent))
            continue;

        // Reject targets quickly by fov
        Vec3 toTarget(ent->s.origin);
        toTarget -= self->s.origin;
        float squareDistance = toTarget.SquaredLength();
        if (squareDistance < 1)
            continue;
        float invDistance = Q_RSqrt(squareDistance);
        toTarget *= invDistance;
        if (toTarget.Dot(lookDir) < dotFactor)
            continue;

        // It seams to be more instruction cache-friendly to just add an entity to a plain array
        // and sort it once after the loop instead of pushing an entity in a heap on each iteration
        candidateTargets.emplace_back(EntAndDistance(ENTNUM(ent), 1.0f / invDistance));
    }

    std::sort(candidateTargets.begin(), candidateTargets.end());

    // Select inPVS/visible targets first to aid instruction cache, do not call callbacks in loop
    StaticVector<edict_t *, MAX_CLIENTS> targetsInPVS;
    StaticVector<edict_t *, MAX_CLIENTS> visibleTargets;

    static_assert(AiBaseEnemyPool::MAX_TRACKED_ENEMIES <= MAX_CLIENTS, "targetsInPVS capacity may be exceeded");

    for (int i = 0, end = std::min(candidateTargets.size(), botBrain.MaxTrackedEnemies()); i < end; ++i)
    {
        edict_t *ent = game.edicts + candidateTargets[i].entNum;
        if (trap_inPVS(self->s.origin, ent->s.origin))
            targetsInPVS.push_back(ent);
    }

    for (auto ent: targetsInPVS)
        if (G_Visible(self, ent))
            visibleTargets.push_back(ent);

    // Call bot brain callbacks on visible targets
    for (auto ent: visibleTargets)
        botBrain.OnEnemyViewed(ent);

    botBrain.AfterAllEnemiesViewed();

    CheckAlertSpots(visibleTargets);
}
示例#15
0
void Object::DynamicInit1() { // Dwarven mine
  const char* names[] = {"An Entrance to a Large Mining Tunnel",
                         "A Large Mining Tunnel",
                         "A Large Mining Tunnel with a Small Tunnel to One Side",
                         "A Large Mining Tunnel",
                         "A Large Open Chamber",
                         "A Small Mining Tunnel",
                         "A Bend in a Small Mining Tunnel",
                         "A Fork in a Small Mining Tunnel",
                         "A Small Alcove"};
  const char* descs[] = {
      "This tunnel looks to have been carved centuries ago.  It is so well "
      "crafted\n"
      "that you think it will stand as-is for another millenia.\n",
      "This tunnel looks to have been carved centuries ago.  It is so well "
      "crafted\n"
      "that you think it will stand as-is for another millenia.\n",
      "This tunnel looks to have been carved centuries ago.  It is so well "
      "crafted\n"
      "that you think it will stand as-is for another millenia.  Another less\n"
      "well-supported tunnel leads off in another direction.\n",
      "This tunnel looks to have been carved centuries ago.  It is so well "
      "crafted\n"
      "that you think it will stand as-is for another millenia.\n",
      "This is a large natural-looking opening.  Perhaps this is where some of "
      "the\n"
      "miners removed a large vein of ore, or maybe this cavern was just here "
      "due\n"
      "to natural forces before they even got here.  It seems the dwarves have "
      "used\n"
      "this tunnel for more than just mining work - a large cage here looks "
      "well\n"
      "used.\n",
      "This tunnel looks to have been carved quickly.  It looks like it might\n"
      "collapse at any moment.\n",
      "This bend in the tunnel looks to have been carved quickly.  It looks "
      "like it\n"
      "might collapse at any moment.\n",
      "This tunnel fork looks to have been carved quickly.  It looks like it\n"
      "might collapse at any moment.\n",
      "The tunnel comes to an end in a rough opening here.\n"};

  static MOBType* dwarf_miner;
  static MOBType* dwarf_engineer;
  static MOBType* dwarf_guard;
  static MOBType* dwarf_explorer;
  static MOBType* elf_prisoner;
  if (!dwarf_miner) {
    WeaponType* weap;
    ArmorType* arm;

    dwarf_miner = new MOBType(
        "a dwarf miner",
        "{He} looks pissed.",
        "",
        "M",
        7,
        7,
        4,
        5,
        6,
        7,
        2,
        2,
        4,
        3,
        8,
        7,
        500,
        2001);
    dwarf_miner->Skill("Two-Handed Cleaves", 100, 4);
    weap = new WeaponType(
        "a dwarven mining pickaxe",
        "A super-strong, super-sharp, super-heavy pickaxe.",
        "",
        "Two-Handed Cleaves",
        2,
        2,
        7,
        3,
        3,
        20000,
        50,
        2000);
    dwarf_miner->Arm(weap);
    arm = new ArmorType(
        "a dwarven leather jerkin",
        "A heavy dwarven leather jerkin.  It'll probably stop an arrow.",
        "",
        3,
        2,
        2,
        2,
        0,
        0,
        1,
        0,
        10000,
        10,
        150,
        ACT_WEAR_CHEST,
        ACT_WEAR_BACK);
    dwarf_miner->Armor(arm);

    dwarf_engineer = new MOBType(
        "a dwarf engineer",
        "She looks pissed.",
        "",
        "F",
        5,
        7,
        4,
        5,
        5,
        7,
        3,
        2,
        5,
        3,
        8,
        7,
        2000,
        8001);
    dwarf_engineer->Skill("Long Cleaves", 100, 2);
    weap = new WeaponType(
        "a dwarven combat axe",
        "A super-strong, super-sharp combat axe.",
        "",
        "Long Cleaves",
        1,
        2,
        7,
        2,
        2,
        4000,
        10,
        1000);
    dwarf_engineer->Arm(weap);
    arm = new ArmorType(
        "a dwarven leather jerkin",
        "A heavy dwarven leather jerkin.  It'll probably stop an arrow.",
        "",
        3,
        2,
        2,
        2,
        0,
        0,
        1,
        0,
        10000,
        10,
        150,
        ACT_WEAR_CHEST,
        ACT_WEAR_BACK);
    dwarf_engineer->Armor(arm);

    dwarf_guard = new MOBType(
        "a dwarf guard",
        "{He} looks pissed.",
        "",
        "MF",
        9,
        4,
        6,
        4,
        9,
        4,
        1,
        3,
        5,
        4,
        9,
        4,
        100,
        401);
    dwarf_guard->Skill("Two-Handed Cleaves", 100, 4);
    weap = new WeaponType(
        "a dwarven war axe",
        "A super-strong, super-sharp, super-heavy, high-quality war axe.",
        "",
        "Two-Handed Cleaves",
        2,
        4,
        6,
        4,
        2,
        20000,
        40,
        5000);
    dwarf_guard->Arm(weap);
    arm = new ArmorType(
        "a dwarven heavy breastplate",
        "A heavy dwarven breastplate.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        200000,
        100,
        15000,
        ACT_WEAR_CHEST,
        ACT_WEAR_BACK);
    dwarf_guard->Armor(arm);
    arm = new ArmorType(
        "a dwarven great helm",
        "A heavy dwarven great helm.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        50000,
        70,
        5000,
        ACT_WEAR_HEAD);
    dwarf_guard->Armor(arm);
    arm = new ArmorType(
        "a dwarven arm plate (right)",
        "A heavy dwarven arm plate.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        50000,
        60,
        5000,
        ACT_WEAR_RARM);
    dwarf_guard->Armor(arm);
    arm = new ArmorType(
        "a dwarven arm plate (left)",
        "A heavy dwarven arm plate.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        50000,
        60,
        5000,
        ACT_WEAR_LARM);
    dwarf_guard->Armor(arm);
    arm = new ArmorType(
        "a dwarven battle skirt",
        "A heavy dwarven battle skirt.  It'll probably stop a warhammer.",
        "",
        8,
        4,
        6,
        2,
        4,
        2,
        10,
        5,
        100000,
        80,
        10000,
        ACT_WEAR_RLEG,
        ACT_WEAR_LLEG);
    dwarf_guard->Armor(arm);

    dwarf_explorer = new MOBType(
        "a dwarf explorer",
        "{He} looks pissed.",
        "",
        "MF",
        5,
        4,
        5,
        4,
        6,
        4,
        3,
        2,
        6,
        4,
        9,
        5,
        1000,
        4001);
    dwarf_explorer->Skill("Long Cleaves", 100, 4);
    weap = new WeaponType(
        "a dwarven climbing pick",
        "A super-sharp, lightweight pick.",
        "",
        "Long Cleaves",
        1,
        1,
        3,
        3,
        1,
        2000,
        10,
        500);
    dwarf_explorer->Arm(weap);
    arm = new ArmorType(
        "a dwarven leather jerkin",
        "A heavy dwarven leather jerkin.  It'll probably stop an arrow.",
        "",
        3,
        2,
        2,
        2,
        0,
        0,
        1,
        0,
        10000,
        10,
        150,
        ACT_WEAR_CHEST,
        ACT_WEAR_BACK);
    dwarf_explorer->Armor(arm);

    elf_prisoner = new MOBType(
        "an elf slave",
        "This elf looks like {he}'s been a "
        "prisoner longer than you've been alive.",
        "",
        "MF",
        4,
        2,
        8,
        4,
        5,
        2,
        8,
        2,
        7,
        4,
        4,
        4,
        0,
        0);
    elf_prisoner->Skill("Carromeleg - Tier I", 2);
    elf_prisoner->Skill("Carromeleg - Tier II", 2);
    elf_prisoner->Skill("Carromeleg - Tier III", 2);
    elf_prisoner->Skill("Carromeleg - Tier IV", 2);
    elf_prisoner->Skill("Carromeleg - Tier V", 2);
    elf_prisoner->Skill("Carromeleg - Tier VI", 2);
  }

  int mojo = Skill("DynamicMojo");
  SetSkill("DynamicMojo", 0);

  // Tree structure, start with one door - dir of travel is opposite it.
  const char* dirb = "south";
  const char* dir = "north";
  const char* dir2 = "west";
  const char* dir3 = "east";

  if (PickObject("north", LOC_INTERNAL) != NULL) {
    dirb = "north";
    dir = "south";
    dir2 = "east";
    dir3 = "west";
  } else if (PickObject("east", LOC_INTERNAL) != NULL) {
    dirb = "east";
    dir = "west";
    dir2 = "south";
    dir3 = "north";
  } else if (PickObject("west", LOC_INTERNAL) != NULL) {
    dirb = "west";
    dir = "east";
    dir2 = "north";
    dir3 = "south";
  }
  // 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());
      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 (2): { // Major Shaft w/ Minor Offshoot
      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) * 9 / 10);

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

      if (rand() % 2)
        swap(dir2, dir3); // Half left, half right
      next = new Object(parent);
      next->SetShortDesc(names[5]);
      next->SetDesc(descs[5]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", 5); // Minor Shaft
      next->SetSkill("DynamicMojo", (mojo - 1000) / 10);

      door1 = new Object(this);
      door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\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 (3): { // Major Shaft w/ Secret Minor Offshoot
      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) * 3 / 4);

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

      if (rand() % 2)
        swap(dir2, dir3); // Half left, half right
      next = new Object(parent);
      next->SetShortDesc(names[5]);
      next->SetDesc(descs[5]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", 5); // Minor Shaft
      next->SetSkill("DynamicMojo", (mojo - 1000) / 4);

      door1 = new Object(this);
      door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\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);
      door1->SetSkill("Hidden", 4 + rand() % 13);
    } break;
    case (4): { // Major Chamber
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      if ((rand() % 100) < 10) {
        mojo -= 500;
        AddMOB(dwarf_engineer);
      }
      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 ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        AddMOB(dwarf_guard);
      }

      Object* cage = new Object(this);
      cage->SetShortDesc("an old strong cage");
      cage->SetDesc(
          "This is a very old, large, rugged cage - probably built by "
          "dwarves.\n");
      cage->SetSkill("Transparent", 900);
      cage->SetSkill("Container", 100000);
      cage->SetSkill("Locked", 1);
      cage->SetSkill("Closeable", 1);

      if ((rand() % 100) < 20) {
        mojo -= 500;
        cage->AddMOB(elf_prisoner);
      }
      if ((rand() % 100) < 20) {
        mojo -= 500;
        cage->AddMOB(elf_prisoner);
      }

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

      int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3};
      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());
      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 (5): { // Minor Shaft
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      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_explorer);
      }

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

      //      int ntypes[] = { 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 9 };
      int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
      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 - 100);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling 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 (6): { // Minor Shaft (Bend)
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      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_explorer);
      }

      //      int ntypes[] = { 5, 5, 5, 5, 5, 6, 6, 7, 7, 8, 9 };
      int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
      int ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];

      if (rand() % 2)
        swap(dir2, dir3); // Half left, half right
      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 - 100);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\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 (7): { // Minor Shaft Fork
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      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_explorer);
      }

      //      int ntypes[] = { 5, 5, 5, 5, 5, 6, 6, 7, 7, 8, 9 };
      int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
      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 - 100) / 2);

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\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);

      ntype = ntypes[rand() % (sizeof(ntypes) / sizeof(int))];
      swap(dir2, dir3); // Same code, opposite dir.
      next = new Object(parent);
      next->SetShortDesc(names[ntype]);
      next->SetDesc(descs[ntype]);
      next->SetSkill("DynamicInit", 1);
      next->SetSkill("DynamicPhase", ntype);
      next->SetSkill("DynamicMojo", (mojo - 100) / 2);

      door1 = new Object(this);
      door2 = new Object(next);
      door1->SetShortDesc(dir2);
      door2->SetShortDesc(dir3);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir2 + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling passage leading ") + dir3 + ".\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 (8): { // Minor Shaft Alcove
      if ((rand() % 100) < 30) {
        mojo -= 500;
        AddMOB(dwarf_miner);
      }
      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_explorer);
      }

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

      if (mojo > 10000 && (rand() % 100) < 20) {
        mojo -= 5000;
        int option = rand() % 100;
        if (option >= 70) {
          swap(dir, dir2);
          swap(dirb, dir3);
        } else if (option >= 70) {
          swap(dir, dir3);
          swap(dirb, dir2);
        }
      } else { // No secret tunnels here!
        break;
      }

      int ntype = 5;

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

      Object* door1 = new Object(this);
      Object* door2 = new Object(next);
      door1->SetShortDesc(dir);
      door2->SetShortDesc(dirb);
      door1->SetDesc((string("You see a crumbling passage leading ") + dir + ".\n").c_str());
      door2->SetDesc((string("You see a crumbling 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);
      door1->SetSkill("Hidden", 4 + rand() % 13);
    } break;
    default: {
      fprintf(
          stderr,
          "Unknown dynamic-phase-type (%d-%d) init requested!\n",
          Skill("DynamicInit"),
          Skill("DynamicPhase"));
    } break;
  }
  SetSkill("DynamicPhase", 0);
}
示例#16
0
bool Skill::Secondary::isValid(void) const
{
    return Skill() != UNKNOWN && Level() != Level::NONE;
}
示例#17
0
/* index sprite from SECSKILL */
u8 Skill::Secondary::GetIndexSprite1(void) const
{
    return Skill() <= ESTATES ? Skill() : 0;
}
示例#18
0
/* index sprite from MINISS */
u8 Skill::Secondary::GetIndexSprite2(void) const
{
    return Skill() <= ESTATES ? Skill() - 1 : 0xFF;
}
        Skills::Skills(CharacterDescription& charDescription, AbilityScores& abilityScores)
        :
            characterDescription(charDescription),
            abilityScores(abilityScores)
        {
            skills[SkillType::Acrobatics] = Skill();
            skills[SkillType::Appraise] = Skill();
            skills[SkillType::Bluff] = Skill();
            skills[SkillType::Climb] = Skill();
            skills[SkillType::Craft] = Skill();
            skills[SkillType::Diplomacy] = Skill();
            skills[SkillType::DisableDevice] = Skill();
            skills[SkillType::Disguise] = Skill();
            skills[SkillType::EscapeArtist] = Skill();
            skills[SkillType::Fly] = Skill();
            skills[SkillType::HandleAnimal] = Skill();
            skills[SkillType::Heal] = Skill();
            skills[SkillType::Intimidate] = Skill();
            skills[SkillType::KnowledgeArcana] = Skill();
            skills[SkillType::KnowledgeDungeoneering] = Skill();
            skills[SkillType::KnowledgeEngineering] = Skill();
            skills[SkillType::KnowledgeGeography] = Skill();
            skills[SkillType::KnowledgeHistory] = Skill();
            skills[SkillType::KnowledgeLocal] = Skill();
            skills[SkillType::KnowledgeNature] = Skill();
            skills[SkillType::KnowledgeNobility] = Skill();
            skills[SkillType::KnowledgePlanes] = Skill();
            skills[SkillType::KnowledgeReligion] = Skill();
            skills[SkillType::Linguistics] = Skill();
            skills[SkillType::Perception] = Skill();
            skills[SkillType::Perform] = Skill();
            skills[SkillType::Profession] = Skill();
            skills[SkillType::Ride] = Skill();
            skills[SkillType::SenseMotive] = Skill();
            skills[SkillType::SleightOfHand] = Skill();
            skills[SkillType::Spellcraft] = Skill();
            skills[SkillType::Stealth] = Skill();
            skills[SkillType::Survival] = Skill();
            skills[SkillType::Swim] = Skill();
            skills[SkillType::UseMagicDevice] = Skill();

            skills[SkillType::Acrobatics].keyAbility = Character::AbilityScoreTypes::DEX;
            skills[SkillType::Appraise].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::Bluff].keyAbility = Character::AbilityScoreTypes::CHA;
            skills[SkillType::Climb].keyAbility = Character::AbilityScoreTypes::STR;
            skills[SkillType::Craft].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::Diplomacy].keyAbility = Character::AbilityScoreTypes::CHA;
            skills[SkillType::DisableDevice].keyAbility = Character::AbilityScoreTypes::DEX;
            skills[SkillType::Disguise].keyAbility = Character::AbilityScoreTypes::CHA;
            skills[SkillType::EscapeArtist].keyAbility = Character::AbilityScoreTypes::DEX;
            skills[SkillType::Fly].keyAbility = Character::AbilityScoreTypes::DEX;
            skills[SkillType::HandleAnimal].keyAbility = Character::AbilityScoreTypes::CHA;
            skills[SkillType::Heal].keyAbility = Character::AbilityScoreTypes::WIS;
            skills[SkillType::Intimidate].keyAbility = Character::AbilityScoreTypes::CHA;
            skills[SkillType::KnowledgeArcana].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgeDungeoneering].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgeEngineering].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgeGeography].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgeHistory].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgeLocal].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgeNature].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgeNobility].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgePlanes].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::KnowledgeReligion].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::Linguistics].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::Perception].keyAbility = Character::AbilityScoreTypes::WIS;
            skills[SkillType::Perform].keyAbility = Character::AbilityScoreTypes::CHA;
            skills[SkillType::Profession].keyAbility = Character::AbilityScoreTypes::WIS;
            skills[SkillType::Ride].keyAbility = Character::AbilityScoreTypes::DEX;
            skills[SkillType::SenseMotive].keyAbility = Character::AbilityScoreTypes::WIS;
            skills[SkillType::SleightOfHand].keyAbility = Character::AbilityScoreTypes::DEX;
            skills[SkillType::Spellcraft].keyAbility = Character::AbilityScoreTypes::INT;
            skills[SkillType::Stealth].keyAbility = Character::AbilityScoreTypes::DEX;
            skills[SkillType::Survival].keyAbility = Character::AbilityScoreTypes::WIS;
            skills[SkillType::Swim].keyAbility = Character::AbilityScoreTypes::STR;
            skills[SkillType::UseMagicDevice].keyAbility = Character::AbilityScoreTypes::CHA;

            characterDescription.registerObserver("skills", this);
            abilityScores.registerObserver("skills", this);

            calculateTotalSpendableRanks(abilityScores, characterDescription);
            calculateTotalSkillPoints(abilityScores, characterDescription);
        }
示例#20
0
// public
Skills::Skills(ClientInterface & client, TargetInterface & targeting):
        m_client(client), m_targeting(targeting)
{
    m_skills.insert(skill_map_t::value_type("Anatomy",                  Skill( "1", 1, false)));
    m_skills.insert(skill_map_t::value_type("Animal Lore",              Skill( "2", 1, false)));
    m_skills.insert(skill_map_t::value_type("Animal Taming",            Skill("35", 1, false)));
    m_skills.insert(skill_map_t::value_type("Arms Lore",                Skill( "4", 1, false)));
    m_skills.insert(skill_map_t::value_type("Begging",                  Skill( "6", 1, false)));
    m_skills.insert(skill_map_t::value_type("Cartography",              Skill("12", 1, false)));
    m_skills.insert(skill_map_t::value_type("Detect Hidden",            Skill("14", 0, false)));
    m_skills.insert(skill_map_t::value_type("Enticement",               Skill("15", 1, false)));
    m_skills.insert(skill_map_t::value_type("Evaluating Intelligence",  Skill("16", 1, false)));
    m_skills.insert(skill_map_t::value_type("Forensic Evaluation",      Skill("19", 1, false)));
    m_skills.insert(skill_map_t::value_type("Hiding",                   Skill("21", 0, false)));
    m_skills.insert(skill_map_t::value_type("Inscription",              Skill("23", 0, true)));
    m_skills.insert(skill_map_t::value_type("Item Identification",      Skill( "3", 1, false)));
    m_skills.insert(skill_map_t::value_type("Meditation",               Skill("46", 0, false)));
    m_skills.insert(skill_map_t::value_type("Peacemaking",              Skill( "9", 1, false)));
    m_skills.insert(skill_map_t::value_type("Poisoning",                Skill("30", 2, false)));
    m_skills.insert(skill_map_t::value_type("Provocation",              Skill("22", 2, false)));
    m_skills.insert(skill_map_t::value_type("Remove Trap",              Skill("48", 1, false)));
    m_skills.insert(skill_map_t::value_type("Spirit Speak",             Skill("32", 0, false)));
    m_skills.insert(skill_map_t::value_type("Stealing",                 Skill("33", 1, false)));
    m_skills.insert(skill_map_t::value_type("Stealth",                  Skill("47", 0, false)));
    m_skills.insert(skill_map_t::value_type("Taste Identification",     Skill("36", 1, false)));
    m_skills.insert(skill_map_t::value_type("Tracking",                 Skill("38", 0, true)));
}
示例#21
0
std::string Skill::Secondary::GetDescription(void) const
{
    const u16 count = GetValues();
    std::string str = "unknown";

    switch(Skill())
    {
	case PATHFINDING:
	    str = ngettext("Reduces the movement penalty for rough terrain by %{count} percent.",
			"Reduces the movement penalty for rough terrain by %{count} percent.", count); break;
        case ARCHERY:
	    str = ngettext("Increases the damage done by range attacking creatures by %{count} percent.",
			"Increases the damage done by range attacking creatures by %{count} percent.", count); break;
        case LOGISTICS:
	    str = ngettext("Increases your hero's movement points by %{count} percent.",
			"Increases your hero's movement points by %{count} percent.", count); break;
        case SCOUTING:
	    str = ngettext("Increases your hero's viewable area by %{count} square.",
			"Increases your hero's viewable area by %{count} squares.", count); break;
        case DIPLOMACY:
	    str = _("Allows you to negotiate with monsters who are weaker than your group.");
	    str.append(" ");
	    str.append(ngettext("Approximately %{count} percent of the creatures may offer to join you.",
		    "Approximately %{count} percent of the creatures may offer to join you.", count)); break;
        case NAVIGATION:
	    str = ngettext("Increases your hero's movement points over water by %{count} percent.",
		    "Increases your hero's movement points over water by %{count} percent.", count); break;
        case LEADERSHIP:
	    str = ngettext("Increases your hero's troops' morale by %{count}.",
		    "Increases your hero's troops' morale by %{count}.", count); break;
        case WISDOM:
	{
	    switch(Level())
	    {
		case Level::BASIC:
		    str = _("Allows your hero to learn third level spells."); break;
		case Level::ADVANCED:
		    str = _("Allows your hero to learn fourth level spells."); break;
		case Level::EXPERT:
		    str = _("Allows your hero to learn fifth level spells."); break;
		default: break;
	    }
	    break;
	}
        case MYSTICISM:
	    str = ngettext("Regenerates %{count} of your hero's spell point per day.",
		    "Regenerates %{count} of your hero's spell points per day.", count); break;
        case LUCK:
	    str = ngettext("Increases your hero's luck by %{count}.",
		    "Increases your hero's luck by %{count}.", count); break;
        case BALLISTICS:
	    switch(Level())
	    {
		case Level::BASIC:
		    str = _("Gives your hero's catapult shots a greater chance to hit and do damage to castle walls."); break;
		case Level::ADVANCED:
		    str = _("Gives your hero's catapult an extra shot, and each shot has a greater chance to hit and do damage to castle walls."); break;
		case Level::EXPERT:
		    str = _("Gives your hero's catapult an extra shot, and each shot automatically destroys any wall, except a fortified wall in a Knight town."); break;
		default: break;
	    }
	    break;
        case EAGLEEYE:
	    switch(Level())
	    {
		case Level::BASIC:
		    str = ngettext("Gives your hero a %{count} percent chance to learn any given 1st or 2nd level enemy spell used against him in a combat.",
		    "Gives your hero a %{count} percent chance to learn any given 1st or 2nd level enemy spell used against him in a combat.", count); break;
		case Level::ADVANCED:
		    str = ngettext("Gives your hero a %{count} percent chance to learn any given 3rd level spell (or below) used against him in combat.",
		    "Gives your hero a %{count} percent chance to learn any given 3rd level spell (or below) used against him in combat.", count); break;
		case Level::EXPERT:
		    str = ngettext("Gives your hero a %{count} percent chance to learn any given 4th level spell (or below) used against him in combat.",
		    "Gives your hero a %{count} percent chance to learn any given 4th level spell (or below) used against him in combat.", count); break;
		default: break;
	    }
	    break;
        case NECROMANCY:
	    str = ngettext("Allows %{count} percent of the creatures killed in combat to be brought back from the dead as Skeletons.",
		    "Allows %{count} percent of the creatures killed in combat to be brought back from the dead as Skeletons.", count); break;
	case ESTATES:
	    str = ngettext("Your hero produce %{count} gold pieces per turn as tax revenue from estates.",
		    "Your hero produces %{count} gold pieces per turn as tax revenue from estates.", count); break;
	default: break;
    }

    String::Replace(str, "%{count}", count);

    return str;
}
示例#22
0
文件: main.cpp 项目: CCJY/coliru
int main()
{
    std::cout << Skill( 1000, 100, 25, 250, 250, 2500, 75 );
}
示例#23
0
void TransAstro(char plr, int inx)
// indexed 1 thru 5
{
    int i, j, w, count = 0, max, found, flt1, flt2, bug = 1;

    while (bug == 1) {
        count = 0;
        max = 0;
        found = 0;
        flt1 = 0;
        flt2 = 0;

        if (inx == 5) {
            max = 4;
        } else if (inx == 4) {
            max = 3;
        } else {
            max = inx;
        }

        if (Data->P[plr].AstroCount == 0) {
            return;
        }

        for (i = 0; i < Data->P[plr].AstroCount; i++) {
            Data->P[plr].Pool[i].Mood = 100;

            if (Data->P[plr].Pool[i].Status == AST_ST_RETIRED || Data->P[plr].Pool[i].Status == AST_ST_DEAD) {
                Data->P[plr].Pool[i].Status = AST_ST_ACTIVE;
                Data->P[plr].Pool[i].Assign = 0;
                Data->P[plr].Pool[i].Una = 0;
                Data->P[plr].Pool[i].Prime = 0;
                Data->P[plr].Pool[i].oldAssign = -1;
                Data->P[plr].Pool[i].Crew = 0;
            }

            Data->P[plr].Pool[i].RetReas = 0;
            Data->P[plr].Pool[i].Hero = 0; //clear hero flag

            if (Data->P[plr].Pool[i].Status == AST_ST_ACTIVE && Data->P[plr].Pool[i].Assign == 0 && Data->P[plr].Pool[i].Prime < 1) {
                ++count;
            }
        }

        if (count < max * 2) {
            CheckAdv(plr);
            return;
        }

        found = 0;
        flt1 = -1;
        flt2 = -1;

        for (i = 0; i < 8; i++) {
            if (Data->P[plr].Gcnt[inx][i] == 0) {
                if (flt1 == -1) {
                    flt1 = i;
                } else if (flt2 == -1) {
                    flt2 = i;
                }
            }
        }

        if (flt1 == -1 || flt2 == -1) {
            CheckAdv(plr);
            return;
        }

        for (i = 0; i < 2; i++) {
            for (j = 1; j <= max; j++) {
                w = 0;
                found = 0;

                while (w < Data->P[plr].AstroCount && found == 0) {
                    if (Data->P[plr].Pool[w].Status == AST_ST_ACTIVE && Data->P[plr].Pool[w].Assign == 0 && Data->P[plr].Pool[w].Prime < 1) {
                        // based on [j] an program and position pick best skill
                        switch (inx) {
                        case 1:
                            w = Skill(plr, 1);
                            break;

                        case 2:
                            if (j == 1) {
                                w = Skill(plr, 1);
                            } else {
                                w = Skill(plr, 2);
                            }

                            break;

                        case 3:
                            if (j == 1) {
                                w = Skill(plr, 1);
                            } else if (j == 2) {
                                w = Skill(plr, 2);
                            } else {
                                w = Skill(plr, 3);
                            }

                            break;

                        case 4:
                            if (j == 1) {
                                w = Skill(plr, 4);
                            } else if (j == 2) {
                                w = Skill(plr, 2);
                            } else {
                                w = Skill(plr, 3);
                            }

                            break;

                        case 5:
                            if (j == 1) {
                                w = Skill(plr, 4);
                            } else if (j == 2) {
                                w = Skill(plr, 4);
                            } else if (j == 3) {
                                w = Skill(plr, 5);
                            } else {
                                w = Skill(plr, 5);
                            }

                            break;

                        default:
                            break;
                        }

                        if (i == 0) {
                            Data->P[plr].Pool[w].Assign = inx;
                            Data->P[plr].Pool[w].Una = 1;
                            Data->P[plr].Crew[inx][flt1][j - 1] = w + 1;
                            found = 1;
                        } else {
                            Data->P[plr].Pool[w].Assign = inx;
                            Data->P[plr].Pool[w].Una = 1;
                            Data->P[plr].Crew[inx][flt2][j - 1] = w + 1;
                            found = 1;
                        }
                    } // end if

                    ++w;
                } // end while
            }

            Data->P[plr].Gcnt[inx][flt1] = max;
            Data->P[plr].Gcnt[inx][flt2] = max;
        }
    } // end while

    return;
}