Add alpha move for encounter slots

oops
Closes #3427
This commit is contained in:
Kurt 2022-02-09 19:21:45 -08:00
parent bc2549b24e
commit d17639f956
4 changed files with 35 additions and 14 deletions

View file

@ -75,16 +75,6 @@ namespace PKHeX.Core
/// </summary>
/// <param name="pk">Pokémon to modify.</param>
/// <param name="index">Move PP to refresh.</param>
public static void SetSuggestedMovePP(this PKM pk, int index)
{
switch (index)
{
case 0: pk.Move1_PP = pk.GetMovePP(pk.Move1, pk.Move1_PPUps); return;
case 1: pk.Move2_PP = pk.GetMovePP(pk.Move2, pk.Move2_PPUps); return;
case 2: pk.Move3_PP = pk.GetMovePP(pk.Move3, pk.Move3_PPUps); return;
case 3: pk.Move4_PP = pk.GetMovePP(pk.Move4, pk.Move4_PPUps); return;
default: throw new ArgumentOutOfRangeException(nameof(index));
}
}
public static void SetSuggestedMovePP(this PKM pk, int index) => pk.HealPPIndex(index);
}
}
}

View file

@ -37,7 +37,11 @@ public sealed record EncounterSlot8a : EncounterSlot, IAlpha
if (pk is IScaledSize s)
s.HeightScalar = s.WeightScalar = byte.MaxValue;
if (Type is not SlotType.Landmark && pk is PA8 pa)
pa.SetMasteryFlagMove(pa.AlphaMove = pa.GetRandomAlphaMove());
{
var extra = pa.AlphaMove = pa.GetRandomAlphaMove();
pa.SetMasteryFlagMove(extra);
pk.PushMove(extra);
}
}
if (pk is IScaledSizeValue v)
{

View file

@ -53,7 +53,11 @@ public sealed record EncounterStatic8a(GameVersion Version) : EncounterStatic(Ve
pa.SetMasteryFlags();
pa.HeightScalarCopy = pa.HeightScalar;
if (IsAlpha)
pa.SetMasteryFlagMove(pa.AlphaMove = pa.GetRandomAlphaMove());
{
var extra = pa.AlphaMove = pa.GetRandomAlphaMove();
pa.SetMasteryFlagMove(extra);
pk.PushMove(extra);
}
}
pk.SetRandomEC();

View file

@ -415,6 +415,20 @@ namespace PKHeX.Core
set => SetMoves(value);
}
public void PushMove(int move)
{
if (move == 0 || (uint)move >= MaxMoveID)
return;
var ct = MoveCount;
if (ct == 4)
ct = 0;
SetMove(ct, move);
HealPPIndex(ct);
}
public int MoveCount => Convert.ToInt32(Move1 != 0) + Convert.ToInt32(Move2 != 0) + Convert.ToInt32(Move3 != 0) + Convert.ToInt32(Move4 != 0);
public void SetMoves(IReadOnlyList<int> value)
{
Move1 = value.Count > 0 ? value[0] : 0;
@ -740,6 +754,15 @@ namespace PKHeX.Core
Move4_PP = GetMovePP(Move4, Move4_PPUps);
}
public int HealPPIndex(int index) => index switch
{
0 => Move1_PP = GetMovePP(Move1, Move1_PPUps),
1 => Move2_PP = GetMovePP(Move2, Move2_PPUps),
2 => Move3_PP = GetMovePP(Move3, Move3_PPUps),
3 => Move4_PP = GetMovePP(Move4, Move4_PPUps),
_ => throw new ArgumentOutOfRangeException(nameof(index)),
};
/// <summary>
/// Enforces that Party Stat values are present.
/// </summary>