Skip to content

Commit

Permalink
Fix Projectiles not checking similar weapons
Browse files Browse the repository at this point in the history
  • Loading branch information
themrrobert committed Oct 11, 2023
1 parent 02cb612 commit dd2bf6e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { ADMIN_IDS, OWNER_IDS, SupportServer } from '../config';
import { ClueTiers } from './clues/clueTiers';
import { badgesCache, BitField, projectiles, usernameCache } from './constants';
import { UserStatsDataNeededForCL } from './data/Collections';
import { getSimilarItems } from './data/similarItems';
import { DefenceGearStat, GearSetupType, GearSetupTypes, GearStat, OffenceGearStat } from './gear/types';
import type { Consumable } from './minions/types';
import { MUserClass } from './MUser';
Expand Down Expand Up @@ -515,7 +516,12 @@ export function checkRangeGearWeapon(gear: Gear) {
const { ammo } = gear;
if (!ammo) return 'You have no ammo equipped.';

const projectileCategory = objectEntries(projectiles).find(i => i[1].weapons.includes(weapon.id));
const projectileCategory = objectEntries(projectiles).find(i =>
i[1].weapons
.map(w => getSimilarItems(w))
.flat()
.includes(weapon.id)
);
if (!projectileCategory) return 'You have an invalid range weapon.';
if (!projectileCategory[1].items.includes(ammo.item)) {
return `You have invalid ammo for your equipped weapon. For ${
Expand Down

0 comments on commit dd2bf6e

Please sign in to comment.