Пример #1
0
void IvBox::changeIV(int newValue)
{
    int stat = sender()->property("ivstat").toInt();

    if(poke().num().pokenum == Pokemon::Xerneas || poke().num().pokenum == Pokemon::Yveltal || poke().num().pokenum == Pokemon::Zygarde) {
        int numFlawless = 6;
        for (int i = 0; i < 6; i++) {
            if(i == stat) {
                if(newValue < 31) {
                    numFlawless--;
                }
            } else if(poke().DV(i) < 31) {
                numFlawless--;
            }
        }
        if(numFlawless < 3) {
            newValue = 31;
            QMessageBox::information(NULL, tr("Invalid IVs"), tr("%1 must have at least 3 flawless IVs.").arg(PokemonInfo::Name(poke().num().pokenum)));
            m_ivchangers[stat]->setValue(31);
        }
    }


    if(poke().DV(stat) != newValue) {
        poke().setDV(stat, newValue);
        updateIVs();
        updateHiddenPower();
    }
}
Пример #2
0
void IvBox::changeIV(int newValue)
{
    int stat = sender()->property("ivstat").toInt();
    if(poke().DV(stat) != newValue) {
        poke().setDV(stat, newValue);
        updateIVs();
        updateHiddenPower();
    }
}
Пример #3
0
void IvBox::updateAll()
{
    updateIVs();
    updateStats();

    updateHiddenPower();

    if (poke().gen() <= 2) {
        ui->hpivspin->setDisabled(true);
        ui->spdefivspin->setDisabled(true);
        ui->hpchoice->hide();

        for (int i = 0; i < 6; i++) {
            m_ivchangers[i]->setRange(0, 15);
        }
    } else {
        ui->hpivspin->setDisabled(false);
        ui->spdefivspin->setDisabled(false);
        ui->hpchoice->show();

        for (int i = 0; i < 6; i++) {
            m_ivchangers[i]->setRange(0, 31);
        }
    }

    if (poke().gen() <= 1) {
        ui->hiddenPowerPower->setVisible(false);
        ui->hiddenPowerTitle->setVisible(false);
        ui->hiddenPowerType->setVisible(false);

        ui->spdefivdesc->hide();
        ui->spdefivlabel->hide();
        ui->spdefivspin->hide();
        ui->spattivdesc->setText(tr("Special: "));
    } else {
        if (poke().gen() > 2) {
            ui->finalStats->setTitle(tr("&IVs"));
        }
        ui->hiddenPowerPower->setVisible(poke().gen() <= 5);
        ui->hiddenPowerTitle->setVisible(true);
        ui->hiddenPowerType->setVisible(true);

        ui->spdefivdesc->setVisible(true);
        ui->spdefivlabel->setVisible(true);
        ui->spdefivspin->setVisible(true);
        ui->spattivdesc->setText(tr("Sp. Atk: "));
    }
}
Пример #4
0
void IvBox::updateAll()
{
    // Abilities.

    for(int i = 0; i < 3; i++) {
        if(poke().abilities().ab(i) != 0 && poke().gen() >= 3 && (i == 0 || poke().abilities().ab(i) != poke().abilities().ab(0))) {
            m_abilities[i]->setVisible(true);
            m_abilities[i]->setText(AbilityInfo::Name(poke().abilities().ab(i)));
            m_abilities[i]->setToolTip(AbilityInfo::Desc(poke().abilities().ab(i)));

            if (poke().abilities().ab(i) == poke().ability()) {
                m_abilities[i]->setChecked(true);
            }
        } else {
             m_abilities[i]->setVisible(false);
        }
    }
    updateIVs();
    updateStats();
    updateHiddenPower();

    if (poke().gen() <= 2) {
        ui->abilityTitle->setVisible(false);

        ui->hpivspin->setDisabled(true);
        ui->spdefivspin->setDisabled(true);

        for (int i = 0; i < 6; i++) {
            m_ivchangers[i]->setRange(0, 15);
        }
    } else {
        ui->abilityTitle->setVisible(true);

        ui->hpivspin->setDisabled(false);
        ui->spdefivspin->setDisabled(false);

        for (int i = 0; i < 6; i++) {
            m_ivchangers[i]->setRange(0, 31);
        }
    }

    if (poke().gen() <= 1) {
        ui->hiddenPowerPower->setVisible(false);
        ui->hiddenPowerTitle->setVisible(false);
        ui->hiddenPowerType->setVisible(false);

        ui->spdefivdesc->hide();
        ui->spdefivlabel->hide();
        ui->spdefivspin->hide();
        ui->spattivdesc->setText(tr("Special: "));
    } else {
        ui->hiddenPowerPower->setVisible(true);
        ui->hiddenPowerTitle->setVisible(true);
        ui->hiddenPowerType->setVisible(true);

        ui->spdefivdesc->setVisible(true);
        ui->spdefivlabel->setVisible(true);
        ui->spdefivspin->setVisible(true);
        ui->spattivdesc->setText(tr("Sp. Atk: "));
    }
}