mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 06:34:19 +00:00
Minor clean
handle some compiler messages
This commit is contained in:
parent
043ba3b6f0
commit
afa368823e
23 changed files with 153 additions and 152 deletions
|
@ -302,9 +302,7 @@ namespace PKHeX.Core
|
|||
var expectForm = pkm.Format == 7 ? Form : FormConverter.GetTotemBaseForm(Species, Form);
|
||||
return expectForm == pkm.AltForm;
|
||||
}
|
||||
if (Form != pkm.AltForm && !Legal.IsFormChangeable(pkm, Species, Form))
|
||||
return false;
|
||||
return true;
|
||||
return Form == pkm.AltForm || Legal.IsFormChangeable(pkm, Species, Form);
|
||||
}
|
||||
|
||||
private bool IsMatchEggLocation(PKM pkm, ref int lvl)
|
||||
|
@ -413,14 +411,12 @@ namespace PKHeX.Core
|
|||
if (!pkm.HasOriginalMetLocation)
|
||||
return lvl >= Level;
|
||||
|
||||
if (lvl == Level)
|
||||
return true;
|
||||
if (!(pkm.Format == 3 && EggEncounter && lvl == 0))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return lvl == Level || IsGen3EggEncounter(pkm, lvl);
|
||||
}
|
||||
|
||||
// met level 0, origin level 5
|
||||
private bool IsGen3EggEncounter(PKM pkm, int lvl) => pkm.Format == 3 && EggEncounter && lvl == 0;
|
||||
|
||||
public virtual bool IsMatchDeferred(PKM pkm)
|
||||
{
|
||||
if (pkm.FatefulEncounter != Fateful)
|
||||
|
|
|
@ -6,7 +6,7 @@ using static PKHeX.Core.Legal;
|
|||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// LevelUp Lookup object
|
||||
/// Level-Up Lookup object
|
||||
/// </summary>
|
||||
public sealed class LearnLookup
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ namespace PKHeX.Core
|
|||
if (index == 0)
|
||||
return LearnNONE;
|
||||
|
||||
// No relearner -- have to be learned on levelup
|
||||
// No Move re-learner -- have to be learned on level-up
|
||||
var lv = Learn[index].GetLevelLearnMove(move, min);
|
||||
if (lv >= 0 && lv <= max)
|
||||
return new LearnVersion(lv, Version);
|
||||
|
|
|
@ -139,7 +139,9 @@ namespace PKHeX.Core
|
|||
return slot.LevelMin + adjust;
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0060, RCS1163 // Unused parameter.
|
||||
public static bool GetIsEncounterable(EncounterSlot slot, FrameType frameType, int rand, LeadRequired lead)
|
||||
#pragma warning restore IDE0060, RCS1163 // Unused parameter.
|
||||
{
|
||||
if (slot.Type.IsSweetScentType())
|
||||
return true;
|
||||
|
@ -147,7 +149,8 @@ namespace PKHeX.Core
|
|||
//return GetCanEncounter(slot, frameType, rand, lead);
|
||||
}
|
||||
|
||||
private static bool GetCanEncounter(EncounterSlot slot, FrameType frameType, int rand, LeadRequired lead)
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public static bool GetCanEncounter(EncounterSlot slot, FrameType frameType, int rand, LeadRequired lead)
|
||||
{
|
||||
int proc = frameType == FrameType.MethodJ ? rand / 656 : rand % 100;
|
||||
if ((slot.Type & SlotType.Rock_Smash) != 0)
|
||||
|
|
|
@ -393,8 +393,8 @@ namespace PKHeX.Core
|
|||
SetEggMetData(pk);
|
||||
pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship;
|
||||
|
||||
pk.HeightScalar = PokeSizeExtensions.GetRandomScalar();
|
||||
pk.WeightScalar = PokeSizeExtensions.GetRandomScalar();
|
||||
pk.HeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
pk.WeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
|
||||
pk.RefreshChecksum();
|
||||
return pk;
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace PKHeX.Core
|
|||
public override PKM Clone() => new BK4((byte[])Data.Clone()){Identifier = Identifier};
|
||||
|
||||
public string GetString(int Offset, int Count) => StringConverter4.GetBEString4(Data, Offset, Count);
|
||||
public byte[] SetString(string value, int maxLength) => StringConverter4.SetBEString4(value, maxLength);
|
||||
private static byte[] SetString(string value, int maxLength) => StringConverter4.SetBEString4(value, maxLength);
|
||||
|
||||
// Structure
|
||||
public override uint PID { get => BigEndian.ToUInt32(Data, 0x00); set => BigEndian.GetBytes(value).CopyTo(Data, 0x00); }
|
||||
|
@ -137,7 +137,7 @@ namespace PKHeX.Core
|
|||
public override int Move2_PPUps { get => Data[0x35]; set => Data[0x35] = (byte)value; }
|
||||
public override int Move3_PPUps { get => Data[0x36]; set => Data[0x36] = (byte)value; }
|
||||
public override int Move4_PPUps { get => Data[0x37]; set => Data[0x37] = (byte)value; }
|
||||
public uint IV32 { get => BigEndian.ToUInt32(Data, 0x38); set => BigEndian.GetBytes(value).CopyTo(Data, 0x38); }
|
||||
private uint IV32 { get => BigEndian.ToUInt32(Data, 0x38); set => BigEndian.GetBytes(value).CopyTo(Data, 0x38); }
|
||||
public override int IV_SPD { get => (int)(IV32 >> 02) & 0x1F; set => IV32 = ((IV32 & ~(0x1Fu << 02)) | ((value > 31 ? 31u : (uint)value) << 02)); }
|
||||
public override int IV_SPA { get => (int)(IV32 >> 07) & 0x1F; set => IV32 = ((IV32 & ~(0x1Fu << 07)) | ((value > 31 ? 31u : (uint)value) << 07)); }
|
||||
public override int IV_SPE { get => (int)(IV32 >> 12) & 0x1F; set => IV32 = ((IV32 & ~(0x1Fu << 12)) | ((value > 31 ? 31u : (uint)value) << 12)); }
|
||||
|
|
|
@ -55,8 +55,8 @@ namespace PKHeX.Core
|
|||
public override int SID { get => BigEndian.ToUInt16(Data, 0x14); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x14); }
|
||||
public override int TID { get => BigEndian.ToUInt16(Data, 0x16); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x16); }
|
||||
public override string OT_Name { get => GetString(0x18, 20); set => SetString(value, 10).CopyTo(Data, 0x18); } // +2 terminator
|
||||
public override string Nickname { get => GetString(0x2E, 20); set { SetString(value, 10).CopyTo(Data, 0x2E); Nickname2 = value; } } // +2 terminator
|
||||
private string Nickname2 { get => GetString(0x44, 20); set => SetString(value, 10).CopyTo(Data, 0x44); } // +2 terminator
|
||||
public override string Nickname { get => GetString(0x2E, 20); set { SetString(value, 10).CopyTo(Data, 0x2E); NicknameCopy = value; } } // +2 terminator
|
||||
public string NicknameCopy { get => GetString(0x44, 20); set => SetString(value, 10).CopyTo(Data, 0x44); } // +2 terminator
|
||||
public override uint EXP { get => BigEndian.ToUInt32(Data, 0x5C); set => BigEndian.GetBytes(value).CopyTo(Data, 0x5C); }
|
||||
public override int Stat_Level { get => Data[0x60]; set => Data[0x60] = (byte)value; }
|
||||
|
||||
|
|
|
@ -120,13 +120,13 @@ namespace PKHeX.Core
|
|||
public int AV_SPE { get => Data[0x27]; set => Data[0x27] = (byte)value; }
|
||||
public int AV_SPA { get => Data[0x28]; set => Data[0x28] = (byte)value; }
|
||||
public int AV_SPD { get => Data[0x29]; set => Data[0x29] = (byte)value; }
|
||||
public byte _0x2A { get => Data[0x2A]; set => Data[0x2A] = value; }
|
||||
// 0x2A Unused
|
||||
private byte PKRS { get => Data[0x2B]; set => Data[0x2B] = value; }
|
||||
public override int PKRS_Days { get => PKRS & 0xF; set => PKRS = (byte)((PKRS & ~0xF) | value); }
|
||||
public override int PKRS_Strain { get => PKRS >> 4; set => PKRS = (byte)((PKRS & 0xF) | value << 4); }
|
||||
public float HeightAbsolute { get => BitConverter.ToSingle(Data, 0x2C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x2C); }
|
||||
public byte _0x38 { get => Data[0x38]; set => Data[0x38] = value; }
|
||||
public byte _0x39 { get => Data[0x39]; set => Data[0x39] = value; }
|
||||
// 0x38 Unused
|
||||
// 0x39 Unused
|
||||
public int HeightScalar { get => Data[0x3A]; set => Data[0x3A] = (byte)value; }
|
||||
public int WeightScalar { get => Data[0x3B]; set => Data[0x3B] = (byte)value; }
|
||||
public uint FormArgument { get => BitConverter.ToUInt32(Data, 0x3C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x3C); }
|
||||
|
@ -195,8 +195,8 @@ namespace PKHeX.Core
|
|||
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70);
|
||||
}
|
||||
|
||||
public byte _0x72 { get => Data[0x72]; set => Data[0x72] = value; }
|
||||
public byte _0x73 { get => Data[0x73]; set => Data[0x73] = value; }
|
||||
// 0x72 Unused
|
||||
// 0x73 Unused
|
||||
private uint IV32 { get => BitConverter.ToUInt32(Data, 0x74); set => BitConverter.GetBytes(value).CopyTo(Data, 0x74); }
|
||||
public override int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (IV32 & ~(0x1Fu << 00)) | ((value > 31 ? 31u : (uint)value) << 00); }
|
||||
public override int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (IV32 & ~(0x1Fu << 05)) | ((value > 31 ? 31u : (uint)value) << 05); }
|
||||
|
@ -211,29 +211,29 @@ namespace PKHeX.Core
|
|||
public override string HT_Name { get => GetString(0x78, 24); set => SetString(value, 12).CopyTo(Data, 0x78); }
|
||||
public override int HT_Gender { get => Data[0x92]; set => Data[0x92] = (byte)value; }
|
||||
public override int CurrentHandler { get => Data[0x93]; set => Data[0x93] = (byte)value; }
|
||||
public byte _0x94 { get => Data[0x94]; set => Data[0x94] = value; }
|
||||
public byte _0x95 { get => Data[0x95]; set => Data[0x95] = value; }
|
||||
public byte _0x96 { get => Data[0x96]; set => Data[0x96] = value; }
|
||||
public byte _0x97 { get => Data[0x97]; set => Data[0x97] = value; }
|
||||
public byte _0x98 { get => Data[0x98]; set => Data[0x98] = value; }
|
||||
public byte _0x99 { get => Data[0x99]; set => Data[0x99] = value; }
|
||||
public byte _0x9A { get => Data[0x9A]; set => Data[0x9A] = value; }
|
||||
public byte _0x9B { get => Data[0x9B]; set => Data[0x9B] = value; }
|
||||
public byte _0x9C { get => Data[0x9C]; set => Data[0x9C] = value; }
|
||||
public byte _0x9D { get => Data[0x9D]; set => Data[0x9D] = value; }
|
||||
public byte _0x9E { get => Data[0x9E]; set => Data[0x9E] = value; }
|
||||
public byte _0x9F { get => Data[0x9F]; set => Data[0x9F] = value; }
|
||||
public byte _0xA0 { get => Data[0xA0]; set => Data[0xA0] = value; }
|
||||
public byte _0xA1 { get => Data[0xA1]; set => Data[0xA1] = value; }
|
||||
// 0x94 Unused
|
||||
// 0x95 Unused
|
||||
// 0x96 Unused
|
||||
// 0x97 Unused
|
||||
// 0x98 Unused
|
||||
// 0x99 Unused
|
||||
// 0x9A Unused
|
||||
// 0x9B Unused
|
||||
// 0x9C Unused
|
||||
// 0x9D Unused
|
||||
// 0x9E Unused
|
||||
// 0x9F Unused
|
||||
// 0xA0 Unused
|
||||
// 0xA1 Unused
|
||||
public override int HT_Friendship { get => Data[0xA2]; set => Data[0xA2] = (byte)value; }
|
||||
public override int HT_Affection { get => Data[0xA3]; set => Data[0xA3] = (byte)value; }
|
||||
public override int HT_Intensity { get => Data[0xA4]; set => Data[0xA4] = (byte)value; }
|
||||
public override int HT_Memory { get => Data[0xA5]; set => Data[0xA5] = (byte)value; }
|
||||
public override int HT_Feeling { get => Data[0xA6]; set => Data[0xA6] = (byte)value; }
|
||||
public byte _0xA7 { get => Data[0xA7]; set => Data[0xA7] = value; }
|
||||
// 0xA7 Unused
|
||||
public override int HT_TextVar { get => BitConverter.ToUInt16(Data, 0xA8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA8); }
|
||||
public byte _0xAA { get => Data[0xAA]; set => Data[0xAA] = value; }
|
||||
public byte _0xAB { get => Data[0xAB]; set => Data[0xAB] = value; }
|
||||
// 0xAA Unused
|
||||
// 0xAB Unused
|
||||
public byte FieldEventFatigue1 { get => Data[0xAC]; set => Data[0xAC] = value; }
|
||||
public byte FieldEventFatigue2 { get => Data[0xAD]; set => Data[0xAD] = value; }
|
||||
public override byte Fullness { get => Data[0xAE]; set => Data[0xAE] = value; }
|
||||
|
@ -242,12 +242,12 @@ namespace PKHeX.Core
|
|||
#region Block D
|
||||
public override string OT_Name { get => GetString(0xB0, 24); set => SetString(value, 12).CopyTo(Data, 0xB0); }
|
||||
public override int OT_Friendship { get => Data[0xCA]; set => Data[0xCA] = (byte)value; }
|
||||
public int _0xCB { get => Data[0xCB]; set => Data[0xCB] = (byte)value; }
|
||||
public int _0xCC { get => Data[0xCC]; set => Data[0xCC] = (byte)value; }
|
||||
public int _0xCD { get => Data[0xCD]; set => Data[0xCD] = (byte)value; }
|
||||
public int _0xCE { get => Data[0xCE]; set => Data[0xCE] = (byte)value; }
|
||||
public int _0xCF { get => Data[0xCF]; set => Data[0xCF] = (byte)value; }
|
||||
public int _0xD0 { get => Data[0xD0]; set => Data[0xD0] = (byte)value; }
|
||||
// 0xCB Unused
|
||||
// 0xCC Unused
|
||||
// 0xCD Unused
|
||||
// 0xCE Unused
|
||||
// 0xCF Unused
|
||||
// 0xD0 Unused
|
||||
public override int Egg_Year { get => Data[0xD1]; set => Data[0xD1] = (byte)value; }
|
||||
public override int Egg_Month { get => Data[0xD2]; set => Data[0xD2] = (byte)value; }
|
||||
public override int Egg_Day { get => Data[0xD3]; set => Data[0xD3] = (byte)value; }
|
||||
|
@ -268,9 +268,9 @@ namespace PKHeX.Core
|
|||
public bool HT_SPD { get => ((HyperTrainFlags >> 4) & 1) == 1; set => HyperTrainFlags = (HyperTrainFlags & ~(1 << 4)) | ((value ? 1 : 0) << 4); }
|
||||
public bool HT_SPE { get => ((HyperTrainFlags >> 5) & 1) == 1; set => HyperTrainFlags = (HyperTrainFlags & ~(1 << 5)) | ((value ? 1 : 0) << 5); }
|
||||
public override int Version { get => Data[0xDF]; set => Data[0xDF] = (byte)value; }
|
||||
public int _0xE0 { get => Data[0xE0]; set => Data[0xE0] = (byte)value; }
|
||||
public int _0xE1 { get => Data[0xE1]; set => Data[0xE1] = (byte)value; }
|
||||
public int _0xE2 { get => Data[0xE2]; set => Data[0xE2] = (byte)value; }
|
||||
// 0xE0 Unused
|
||||
// 0xE1 Unused
|
||||
// 0xE2 Unused
|
||||
public override int Language { get => Data[0xE3]; set => Data[0xE3] = (byte)value; }
|
||||
public float WeightAbsolute { get => BitConverter.ToSingle(Data, 0xE4); set => BitConverter.GetBytes(value).CopyTo(Data, 0xE4); }
|
||||
#endregion
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace PKHeX.Core
|
|||
|
||||
public bool SecretSuperTrainingUnlocked { get => (Data[0x72] & 1) == 1; set => Data[0x72] = (byte)((Data[0x72] & ~1) | (value ? 1 : 0)); }
|
||||
public bool SecretSuperTrainingComplete { get => (Data[0x72] & 2) == 2; set => Data[0x72] = (byte)((Data[0x72] & ~2) | (value ? 2 : 0)); }
|
||||
public byte _0x73 { get => Data[0x73]; set => Data[0x73] = value; }
|
||||
// 0x73 Unused
|
||||
private uint IV32 { get => BitConverter.ToUInt32(Data, 0x74); set => BitConverter.GetBytes(value).CopyTo(Data, 0x74); }
|
||||
public override int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (IV32 & ~(0x1Fu << 00)) | ((value > 31 ? 31u : (uint)value) << 00); }
|
||||
public override int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (IV32 & ~(0x1Fu << 05)) | ((value > 31 ? 31u : (uint)value) << 05); }
|
||||
|
@ -305,21 +305,21 @@ namespace PKHeX.Core
|
|||
public int Geo4_Country { get => Data[0x9B]; set => Data[0x9B] = (byte)value; }
|
||||
public int Geo5_Region { get => Data[0x9C]; set => Data[0x9C] = (byte)value; }
|
||||
public int Geo5_Country { get => Data[0x9D]; set => Data[0x9D] = (byte)value; }
|
||||
public byte _0x9E { get => Data[0x9E]; set => Data[0x9E] = value; }
|
||||
public byte _0x9F { get => Data[0x9F]; set => Data[0x9F] = value; }
|
||||
public byte _0xA0 { get => Data[0xA0]; set => Data[0xA0] = value; }
|
||||
public byte _0xA1 { get => Data[0xA1]; set => Data[0xA1] = value; }
|
||||
// 0x9E Unused
|
||||
// 0x9F Unused
|
||||
// 0xA0 Unused
|
||||
// 0xA1 Unused
|
||||
public override int HT_Friendship { get => Data[0xA2]; set => Data[0xA2] = (byte)value; }
|
||||
public override int HT_Affection { get => Data[0xA3]; set => Data[0xA3] = (byte)value; }
|
||||
public override int HT_Intensity { get => Data[0xA4]; set => Data[0xA4] = (byte)value; }
|
||||
public override int HT_Memory { get => Data[0xA5]; set => Data[0xA5] = (byte)value; }
|
||||
public override int HT_Feeling { get => Data[0xA6]; set => Data[0xA6] = (byte)value; }
|
||||
public byte _0xA7 { get => Data[0xA7]; set => Data[0xA7] = value; }
|
||||
// 0xA7 Unused
|
||||
public override int HT_TextVar { get => BitConverter.ToUInt16(Data, 0xA8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA8); }
|
||||
public byte _0xAA { get => Data[0xAA]; set => Data[0xAA] = value; }
|
||||
public byte _0xAB { get => Data[0xAB]; set => Data[0xAB] = value; }
|
||||
public byte _0xAC { get => Data[0xAC]; set => Data[0xAC] = value; }
|
||||
public byte _0xAD { get => Data[0xAD]; set => Data[0xAD] = value; }
|
||||
// 0xAA Unused
|
||||
// 0xAB Unused
|
||||
// 0xAC Unused
|
||||
// 0xAD Unused
|
||||
public override byte Fullness { get => Data[0xAE]; set => Data[0xAE] = value; }
|
||||
public override byte Enjoyment { get => Data[0xAF]; set => Data[0xAF] = value; }
|
||||
#endregion
|
||||
|
@ -337,7 +337,7 @@ namespace PKHeX.Core
|
|||
public override int Met_Year { get => Data[0xD4]; set => Data[0xD4] = (byte)value; }
|
||||
public override int Met_Month { get => Data[0xD5]; set => Data[0xD5] = (byte)value; }
|
||||
public override int Met_Day { get => Data[0xD6]; set => Data[0xD6] = (byte)value; }
|
||||
public byte _0xD7 { get => Data[0xD7]; set => Data[0xD7] = value; }
|
||||
// 0xD7 Unused
|
||||
public override int Egg_Location { get => BitConverter.ToUInt16(Data, 0xD8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); }
|
||||
public override int Met_Location { get => BitConverter.ToUInt16(Data, 0xDA); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); }
|
||||
public override int Ball { get => Data[0xDC]; set => Data[0xDC] = (byte)value; }
|
||||
|
|
|
@ -306,7 +306,7 @@ namespace PKHeX.Core
|
|||
|
||||
public bool SecretSuperTrainingUnlocked { get => (Data[0x72] & 1) == 1; set => Data[0x72] = (byte)((Data[0x72] & ~1) | (value ? 1 : 0)); }
|
||||
public bool SecretSuperTrainingComplete { get => (Data[0x72] & 2) == 2; set => Data[0x72] = (byte)((Data[0x72] & ~2) | (value ? 2 : 0)); }
|
||||
public byte _0x73 { get => Data[0x73]; set => Data[0x73] = value; }
|
||||
// 0x73 Unused
|
||||
private uint IV32 { get => BitConverter.ToUInt32(Data, 0x74); set => BitConverter.GetBytes(value).CopyTo(Data, 0x74); }
|
||||
public override int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (IV32 & ~(0x1Fu << 00)) | ((value > 31 ? 31u : (uint)value) << 00); }
|
||||
public override int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (IV32 & ~(0x1Fu << 05)) | ((value > 31 ? 31u : (uint)value) << 05); }
|
||||
|
@ -331,21 +331,21 @@ namespace PKHeX.Core
|
|||
public int Geo4_Country { get => Data[0x9B]; set => Data[0x9B] = (byte)value; }
|
||||
public int Geo5_Region { get => Data[0x9C]; set => Data[0x9C] = (byte)value; }
|
||||
public int Geo5_Country { get => Data[0x9D]; set => Data[0x9D] = (byte)value; }
|
||||
public byte _0x9E { get => Data[0x9E]; set => Data[0x9E] = value; }
|
||||
public byte _0x9F { get => Data[0x9F]; set => Data[0x9F] = value; }
|
||||
public byte _0xA0 { get => Data[0xA0]; set => Data[0xA0] = value; }
|
||||
public byte _0xA1 { get => Data[0xA1]; set => Data[0xA1] = value; }
|
||||
// 0x9E Unused
|
||||
// 0x9F Unused
|
||||
// 0xA0 Unused
|
||||
// 0xA1 Unused
|
||||
public override int HT_Friendship { get => Data[0xA2]; set => Data[0xA2] = (byte)value; }
|
||||
public override int HT_Affection { get => Data[0xA3]; set => Data[0xA3] = (byte)value; }
|
||||
public override int HT_Intensity { get => Data[0xA4]; set => Data[0xA4] = (byte)value; }
|
||||
public override int HT_Memory { get => Data[0xA5]; set => Data[0xA5] = (byte)value; }
|
||||
public override int HT_Feeling { get => Data[0xA6]; set => Data[0xA6] = (byte)value; }
|
||||
public byte _0xA7 { get => Data[0xA7]; set => Data[0xA7] = value; }
|
||||
// 0xA7 Unused
|
||||
public override int HT_TextVar { get => BitConverter.ToUInt16(Data, 0xA8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA8); }
|
||||
public byte _0xAA { get => Data[0xAA]; set => Data[0xAA] = value; }
|
||||
public byte _0xAB { get => Data[0xAB]; set => Data[0xAB] = value; }
|
||||
public byte _0xAC { get => Data[0xAC]; set => Data[0xAC] = value; }
|
||||
public byte _0xAD { get => Data[0xAD]; set => Data[0xAD] = value; }
|
||||
// 0xAA Unused
|
||||
// 0xAB Unused
|
||||
// 0xAC Unused
|
||||
// 0xAD Unused
|
||||
public override byte Fullness { get => Data[0xAE]; set => Data[0xAE] = value; }
|
||||
public override byte Enjoyment { get => Data[0xAF]; set => Data[0xAF] = value; }
|
||||
#endregion
|
||||
|
@ -363,7 +363,7 @@ namespace PKHeX.Core
|
|||
public override int Met_Year { get => Data[0xD4]; set => Data[0xD4] = (byte)value; }
|
||||
public override int Met_Month { get => Data[0xD5]; set => Data[0xD5] = (byte)value; }
|
||||
public override int Met_Day { get => Data[0xD6]; set => Data[0xD6] = (byte)value; }
|
||||
public byte _0xD7 { get => Data[0xD7]; set => Data[0xD7] = value; }
|
||||
// Unused 0xD7
|
||||
public override int Egg_Location { get => BitConverter.ToUInt16(Data, 0xD8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); }
|
||||
public override int Met_Location { get => BitConverter.ToUInt16(Data, 0xDA); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); }
|
||||
public override int Ball { get => Data[0xDC]; set => Data[0xDC] = (byte)value; }
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
XL,
|
||||
}
|
||||
|
||||
public static class PokeSizeExtensions
|
||||
public static class PokeSizeUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// Compares the sizing scalar to different thresholds to determine the size rating.
|
||||
|
|
|
@ -94,8 +94,8 @@ namespace PKHeX.Core
|
|||
public int OriginalRegion { get => Data[0x36]; set => Data[0x36] = (byte)value; }
|
||||
public override int Language { get => Core.Language.GetMainLangIDfromGC(Data[0x37]); set => Data[0x37] = Core.Language.GetGCLangIDfromMain((byte)value); }
|
||||
public override string OT_Name { get => GetString(0x38, 20); set => SetString(value, 10).CopyTo(Data, 0x38); } // +2 terminator
|
||||
public override string Nickname { get => GetString(0x4E, 20); set { SetString(value, 10).CopyTo(Data, 0x4E); Nickname2 = value; } } // +2 terminator
|
||||
private string Nickname2 { get => GetString(0x64, 20); set => SetString(value, 10).CopyTo(Data, 0x64); } // +2 terminator
|
||||
public override string Nickname { get => GetString(0x4E, 20); set { SetString(value, 10).CopyTo(Data, 0x4E); NicknameCopy = value; } } // +2 terminator
|
||||
public string NicknameCopy { get => GetString(0x64, 20); set => SetString(value, 10).CopyTo(Data, 0x64); } // +2 terminator
|
||||
// 0x7A-0x7B Unknown
|
||||
private ushort RIB0 { get => BigEndian.ToUInt16(Data, 0x7C); set => BigEndian.GetBytes(value).CopyTo(Data, 0x7C); }
|
||||
public override bool RibbonChampionG3Hoenn { get => (RIB0 & (1 << 15)) == 1 << 15; set => RIB0 = (ushort)((RIB0 & ~(1 << 15)) | (ushort)(value ? 1 << 15 : 0)); }
|
||||
|
|
|
@ -85,28 +85,26 @@ namespace PKHeX.Core
|
|||
|
||||
private const uint MysteryGiftDPSlotActive = 0xEDB88320;
|
||||
|
||||
private bool[] MysteryGiftDPSlotActiveFlags
|
||||
public bool[] GetMysteryGiftDPSlotActiveFlags()
|
||||
{
|
||||
get
|
||||
{
|
||||
int ofs = WondercardFlags + 0x100; // skip over flags
|
||||
bool[] active = new bool[GiftCountMax]; // 8 PGT, 3 PCD
|
||||
for (int i = 0; i < active.Length; i++)
|
||||
active[i] = BitConverter.ToUInt32(General, ofs + (4 * i)) == MysteryGiftDPSlotActive;
|
||||
int ofs = WondercardFlags + 0x100; // skip over flags
|
||||
bool[] active = new bool[GiftCountMax]; // 8 PGT, 3 PCD
|
||||
for (int i = 0; i < active.Length; i++)
|
||||
active[i] = BitConverter.ToUInt32(General, ofs + (4 * i)) == MysteryGiftDPSlotActive;
|
||||
|
||||
return active;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value.Length != GiftCountMax)
|
||||
return;
|
||||
return active;
|
||||
}
|
||||
|
||||
int ofs = WondercardFlags + 0x100; // skip over flags
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
byte[] magic = BitConverter.GetBytes(value[i] ? MysteryGiftDPSlotActive : 0); // 4 bytes
|
||||
SetData(General, magic, ofs + (4 * i));
|
||||
}
|
||||
public void SetMysteryGiftDPSlotActiveFlags(bool[] value)
|
||||
{
|
||||
if (value.Length != GiftCountMax)
|
||||
return;
|
||||
|
||||
int ofs = WondercardFlags + 0x100; // skip over flags
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
byte[] magic = BitConverter.GetBytes(value[i] ? MysteryGiftDPSlotActive : 0); // 4 bytes
|
||||
SetData(General, magic, ofs + (4 * i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,12 +118,12 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
private void SetActiveGiftFlags(MysteryGift[] gifts)
|
||||
private void SetActiveGiftFlags(IReadOnlyList<MysteryGift> gifts)
|
||||
{
|
||||
var arr = new bool[gifts.Length];
|
||||
var arr = new bool[gifts.Count];
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
arr[i] = !gifts[i].Empty;
|
||||
MysteryGiftDPSlotActiveFlags = arr;
|
||||
SetMysteryGiftDPSlotActiveFlags(arr);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,6 +51,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
#pragma warning disable IDE0052 // Remove unread private members
|
||||
private FlagPairG1 FlagMewtwo { get; }
|
||||
private FlagPairG1 FlagArticuno { get; }
|
||||
private FlagPairG1 FlagZapdos { get; }
|
||||
|
@ -72,6 +73,7 @@ namespace PKHeX.Core
|
|||
private FlagPairG1? FlagBulbasaur { get; }
|
||||
private FlagPairG1? FlagSquirtle { get; }
|
||||
private FlagPairG1? FlagCharmander { get; }
|
||||
#pragma warning restore IDE0052 // Remove unread private members
|
||||
|
||||
public void Save()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
#pragma warning disable CA1815 // Override equals and operator equals on value types
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
|
|
@ -28,9 +28,6 @@ namespace PKHeX.Drawing
|
|||
|
||||
public static Bitmap ChangeOpacity(Image img, double trans)
|
||||
{
|
||||
if (img.PixelFormat.HasFlag(PixelFormat.Indexed))
|
||||
return (Bitmap)img;
|
||||
|
||||
var bmp = (Bitmap)img.Clone();
|
||||
GetBitmapData(bmp, out BitmapData bmpData, out IntPtr ptr, out byte[] data);
|
||||
|
||||
|
@ -44,9 +41,6 @@ namespace PKHeX.Drawing
|
|||
|
||||
public static Bitmap ChangeAllColorTo(Image img, Color c)
|
||||
{
|
||||
if (img.PixelFormat.HasFlag(PixelFormat.Indexed))
|
||||
return (Bitmap)img;
|
||||
|
||||
var bmp = (Bitmap)img.Clone();
|
||||
GetBitmapData(bmp, out BitmapData bmpData, out IntPtr ptr, out byte[] data);
|
||||
|
||||
|
@ -60,9 +54,6 @@ namespace PKHeX.Drawing
|
|||
|
||||
public static Bitmap ToGrayscale(Image img)
|
||||
{
|
||||
if (img.PixelFormat.HasFlag(PixelFormat.Indexed))
|
||||
return (Bitmap)img;
|
||||
|
||||
var bmp = (Bitmap)img.Clone();
|
||||
GetBitmapData(bmp, out BitmapData bmpData, out IntPtr ptr, out byte[] data);
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
private void ClickPPUps(object sender, EventArgs e)
|
||||
{
|
||||
bool min = ModifierKeys.HasFlag(Keys.Control);
|
||||
bool min = (ModifierKeys & Keys.Control) != 0;
|
||||
static int getValue(ListControl cb, bool zero) => zero || WinFormsUtil.GetIndex(cb) == 0 ? 0 : 3;
|
||||
CB_PPu1.SelectedIndex = getValue(CB_Move1, min);
|
||||
CB_PPu2.SelectedIndex = getValue(CB_Move2, min);
|
||||
|
@ -620,12 +620,12 @@ namespace PKHeX.WinForms.Controls
|
|||
private void ClickBall(object sender, EventArgs e)
|
||||
{
|
||||
Entity.Ball = WinFormsUtil.GetIndex(CB_Ball);
|
||||
if (ModifierKeys.HasFlag(Keys.Alt))
|
||||
if ((ModifierKeys & Keys.Alt) != 0)
|
||||
{
|
||||
CB_Ball.SelectedValue = (int)Ball.Poke;
|
||||
return;
|
||||
}
|
||||
if (ModifierKeys.HasFlag(Keys.Shift))
|
||||
if ((ModifierKeys & Keys.Shift) != 0)
|
||||
{
|
||||
CB_Ball.SelectedValue = BallApplicator.ApplyBallLegalByColor(Entity);
|
||||
return;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace PKHeX.WinForms.Controls
|
|||
private void NUD_HeightScalar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
ss.HeightScalar = (byte) NUD_HeightScalar.Value;
|
||||
L_SizeH.Text = SizeClass[(int)PokeSizeExtensions.GetSizeRating(ss.HeightScalar)];
|
||||
L_SizeH.Text = SizeClass[(int)PokeSizeUtil.GetSizeRating(ss.HeightScalar)];
|
||||
|
||||
if (!CHK_Auto.Checked || Loading || pkm == null)
|
||||
return;
|
||||
|
@ -84,7 +84,7 @@ namespace PKHeX.WinForms.Controls
|
|||
private void NUD_WeightScalar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
ss.WeightScalar = (byte) NUD_WeightScalar.Value;
|
||||
L_SizeW.Text = SizeClass[(int)PokeSizeExtensions.GetSizeRating(ss.WeightScalar)];
|
||||
L_SizeW.Text = SizeClass[(int)PokeSizeUtil.GetSizeRating(ss.WeightScalar)];
|
||||
|
||||
if (!CHK_Auto.Checked || Loading || pkm == null)
|
||||
return;
|
||||
|
|
|
@ -63,21 +63,27 @@ namespace PKHeX.WinForms.Controls
|
|||
if (!(sender is MaskedTextBox t))
|
||||
return;
|
||||
|
||||
if (ModifierKeys.HasFlag(Keys.Alt)) // Min
|
||||
switch (ModifierKeys)
|
||||
{
|
||||
t.Text = 0.ToString();
|
||||
}
|
||||
else if (ModifierKeys.HasFlag(Keys.Control))
|
||||
{
|
||||
var index = Array.IndexOf(MT_IVs, t);
|
||||
t.Text = Entity.GetMaximumIV(index, true).ToString();
|
||||
}
|
||||
else if (Entity is IHyperTrain h && ModifierKeys.HasFlag(Keys.Shift))
|
||||
{
|
||||
var index = Array.IndexOf(MT_IVs, t);
|
||||
bool flag = h.HyperTrainInvert(index);
|
||||
UpdateHyperTrainingFlag(index, flag);
|
||||
UpdateStats();
|
||||
case Keys.Alt: // Min
|
||||
t.Text = 0.ToString();
|
||||
break;
|
||||
|
||||
case Keys.Control: // Max
|
||||
{
|
||||
var index = Array.IndexOf(MT_IVs, t);
|
||||
t.Text = Entity.GetMaximumIV(index, true).ToString();
|
||||
break;
|
||||
}
|
||||
|
||||
case Keys.Shift when Entity is IHyperTrain h: // HT
|
||||
{
|
||||
var index = Array.IndexOf(MT_IVs, t);
|
||||
bool flag = h.HyperTrainInvert(index);
|
||||
UpdateHyperTrainingFlag(index, flag);
|
||||
UpdateStats();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,16 +92,16 @@ namespace PKHeX.WinForms.Controls
|
|||
if (!(sender is MaskedTextBox t))
|
||||
return;
|
||||
|
||||
if (!ModifierKeys.HasFlag(Keys.Control)) // Max
|
||||
if ((ModifierKeys & Keys.Control) != 0) // Max
|
||||
{
|
||||
if (ModifierKeys.HasFlag(Keys.Alt)) // Min
|
||||
t.Text = 0.ToString();
|
||||
return;
|
||||
int index = Array.IndexOf(MT_EVs, t);
|
||||
int newEV = Entity.GetMaximumEV(index);
|
||||
t.Text = newEV.ToString();
|
||||
}
|
||||
else if ((ModifierKeys & Keys.Alt) != 0) // Min
|
||||
{
|
||||
t.Text = 0.ToString();
|
||||
}
|
||||
|
||||
int index = Array.IndexOf(MT_EVs, t);
|
||||
int newEV = Entity.GetMaximumEV(index);
|
||||
t.Text = newEV.ToString();
|
||||
}
|
||||
|
||||
private void ClickAV(object sender, EventArgs e)
|
||||
|
@ -103,14 +109,15 @@ namespace PKHeX.WinForms.Controls
|
|||
if (!(sender is MaskedTextBox t))
|
||||
return;
|
||||
|
||||
if (!ModifierKeys.HasFlag(Keys.Control)) // Max
|
||||
if ((ModifierKeys & Keys.Control) != 0) // Max
|
||||
{
|
||||
if (ModifierKeys.HasFlag(Keys.Alt)) // Min
|
||||
t.Text = 0.ToString();
|
||||
return;
|
||||
var max = Legal.AwakeningMax.ToString();
|
||||
t.Text = t.Text == max ? 0.ToString() : max;
|
||||
}
|
||||
else if ((ModifierKeys & Keys.Alt) != 0) // Min
|
||||
{
|
||||
t.Text = 0.ToString();
|
||||
}
|
||||
var max = Legal.AwakeningMax.ToString();
|
||||
t.Text = t.Text == max ? 0.ToString() : max;
|
||||
}
|
||||
|
||||
public void UpdateIVs(object sender, EventArgs e)
|
||||
|
@ -205,7 +212,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
private void UpdateRandomEVs(object sender, EventArgs e)
|
||||
{
|
||||
bool zero = ModifierKeys.HasFlag(Keys.Control);
|
||||
bool zero = (ModifierKeys & Keys.Control) != 0;
|
||||
var evs = zero ? new int[6] : PKX.GetRandomEVs(Entity.Format);
|
||||
LoadEVs(evs);
|
||||
UpdateEVs(null, EventArgs.Empty);
|
||||
|
@ -256,7 +263,7 @@ namespace PKHeX.WinForms.Controls
|
|||
sender = Label_SPA;
|
||||
|
||||
int index = Array.IndexOf(L_Stats, sender as Label);
|
||||
if (ModifierKeys.HasFlag(Keys.Alt)) // EV
|
||||
if ((ModifierKeys & Keys.Alt) != 0) // EV
|
||||
{
|
||||
bool min = e.Button != MouseButtons.Left;
|
||||
if (Entity is PB7)
|
||||
|
@ -270,7 +277,7 @@ namespace PKHeX.WinForms.Controls
|
|||
MT_EVs[index].Text = value.ToString();
|
||||
}
|
||||
}
|
||||
else if (ModifierKeys.HasFlag(Keys.Control)) // IV
|
||||
else if ((ModifierKeys & Keys.Control) != 0) // IV
|
||||
{
|
||||
var value = e.Button != MouseButtons.Left ? 0 : Entity.GetMaximumIV(index, true);
|
||||
MT_IVs[index].Text = value.ToString();
|
||||
|
@ -345,8 +352,8 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
public void UpdateRandomIVs(object sender, EventArgs e)
|
||||
{
|
||||
int? flawless = ModifierKeys.HasFlag(Keys.Control) ? (int?)6 : null;
|
||||
var IVs = Entity.SetRandomIVs(flawless);
|
||||
var flawless = (ModifierKeys & Keys.Control) != 0;
|
||||
var IVs = flawless ? Entity.SetRandomIVs(6) : Entity.SetRandomIVs();
|
||||
LoadIVs(IVs);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,10 @@ namespace PKHeX.WinForms.Controls
|
|||
private void BoxSlot_QueryContinueDrag(object sender, QueryContinueDragEventArgs e) => M?.QueryContinueDrag(sender, e);
|
||||
private void BoxSlot_DragDrop(object sender, DragEventArgs e) => M?.DragDrop(sender, e);
|
||||
|
||||
public bool InitializeFromSAV(SaveFile sav) => InitializeGrid();
|
||||
public bool InitializeFromSAV(SaveFile sav)
|
||||
{
|
||||
Visible = sav.HasParty;
|
||||
return InitializeGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -355,11 +355,11 @@ namespace PKHeX.WinForms.Controls
|
|||
return;
|
||||
if (!tabBoxMulti.GetTabRect(tabBoxMulti.SelectedIndex).Contains(PointToClient(MousePosition)))
|
||||
return;
|
||||
if (!e.Button.HasFlag(MouseButtons.Right))
|
||||
if ((e.Button & MouseButtons.Right) == 0)
|
||||
{
|
||||
if (ModifierKeys.HasFlag(Keys.Alt))
|
||||
if ((ModifierKeys & Keys.Alt) != 0)
|
||||
SortMenu.Clear();
|
||||
else if (ModifierKeys.HasFlag(Keys.Control))
|
||||
else if ((ModifierKeys & Keys.Control) != 0)
|
||||
SortMenu.Sort();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace PKHeX.WinForms.Controls
|
|||
|
||||
public void DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) // external file
|
||||
if ((e.AllowedEffect & DragDropEffects.Copy) != 0) // external file
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
else if (e.Data != null) // within
|
||||
e.Effect = DragDropEffects.Move;
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace PKHeX.WinForms
|
|||
/// For application exceptions, continuing is not possible, so the button should not be shown.</remarks>
|
||||
private bool ShowContinue
|
||||
{
|
||||
get => B_Continue.Visible;
|
||||
set => B_Continue.Visible = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace PKHeX.WinForms
|
|||
|
||||
private void B_ActivateAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool export = ModifierKeys.HasFlag(Keys.Alt);
|
||||
bool export = (ModifierKeys & Keys.Alt) != 0;
|
||||
if (export)
|
||||
{
|
||||
var txt = Raids.DumpAll();
|
||||
|
@ -48,8 +48,8 @@ namespace PKHeX.WinForms
|
|||
return;
|
||||
}
|
||||
|
||||
bool rare = ModifierKeys.HasFlag(Keys.Control);
|
||||
bool isEvent = ModifierKeys.HasFlag(Keys.Shift);
|
||||
bool rare = (ModifierKeys & Keys.Control) != 0;
|
||||
bool isEvent = (ModifierKeys & Keys.Shift) != 0;
|
||||
Raids.ActivateAllRaids(rare, isEvent);
|
||||
LoadDen(CB_Den.SelectedIndex);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue