mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-10-01 13:26:39 -05:00
reconfigure move learn banned fixing
5c452b8b6b (commitcomment-25007984)
should have referenced move instead; move all update logic to
moverandomizer.
This commit is contained in:
@@ -32,11 +32,7 @@ public LearnsetRandomizer(GameConfig config, Learnset[] sets)
|
||||
public bool Learn4Level1 = false;
|
||||
|
||||
public bool STAB { set => moverand.rSTAB = value; }
|
||||
public IList<int> BannedMoves
|
||||
{
|
||||
get => moverand.BannedMoves;
|
||||
set => moverand.BannedMoves = value;
|
||||
}
|
||||
public IList<int> BannedMoves { set => moverand.BannedMoves = value; }
|
||||
public decimal rSTABPercent { set => moverand.rSTABPercent = value; }
|
||||
|
||||
public void Execute()
|
||||
|
||||
@@ -125,5 +125,19 @@ public int GetRandomFirstMove(int[] types)
|
||||
} while (!types.Contains(MoveData[move].Type));
|
||||
return move;
|
||||
}
|
||||
|
||||
public bool SanitizeMovesetForBannedMoves(int[] moves, int index)
|
||||
{
|
||||
bool updated = false;
|
||||
for (int m = 0; m < moves.Length; m++)
|
||||
{
|
||||
if (!BannedMoves.Contains(moves[m]))
|
||||
continue;
|
||||
updated = true;
|
||||
moves[m] = GetRandomFirstMove(index);
|
||||
}
|
||||
|
||||
return updated;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,17 +676,8 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
||||
// sanitize moves
|
||||
if (CB_Moves.SelectedIndex > 1) // learn source
|
||||
{
|
||||
bool update = false;
|
||||
var moves = pk.Moves;
|
||||
for (int m = 0; m < moves.Length; m++)
|
||||
{
|
||||
if (!learn.BannedMoves.Contains(moves[m]))
|
||||
continue;
|
||||
update = true;
|
||||
moves[m] = move.GetRandomFirstMove(pk.Species);
|
||||
}
|
||||
|
||||
if (update)
|
||||
if (move.SanitizeMovesetForBannedMoves(moves, pk.Species))
|
||||
pk.Moves = moves;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user