示例#1
0
void RogueScene::changeGameStatus(GameStatus gameStatus)
{
    CCLOG("turn %d change gameStatus %d => %d", m_TurnCount, m_gameStatus, gameStatus);
    
    GameStatus beforeGameStatus = m_gameStatus;
    m_gameStatus = gameStatus;
    
    // 敵のターン開始時
    if ((beforeGameStatus == GameStatus::PLAYER_TURN || beforeGameStatus == GameStatus::PLAYER_ACTION)
        && m_gameStatus == GameStatus::ENEMY_TURN)
    {
        enemyTurn();
    }
    else if (m_gameStatus == GameStatus::PLAYER_TURN)
    {
        // カーソルはクリアする
        m_mapManager.clearCursor();
        // ターン数を進める
        m_TurnCount++;
        
        // TODO: とりあえずここで・・・
        auto pPlayer = getPlayerActorSprite(1);
        auto pPlayerDto = pPlayer->getActorDto();
        
        // 1ターンに1空腹度が減るという
        if (pPlayerDto->magicPoint > 0)
        {
            pPlayerDto->magicPoint--;
        }
        refreshStatus();
    }
}
示例#2
0
void main() {

    int numEn;
    printf("How many enemies?: ");
    scanf("%d", &numEn);
    printf("\n");
    //Initialize enemy types
    Enemies = malloc(sizeof(int)*numEn);
    int k;
    for (k = 0; k < numEn; k++) {
        Enemies[k] = 100;
    }
    //Initialize player
    //{0 Str; 1 Per; 2 Fort; 3 Cha; 4 Int; 5 Dex; 6 Luk;
    //7 primary miss; 8 primary dam; 9 primary in mag;
    //10 primary mag size; 11 primary mags; 12 Health; 13 Hunkered}
    char* input = malloc(sizeof(char)*10);
    int* playerStats = malloc(sizeof(int)*13);
    printf("Enter player stats:\nStrength: ");
    scanf("%d", &playerStats[0]);
    printf("\nPerception: ");
    scanf("%d", &playerStats[1]);
    printf("\nFortitude: ");
    scanf("%d", &playerStats[2]);
    printf("\nCharisma: ");
    scanf("%d", &playerStats[3]);
    printf("\nIntelligence: ");
    scanf("%d", &playerStats[4]);
    printf("\nDexterity: ");
    scanf("%d", &playerStats[5]);
    printf("\nLuck: ");
    scanf("%d", &playerStats[6]);

    printf("\nMiss Chance of Primary: ");
    scanf("%d", &playerStats[7]);
    printf("\nPrimary Damage: ");
    scanf("%d", &playerStats[8]);
    printf("\nRounds in Magazine: ");
    scanf("%d", &playerStats[9]);
    printf("\nSize of Magazine: ");
    scanf("%d", &playerStats[10]);
    printf("\nNumber of Magazines: ");
    scanf("%d", &playerStats[11]);
    playerStats[12] = (playerStats[2] *10 +50);
    playerStats[13] = 0;
    //roll initiative
    //Take first turn
    while (playerStats[12] > 0) {
        playerTurn(numEn, playerStats);
        int u;
        for (u = 0; u < numEn; u++) {
            if ()
            enemyTurn(u);
        }
    }
}
示例#3
0
void GameLogic::ProcessEvents()
{
    fight();

    move();
    mine();

    enemyTurn();

    foreach (GameUnit *unit, gameUnits)
    {
        unit->nextFrame();
    }

    foreach (UICooldownButton *button, cooldownButtons)
    {
        button->updateCooldownElapsedIfNeeded();
    }

    emit GameUpdated();
}
示例#4
0
void turnEvent(int event){
  if(event < 4){
    if(event == EVENT_MOVE_UP){
      movePlayer(0,-1);
    } else if(event == EVENT_MOVE_RIGHT){
      movePlayer(1,0);
    } else if(event == EVENT_MOVE_DOWN){
      movePlayer(0,1);
    } else {
      movePlayer(-1,0);
    }
  } else {
    if(event == EVENT_SHOOT_UP){
      shootDirection(0,-1);
    } else if(event == EVENT_SHOOT_RIGHT){
      shootDirection(1,0);
    } else if(event == EVENT_SHOOT_DOWN){
      shootDirection(0,1);
    } else {
      shootDirection(-1,0);
    }
  }
  enemyTurn();
}