Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
Remove stats from meta affixes when the tier stat type is selected.
  • Loading branch information
DanielWieder committed Jul 31, 2017
1 parent 7d5f39b commit 7ae43b0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public static class AffixValueCalculator
private static List<string> HybridEvasionPercentDefenseAffixNames => HybridDefenseAffixNames.Where(x => x.Contains("Evasion")).ToList();
private static List<string> HybridArmourPercentDefenseAffixNames => HybridDefenseAffixNames.Where(x => x.Contains("Armour") || x.Contains("PhysicalDamageReductionRating")).ToList();


private class ConditionContainer
{
public ItemBase ItemBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public partial class SubconditionAffixControl : UserControl, INotifyPropertyChan

// There are no relevant third stats. All of them have their min/max values as equal

public bool HasFirstStat => AffixName != null && !string.IsNullOrEmpty(FirstStatName) && _statOneMin != _statOneMax;
public bool HasSecondStat => AffixName != null && !IsTier && !string.IsNullOrEmpty(SecondStatName) && _statTwoMin != _statThreeMax;
public bool HasFirstStat => !string.IsNullOrEmpty(AffixName) && !string.IsNullOrEmpty(FirstStatName) && _statOneMin != _statOneMax;
public bool HasSecondStat => !string.IsNullOrEmpty(AffixName) && !IsTier && !string.IsNullOrEmpty(SecondStatName) && _statTwoMin != _statTwoMax;

public bool HasOneStat => (HasFirstStat && !HasSecondStat) || (!HasFirstStat && HasSecondStat);
private bool IsMetaAffix => AffixName != null && _affixType == AffixType.Meta;
private bool IsMetaAffix => !string.IsNullOrEmpty(AffixName) && _affixType == AffixType.Meta;
public bool IsTier => StatValueType == StatValueType.Tier;

public Visibility DoubleStatSelectionVisibility => BoolToVisibility(!IsMetaAffix && (HasFirstStat && HasSecondStat));
Expand All @@ -80,7 +80,7 @@ public partial class SubconditionAffixControl : UserControl, INotifyPropertyChan
_statValueType = value;
OnPropertyChanged(nameof(StatValueType));

if (_affixType == AffixType.Meta && _statValueType == StatValueType.Tier)
if (IsMetaAffix && IsTier)
{
ClearStats();
return;
Expand Down Expand Up @@ -136,26 +136,31 @@ private void ClearStats()

_statOneMin = null;
_statOneMax = null;

_statTwoMin = null;
_statTwoMax = null;

_statThreeMin = null;
_statThreeMax = null;

FirstStatMin = _statOneMin;
SecondStatMin = _statTwoMin;
ThirdStatMin = _statThreeMin;
FirstStatMax = _statOneMax;

SecondStatMin = _statTwoMin;
SecondStatMax = _statTwoMax;

ThirdStatMin = _statThreeMin;
ThirdStatMax = _statThreeMax;

OnPropertyChanged(nameof(AffixName));
OnPropertyChanged(nameof(DoubleStatSelectionVisibility));
OnPropertyChanged(nameof(FirstStatSelectionVisibility));
OnPropertyChanged(nameof(SecondStatSelectionVisibility));
OnPropertyChanged(nameof(FirstStatName));
OnPropertyChanged(nameof(SecondStatName));
OnPropertyChanged(nameof(ThirdStatName));
OnPropertyChanged(nameof(FirstStatMin));
OnPropertyChanged(nameof(SecondStatMin));
OnPropertyChanged(nameof(FirstStatMax));
OnPropertyChanged(nameof(SecondStatMin));
OnPropertyChanged(nameof(SecondStatMax));
OnPropertyChanged(nameof(ThirdStatMin));
Expand Down Expand Up @@ -202,21 +207,21 @@ public SubconditionAffixControl(ConditionAffix condition, List<Affix> affixes, S

public ConditionAffix GetCondition()
{
if (string.IsNullOrEmpty(_affixName))
if (string.IsNullOrEmpty(_affixName) || (IsMetaAffix && IsTier))
{
return null;
}

var condition = new ConditionAffix();

condition.ModType = RemoveSpaces(_affixName);

condition.Min1 = FirstStatMin;
condition.Max1 = FirstStatMax;
condition.Min2 = SecondStatMin;
condition.Max2 = SecondStatMax;
condition.Min3 = ThirdStatMin;
condition.Max3 = ThirdStatMax;
var condition = new ConditionAffix
{
ModType = RemoveSpaces(_affixName),
Min1 = FirstStatMin,
Max1 = FirstStatMax,
Min2 = SecondStatMin,
Max2 = SecondStatMax,
Min3 = ThirdStatMin,
Max3 = ThirdStatMax
};

return condition;
}
Expand Down

0 comments on commit 7ae43b0

Please sign in to comment.