Пример #1
0
/**
 * Lightning.
 * Chance of lightning illumination for the current turn when aboveground. Thunder.
 *
 * This used to manifest actual lightning on the map, causing fires and such, but since such effects
 * only manifest properly near the player due to the "reality bubble", this was causing undesired metagame tactics
 * such as players leaving their shelter for a more "expendable" area during lightning storms.
 */
void weather_effect::lightning()
{
    thunder();
    if(one_in(LIGHTNING_CHANCE)) {
        if(g->get_levz() >= 0) {
            add_msg(_("A flash of lightning illuminates your surroundings!"));
            g->lightning_active = true;
        }
    } else {
        g->lightning_active = false;
    }
}
Пример #2
0
/**
 * Lightning.
 * Chance of lightning illumination for the current turn when aboveground. Thunder.
 *
 * This used to manifest actual lightning on the map, causing fires and such, but since such effects
 * only manifest properly near the player due to the "reality bubble", this was causing undesired metagame tactics
 * such as players leaving their shelter for a more "expendable" area during lightning storms.
 */
void weather_effect::lightning()
{
    thunder();
    if(one_in(LIGHTNING_CHANCE)) {
        if(g->get_levz() >= 0) {
            add_msg(_("A flash of lightning illuminates your surroundings!"));
            sfx::play_variant_sound("environment", "thunder_near", 100, rng(0, 359));
            g->lightning_active = true;
        }
    } else {
        g->lightning_active = false;
    }
}
Пример #3
0
void
Thunderstorm::update(float )
{
  if (!running) return;
  if (time_to_thunder.check()) {
    thunder();
    time_to_lightning.start(LIGHTNING_DELAY);
  }
  if (time_to_lightning.check()) {
    lightning();
    time_to_thunder.start(interval);
  }
}
Пример #4
0
void weather_effect::lightning(game *g)
{
 thunder(g);
 if (one_in(LIGHTNING_CHANCE)) {
  std::vector<point> strike;
  for (int x = g->u.posx - SEEX * 2; x <= g->u.posx + SEEX * 2; x++) {
   for (int y = g->u.posy - SEEY * 2; y <= g->u.posy + SEEY * 2; y++) {
    if (g->m.move_cost(x, y) == 0 && g->m.is_outside(x, y))
     strike.push_back(point(x, y));
   }
  }
  point hit;
  if (strike.size() > 0) {
   hit = strike[rng(0, strike.size() - 1)];
   g->add_msg(_("Lightning strikes nearby!"));
   g->explosion(hit.x, hit.y, 10, 0, one_in(4));
  }
 }
}
Пример #5
0
void battle(s_player *player1, s_monster *monster1){
  char *entree_clavier;

  while (1){
    if (player1->pv <= 0){
      my_putstr("\nYou Are a looser\n");
      return;
    }
    else if (monster1->pv <= 0){
      my_putstr("\nYou Are a great Winner\n");
      return;
    }
    my_putstr("\nplayer : => ");
    entree_clavier = readLine();

    if ((my_strcmp(entree_clavier,"help") == 0))  	
      aff_help();
    else if ((my_strcmp(entree_clavier,"stat") == 0)) 
      stat(player1);     
    else if ((my_strcmp(entree_clavier,"libra") == 0))  	
      libra(player1, monster1);
    else if ((my_strcmp(entree_clavier,"attack") == 0)){ 
      attack(player1, monster1);
      rand_attack(player1, monster1);      
    }
    else if ((my_strcmp(entree_clavier,"fire") == 0)){ 
      fire(player1, monster1);
      rand_attack(player1, monster1);
    }
    else if ((my_strcmp(entree_clavier,"slash") == 0)){ 
      slash(player1, monster1);
      rand_attack(player1, monster1);
    }
    else if ((my_strcmp(entree_clavier,"thunder") == 0)){ 
      thunder(player1, monster1);
      rand_attack(player1, monster1);
    }
    else if ((my_strcmp(entree_clavier,"quit") == 0))  	
      return;
    else
      my_putstr("\nkeyboard entry wrong tap help\n");
  }
}
Пример #6
0
void weather_effect::lightning(game *g)
{
thunder(g);
}
Пример #7
0
int qml_interface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0:
            itFogz();
            break;
        case 1:
            destroyAll();
            break;
        case 2:
            fair();
            break;
        case 3:
            pCloudy();
            break;
        case 4:
            cloudy();
            break;
        case 5:
            rain();
            break;
        case 6:
            thunder();
            break;
        case 7:
            snow();
            break;
        case 8:
            updateSlot();
            break;
        case 9:
            replyFinished((*reinterpret_cast< QNetworkReply*(*)>(_a[1])));
            break;
        case 10: {
            QString _r = getWindSpeed();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 11: {
            QString _r = getWindDirection();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 12: {
            QString _r = getTemperature();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 13: {
            QString _r = getTime();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 14: {
            QString _r = depsurx();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 15: {
            QString _r = arvsurx();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 16: {
            QString _r = depsury();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 17: {
            QString _r = arvsury();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 18: {
            QString _r = depsurz();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 19: {
            QString _r = arvsurz();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 20: {
            QString _r = getNextUpdate();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 21: {
            QString _r = getFrequence();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 22: {
            QString _r = getSymbol();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        case 23:
            ItFogs();
            break;
        case 24: {
            int _r = getPositionCiel();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r;
        }
        break;
        case 25:
            setSymbol();
            break;
        case 26: {
            QString _r = getRandomInteger();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r;
        }
        break;
        default:
            ;
        }
        _id -= 27;
    }
#ifndef QT_NO_PROPERTIES
    else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0:
            *reinterpret_cast< Forecast*>(_v) = getCurrentForecast();
            break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::WriteProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 1;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Пример #8
0
int main(){
    
    Vector2 startPosition(300, 500);
    Vector2 startDirection(0, -1);
    
    /* This list is used to store all user emmitted active missiles */
    MissileList enemy2Missiles;
    MissileList playerMissiles;
    
    /* Create the thunder */
    Thunder thunder(startPosition, startDirection);
    thunder.setVelocity(5);
    thunder.SwitchWeapon(BULLET, playerMissiles);
    
    Plane *player;
    player = &thunder;
    
    /* Create the boss */
    LazerEnemy enemy2(Vector2(300, 0), Vector2(0,1));
    enemy2.Init(enemy2Missiles);
    enemy2.setVelocity(15);
    Plane *enemy;
    enemy = &enemy2;
  
    
    FsOpenWindow(0,0,WINDOW_WID,WINDOW_HEI,1);
    glClearColor(0.1, 0.1, 0.1, 1);
    
    bool running = true;
    int i = 0;
    int cntDown = 0;
    
    while(running)
    {
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
        FsPollDevice();
        
        int key=FsInkey();
        int lb, mb, rb, mx, my;
        int mouse = FsGetMouseEvent(lb, mb, rb, mx, my);
        
        if(FSKEY_ESC==key) {
            running=false;
            break;
        } else if (FSKEY_UP == key) {
            /* UP for power up */
            ((Thunder *)player)->PowerUp(playerMissiles);
        }
        if (FSMOUSEEVENT_RBUTTONDOWN == mouse) {
            /* Right click for switch between 3 types of weapons */
            i = (i+1) % 3;
            ((Thunder *)player)->SwitchWeapon((MissileType)i, playerMissiles);
        }
        
        /* Thunder: shoot and cool down weapon. */
        player->Shoot(mouse, playerMissiles);
        player->CoolDown();
        
        /* Thunder: move and draw. */
        player->Move(1.0);
        player->Draw();
        
        /* Draw the enemy */
        enemy->Aim(player);
        printf("before move\n");
        enemy->Move(0.4);
        printf("after move\n");
        enemy->Draw();
        /* Enemy fire */
        ((LazerEnemy *)enemy)->Shoot(enemy2Missiles);
        enemy->CoolDown();
        
        if (enemy->CheckHit(playerMissiles) == 1) {
            ((LazerEnemy *)enemy)->Disappear(enemy2Missiles);
            cntDown = 100;
        }
        
        /* Stay for a while after boss die */
        if (cntDown > 0) {
            cntDown--;
            if (cntDown == 0)
                running = false;
        }
        
        /* traverse the missiles list, move missile */
        MissileNode *node;
        node = enemy2Missiles.getFront();
        while(node) {
            node->dat->Move(1.0);
            
            if (!node->dat->CheckInWindow()) {
                node = enemy2Missiles.Delete(node);
            } else {
                node = node->next;
            }
        }
        node = playerMissiles.getFront();
        while(node) {
            node->dat->Move(1.0);
            
            if (!node->dat->CheckInWindow()) {
                node = playerMissiles.Delete(node);
            } else {
                node = node->next;
            }
        }
        
        FOR_EACH(node, enemy2Missiles) {
            node->dat->Draw();
        }
        FOR_EACH(node, playerMissiles) {
            node->dat->Draw();
        }
        PrintPower(((LazerEnemy *)enemy)->getLife());
        FsSwapBuffers();
        FsSleep(25);
    }
    
    return 0;
}