mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-25 16:20:08 -05:00
Implemented IV judgement formula.
This commit is contained in:
parent
b5b31af68c
commit
ef758a218b
|
|
@ -91,6 +91,26 @@ namespace PkmnFoundations.Structures
|
|||
SpecialDefense = 6
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum StatFlags
|
||||
{
|
||||
None = 0,
|
||||
Hp = 1,
|
||||
Attack = 2,
|
||||
Defense = 4,
|
||||
Speed = 8,
|
||||
SpecialAttack = 16,
|
||||
SpecialDefense = 32
|
||||
}
|
||||
|
||||
public enum Potential
|
||||
{
|
||||
Decent,
|
||||
AboveAverage,
|
||||
RelativelySuperior,
|
||||
Outstanding
|
||||
}
|
||||
|
||||
public enum Conditions
|
||||
{
|
||||
Cool = 1,
|
||||
|
|
|
|||
|
|
@ -45,5 +45,62 @@ namespace PkmnFoundations.Structures
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public JudgeSummary JudgeSummary
|
||||
{
|
||||
get
|
||||
{
|
||||
Potential overall = Potential.Decent;
|
||||
int overallInt = Stats.Sum(s => (int)s);
|
||||
if (overallInt > 90) overall = Potential.AboveAverage;
|
||||
if (overallInt > 120) overall = Potential.RelativelySuperior;
|
||||
if (overallInt > 150) overall = Potential.Outstanding;
|
||||
|
||||
byte bestIvValue = 0;
|
||||
StatFlags bestIvs = StatFlags.None;
|
||||
StatFlags zeroIvs = StatFlags.None;
|
||||
int current = 1;
|
||||
for (int x = 0; x < Stats.Length; x++)
|
||||
{
|
||||
if (Stats[x] > bestIvValue)
|
||||
{
|
||||
bestIvValue = Stats[x];
|
||||
bestIvs = (StatFlags)current;
|
||||
}
|
||||
else if (Stats[x] == bestIvValue)
|
||||
{
|
||||
bestIvs |= (StatFlags)current;
|
||||
}
|
||||
if (Stats[x] == 0)
|
||||
{
|
||||
zeroIvs |= (StatFlags)current;
|
||||
}
|
||||
current <<= 1;
|
||||
}
|
||||
|
||||
Potential bestPotential = Potential.Decent;
|
||||
if (bestIvValue > 15) bestPotential = Potential.AboveAverage;
|
||||
if (bestIvValue > 25) bestPotential = Potential.RelativelySuperior;
|
||||
if (bestIvValue > 30) bestPotential = Potential.Outstanding;
|
||||
|
||||
return new JudgeSummary(overall, bestIvs, bestPotential, zeroIvs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct JudgeSummary
|
||||
{
|
||||
public Potential OverallPotential;
|
||||
public StatFlags BestIvs;
|
||||
public Potential BestPotential;
|
||||
public StatFlags ZeroIvs;
|
||||
|
||||
public JudgeSummary(Potential overall_potential, StatFlags best_ivs, Potential best_potential, StatFlags zero_ivs)
|
||||
{
|
||||
OverallPotential = overall_potential;
|
||||
BestIvs = best_ivs;
|
||||
BestPotential = best_potential;
|
||||
ZeroIvs = zero_ivs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user