Advertisement
Guest User

mainwindow.coreradio

a guest
Sep 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include "newgame.h"
  4. #include "painttab.h"
  5.  
  6. #include<QLineEdit>
  7. #include<QComboBox>
  8. #include <QMessageBox>
  9. #include<QPainter>
  10.  
  11. namespace GAME
  12. {
  13.  
  14. MainWindow::MainWindow(QWidget *parent) :
  15.     QMainWindow(parent),
  16.     ui(new Ui::MainWindow)
  17. {
  18.     ui->setupUi(this);
  19.  
  20.     setWindowTitle("one button clicker");
  21.  
  22.     setFixedSize(size());
  23.  
  24.     connect(this, SIGNAL(StartFormChanged()), this, SLOT(setStartForm()));
  25.     connect(this, SIGNAL(reasonDisabledMoveBtn(const QString &)), this, SLOT(disableMoveBtn(const QString &)));
  26.     connect(this, SIGNAL(FormChanged()), this, SLOT(setForm()));
  27.     connect(this, SIGNAL(endgame()), this, SLOT(calcwinner()));
  28.    // connect(this, SIGNAL(newgame()), this, SLOT(on_actionNew_game_triggered()));
  29. }
  30.  
  31. MainWindow::~MainWindow()
  32. {
  33.     delete ui;
  34. }
  35.  
  36. void MainWindow::on_actionQuit_triggered()
  37. {
  38.     qApp->exit();
  39. }
  40.  
  41. void MainWindow::on_actionNew_game_triggered()
  42. {
  43.     srand(time(0));
  44.  
  45.     NewGame ng;
  46.     if(ng.exec() == QDialog::Accepted)
  47.     {
  48.        ng.names[0] = ng.player1->text();
  49.        ng.names[1] = ng.player2->text();
  50.  
  51.        switch(ng.choose1->currentIndex())
  52.        {
  53.            case WIZARD:  ng.choises[0] = 'w';
  54.                     break;
  55.            case WARRIOR: ng.choises[0] = 'b';
  56.                     break;
  57.            case ASSASIN: ng.choises[0] = 'a';
  58.                     break;
  59.        }
  60.  
  61.        switch(ng.choose2->currentIndex())
  62.        {
  63.            case WIZARD:  ng.choises[1] = 'w';
  64.                     break;
  65.            case WARRIOR: ng.choises[1] = 'b';
  66.                     break;
  67.            case ASSASIN: ng.choises[1] = 'a';
  68.                     break;
  69.        }
  70.     }
  71.     else
  72.         return;
  73.  
  74.     Data = new field(ng.names, ng.choises);
  75.  
  76.     Data->a_pos = Data->tmpPosForReset = rand()%2;
  77.     Data->d_pos = !Data->a_pos;
  78.  
  79.  
  80.     emit StartFormChanged();
  81. }
  82.  
  83. void MainWindow::setStartForm()
  84. {
  85.     ui->battle_log->clear();
  86.  
  87.    for(int i=0; i<2; ++i)
  88.         tabs.push_back(new PaintTab);
  89.  
  90.     for(int i=0; i<2; i++)
  91.     {
  92.         if(Data->p[i]->get_initchar() == WIZARD)
  93.         {
  94.             tabs[i]->colorForPoints = Qt::GlobalColor::blue;
  95.             tabs[i]->colorForShield = Qt::GlobalColor::white;
  96.             tabs[i]->points->setText("mana\npoints");
  97.         }
  98.         else
  99.         {
  100.             tabs[i]->colorForPoints = Qt::GlobalColor::white;
  101.             tabs[i]->colorForShield = Qt::GlobalColor::white;
  102.  
  103.             if(Data->p[i]->get_initchar() == WARRIOR)
  104.             {
  105.                 tabs[i]->colorForShield = Qt::GlobalColor::magenta;
  106.                 tabs[i]->points->setText("fury\npoints");
  107.             }
  108.  
  109.             if(Data->p[i]->get_initchar() == ASSASIN)
  110.                 tabs[i]->points->setText("dark\npoints");
  111.         }
  112.     }
  113.  
  114.     ui->class1->addTab(tabs.at(0), "view");
  115.     ui->class2->addTab(tabs.at(1), "view");
  116.  
  117.     clearSpellBox();
  118.  
  119.   //  for(int i=0;i<2;++i)
  120.   //      tabs[i]->update();
  121.  
  122.     ui->lbl_round_2->setNum(Data->get_roundcount());
  123.  
  124.     if(ui->btn_make_attack->text() == "Skip!")
  125.         ui->btn_make_attack->setText("Attack!");
  126.  
  127.     ui->lbl_move_info->setText("");
  128.  
  129.     ui->actionClear_form->setEnabled(true);
  130.  
  131.     ui->lbl_move->setText(Data->p[Data->a_pos]->get_name() + " makes a move:");
  132.  
  133.     ui->lbl_name1->setText(Data->p[0]->get_name());
  134.     ui->lbl_name2->setText(Data->p[1]->get_name());
  135.  
  136.     ui->btn_make_attack->setEnabled(false);
  137.     ui->spellBox->setEnabled(false);
  138.  
  139.     if(Data->p[Data->a_pos]->get_initchar() == WARRIOR || Data->p[Data->a_pos]->get_initchar() == ASSASIN)
  140.         ui->btn_make_attack->setEnabled(true);
  141.  
  142.     if(Data->p[Data->a_pos]->get_initchar() == WIZARD)
  143.         ui->spellBox->setEnabled(true);
  144.  
  145.     switch(Data->p[0]->get_initchar())
  146.     {
  147.        case WARRIOR: ui->lbl_class1_2->setText("Warrior"); break;
  148.        case WIZARD:  ui->lbl_class1_2->setText("Wizard");  break;
  149.        case ASSASIN: ui->lbl_class1_2->setText("Assasin"); break;
  150.     }
  151.  
  152.     switch(Data->p[1]->get_initchar())
  153.     {
  154.        case WARRIOR: ui->lbl_class2_2->setText("Warrior"); break;
  155.        case WIZARD:  ui->lbl_class2_2->setText("Wizard");  break;
  156.        case ASSASIN: ui->lbl_class2_2->setText("Assasin"); break;
  157.     }
  158.  
  159.    setPrimaryParam();
  160.  
  161.    ui->lbl_dmg1_2->setNum(Data->p[0]->get_damage());
  162.    ui->lbl_dmg2_2->setNum(Data->p[1]->get_damage());
  163.  
  164.    if(Data->p[0]->get_initchar() == WIZARD)
  165.       ui->lbl_md1_2->setNum(static_cast<Wizard*>(Data->p[0])->get_magic_damage());
  166.    else
  167.       ui->lbl_md1_2->setText("none");
  168.  
  169.    if(Data->p[1]->get_initchar() == WIZARD)
  170.        ui->lbl_md2_2->setNum(static_cast<Wizard*>(Data->p[1])->get_magic_damage());
  171.    else
  172.       ui->lbl_md2_2->setText("none");
  173.  
  174.    if(Data->p[0]->get_initchar() == WIZARD)
  175.        ui->lbl_other1_2->setText("It's hard to win!\n\nmagic damage: cost - 17 mp,\ncooldown - 2 rounds\n\nmagic shield: cost - 30mp,\ncooldown - 3 rounds\n\nrestore mana:\ncooldown - 3 rounds");
  176.    else if(Data->p[0]->get_initchar() == ASSASIN)
  177.        ui->lbl_other1_2->setText("ability: dark contract -\ncreates an antimagic shield\n\nability: critical hit -\nwith a 50% chance to deal\n150% damage");
  178.    else
  179.        ui->lbl_other1_2->setText("ability: Skin of ancestors -\nreduction of physical damage\ntaken by 15%,\nincrease in magic damage\ntaken by 20%\n\nability: rage of blood -\nthe player becomes enraged\nand stuns the enemy,\nrestoring his armor");
  180.  
  181.    if(Data->p[1]->get_initchar() == WIZARD)
  182.        ui->lbl_other2_2->setText("It's hard to win!\n\nmagic damage: cost - 17 mp,\ncooldown - 2 rounds\n\nmagic shield: cost - 30mp,\ncooldown - 3 rounds\n\nrestore mana:\ncooldown - 3 rounds");
  183.    else if(Data->p[1]->get_initchar() == ASSASIN)
  184.        ui->lbl_other2_2->setText("ability: dark contract -\ncreates an antimagic shield\n\nability: critical hit -\nwith a 50% chance to deal\n150% damage");
  185.    else
  186.        ui->lbl_other2_2->setText("ability: Skin of ancestors -\nreduction of physical damage\ntaken by 15%,\nincrease in magic damage\ntaken by 20%\n\nability: rage of blood -\nthe player becomes enraged\nand stuns the enemy,\nrestoring his armor");
  187. }
  188.  
  189. void MainWindow::on_actionReset_game_triggered()
  190. {
  191.     Data->count = 1;
  192.  
  193.     ui->actionReset_game->setEnabled(false);
  194.     ui->actionClear_form->setEnabled(false);
  195.  
  196.     ui->battle_log->clear();
  197.  
  198.     Data->a_pos = Data->tmpPosForReset;
  199.     Data->d_pos = !Data->a_pos;
  200.  
  201.     Data->message = "";
  202.  
  203.     for(auto & x: Data->p)
  204.     {
  205.         x->health = x->get_max_health();
  206.         x->set_shield_is_active(false);
  207.  
  208.         if(x->get_initchar() == WARRIOR)
  209.         {
  210.             x->set_shield(x->get_max_shield());
  211.             x->set_points(0);
  212.             static_cast<Warrior*>(x)->enemyStanCount = 0;
  213.         }
  214.  
  215.         if(x->get_initchar() == WIZARD)
  216.         {
  217.             x->set_shield(0);
  218.             x->set_points(x->get_max_points());
  219.             std::fill(static_cast<Wizard*>(x)->Counts.begin(), static_cast<Wizard*>(x)->Counts.end(), 0);
  220.         }
  221.  
  222.         if(x->get_initchar() == ASSASIN)
  223.         {
  224.             x->set_shield(0);
  225.             x->set_points(0);
  226.             static_cast<Assasin*>(x)->critical = static_cast<Assasin*>(x)->orignCritical;
  227.         }
  228.     }
  229.  
  230.     emit FormChanged();
  231. }
  232.  
  233.  
  234. void MainWindow::disableMoveBtn(const QString & reason)
  235. {
  236.     ui->lbl_move_info->setText(reason);
  237.     ui->btn_make_attack->setEnabled(false);
  238. }
  239.  
  240.  
  241. void MainWindow::on_btn_make_attack_clicked()
  242. {
  243.     if(Data->p[Data->a_pos]->get_initchar() == WIZARD)
  244.     {
  245.         if(ui->btn_mag_attack->isChecked())
  246.             static_cast<Wizard *>(Data->p[Data->a_pos])->set_count_magic_damage(5); // 2 раунда перезарядки
  247.  
  248.         if(ui->btn_shield->isChecked())
  249.             static_cast<Wizard *>(Data->p[Data->a_pos])->set_count_shield(7); // 3 раунда перезарядки
  250.  
  251.         if(ui->btn_res_mana->isChecked())
  252.              static_cast<Wizard *>(Data->p[Data->a_pos])->set_count_restore_mana(7); // 3 раунда перезарядки
  253.     }
  254.  
  255.     bool result = Data->get_move();
  256.  
  257.     graphicTabHadler();
  258.  
  259.     Data->a_pos = !Data->a_pos;
  260.     Data->d_pos = !Data->d_pos;  
  261.     Data->inc_count();
  262.  
  263.      emit FormChanged();
  264.  
  265.     if(result)
  266.         emit endgame();
  267. }
  268.  
  269. void MainWindow::setForm()
  270. {
  271.     clearSpellBox();
  272.  
  273.     if(Data->count == 1)
  274.         ui->actionClear_form->setEnabled(true);
  275.  
  276.     if(Data->count == 2)
  277.        ui->actionReset_game->setEnabled(true);
  278.  
  279.     ui->lbl_round_2->setNum(Data->get_roundcount());
  280.  
  281.     ui->lbl_move->setText(Data->p[Data->a_pos]->get_name() + " makes a move:");
  282.  
  283.     setPrimaryParam();
  284.  
  285.     ui->spellBox->setEnabled(false);
  286.  
  287.     if(ui->btn_make_attack->text() == "Skip!")
  288.         ui->btn_make_attack->setText("Attack!");
  289.  
  290.     if(Data->p[Data->a_pos]->get_initchar() == WIZARD)
  291.     {
  292.         ui->btn_make_attack->setEnabled(false);
  293.         ui->spellBox->setEnabled(true);
  294.     }
  295.  
  296.     if(Data->p[Data->d_pos]->get_initchar() == WARRIOR)
  297.     {
  298.         if(static_cast<Warrior *>(Data->p[Data->d_pos])->enemyStanCount > 0)
  299.         {
  300.             ui->btn_make_attack->setText("Skip!");
  301.  
  302.             if(Data->p[Data->a_pos]->get_initchar() == WIZARD)
  303.             {
  304.                 ui->btn_make_attack->setEnabled(true);
  305.                 ui->spellBox->setEnabled(false);
  306.             }
  307.         }
  308.     }
  309.  
  310.  // for(int i=0; i<2; ++i)
  311.   //    tabs[i]->update();
  312.  
  313.     QObject * obj = sender();
  314.  
  315.     if(obj != ui->actionReset_game)
  316.         ui->battle_log->append(Data->message + "\n\n");
  317. }
  318.  
  319. void MainWindow::calcwinner()
  320. {
  321.     QMessageBox msgBox;
  322.     msgBox.setWindowTitle("victory!");
  323.     msgBox.setText(Data->calc_winner());
  324.     msgBox.setInformativeText("Try again?");
  325.     msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
  326.     msgBox.setDefaultButton(QMessageBox::Ok);
  327.     int ret = msgBox.exec();
  328.  
  329.     switch(ret)
  330.     {
  331.         case QMessageBox::Ok:     on_actionNew_game_triggered(); break;
  332.         case QMessageBox::Cancel: on_actionClear_form_triggered();  break;
  333.     }
  334. }
  335.  
  336. void MainWindow::on_btn_attack_clicked()
  337. {
  338.     ui->lbl_move_info->clear();
  339.     ui->btn_make_attack->setEnabled(true);
  340.     static_cast<Wizard *>(Data->p[Data->a_pos])->CurrentSpell = DAMAGE;
  341. }
  342.  
  343. void MainWindow::on_btn_mag_attack_clicked()
  344. {
  345.     ui->btn_make_attack->setEnabled(false);
  346.  
  347.     if(static_cast<Wizard *>(Data->p[Data->a_pos])->get_count_magic_damage() == 0)
  348.     {
  349.        if(Data->p[Data->a_pos]->get_points() >= GAME::MDCOST)
  350.        {
  351.           ui->lbl_move_info->clear();
  352.           static_cast<Wizard *>(Data->p[Data->a_pos])->CurrentSpell = MAGICDAMAGE;
  353.           ui->btn_make_attack->setEnabled(true);
  354.        }
  355.        else
  356.          emit reasonDisabledMoveBtn("Your manapoints hits too low,\nplease choise another spell!");
  357.     }
  358.     else
  359.         emit reasonDisabledMoveBtn("Your spells is not ready,\nplease choise another spell!");
  360. }
  361.  
  362. void MainWindow::on_btn_shield_clicked()
  363. {
  364.     ui->btn_make_attack->setEnabled(false);
  365.  
  366.     if(static_cast<Wizard *>(Data->p[Data->a_pos])->get_count_shield() == 0)
  367.     {
  368.        if(Data->p[Data->a_pos]->get_points() >= SHIELDCOST)
  369.        {
  370.           ui->lbl_move_info->clear();
  371.           static_cast<Wizard *>(Data->p[Data->a_pos])->CurrentSpell = SHIELD;
  372.           ui->btn_make_attack->setEnabled(true);
  373.        }
  374.        else
  375.            emit reasonDisabledMoveBtn("Your manapoints hits too low,\nplease choise another spell!");
  376.     }
  377.     else
  378.         emit reasonDisabledMoveBtn("Your spells is not ready,\nplease choise another spell!");
  379. }
  380.  
  381. void MainWindow::on_btn_res_mana_clicked()
  382. {
  383.     ui->btn_make_attack->setEnabled(false);
  384.  
  385.     if(static_cast<GAME::Wizard *>(Data->p[Data->a_pos])->get_count_restore_mana() == 0)
  386.     {
  387.         ui->lbl_move_info->clear();
  388.         static_cast<Wizard *>(Data->p[Data->a_pos])->CurrentSpell = RESTOREMANA;
  389.         ui->btn_make_attack->setEnabled(true);
  390.     }
  391.     else
  392.         emit reasonDisabledMoveBtn("Your spells is not ready,\nplease choise another spell!");
  393. }
  394.  
  395. void MainWindow::on_actionAbout_game_triggered()
  396. {
  397.     QMessageBox::information(this, "attention!", "зашел сюда - хуев тебе пачка", QMessageBox::Ok);
  398. }
  399.  
  400.  
  401. void MainWindow::on_actionClear_form_triggered()
  402. {
  403.     delete Data;
  404.  
  405.     for(int i=0;i<2;++i)
  406.         delete tabs.at(i);
  407.  
  408.     clearSpellBox();
  409.  
  410.     ui->lbl_name1->setText("---");
  411.     ui->lbl_name2->setText("---");
  412.     ui->lbl_class1_2->setText("---");
  413.     ui->lbl_class2_2->setText("---");
  414.     ui->lbl_dmg1_2->setText("---");
  415.     ui->lbl_dmg2_2->setText("---");
  416.     ui->lbl_health1_2->setText("---");
  417.     ui->lbl_health2_2->setText("---");
  418.     ui->lbl_md1_2->setText("---");
  419.     ui->lbl_md2_2->setText("---");
  420.     ui->lbl_move->setText("---");
  421.     ui->lbl_round_2->setText("---");
  422.     ui->lbl_shield1_2->setText("---");
  423.     ui->lbl_shield2_2->setText("---");
  424.     ui->lbl_points1_2->setText("---");
  425.     ui->lbl_points2_2->setText("---");
  426.     ui->lbl_other1_2->clear();
  427.     ui->lbl_other2_2->clear();
  428.     ui->battle_log->clear();
  429.     ui->lbl_move_info->clear();
  430.  
  431.     ui->spellBox->setEnabled(false);
  432.     ui->btn_make_attack->setEnabled(false);
  433.  
  434.     ui->actionClear_form->setEnabled(false);
  435.     ui->actionReset_game->setEnabled(false);
  436. }
  437.  
  438. void MainWindow::clearSpellBox()
  439. {
  440.     if(ui->btn_attack->isChecked())
  441.     {
  442.         ui->btn_attack->setAutoExclusive(false);
  443.         ui->btn_attack->setChecked(false);
  444.         ui->btn_attack->setAutoExclusive(true);
  445.     }
  446.  
  447.     if(ui->btn_mag_attack->isChecked())
  448.     {
  449.         ui->btn_mag_attack->setAutoExclusive(false);
  450.         ui->btn_mag_attack->setChecked(false);
  451.         ui->btn_mag_attack->setAutoExclusive(true);
  452.     }
  453.  
  454.     if(ui->btn_shield->isChecked())
  455.     {
  456.         ui->btn_shield->setAutoExclusive(false);
  457.         ui->btn_shield->setChecked(false);
  458.         ui->btn_shield->setAutoExclusive(true);
  459.     }
  460.  
  461.     if(ui->btn_res_mana->isChecked())
  462.     {
  463.         ui->btn_res_mana->setAutoExclusive(false);
  464.         ui->btn_res_mana->setChecked(false);
  465.         ui->btn_res_mana->setAutoExclusive(true);
  466.     }
  467. }
  468.  
  469. void MainWindow::setPrimaryParam()
  470. {
  471.     ui->lbl_health1_2->setText(QString::number(Data->p[0]->get_health()) + "/" + QString::number(Data->p[0]->get_max_health()));
  472.     ui->lbl_health2_2->setText(QString::number(Data->p[1]->get_health()) + "/" + QString::number(Data->p[1]->get_max_health()));
  473.  
  474.     ui->lbl_shield1_2->setText(QString::number(Data->p[0]->get_shield()) + "/" + QString::number(Data->p[0]->get_max_shield()));
  475.     ui->lbl_shield2_2->setText(QString::number(Data->p[1]->get_shield()) + "/" + QString::number(Data->p[1]->get_max_shield()));
  476.  
  477.     ui->lbl_points1_2->setText(QString::number(Data->p[0]->get_points()) + "/" + QString::number(Data->p[0]->get_max_points()));
  478.     ui->lbl_points2_2->setText(QString::number(Data->p[1]->get_points()) + "/" + QString::number(Data->p[1]->get_max_points()));
  479. }
  480.  
  481. void MainWindow::graphicTabHadler()
  482. {
  483.     for(int i=0;i<2;++i)
  484.     {
  485.         tabs[i]->current_y0_0_length = tabs[i]->y_length * (Data->p[i]->get_max_health() / Data->p[i]->get_health()) - 1;
  486.         tabs[i]->current_y0_0 = tabs[i]->y0 + 1 + tabs[i]->y_length - (tabs[i]->current_y0_0_length + 1);
  487.  
  488.         tabs[i]->update();
  489.     }
  490. }
  491.  
  492. /*
  493. void MainWindow::graphicTabHadler()
  494. {      
  495.     if(Data->p[Data->a_pos]->get_initchar() == WIZARD)
  496.     {
  497.         if(static_cast<Wizard*>(Data->p[Data->a_pos])->CurrentSpell == SHIELD)
  498.         {
  499.             tabs[Data->a_pos]->colorForShield = Qt::GlobalColor::cyan;
  500.  
  501.             tabs[Data->a_pos]->current_y0_1 = tabs[Data->a_pos]->y0 + 1;
  502.             tabs[Data->a_pos]->current_y0_1_length = tabs[Data->a_pos]->y_length - 1;
  503.  
  504.             tabs[Data->a_pos]->d_y3 = (tabs[Data->a_pos]->y_length / MAX_MANA_POINTS) * SHIELDCOST;
  505.             tabs[Data->a_pos]->current_y0_2 += tabs[Data->a_pos]->d_y3;
  506.             tabs[Data->a_pos]->current_y0_2_length -= tabs[Data->a_pos]->d_y3;
  507.         }
  508.  
  509.         if(static_cast<Wizard*>(Data->p[Data->a_pos])->CurrentSpell == RESTOREMANA)
  510.         {
  511.             if(Data->p[Data->a_pos]->get_points() >= MAX_MANA_POINTS)
  512.             {
  513.                 tabs[Data->a_pos]->current_y0_2 = tabs[Data->a_pos]->y0;
  514.                 tabs[Data->a_pos]->current_y0_2_length = tabs[Data->a_pos]->y_length;
  515.             }
  516.             else
  517.             {
  518.                 tabs[Data->a_pos]->d_y3 = (tabs[Data->a_pos]->y_length / MAX_MANA_POINTS) * static_cast<Wizard*>(Data->p[Data->a_pos])->get_restored_mana();
  519.                 tabs[Data->a_pos]->current_y0_2 += tabs[Data->a_pos]->d_y3;
  520.                 tabs[Data->a_pos]->current_y0_2_length -= tabs[Data->a_pos]->d_y3;
  521.             }
  522.         }
  523.  
  524.         if(static_cast<Wizard*>(Data->p[Data->a_pos])->CurrentSpell == DAMAGE || static_cast<Wizard*>(Data->p[Data->a_pos])->CurrentSpell == MAGICDAMAGE)
  525.         {
  526.             if(static_cast<Wizard*>(Data->p[Data->a_pos])->CurrentSpell == MAGICDAMAGE)
  527.             {
  528.                 tabs[Data->a_pos]->d_y3 = (tabs[Data->a_pos]->y_length / MAX_MANA_POINTS) * MDCOST;
  529.                 tabs[Data->a_pos]->current_y0_2 += tabs[Data->a_pos]->d_y3;
  530.                 tabs[Data->a_pos]->current_y0_2_length -= tabs[Data->a_pos]->d_y3;
  531.             }
  532.  
  533.             if(Data->p[Data->a_pos]->tmp > 0)
  534.             {
  535.                 tabs[Data->d_pos]->d_y2 = Data->p[Data->a_pos]->tmp * (tabs[Data->a_pos]->y_length / Data->p[Data->d_pos]->get_max_points());
  536.                 tabs[Data->d_pos]->current_y0_1 += tabs[Data->d_pos]->d_y2;
  537.                 tabs[Data->d_pos]->current_y0_1_length -= tabs[Data->d_pos]->d_y2;
  538.             }
  539.             else if(Data->p[Data->a_pos]->tmp < 0)
  540.             {
  541.                 tabs[Data->d_pos]->colorForShield = Qt::GlobalColor::white;
  542.                 tabs[Data->d_pos]->current_y0_1 = tabs[Data->a_pos]->y0 + 1;
  543.                 tabs[Data->d_pos]->current_y0_1_length = tabs[Data->a_pos]->y_length - 1;
  544.  
  545.                 tabs[Data->d_pos]->d_y1 = Data->p[Data->a_pos]->currentDamage * (tabs[Data->a_pos]->y_length / Data->p[Data->d_pos]->get_max_health());
  546.                 tabs[Data->d_pos]->current_y0_0 += tabs[Data->d_pos]->d_y1;
  547.                 tabs[Data->d_pos]->current_y0_0_length -= tabs[Data->d_pos]->d_y1;
  548.             }
  549.             else
  550.             {
  551.                 tabs[Data->d_pos]->d_y1 = Data->p[Data->a_pos]->currentDamage * (tabs[Data->a_pos]->y_length / Data->p[Data->d_pos]->get_max_health());
  552.                 tabs[Data->d_pos]->current_y0_0 += tabs[Data->d_pos]->d_y1;
  553.                 tabs[Data->d_pos]->current_y0_0_length -= tabs[Data->d_pos]->d_y1;
  554.             }
  555.         }
  556.     }
  557.  
  558.     for(int i=0;i<2;++i)
  559.         tabs[i]->update();
  560. }
  561. */
  562. } //end of GAME
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement