Skip to content

Commit 313117f

Browse files
committed
bugfixing v1.4.0, 5th iteration
1 parent 6fd5e25 commit 313117f

File tree

2 files changed

+59
-41
lines changed

2 files changed

+59
-41
lines changed

OPRPCharBuild/OPRPCharBuild/Add_TechStats.cs

+46-31
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,33 @@ public partial class Add_TechStats : Form
2020

2121
// Used to transfer across variables
2222
private int rank;
23+
private int power;
2324
private string statOpt;
2425

25-
public Add_TechStats(string opt_, int rank_) {
26+
private const string SINGLE = "Single";
27+
28+
public Add_TechStats(string opt_, int rank_, int pow_, string range_) {
2629
button_clicked = false;
2730
InitializeComponent();
2831
// Set Variables
2932
statOpt = opt_;
3033
rank = rank_;
34+
power = pow_;
3135
// Add to Combobox
3236
comboBox_AoE.Items.AddRange(new string[] {
33-
"No AoE",
37+
SINGLE,
3438
Database.EFF_SHAOE,
3539
Database.EFF_MDAOE,
3640
Database.EFF_LOAOE
3741
});
38-
comboBox_AoE.SelectedIndex = 0;
42+
if (range_ == Database.EFF_SHAOE) { comboBox_AoE.Text = range_; }
43+
else if (range_ == Database.EFF_MDAOE) { comboBox_AoE.Text = range_; }
44+
else if (range_ == Database.EFF_LOAOE) { comboBox_AoE.Text = range_; }
3945
}
4046

4147
public string LoadDialog(ref Stats techStats, string textbox) {
42-
if (statOpt == Database.BUF_CRITHI) { label_Rank.Text = rank + " Power"; }
48+
if (statOpt == Database.BUF_CRITHI || statOpt == Database.BUF_ANASTR ||
49+
statOpt == Database.BUF_QUICKS) { label_Rank.Text = power + " Power"; }
4350
else { label_Rank.Text = "Rank " + rank; }
4451
label_Rank.Text += " Tech for " + statOpt;
4552
StatAlter alterSetting = Database.getStatAlter(statOpt);
@@ -69,7 +76,9 @@ public string LoadDialog(ref Stats techStats, string textbox) {
6976
// Set calculations and total Buff/Debuff
7077
setCalcAndLabels(alterSetting);
7178
// Food is Long AoE, so disable
72-
if (statOpt == Database.BUF_FOOD) { comboBox_AoE.Enabled = false; }
79+
if (statOpt == Database.BUF_DRUG) { comboBox_AoE.Text = SINGLE; }
80+
else if (statOpt == Database.BUF_FOOD) { comboBox_AoE.Text = Database.EFF_LOAOE; }
81+
if (statOpt == Database.BUF_FOOD || statOpt == Database.BUF_DRUG) { comboBox_AoE.Enabled = false; }
7382
// Load Template
7483
this.ShowDialog();
7584
if (button_clicked) {
@@ -91,30 +100,33 @@ public string LoadDialog(ref Stats techStats, string textbox) {
91100
#region Helper Functions
92101

93102
// Calculates based on Standard Table
94-
private double calcStdTable(int rank, string statOpt) {
95-
double decRank = rank;
103+
// HELPER function for calcBuffNum()
104+
private double calcStdTable(int rankBuff, string statOpt) {
105+
double decRank = rankBuff;
96106
// Willpower Buff Table (one Tier lower)
97107
if (statOpt == Database.BUF_WILLPO) {
98-
if (rank >= 44) { return decRank * 0.85; }
99-
else if (rank >= 28) { return decRank * 0.70; }
100-
else if (rank >= 14) { return decRank * 0.60; }
108+
if (rankBuff >= 44) { return decRank * 0.85; }
109+
else if (rankBuff >= 28) { return decRank * 0.70; }
110+
else if (rankBuff >= 14) { return decRank * 0.60; }
101111
// Should never get here
102112
}
103113
// Obs Haki Buff Table (one Tier higher)
104114
else if (statOpt == Database.BUF_OBHAKI) {
105-
if (rank >= 28) { return decRank; }
106-
else if (rank >= 14) { return decRank * 0.85; }
115+
if (rankBuff >= 28) { return decRank; }
116+
else if (rankBuff >= 14) { return decRank * 0.85; }
107117
else { return decRank * 0.70; }
108118
}
109119
// Standard Table
110-
if (rank >= 44 || statOpt == Database.BUF_ZOAN) { return decRank; }
111-
else if (rank >= 28) { return decRank * 0.85; }
112-
else if (rank >= 14) { return decRank * 0.70; }
120+
if (rankBuff >= 44 || statOpt == Database.BUF_ZOAN) { return decRank; }
121+
else if (rankBuff >= 28) { return decRank * 0.85; }
122+
else if (rankBuff >= 14) { return decRank * 0.70; }
113123
else { return decRank * 0.60; }
114124
}
115125

116-
private int calcBuffNum(int rank, string statOpt, bool buff, string AoE) {
117-
double tblNum = calcStdTable(rank, statOpt);
126+
private int calcBuffNum(int rankBuff, bool buff, string AoE) {
127+
double tblNum = (statOpt == Database.BUF_CRITHI ||
128+
statOpt == Database.BUF_ANASTR ||
129+
statOpt == Database.BUF_QUICKS) ? calcStdTable(power, statOpt) : calcStdTable(rankBuff, statOpt);
118130
// Is this a Life Return Debuff?
119131
if (statOpt == Database.BUF_LIFRET && !buff) {
120132
return (int)(tblNum * 0.50);
@@ -133,26 +145,29 @@ private int calcBuffNum(int rank, string statOpt, bool buff, string AoE) {
133145
return (int)tblNum;
134146
}
135147

136-
private string calcBuffString(int rank, string statOpt, bool buff, string AoE, int final) {
137-
string calc = rank.ToString() + " * ";
148+
private string calcBuffString(int rankBuff, bool buff, string AoE, int final) {
149+
string calc = (statOpt == Database.BUF_CRITHI ||
150+
statOpt == Database.BUF_ANASTR ||
151+
statOpt == Database.BUF_QUICKS) ? power.ToString() : rankBuff.ToString();
152+
calc += " * ";
138153
// ----- First Multiplier
139154
// Willpower Buff Table (one Tier lower)
140155
if (statOpt == Database.BUF_WILLPO) {
141-
if (rank >= 44) { calc += "85%"; }
142-
else if (rank >= 28) { calc += "70%"; }
143-
else if (rank >= 14) { calc += "60%"; }
156+
if (rankBuff >= 44) { calc += "85%"; }
157+
else if (rankBuff >= 28) { calc += "70%"; }
158+
else if (rankBuff >= 14) { calc += "60%"; }
144159
// Should never get here
145160
}
146161
// Obs Haki Buff Table (one Tier higher)
147162
else if (statOpt == Database.BUF_OBHAKI) {
148-
if (rank >= 28) { calc += "100%"; }
149-
else if (rank >= 14) { calc += "85%"; }
163+
if (rankBuff >= 28) { calc += "100%"; }
164+
else if (rankBuff >= 14) { calc += "85%"; }
150165
else { calc += "70%"; }
151166
}
152167
// Standard Table
153-
else if (statOpt == Database.BUF_ZOAN || rank >= 44) { calc += "100%"; }
154-
else if (rank >= 28) { calc += "85%"; }
155-
else if (rank >= 14) { calc += "70%"; }
168+
else if (statOpt == Database.BUF_ZOAN || rankBuff >= 44) { calc += "100%"; }
169+
else if (rankBuff >= 28) { calc += "85%"; }
170+
else if (rankBuff >= 14) { calc += "70%"; }
156171
else { calc += "60%"; }
157172
// ----- Second Multiplier
158173
// Is this a Life Return debuff?
@@ -210,19 +225,19 @@ private bool checkValid() {
210225
private void setCalcAndLabels(StatAlter alterSetting) {
211226
// Set calculations and total Buff/Debuff
212227
if (alterSetting.type == StatAlter.BUFF || alterSetting.type == StatAlter.STANCE) {
213-
totBuff = calcBuffNum(rank, statOpt, true, comboBox_AoE.Text);
228+
totBuff = calcBuffNum(rank, true, comboBox_AoE.Text);
214229
label_TotBuff.Text = "Total Buff: " + totBuff;
215-
textBox_BuffCalc.Text = calcBuffString(rank, statOpt, true, comboBox_AoE.Text, totBuff);
230+
textBox_BuffCalc.Text = calcBuffString(rank, true, comboBox_AoE.Text, totBuff);
216231
}
217232
else {
218233
totBuff = 0;
219234
label_TotBuff.Text = "Total Buff: " + totBuff;
220235
textBox_BuffCalc.Text = "0 = 0";
221236
}
222237
if (alterSetting.type == StatAlter.DEBUFF || alterSetting.type == StatAlter.STANCE) {
223-
totDebuff = calcBuffNum(rank, statOpt, false, comboBox_AoE.Text);
238+
totDebuff = calcBuffNum(rank, false, comboBox_AoE.Text);
224239
label_TotDebuff.Text = "Total Debuff: " + totDebuff;
225-
textBox_DebuffCalc.Text = calcBuffString(rank, statOpt, false, comboBox_AoE.Text, totDebuff);
240+
textBox_DebuffCalc.Text = calcBuffString(rank, false, comboBox_AoE.Text, totDebuff);
226241
}
227242
else {
228243
totDebuff = 0;

OPRPCharBuild/OPRPCharBuild/Add_Technique.cs

+13-10
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ private void Copy_Data_To_Form(Technique Tech) {
180180
comboBox_StatOpt.Text = Tech.stats.statsName;
181181
textBox_Stats.Text = Tech.stats.getTechString();
182182
// Power/Effects
183+
checkBox_NA.Checked = Tech.NApower;
183184
checkBox_AutoCalc.Checked = Tech.autoCalc;
184-
checkBox_NA.Checked = Tech.NApower;
185-
if (!Tech.NApower) {
185+
if (!Tech.NApower) {
186186
// If N/A Power is not selected
187187
// Adding onto ListView for effects
188188
foreach (Effect effect in Tech.effects) {
@@ -199,9 +199,11 @@ private void Copy_Data_To_Form(Technique Tech) {
199199
}
200200
listView_Effects.Items.Add(item);
201201
}
202+
// Update Power after Effects are added
203+
Update_Power_Value();
202204
}
203-
// DF Options
204-
if (Tech.note.Contains("Devil Fruit")) {
205+
// DF Options
206+
if (Tech.note.Contains("Devil Fruit")) {
205207
checkBox_DFTechEnable.Enabled = true;
206208
checkBox_DFTechEnable.Checked = true;
207209
}
@@ -885,17 +887,15 @@ private void button_LoadStats_Click(object sender, EventArgs e) {
885887
MessageBoxButtons.OK, MessageBoxIcon.Error);
886888
return;
887889
}
888-
// For Crit Hit/Anat/Quickstrike, power is followed instead
889-
if (statopt == Database.BUF_CRITHI) {
890-
rank = int.Parse(textBox_Power.Text);
891-
}
892890
// Rank 1 Tech isn't allowed
893891
if (rank < 2) {
894892
MessageBox.Show("<R2 buffs/debuffs are not possible.", "Error",
895893
MessageBoxButtons.OK, MessageBoxIcon.Error);
896894
return;
897895
}
898-
Add_TechStats statsWin = new Add_TechStats(statopt, rank);
896+
int power = int.Parse(textBox_Power.Text);
897+
string range = comboBox_Range.Text;
898+
Add_TechStats statsWin = new Add_TechStats(statopt, rank, power, range);
899899
textBox_Stats.Text = statsWin.LoadDialog(ref techStats, textBox_Stats.Text);
900900
Update_Note();
901901
}
@@ -918,6 +918,10 @@ private void textBox_Power_TextChanged(object sender, EventArgs e) {
918918
}
919919
}
920920

921+
private void checkBox_AutoCalc_CheckedChanged(object sender, EventArgs e) {
922+
Update_Power_Value();
923+
}
924+
921925
private void checkBox_NA_CheckedChanged(object sender, EventArgs e) {
922926
if (checkBox_NA.Checked) {
923927
listView_Effects.Enabled = false;
@@ -1274,6 +1278,5 @@ private void button_Rokushiki_Click(object sender, EventArgs e) {
12741278
}
12751279

12761280
#endregion
1277-
12781281
}
12791282
}

0 commit comments

Comments
 (0)