Misc clarity

no functional change
make batch editor prefix list readonly
This commit is contained in:
Kurt 2019-02-03 10:28:33 -08:00
parent 2eef523475
commit 893f98d667
6 changed files with 16 additions and 14 deletions

View file

@ -78,6 +78,7 @@ namespace PKHeX.Core
private static IEnumerable<Ball> GetBallListFromColor(PKM pkm)
{
// fetch with latest-gen personal info; gen1/2 don't store color
var pi = PKX.Personal.GetFormeEntry(pkm.Species, pkm.AltForm);
var color = (PersonalColor)pi.Color;
var balls = BallColors[color];

View file

@ -17,7 +17,7 @@ namespace PKHeX.Core
PropertyValue = index > -1 ? index.ToString() : PropertyValue;
}
public static readonly char[] Prefixes = { Apply, Require, Exclude };
public static readonly IReadOnlyList<char> Prefixes = new[] { Apply, Require, Exclude };
private const char Exclude = '!';
private const char Require = '=';
private const char Apply = '.';

View file

@ -219,8 +219,8 @@ namespace PKHeX
case 093:
case 094: return level < 29 && !moves.Contains(095); // Haunter/Gengar without Hypnosis
case 110: return level < 39 && !moves.Contains(108); // Weezing without Smoke Screen
default: return false;
}
return false;
}
private static int GetRequiredMoveCountDecrement(PKM pk, int[] moves, List<int>[] learn, int[] initialmoves)
@ -262,6 +262,7 @@ namespace PKHeX
case 130 when pk.CurrentLevel < 32: // Gyarados
usedslots--;
break;
default: return usedslots;
}
return usedslots;
}
@ -290,7 +291,7 @@ namespace PKHeX
}
// Add to used slots the non-mandatory moves from the learnset table that the pokemon have learned
return mandatory.Count + moves.Count(m => m != 0 && mandatory.All(l => l != m) && learn[1].Any(t => t == m));
return mandatory.Count + moves.Where(m => m != 0).Count(m => !mandatory.Contains(m) && learn[1].Contains(m));
}
private static List<int> GetRequiredMoveCountLevel(PKM pk)

View file

@ -1104,24 +1104,27 @@ namespace PKHeX.Core
// Writeback Validity
public override string MiscSaveChecks()
{
string r = "";
var r = new StringBuilder();
// FFFF checks
for (int i = 0; i < Data.Length / 0x200; i++)
{
if (Data.Skip(i * 0x200).Take(0x200).Any(z => z != 0xFF))
continue;
r = $"0x200 chunk @ 0x{i * 0x200:X5} is FF'd."
+ Environment.NewLine + "Cyber will screw up (as of August 31st 2014)." + Environment.NewLine + Environment.NewLine;
r.Append("0x200 chunk @ 0x").AppendFormat("{0:X5}", i * 0x200).AppendLine(" is FF'd.");
r.AppendLine("Cyber will screw up (as of August 31st 2014).");
r.AppendLine();
// Check to see if it is in the Pokedex
if (i * 0x200 > PokeDex && i * 0x200 < PokeDex + 0x900)
{
r += "Problem lies in the Pokedex. ";
r.Append("Problem lies in the Pokedex. ");
if (i * 0x200 == PokeDex + 0x400)
r += "Remove a language flag for a species < 585, ie Petilil";
r.Append("Remove a language flag for a species < 585, ie Petilil");
}
break;
}
return r;
return r.ToString();
}
public override string MiscSaveInfo() => string.Join(Environment.NewLine, Blocks.Select(b => b.Summary));

View file

@ -10,10 +10,7 @@ namespace PKHeX.WinForms.Controls
{
public partial class ContextMenuSAV : UserControl
{
public ContextMenuSAV()
{
InitializeComponent();
}
public ContextMenuSAV() => InitializeComponent();
public event LegalityRequest RequestEditorLegality;
public delegate void LegalityRequest(object sender, EventArgs e, PKM pkm);

View file

@ -66,7 +66,7 @@ namespace PKHeX.WinForms
if (CB_Property.SelectedIndex < 0)
{ WinFormsUtil.Alert(MsgBEPropertyInvalid); return; }
char[] prefix = StringInstruction.Prefixes;
var prefix = StringInstruction.Prefixes;
string s = prefix[CB_Require.SelectedIndex] + CB_Property.Items[CB_Property.SelectedIndex].ToString() + StringInstruction.SplitInstruction;
if (RTB_Instructions.Lines.Length != 0 && RTB_Instructions.Lines.Last().Length > 0)
s = Environment.NewLine + s;