Make it possible to inherit from BattleBuilder.

This commit is contained in:
Deukhoofd 2020-08-22 16:49:31 +02:00
parent a2cf693bbd
commit f74f29daef
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 7 additions and 7 deletions

View File

@ -6,12 +6,12 @@ namespace PkmnLibSharp.Battling
{ {
public class BattleBuilder public class BattleBuilder
{ {
private readonly BattleLibrary _library; protected readonly BattleLibrary _library;
private readonly bool _canFlee; protected readonly bool _canFlee;
private readonly byte _numberOfSides; protected readonly byte _numberOfSides;
private readonly byte _pokemonPerSide; protected readonly byte _pokemonPerSide;
private ulong? _seed; protected ulong? _seed;
private readonly List<BattleParty> _parties = new List<BattleParty>(); protected readonly List<BattleParty> _parties = new List<BattleParty>();
public BattleBuilder(BattleLibrary library, bool canFlee, byte numberOfSides = 2, byte pokemonPerSide = 1) public BattleBuilder(BattleLibrary library, bool canFlee, byte numberOfSides = 2, byte pokemonPerSide = 1)
{ {
@ -34,7 +34,7 @@ namespace PkmnLibSharp.Battling
return this; return this;
} }
public Battle Build() public virtual Battle Build()
{ {
// Use the milliseconds since epoch time as random seed if none is specified. // Use the milliseconds since epoch time as random seed if none is specified.
_seed ??= (ulong) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds; _seed ??= (ulong) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds;