Skip to content

Commit

Permalink
4匹目3Vが存在しない穴を選択してもエラーが出ないように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
rusted-coil committed Jan 18, 2020
1 parent a4eaae2 commit bc68a32
Showing 1 changed file with 53 additions and 19 deletions.
72 changes: 53 additions & 19 deletions OneStar/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,40 @@ class PokemonInfoForm {
// 言語設定可能コントロール
Dictionary<string, Control[]> m_MultiLanguageControls;

int m_is2VEnable = -1;
enum Star35PanelMode {
From2V,
From3V
class Star35PanelMode
{
public enum ModeType {
From2V,
From3V
};

public ModeType Mode { get; private set; }

public override string ToString()
{
if (Mode == ModeType.From2V)
{
return Messages.Instance.SystemLabel["Pokemon35_1_2V"];
}
else if (Mode == ModeType.From3V)
{
return Messages.Instance.SystemLabel["Pokemon35_1_3V"];
}
return "";
}

public Star35PanelMode(ModeType mode)
{
Mode = mode;
}
};

Star35PanelMode Get35Mode()
int m_is2VEnable = -1;
int m_is3VEnable = -1;

Star35PanelMode.ModeType Get35Mode()
{
return m_is2VEnable == 1 ? (Star35PanelMode)f_ComboBoxModeSelector_35.SelectedIndex : Star35PanelMode.From3V;
return (f_ComboBoxModeSelector_35.SelectedItem as Star35PanelMode).Mode;
}

public MainForm()
Expand Down Expand Up @@ -385,7 +410,7 @@ private void f_ButtonIvsCheck_Click(object sender, EventArgs e)
}

// 1匹目はVが2or3箇所じゃないとエラー
int strict = (Get35Mode() == Star35PanelMode.From3V ? 3 : 2);
int strict = (Get35Mode() == Star35PanelMode.ModeType.From3V ? 3 : 2);
int c = 0;
for (int i = 0; i < 6; ++i)
{
Expand Down Expand Up @@ -424,7 +449,7 @@ private void f_ButtonIvsCheck_Click(object sender, EventArgs e)

// 2V+3Vor4Vで6個確定
// 3V+4Vで5個確定
int needNumber = (Get35Mode() == Star35PanelMode.From2V ? 6 : 5);
int needNumber = (Get35Mode() == Star35PanelMode.ModeType.From2V ? 6 : 5);

for (int vCount = fixedCount + 1; vCount <= 4; ++vCount)
{
Expand Down Expand Up @@ -639,7 +664,7 @@ void SeedSearch35()
}

// V箇所が足りなかったらエラー
int strict = (Get35Mode() == Star35PanelMode.From3V ? 3 : 2);
int strict = (Get35Mode() == Star35PanelMode.ModeType.From3V ? 3 : 2);
for (int a = 0; a < 3; ++a)
{
int c = 0;
Expand Down Expand Up @@ -675,7 +700,7 @@ void SeedSearch35()

// 計算準備
var mode = Get35Mode();
SeedSearcher searcher = new SeedSearcher(mode == Star35PanelMode.From2V ? SeedSearcher.Mode.Star35_6 : SeedSearcher.Mode.Star35_5);
SeedSearcher searcher = new SeedSearcher(mode == Star35PanelMode.ModeType.From2V ? SeedSearcher.Mode.Star35_6 : SeedSearcher.Mode.Star35_5);

// 条件をセット
for (int i = 0; i < 3; ++i)
Expand Down Expand Up @@ -714,7 +739,7 @@ void SeedSearch35()
vFlag[i] = true;
}
}
int c = (mode == Star35PanelMode.From3V ? 3 : 2);
int c = (mode == Star35PanelMode.ModeType.From3V ? 3 : 2);
int[] conditionIv = new int[6];
int cursor = 0;
for (int i = 0; i < 6; ++i)
Expand Down Expand Up @@ -749,11 +774,11 @@ void SeedSearch35()
}
}

if (mode == Star35PanelMode.From2V)
if (mode == Star35PanelMode.ModeType.From2V)
{
SeedSearcher.SetTargetCondition6(conditionIv[0], conditionIv[1], conditionIv[2], conditionIv[3], conditionIv[4], conditionIv[5]);
}
else if (mode == Star35PanelMode.From3V)
else if (mode == Star35PanelMode.ModeType.From3V)
{
SeedSearcher.SetTargetCondition5(conditionIv[0], conditionIv[1], conditionIv[2], conditionIv[3], conditionIv[4]);
}
Expand Down Expand Up @@ -1357,17 +1382,23 @@ void RefreshDen()

// ★3以上かつ2Vがいるかチェック
bool isEnable2V = false;
bool isEnable3V = false;
foreach (var encounter in m_EncounterList)
{
if (encounter.FlawlessIvs <= 2 && encounter.Rank >= 2)
{
isEnable2V = true;
break;
}
if (encounter.FlawlessIvs == 3 && encounter.Rank >= 2)
{
isEnable3V = true;
}
}
if (m_is2VEnable == -1 || (m_is2VEnable == 1) != isEnable2V)
if (m_is2VEnable == -1 || (m_is2VEnable == 1) != isEnable2V
|| m_is3VEnable == -1 || (m_is3VEnable == 1) != isEnable3V)
{
m_is2VEnable = (isEnable2V ? 1 : 0);
m_is3VEnable = (isEnable3V ? 1 : 0);
RefreshModeComboBox();
f_ComboBoxModeSelector_35.SelectedIndex = 0;
}
Expand All @@ -1380,9 +1411,12 @@ void RefreshModeComboBox()
f_ComboBoxModeSelector_35.Items.Clear();
if (m_is2VEnable == 1)
{
f_ComboBoxModeSelector_35.Items.Add(Messages.Instance.SystemLabel["Pokemon35_1_2V"]);
f_ComboBoxModeSelector_35.Items.Add(new Star35PanelMode(Star35PanelMode.ModeType.From2V));
}
if (m_is3VEnable == 1)
{
f_ComboBoxModeSelector_35.Items.Add(new Star35PanelMode(Star35PanelMode.ModeType.From3V));
}
f_ComboBoxModeSelector_35.Items.Add(Messages.Instance.SystemLabel["Pokemon35_1_3V"]);
}
void RefreshPokemonComboBox()
{
Expand Down Expand Up @@ -1413,11 +1447,11 @@ void RefreshPokemonComboBox()
if (encounter.Rank >= 2)
{
// 2Vモードor3Vモード
if (mode == Star35PanelMode.From2V && encounter.FlawlessIvs == 2)
if (mode == Star35PanelMode.ModeType.From2V && encounter.FlawlessIvs == 2)
{
f_ComboBoxPokemon_351.Items.Add(encounter);
}
else if (mode == Star35PanelMode.From3V && encounter.FlawlessIvs == 3)
else if (mode == Star35PanelMode.ModeType.From3V && encounter.FlawlessIvs == 3)
{
f_ComboBoxPokemon_351.Items.Add(encounter);
}
Expand Down

0 comments on commit bc68a32

Please sign in to comment.