Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
新增單ARC升到滿級的日期計算
Browse files Browse the repository at this point in the history
- 修正ARC升級資訊計算數值錯誤
- 簡化程式碼
  • Loading branch information
WhatTheBlock committed Jun 3, 2022
1 parent 4e52870 commit 3ebc4d7
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 89 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ UI介面:
Changelog:
----

#### v2.9-alpha.3 (僅支援v244以後的版本)
#### v2.9-alpha.4 (僅支援v244以後的版本)
- 新增AUT升級楓幣計算
- 新增AUT傷害計算
- 升級所需楓幣功能重構
- 更新屬性增加量比率
- 新增單ARC升到滿級的日期計算
- 新增快捷鍵
- 新增快捷功能說明 (左右鍵或滑鼠滾輪可切換頁面)
- 升級所需楓幣功能重構
- 更新屬性增加量比率
- 重新設計"其他功能"頁面
- 修正阿爾卡娜圖示左偏的問題
- 修正ARC升級資訊楓幣數值計算錯誤
Expand Down
99 changes: 48 additions & 51 deletions calculate.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "mainui.h"

//更新各ARC的升級資訊
void MainUI::updateArcToolTips(QLabel* arcimg, int arc, int lv) {
void MainUI::updateArcToolTips(QLabel* arcimg, int arc) {
dailyTask();

int dailyGet[6] = { 0 };
Expand All @@ -28,68 +28,65 @@ void MainUI::updateArcToolTips(QLabel* arcimg, int arc, int lv) {
mobbingMission[4] = D230_MOB;
mobbingMission[5] = D235_MOB;

int arcLv = ArcLV[arc]->value();
int characterLV = ui->characterLV->value();
int arcVal = ArcCurrent[arc]->value();
int arcVal_max = arcUpgradeList[arcLv - 1] + arcVal;
int target = ArcUpgrade[arc]->text().toInt();
int target_max = ARCMAXTOTAL;

//升級所需楓幣
arcUpgradeMeso[arc] = (lv != 99) ? arcUpgradeCost(arc, lv, lv + 1) : 0;
//升級 & 滿級所需楓幣
arcUpgradeMeso[arc] = arcUpgradeCost(arc, arcLv, arcLv + 1);
arcUpgradeMeso_max[arc] = arcUpgradeCost(arc, arcLv, ARCMAXLV);

//升級 & 滿級所需天數
int temp = ArcCurrent[arc]->value();
arcUpgradeDays[arc] = 0;
arcMaxDays[arc] = 0;

bool invalid = false;
if(arcLv == 0 || (dailyGet[arc] == 0 && !mobbingMissionState[arc])) {
arcimg->setToolTip(QStringLiteral("升級所需楓幣:?\n升級所需天數:?\n升級日期:?\n-\n滿級所需楓幣:?\n滿級所需天數:?\n滿級日期:?"));
}
else {
if(arc == 2) {
arcVal *= ARC_TO_COIN_220;
arcVal_max *= ARC_TO_COIN_220;
target *= ARC_TO_COIN_220;
target_max *= ARC_TO_COIN_220;
}
else if(arc == 3) {
arcVal *= ARC_TO_COIN_225;
arcVal_max *= ARC_TO_COIN_225;
target *= ARC_TO_COIN_225;
target_max *= ARC_TO_COIN_225;
}

switch (arc) {
case 2:
temp *= ARC_TO_COIN_220;
while(temp < ArcUpgrade[arc]->text().toInt() * ARC_TO_COIN_220) {
if(dailyGet[arc] == 0 && !mobbingMissionState[arc]) {
invalid = true;
break;
}
else {
if(mobbingMissionState[arc]) temp += mobbingMission[arc];
temp += dailyGet[arc];
arcUpgradeDays[arc]++;
}
} break;
case 3:
temp *= ARC_TO_COIN_225;
while(temp < ArcUpgrade[arc]->text().toInt() * ARC_TO_COIN_225) {
if(dailyGet[arc] == 0 && !mobbingMissionState[arc]) {
invalid = true;
break;
while(arcVal < target) {
if(mobbingMissionState[arc]) {
arcVal += mobbingMission[arc];
if(arc == 0 && characterLV >= 205) arcVal += D205_MOB;
else if(arc == 1 && characterLV >= 215) arcVal += D215_MOB;
}
else {
if(mobbingMissionState[arc]) temp += mobbingMission[arc];
temp += dailyGet[arc];
arcUpgradeDays[arc]++;
}
} break;
default:
while(temp < ArcUpgrade[arc]->text().toInt()) {
if(dailyGet[arc] == 0 && !mobbingMissionState[arc]) {
invalid = true;
break;
}
else {
if(mobbingMissionState[arc]) temp += mobbingMission[arc];
if(arc == 0 && characterLV >= 205) temp += D205_MOB;
else if(arc == 1 && characterLV >= 215) temp += D215_MOB;
temp += dailyGet[arc];
arcUpgradeDays[arc]++;
arcVal += dailyGet[arc];
arcUpgradeDays[arc]++;
}

while(arcVal_max < target_max) {
if(mobbingMissionState[arc]) {
arcVal_max += mobbingMission[arc];
if(arc == 0 && characterLV >= 205) arcVal_max += D205_MOB;
else if(arc == 1 && characterLV >= 215) arcVal_max += D215_MOB;
}
arcVal_max += dailyGet[arc];
arcMaxDays[arc]++;
}
}

if(invalid) arcimg->setToolTip(QStringLiteral("升級所需楓幣:?\n升級所需天數:?\n升級日期:?"));
else {
arcimg->setToolTip(
QStringLiteral("升級所需楓幣:%1\n升級所需天數:%2\n升級日期:%3")
.arg(decimalSeparator(arcUpgradeMeso[arc]))
.arg(arcUpgradeDays[arc])
.arg(ui->startDate->date().addDays(arcUpgradeDays[arc]).toString("yyyy/MM/dd"))
arcimg->setToolTip(QStringLiteral("升級所需楓幣:%1\n升級所需天數:%2\n升級日期:%3\n-\n滿級所需楓幣:%4\n滿級所需天數:%5\n滿級日期:%6")
.arg(decimalSeparator(arcUpgradeMeso[arc]))
.arg(arcUpgradeDays[arc])
.arg(ui->startDate->date().addDays(arcUpgradeDays[arc]).toString("yyyy/MM/dd"))
.arg(decimalSeparator(arcUpgradeMeso_max[arc]))
.arg(arcMaxDays[arc])
.arg(ui->startDate->date().addDays(arcMaxDays[arc]).toString("yyyy/MM/dd"))
);
}
}
Expand Down
19 changes: 10 additions & 9 deletions mainui.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class MainUI : public QWidget{
~MainUI();

private slots:
void on_Arc1LV_valueChanged(int);
void on_Arc2LV_valueChanged(int);
void on_Arc3LV_valueChanged(int);
void on_Arc4LV_valueChanged(int);
void on_Arc5LV_valueChanged(int);
void on_Arc6LV_valueChanged(int);
void on_Arc1LV_valueChanged();
void on_Arc2LV_valueChanged();
void on_Arc3LV_valueChanged();
void on_Arc4LV_valueChanged();
void on_Arc5LV_valueChanged();
void on_Arc6LV_valueChanged();

void on_ArcMode_currentIndexChanged(int);

Expand Down Expand Up @@ -101,7 +101,8 @@ private slots:
QUrl url;

int arcLV, arcCurrent, arcUpgradeInt[6];
int arcUpgradeMeso[6], arcUpgradeDays[6], arcMaxDays[6];
int arcUpgradeMeso[6], arcUpgradeMeso_max[6];
int arcUpgradeDays[6], arcMaxDays[6];
int arcUpgradeList[ARCMAXLV];
int autUpgradeList[AUTMAXLV];
int dailyGet[6];
Expand All @@ -118,11 +119,11 @@ private slots:
void upgradeVal();
void updateAp(int);
void updateArc();
void arcLvChanged(QLabel*, int, int);
void arcLvChanged(QLabel*, int);
void avoidError();
void clearMission();

void updateArcToolTips(QLabel*, int, int);
void updateArcToolTips(QLabel*, int);
void dailyTask();

int arcUpgradeCost(int, int, int);
Expand Down
1 change: 1 addition & 0 deletions static_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define ARCMAX_MOB 1320 //怪物最高ARC (黑魔法師)
#define AUTMAX_MOB 300 //怪物最高AUT (凱羅斯)
#define ARC_LV19_MAX 372 //ARC LV19的最高數量
#define ARCMAXTOTAL 2679 //ARC升級至上限的總數

//職業屬性增加量比率
#define NORMAL_ARC 10
Expand Down
48 changes: 24 additions & 24 deletions triggerEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,78 +20,78 @@ void MainUI::on_tabWidget_currentChanged(int index) {
}
}

void MainUI::on_Arc1LV_valueChanged(int lv) {
arcLvChanged(ui->arcimg1, 0, lv);
void MainUI::on_Arc1LV_valueChanged() {
arcLvChanged(ui->arcimg1, 0);
}
void MainUI::on_Arc2LV_valueChanged(int lv) {
arcLvChanged(ui->arcimg2, 1, lv);
void MainUI::on_Arc2LV_valueChanged() {
arcLvChanged(ui->arcimg2, 1);
}
void MainUI::on_Arc3LV_valueChanged(int lv) {
arcLvChanged(ui->arcimg3, 2, lv);
void MainUI::on_Arc3LV_valueChanged() {
arcLvChanged(ui->arcimg3, 2);
}
void MainUI::on_Arc4LV_valueChanged(int lv) {
arcLvChanged(ui->arcimg4, 3, lv);
void MainUI::on_Arc4LV_valueChanged() {
arcLvChanged(ui->arcimg4, 3);
}
void MainUI::on_Arc5LV_valueChanged(int lv) {
arcLvChanged(ui->arcimg5, 4, lv);
void MainUI::on_Arc5LV_valueChanged() {
arcLvChanged(ui->arcimg5, 4);
}
void MainUI::on_Arc6LV_valueChanged(int lv) {
arcLvChanged(ui->arcimg6, 5, lv);
void MainUI::on_Arc6LV_valueChanged() {
arcLvChanged(ui->arcimg6, 5);
}

void MainUI::on_Arc1current_valueChanged() {
updateArcToolTips(ui->arcimg1, 0, 99);
updateArcToolTips(ui->arcimg1, 0);
}
void MainUI::on_Arc2current_valueChanged() {
updateArcToolTips(ui->arcimg2, 1, 99);
updateArcToolTips(ui->arcimg2, 1);
}
void MainUI::on_Arc3current_valueChanged() {
updateArcToolTips(ui->arcimg3, 2, 99);
updateArcToolTips(ui->arcimg3, 2);
}
void MainUI::on_Arc4current_valueChanged() {
updateArcToolTips(ui->arcimg4, 3, 99);
updateArcToolTips(ui->arcimg4, 3);
}
void MainUI::on_Arc5current_valueChanged() {
updateArcToolTips(ui->arcimg5, 4, 99);
updateArcToolTips(ui->arcimg5, 4);
}
void MainUI::on_Arc6current_valueChanged() {
updateArcToolTips(ui->arcimg6, 5, 99);
updateArcToolTips(ui->arcimg6, 5);
}

void MainUI::on_ArcMode_currentIndexChanged(int index) { updateAp(index); }

void MainUI::on_d200_valueChanged() {
updateArcToolTips(ui->arcimg1, 0, 99);
updateArcToolTips(ui->arcimg1, 0);
}
void MainUI::on_mobbingMission_200_stateChanged() {
on_d200_valueChanged();
}
void MainUI::on_d210_valueChanged() {
updateArcToolTips(ui->arcimg2, 1, 99);
updateArcToolTips(ui->arcimg2, 1);
}
void MainUI::on_mobbingMission_210_stateChanged() {
on_d210_valueChanged();
}
void MainUI::on_d220_valueChanged() {
updateArcToolTips(ui->arcimg3, 2, 99);
updateArcToolTips(ui->arcimg3, 2);
}
void MainUI::on_mobbingMission_220_stateChanged() {
on_d220_valueChanged();
}
void MainUI::on_d225_valueChanged() {
updateArcToolTips(ui->arcimg4, 3, 99);
updateArcToolTips(ui->arcimg4, 3);
}
void MainUI::on_mobbingMission_225_stateChanged() {
on_d225_valueChanged();
}
void MainUI::on_d230_valueChanged() {
updateArcToolTips(ui->arcimg5, 4, 99);
updateArcToolTips(ui->arcimg5, 4);
}
void MainUI::on_mobbingMission_230_stateChanged() {
on_d230_valueChanged();
}
void MainUI::on_d235_valueChanged() {
updateArcToolTips(ui->arcimg6, 5, 99);
updateArcToolTips(ui->arcimg6, 5);
}
void MainUI::on_mobbingMission_235_stateChanged() {
on_d235_valueChanged();
Expand Down
4 changes: 2 additions & 2 deletions utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ void MainUI::clearMission() {
ui->d235->setValue(0);
}

void MainUI::arcLvChanged(QLabel* arcimg, int arc, int lv) {
void MainUI::arcLvChanged(QLabel* arcimg, int arc) {
upgradeVal();
updateAp(ArcMode->currentIndex());
updateArcToolTips(arcimg, arc, lv);
updateArcToolTips(arcimg, arc);
}

0 comments on commit 3ebc4d7

Please sign in to comment.