Skip to content

Commit

Permalink
Merge pull request #37 from TheAsel/variant_level_fix
Browse files Browse the repository at this point in the history
🐛 Fix variant level in creature sheets & encounter
  • Loading branch information
TheAsel authored Jul 23, 2024
2 parents f6a9350 + b3030c6 commit ce7fb5b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bybe-frontend",
"version": "2.0.0",
"version": "2.0.1",
"description": "Beyond Your Bestiary Explorer (BYBE) is a one-stop shop for the most useful tools for Pathfinder Second Edition GMs",
"productName": "BYBE - Pathfinder 2e GM Tools",
"author": "TheAsel",
Expand Down
12 changes: 10 additions & 2 deletions src/components/Encounter/CreatureList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ const debouncedCall = debounce(async function () {
for (let j = 0; j < creature.quantity!; j++) {
switch (creature.variant) {
case 'Weak':
enemyLevels.push(creature.level - 1);
if (creature.level === 1) {
enemyLevels.push(-1);
} else {
enemyLevels.push(creature.level - 1);
}
break;
case 'Elite':
enemyLevels.push(creature.level + 1);
if (creature.level === -1) {
enemyLevels.push(1);
} else {
enemyLevels.push(creature.level + 1);
}
break;
default:
enemyLevels.push(creature.level);
Expand Down
8 changes: 4 additions & 4 deletions src/components/Encounter/CreaturesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const columns: {
{
name: 'level',
label: 'Level',
field: (row) => row.core_data.essential.level,
field: (row) => row.core_data.essential.base_level,
required: false,
align: 'left',
sortable: true,
Expand Down Expand Up @@ -186,8 +186,8 @@ const combineFilters = computed(() => {
let filteredLevel = filteredNames.filter((out) => {
if (levelRange.value.max < 25 || levelRange.value.min > -1) {
return (
out.core_data.essential.level <= levelRange.value.max &&
out.core_data.essential.level >= levelRange.value.min
out.core_data.essential.base_level <= levelRange.value.max &&
out.core_data.essential.base_level >= levelRange.value.min
);
}
return out;
Expand Down Expand Up @@ -297,7 +297,7 @@ const addCreature = debounce(function (creature: creature) {
id: creature.core_data.essential.id,
archive_link: creature.core_data.derived.archive_link,
name: creature.core_data.essential.name,
level: creature.core_data.essential.level,
level: creature.core_data.essential.base_level,
variant: 'Base'
};
encounter.addToEncounter(min_creature);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const generateEncounter = debounce(async function () {
id: randomEncounter.results[i].core_data.essential.id,
archive_link: randomEncounter.results[i].core_data.derived.archive_link,
name: randomEncounter.results[i].core_data.essential.name,
level: randomEncounter.results[i].core_data.essential.level,
level: randomEncounter.results[i].core_data.essential.base_level,
variant: randomEncounter.results[i].variant_data?.variant
};
encounter.addToEncounter(min_creature);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/BestiaryPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ const printPage = () => {
<div class="tw-my-auto">
{{ creatureData?.core_data.essential.cr_type.toUpperCase() }}
<span :class="{ 'tw-text-red-600': creatureVariant != 'Base' }">{{
creatureData?.core_data.essential.level
creatureData?.variant_data?.level
}}</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/types/creature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type creature = {
aon_id: number;
name: string;
hp: number;
level: number;
base_level: number;
size: sizes;
family: string;
rarity: rarities;
Expand Down

0 comments on commit ce7fb5b

Please sign in to comment.