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


C++ Pokemon::GetLoyalty方法代码示例

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


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

示例1: SendPokemonTeam

  void User::SendPokemonTeam (PokemonTeam& pokemonTeam)
  {
    yap::Packet packet;
    packet.CreateFromType (yap::PacketType::ServerInfoPokemonTeam);

    // Send the number of Pokemon in the team
    int pokemonNumber = pokemonTeam.GetPokemonCount ();
    packet.Write (pokemonNumber);

    Pokemon* currentPokemon = nullptr;

    for (int i = 0; i < pokemonNumber; i++)
    {
      currentPokemon = &pokemonTeam.GetPokemon (i);

      // Write the current pokemon basic information in the packet
      packet.Write (currentPokemon->GetStaticID ());
      packet.Write (currentPokemon->GetUniqueID ());
      packet.Write (static_cast<yap::UInt8>(currentPokemon->GetGender ()));
      packet.Write (static_cast<yap::UInt8>(currentPokemon->GetStatus ()));
      packet.Write (currentPokemon->GetNickname ());
      packet.Write (currentPokemon->GetShiny ());
      packet.Write (currentPokemon->GetLoyalty ());
      packet.Write (currentPokemon->GetNatureID ());
      packet.Write (currentPokemon->GetTotalExperience ());
      packet.Write (currentPokemon->GetBoxNumber ());
      packet.Write (currentPokemon->GetBoxIndex ());
      packet.Write (currentPokemon->GetCatchDate ());
      packet.Write (currentPokemon->GetCurrentHP ());

      // Write the current Pokemon's stats
      const yap::PokemonStat& stats = currentPokemon->GetStats ();

      // Send EV
      packet.Write (stats.GetHitPoint ().GetEffortValue ());
      packet.Write (stats.GetAttack ().GetEffortValue ());
      packet.Write (stats.GetDefense ().GetEffortValue ());
      packet.Write (stats.GetSpecialAttack ().GetEffortValue ());
      packet.Write (stats.GetSpecialDefense ().GetEffortValue ());
      packet.Write (stats.GetSpeed ().GetEffortValue ());

      // Send IV
      packet.Write (stats.GetHitPoint ().GetIndividualValue ());
      packet.Write (stats.GetAttack ().GetIndividualValue ());
      packet.Write (stats.GetDefense ().GetIndividualValue ());
      packet.Write (stats.GetSpecialAttack ().GetIndividualValue ());
      packet.Write (stats.GetSpecialDefense ().GetIndividualValue ());
      packet.Write (stats.GetSpeed ().GetIndividualValue ());

      // Send Pokemon's moves
      const yap::PokemonMoveSet& moveSet =
        currentPokemon->GetMoveSet ();
      yap::UInt8 moveNumber = currentPokemon->GetMoveSet ().GetMoveNumber ();

      // Send the move number of the Pokemon
      packet.Write (moveNumber);

      for (yap::UInt8 index = 0; index < 4; index++)
      {
        if (moveSet.GetMove (index) != nullptr)
        {
          packet.Write (moveSet.GetMove (index)->GetStaticID ());
          packet.Write (index);
          packet.Write (moveSet.GetMove (index)->GetCurrentPP ());
          packet.Write (moveSet.GetMove (index)->GetMaxPP ());
        }
      }

    }

    SendPacket (packet);
  }
开发者ID:Noxalus,项目名称:YAPOG,代码行数:72,代码来源:User.cpp


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