protected PBETrainerInfoBase(IPBEPokemonCollection party) { if (party == null) { throw new ArgumentNullException(nameof(party)); } if (party.Count < 1) { throw new ArgumentException("Party count must be at least 1", nameof(party)); } if (party is PBELegalPokemonCollection lp) { _requiredSettings = lp.Settings; } Party = new ReadOnlyCollection <IPBEPokemon>(party.ToArray()); }
public PBETrainerInfo(IPBEPokemonCollection party, string name) { if (party == null) { throw new ArgumentNullException(nameof(party)); } if (party.Count < 1) { throw new ArgumentException("Party count must be at least 1", nameof(party)); } if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentOutOfRangeException(nameof(name)); } if (party is PBELegalPokemonCollection lp) { _requiredSettings = lp.Settings; } Party = new ReadOnlyCollection <IPBEPokemon>(party.ToArray()); Name = name; }
protected PBETrainerInfoBase(IPBEPokemonCollection party) { if (party is IPBEPartyPokemonCollection ppc) { if (!ppc.Any(p => p.HP > 0 && !p.PBEIgnore)) { throw new ArgumentException("Party must have at least 1 conscious battler", nameof(party)); } } else { if (!party.Any(p => !p.PBEIgnore)) { throw new ArgumentException("Party must have at least 1 conscious battler", nameof(party)); } } if (party is PBELegalPokemonCollection lp) { _requiredSettings = lp.Settings; } Party = new ReadOnlyCollection <IPBEPokemon>(party.ToArray()); }