Skip to content

Commit

Permalink
fix: pf version filter
Browse files Browse the repository at this point in the history
  • Loading branch information
RakuJa committed May 30, 2024
1 parent c7ad8d8 commit aad2a7c
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions src/models/creature/creature_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,28 @@ impl Creature {
.type_filter
.as_ref()
.map_or(true, |cr_type| self.core_data.essential.cr_type == *cr_type)
&& filters.role_threshold.is_none()
|| filters.role_filter.as_ref().map_or(true, |cr_role| {
let t = filters.role_threshold.unwrap_or(0);
match cr_role {
CreatureRoleEnum::Brute => self.core_data.derived.brute_percentage >= t,
CreatureRoleEnum::MagicalStriker => {
self.core_data.derived.magical_striker_percentage >= t
&& (filters.role_threshold.is_none()
|| filters.role_filter.as_ref().map_or(true, |cr_role| {
let t = filters.role_threshold.unwrap_or(0);
match cr_role {
CreatureRoleEnum::Brute => self.core_data.derived.brute_percentage >= t,
CreatureRoleEnum::MagicalStriker => {
self.core_data.derived.magical_striker_percentage >= t
}
CreatureRoleEnum::SkillParagon => {
self.core_data.derived.skill_paragon_percentage >= t
}
CreatureRoleEnum::Skirmisher => {
self.core_data.derived.skirmisher_percentage >= t
}
CreatureRoleEnum::Sniper => self.core_data.derived.sniper_percentage >= t,
CreatureRoleEnum::Soldier => self.core_data.derived.soldier_percentage >= t,
CreatureRoleEnum::SpellCaster => {
self.core_data.derived.spell_caster_percentage >= t
}
}
CreatureRoleEnum::SkillParagon => {
self.core_data.derived.skill_paragon_percentage >= t
}
CreatureRoleEnum::Skirmisher => {
self.core_data.derived.skirmisher_percentage >= t
}
CreatureRoleEnum::Sniper => self.core_data.derived.sniper_percentage >= t,
CreatureRoleEnum::Soldier => self.core_data.derived.soldier_percentage >= t,
CreatureRoleEnum::SpellCaster => {
self.core_data.derived.spell_caster_percentage >= t
}
}
}) && match filters.pathfinder_version.clone().unwrap_or_default() {
}))
&& match filters.pathfinder_version.clone().unwrap_or_default() {
PathfinderVersionEnum::Legacy => !self.core_data.essential.remaster,
PathfinderVersionEnum::Remaster => self.core_data.essential.remaster,
PathfinderVersionEnum::Any => true,
Expand Down

0 comments on commit aad2a7c

Please sign in to comment.