示例#1
0
void process_armageddon(void)
{
    struct PlayerInfo *player;
    struct Dungeon *dungeon;
    struct Thing *heartng;
    long i;
    SYNCDBG(6,"Starting");
    //_DK_process_armageddon(); return;
    if (game.armageddon_cast_turn == 0)
        return;
    if (game.armageddon.count_down+game.armageddon_cast_turn > game.play_gameturn)
    {
        if (player_cannot_win(game.armageddon_caster_idx))
        {
            // Stop the armageddon if its originator is just losing
            game.armageddon_cast_turn = 0;
        }
    } else
    if (game.armageddon.count_down+game.armageddon_cast_turn == game.play_gameturn)
    {
        for (i=0; i < PLAYERS_COUNT; i++)
        {
            player = get_player(i);
            if (player_exists(player))
            {
              if (player->field_2C == 1)
                reveal_whole_map(player);
            }
        }
    } else
    if (game.armageddon.count_down+game.armageddon_cast_turn < game.play_gameturn)
    {
        for (i=0; i < PLAYERS_COUNT; i++)
        {
            player = get_player(i);
            if ( (player_exists(player)) && (player->field_2C == 1) )
            {
                dungeon = get_dungeon(player->id_number);
                if ((player->victory_state == VicS_Undecided) && (dungeon->num_active_creatrs == 0))
                {
                    event_kill_all_players_events(i);
                    set_player_as_lost_level(player);
                    if (is_my_player_number(i))
                        LbPaletteSet(engine_palette);
                    heartng = get_player_soul_container(player->id_number);
                    if (thing_exists(heartng)) {
                        heartng->health = -1;
                    }
                }
            }
        }
    }
}
示例#2
0
void activate_dungeon_special(struct Thing *cratetng, struct PlayerInfo *player)
{
  SYNCDBG(6,"Starting");
  short used;
  struct Coord3d pos;
  int spkindidx;

  // Gathering data which we'll need if the special is used and disposed.
  memcpy(&pos,&cratetng->mappos,sizeof(struct Coord3d));
  spkindidx = cratetng->model - 86;
  used = 0;
  if (thing_exists(cratetng) && is_dungeon_special(cratetng))
  {
    switch (cratetng->model)
    {
        case 86:
          reveal_whole_map(player);
          remove_events_thing_is_attached_to(cratetng);
          used = 1;
          delete_thing_structure(cratetng, 0);
          break;
        case 87:
          start_resurrect_creature(player, cratetng);
          break;
        case 88:
          start_transfer_creature(player, cratetng);
          break;
        case 89:
          if (steal_hero(player, &cratetng->mappos))
          {
            remove_events_thing_is_attached_to(cratetng);
            used = 1;
            delete_thing_structure(cratetng, 0);
          }
          break;
        case 90:
          multiply_creatures(player);
          remove_events_thing_is_attached_to(cratetng);
          used = 1;
          delete_thing_structure(cratetng, 0);
          break;
        case 91:
          increase_level(player);
          remove_events_thing_is_attached_to(cratetng);
          used = 1;
          delete_thing_structure(cratetng, 0);
          break;
        case 92:
          make_safe(player);
          remove_events_thing_is_attached_to(cratetng);
          used = 1;
          delete_thing_structure(cratetng, 0);
          break;
        case 93:
          activate_bonus_level(player);
          remove_events_thing_is_attached_to(cratetng);
          used = 1;
          delete_thing_structure(cratetng, 0);
          break;
        default:
          ERRORLOG("Invalid dungeon special (Model %d)", (int)cratetng->model);
          break;
      }
      if ( used )
      {
        if (is_my_player(player))
          output_message(special_desc[spkindidx].speech_msg, 0, true);
        create_special_used_effect(&pos, player->id_number);
      }
  }
}