void IvBox::updateHiddenPowerSelection() { QList<QStringList> possibilities = HiddenPowerInfo::PossibilitiesForType(calculateHiddenPowerType(), poke().gen()); while (ui->hpchoice->rowCount() > 0) { ui->hpchoice->removeRow(0); } foreach(QStringList s, possibilities) { int c = ui->hpchoice->rowCount(); ui->hpchoice->insertRow(c); if(poke().num().pokenum == Pokemon::Xerneas || poke().num().pokenum == Pokemon::Yveltal || poke().num().pokenum == Pokemon::Zygarde) { int numFlawless = 0; for (int i = 0; i < 6; i++) { if(s[i].toInt() == 31) { numFlawless++; } } if(numFlawless < 3) { ui->hpchoice->removeRow(c); } } if(ui->hpchoice->rowCount() == c + 1) { for (int i = 0; i < 6; i++) { ui->hpchoice->setItem(c, i, new QTableWidgetItem(s[i])); } } }
void IvBox::updateHiddenPower() { ui->hiddenPowerPower->setText(tr("(%1 pow)").arg(QString::number(calculateHiddenPowerPower()))); int type = calculateHiddenPowerType(); ui->hiddenPowerType->setCurrentIndex(type - 1); updateHiddenPowerSelection(); }
void IvBox::changeHiddenPower(int newType) { newType += 1; if (newType == calculateHiddenPowerType()) { return; } QStringList possibility = HiddenPowerInfo::PossibilitiesForType(newType).front(); for (int i = 0; i < std::max(6, possibility.size()); i++) { poke().setDV(i, possibility[i].toInt()); } updateIVs(); }
void IvBox::updateHiddenPower() { ui->hiddenPowerPower->setText("Power: " + QString::number(calculateHiddenPowerPower())); int type = calculateHiddenPowerType(); ui->hiddenPowerType->setCurrentIndex(type - 1); }