Add more party related properties/methods

This commit is contained in:
Kurt
2019-01-12 10:54:38 -08:00
parent ca0e012c5c
commit b5cf02a933
2 changed files with 21 additions and 1 deletions

View File

@@ -782,12 +782,32 @@ public void SetStats(ushort[] stats)
Stat_SPD = stats[5];
}
/// <summary>
/// Indicates if Party Stats are present. False if not initialized (from stored format).
/// </summary>
public bool PartyStatsPresent => Stat_HPMax != 0;
/// <summary>
/// Clears any status condition and refreshes the stats.
/// </summary>
public void Heal()
{
SetStats(GetStats(PersonalInfo));
Status_Condition = 0;
}
/// <summary>
/// Enforces that Party Stat values are present.
/// </summary>
/// <returns>True if stats were refreshed, false if stats were already present.</returns>
public bool ForcePartyData()
{
if (PartyStatsPresent)
return false;
Heal();
return true;
}
/// <summary>
/// Checks if the <see cref="PKM"/> can hold its <see cref="HeldItem"/>.
/// </summary>

View File

@@ -253,7 +253,7 @@ private void LoadFieldsFromPKM(PKM pk, bool focus = true, bool skipConversionChe
MT_Level.Text = (pk.Stat_HPMax != 0 ? pk.Stat_Level : Experience.GetLevel(pk.EXP, pk.Species, pk.AltForm)).ToString();
TB_EXP.Text = pk.EXP.ToString();
MT_Form.Text = pk.AltForm.ToString();
if (pk.Stat_HPMax != 0) // stats present
if (pk.PartyStatsPresent) // stats present
Stats.LoadPartyStats(pk);
}
FieldsLoaded = true;