forked from tylercamp/palcalc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPalSpecifier.cs
41 lines (34 loc) · 1.57 KB
/
PalSpecifier.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using PalCalc.Model;
using PalCalc.Solver.PalReference;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PalCalc.Solver
{
public class PalSpecifier
{
public Pal Pal { get; set; }
public List<PassiveSkill> RequiredPassives { get; set; } = new List<PassiveSkill>();
public PalGender RequiredGender { get; set; } = PalGender.WILDCARD;
public List<PassiveSkill> OptionalPassives { get; set; } = new List<PassiveSkill>();
public IEnumerable<PassiveSkill> DesiredPassives => RequiredPassives.Concat(OptionalPassives);
public int IV_HP { get; set; }
public int IV_Attack { get; set; }
public int IV_Defense { get; set; }
public override string ToString() => $"{Pal.Name} with {RequiredPassives.PassiveSkillListToString()}";
public bool IsSatisfiedBy(IPalReference palRef) =>
Pal == palRef.Pal &&
!RequiredPassives.Except(palRef.EffectivePassives).Any() &&
(RequiredGender == PalGender.WILDCARD || palRef.Gender == PalGender.WILDCARD || palRef.Gender == RequiredGender) &&
(IV_HP == 0 || palRef.IVs.HP.Satisfies(IV_HP)) &&
(IV_Attack == 0 || palRef.IVs.Attack.Satisfies(IV_Attack)) &&
(IV_Defense == 0 || palRef.IVs.Defense.Satisfies(IV_Defense));
public void Normalize()
{
RequiredPassives = RequiredPassives.Distinct().ToList();
OptionalPassives = OptionalPassives.Except(RequiredPassives).Distinct().ToList();
}
}
}