示例#1
0
文件: Unit.cpp 项目: Irathia/SOE
void Unit::ManaUp(int value)
{
	if (mana+value >= (chs.mana)*80 + + GetBonus(1))
		mana = (chs.mana)*80 + + GetBonus(1);
	else
		mana += value;
}
示例#2
0
文件: Unit.cpp 项目: Irathia/SOE
void Unit::HealthUp(int value)
{
	if (health+value >= (chs.health)*100  + GetBonus(0))
		health = (chs.health)*100 + + GetBonus(0);
	else
		health += value;
}
void LompatKe (InfoPlayer *X, AddressOfPetak Pt)
/*Mengubah posisi pemain menuju ke petak 'pt' karena berhenti di world travel*/
{
    (*X).posisi = Pt;
    if(Info(Pt).id_petak == 1) ExecuteStart();
    else if(Info(Pt).id_petak == 3) GetBonus();
    else if(Info(Pt).id_petak == 9) Info(global.currentPlayer).penjara = true;
    else if(Info(Pt).id_petak == 13 || Info(Pt).id_petak == 21 || Info(Pt).id_petak == 29) DrawCards();
    else if(Info(Pt).id_petak == 31) PayTax();
    else if(isKota(Pt) || isTempatWisata(Pt)) BayarSewa();
}
示例#4
0
文件: event.c 项目: joewing/xdiamonds
/** Event loop for a win. */
void WinLoop() {
   struct timeval last, current;
   unsigned long elapsedTime;
   XEvent event;
   int count;

   if(!GetBonus()) {
      return;
   }

   gettimeofday(&last, NULL);
   count = 64;
   while(!shouldExit) {

      while(XPending(display) > 0) {
         XNextEvent(display, &event);
         switch(event.type) {
         case Expose:
            HandleExposeEvent(&event.xexpose);
            break;
         case KeyPress:
            if(event.xkey.keycode == keyESC) {
               shouldExit = 1;
            }
            break;
         default:
            break;
         }
      }

      gettimeofday(&current, NULL);
      elapsedTime = (current.tv_sec - last.tv_sec) * 1000000;
      elapsedTime += current.tv_usec - last.tv_usec;

      if(elapsedTime >= COUNTDOWN_SPEED) {
         last = current;
         UpdateBonusCountdown();
         --count;
         if(count <= 0) {
            break;
         }
      }
   }
}
void MajuNLangkah (InfoPlayer *X, ListPetak L, int N)
/*Mengubah posisi pemain sebanyak N langkah kedepan.
 Jumlah langkah tergantung dari roll dadu (N>=2 dan N<=12). */
{
    int i;
    AddressOfPetak P = (*X).posisi;
    for(i=0; i<N; i++)
    {
        P = Next(P);
        if(Info(P).id_petak == 1) ExecuteStart();
    }

    (*X).posisi = P;
    printf("\nAnda melangkah dan sampai ke petak ");
    PrintKata(InfoPetak(P).nama_petak);
    puts("");
    if(Info(P).id_petak == 3) GetBonus();
    else if(Info(P).id_petak == 9) MasukPenjara(X, L);
    else if(Info(P).id_petak == 13 || Info(P).id_petak == 21 || Info(P).id_petak == 29) DrawCards();
    else if(Info(P).id_petak == 31) PayTax();
    else if(isKota(P) || isTempatWisata(P))
    {
        printf("Saat ini anda berada di:\n");
        PrintPetak(Info(Info(global.currentPlayer).posisi).nama_petak);
        BayarSewa();
    }
    else if (isWorldCup(P))
    {
        printf("Saat ini anda berada di Petak World Cup\n");
    }
    else if (isWorldTravel(P))
    {
        printf("Saat ini anda berada di Petak World Travel.\n");
    }

}
示例#6
0
void GBomber::Move()
{
	if (m_bonus) m_bonus->Move();

	float speed = m_basespeed * gspeed;

	if (m_bonus) m_bonus->BeforeMove(&speed);


	if (m_dead) {
		if (m_anim < P_bomber.anims*P_bomber.animspeed) m_anim++;
		return;
	}
	else {
		if (m_dir != 0) {
			m_smer = m_dir-1;
			if (++m_anim > P_bomber.anims*P_bomber.animspeed) m_anim = 0;
		}
		else m_anim = 0;
	}

	GetBonus();

	switch (m_dir)
	{
	case 1: // Doleva
		if (m_x > 25 || m_map->IsFree(m_mx-1,m_my)) {
			m_x -= speed;
			if (m_y > 25+speed) m_y -= speed;
			else if (m_y < 25-speed) m_y += speed;
				  else m_y = 25;
		}
		else KickBomb();
		break;
	case 2: // doprava
		if (m_x < 25 || m_map->IsFree(m_mx+1,m_my)) {
			m_x += speed;
			if (m_y > 25+speed) m_y -= speed;
			else if (m_y < 25-speed) m_y += speed;
				  else m_y = 25;
		}
		else KickBomb();
		break;
	case 3: // nahoru
		if (m_y > 25 || m_map->IsFree(m_mx,m_my-1)) {
			m_y -= speed;
			if (m_x > 25+speed) m_x -= speed;
			else if (m_x < 25-speed) m_x += speed;
				  else m_x = 25;
		}
		else KickBomb();
		break;
	case 4: // dolu
		if (m_y < 25 || m_map->IsFree(m_mx,m_my+1)) {
			m_y += speed;
			if (m_x > 25+speed) m_x -= speed;
			else if (m_x < 25-speed) m_x += speed;
				  else m_x = 25;
		}
		else KickBomb();
		break;
	}

	if (m_x > 50) {m_mx++; m_x -= 50;};
	if (m_y > 50) {m_my++; m_y -= 50;};
	if (m_x < 0) {m_mx--; m_x += 50;};
	if (m_y < 0) {m_my--; m_y += 50;};

	if (m_casovac) {
		if (m_action)
			if (!m_undertimer) 
				if (PutBomb()) 	m_undertimer = true;
	}
	else 
		if ((m_action && m_bombused < m_bomb) && !m_undertimer) PutBomb();
			

	if (!m_action && m_undertimer) {
		m_undertimer = false;
		for (int i = 0; i < MAX_BOMBS; i++)
			if (m_map->m_bomba[i] != NULL)
				if (m_map->m_bomba[i]->m_bomberID == m_ID) m_map->m_bomba[i]->m_bombtime = 1;
	
	}

}