Skip to content

Commit

Permalink
commented filter permutation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rorschach7552 committed Sep 19, 2024
1 parent d4e2ec2 commit 2a53b46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/components/HoverCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ const HoverCard: React.FC<HoverCardProps> = ({ item, children }) => {
});
return;
}

console.log('Item not found in any table');
} catch (error) {
console.error('Error fetching item data:', error);
}
Expand Down
13 changes: 13 additions & 0 deletions src/features/armor-optimization/filter-permutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import {
FragmentStatModifications,
} from '../../types/d2l-types';

/**
* Finds the stat deficit by considering the total armor in each permutation and the fragment modifications.
* Then, it tries pre-calculated mod combinations to meet the required threshold.
* It returns a sorted, filtered permutation array based on the lowest number of mods used.
*/

interface SelectedThresholds {
[key: string]: number;
}
Expand Down Expand Up @@ -99,6 +105,13 @@ function calculateTotalCost(perm: FilteredPermutation): number {
return total;
}

/**
* The algorithm for the ShareLoadout link to find optimal armor from the receiving user's armor pool.
* It starts with the highest priority stat at its maximum threshold and decrements
* the threshold until a permutation is found. This allows us to find the best or closest
* possible armor from the receiving user's armor pool.
*/

export function filterFromSharedLoadout(
decodedLoadout: DecodedLoadoutData,
permutations: DestinyArmor[][],
Expand Down

0 comments on commit 2a53b46

Please sign in to comment.