mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Merge GO IV checks, behavior is now correct
Rename IV1/2/3 to HP/ATK/DEF in gp1 structure
This commit is contained in:
parent
6fc8779aaa
commit
373aecdf7c
5 changed files with 38 additions and 45 deletions
|
@ -22,21 +22,6 @@ namespace PKHeX.Core
|
|||
pb.WeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
}
|
||||
|
||||
public override bool GetIVsValid(PKM pkm)
|
||||
{
|
||||
// Stamina*2 | 1 -> HP
|
||||
// ATK * 2 | 1 -> ATK&SPA
|
||||
// DEF * 2 | 1 -> DEF&SPD
|
||||
// Speed is random.
|
||||
|
||||
// All IVs must be odd (except speed) and equal to their counterpart.
|
||||
if ((pkm.GetIV(1) & 1) != 1 || pkm.GetIV(1) != pkm.GetIV(4)) // ATK=SPA
|
||||
return false;
|
||||
if ((pkm.GetIV(2) & 1) != 1 || pkm.GetIV(2) != pkm.GetIV(5)) // DEF=SPD
|
||||
return false;
|
||||
return (pkm.GetIV(0) & 1) == 1; // HP
|
||||
}
|
||||
|
||||
protected override void SetEncounterMoves(PKM pk, GameVersion version, int level)
|
||||
{
|
||||
var moves = MoveLevelUp.GetEncounterMoves(pk, level, GameVersion.GG);
|
||||
|
|
|
@ -23,11 +23,6 @@ namespace PKHeX.Core
|
|||
OriginGroup = originGroup;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the minimum IV (in GO) the encounter must have.
|
||||
/// </summary>
|
||||
public int GetMinIV() => Type.GetMinIV();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the <seealso cref="Ball"/> is compatible with the <seealso cref="PogoType"/>.
|
||||
/// </summary>
|
||||
|
@ -49,26 +44,11 @@ namespace PKHeX.Core
|
|||
pk8.WeightScalar = PokeSizeUtil.GetRandomScalar();
|
||||
}
|
||||
|
||||
public override bool GetIVsValid(PKM pkm)
|
||||
{
|
||||
var minIV = GetMinIV();
|
||||
return IsGoIVSetValid(pkm, minIV);
|
||||
}
|
||||
|
||||
protected override void SetEncounterMoves(PKM pk, GameVersion version, int level)
|
||||
{
|
||||
var moves = MoveLevelUp.GetEncounterMoves(pk, level, OriginGroup);
|
||||
pk.SetMoves(moves);
|
||||
pk.SetMaximumPPCurrent(moves);
|
||||
}
|
||||
|
||||
private static bool IsGoIVSetValid(PKM pkm, int min)
|
||||
{
|
||||
if (pkm.IV_ATK >> 1 < min) // ATK
|
||||
return false;
|
||||
if (pkm.IV_DEF >> 1 < min) // DEF
|
||||
return false;
|
||||
return pkm.IV_HP >> 1 >= min; // HP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,34 @@ namespace PKHeX.Core
|
|||
pk.SetRandomIVsGO(Type.GetMinIV());
|
||||
}
|
||||
|
||||
public abstract bool GetIVsValid(PKM pkm);
|
||||
public bool GetIVsAboveMinimum(PKM pkm)
|
||||
{
|
||||
int min = Type.GetMinIV();
|
||||
return GetIVsAboveMinimum(pkm, min);
|
||||
}
|
||||
|
||||
private static bool GetIVsAboveMinimum(PKM pkm, int min)
|
||||
{
|
||||
if (pkm.IV_ATK >> 1 < min) // ATK
|
||||
return false;
|
||||
if (pkm.IV_DEF >> 1 < min) // DEF
|
||||
return false;
|
||||
return pkm.IV_HP >> 1 >= min; // HP
|
||||
}
|
||||
|
||||
public static bool GetIVsValid(PKM pkm)
|
||||
{
|
||||
// HP * 2 | 1 -> HP
|
||||
// ATK * 2 | 1 -> ATK&SPA
|
||||
// DEF * 2 | 1 -> DEF&SPD
|
||||
// Speed is random.
|
||||
|
||||
// All IVs must be odd (except speed) and equal to their counterpart.
|
||||
if ((pkm.GetIV(1) & 1) != 1 || pkm.GetIV(1) != pkm.GetIV(4)) // ATK=SPA
|
||||
return false;
|
||||
if ((pkm.GetIV(2) & 1) != 1 || pkm.GetIV(2) != pkm.GetIV(5)) // DEF=SPD
|
||||
return false;
|
||||
return (pkm.GetIV(0) & 1) == 1; // HP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace PKHeX.Core
|
|||
|
||||
private void VerifyIVsGoTransfer(LegalityAnalysis data)
|
||||
{
|
||||
if (data.EncounterMatch is EncounterSlotGO g && !g.GetIVsValid(data.pkm))
|
||||
if (data.EncounterMatch is EncounterSlotGO && EncounterSlotGO.GetIVsValid(data.pkm))
|
||||
data.AddLine(GetInvalid(LIVNotCorrect));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,9 +89,9 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
|
||||
public int IV1 => BitConverter.ToInt32(Data, 0x50);
|
||||
public int IV2 => BitConverter.ToInt32(Data, 0x54);
|
||||
public int IV3 => BitConverter.ToInt32(Data, 0x58);
|
||||
public int IV_HP => BitConverter.ToInt32(Data, 0x50);
|
||||
public int IV_ATK => BitConverter.ToInt32(Data, 0x54);
|
||||
public int IV_DEF => BitConverter.ToInt32(Data, 0x58);
|
||||
public int Date => BitConverter.ToInt32(Data, 0x5C); // ####.##.## YYYY.MM.DD
|
||||
public int Year => Date / 1_00_00;
|
||||
public int Month => (Date / 1_00) % 1_00;
|
||||
|
@ -123,12 +123,12 @@ namespace PKHeX.Core
|
|||
{
|
||||
string form = Form > 0 ? $"-{Form:00}" : string.Empty;
|
||||
string star = IsShiny ? " ★" : string.Empty;
|
||||
return $"{Species:000}{form}{star} - {NickStr} - Lv. {Level:00} - {IV1:00}.{IV2:00}.{IV3:00} - CP {CP:0000} (Moves {Move1:000}, {Move2:000})";
|
||||
return $"{Species:000}{form}{star} - {NickStr} - Lv. {Level:00} - {IV_HP:00}.{IV_ATK:00}.{IV_DEF:00} - CP {CP:0000} (Moves {Move1:000}, {Move2:000})";
|
||||
}
|
||||
}
|
||||
|
||||
public string GeoTime => $"Captured in {GeoCityName} by {Username1} on {Year}/{Month:00}/{Day:00}";
|
||||
public string StatMove => $"{IV1:00}/{IV2:00}/{IV3:00}, CP {CP:0000} (Moves {Move1:000}, {Move2:000})";
|
||||
public string StatMove => $"{IV_HP:00}/{IV_ATK:00}/{IV_DEF:00}, CP {CP:0000} (Moves {Move1:000}, {Move2:000})";
|
||||
public string Dump(IReadOnlyList<string> speciesNames, int index) => $"{index:000} {Nickname} ({speciesNames[Species]}{FormString} {ShinyString}[{GenderString}]) @ Lv. {Level:00} - {StatMove}, {GeoTime}.";
|
||||
|
||||
public PB7 ConvertToPB7(ITrainerInfo sav) => ConvertToPB7(sav, EncounterCriteria.Unrestricted);
|
||||
|
@ -165,9 +165,9 @@ namespace PKHeX.Core
|
|||
pk.Nickname = SpeciesName.GetSpeciesNameGeneration(Species, sav.Language, 7);
|
||||
}
|
||||
|
||||
pk.IV_DEF = pk.IV_SPD = (IV3 * 2) + 1;
|
||||
pk.IV_ATK = pk.IV_SPA = (IV2 * 2) + 1;
|
||||
pk.IV_HP = (IV1 * 2) + 1;
|
||||
pk.IV_DEF = pk.IV_SPD = (IV_DEF * 2) + 1;
|
||||
pk.IV_ATK = pk.IV_SPA = (IV_ATK * 2) + 1;
|
||||
pk.IV_HP = (IV_HP * 2) + 1;
|
||||
pk.IV_SPE = Util.Rand.Next(32);
|
||||
|
||||
var pi = pk.PersonalInfo;
|
||||
|
|
Loading…
Reference in a new issue