Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
DayV-git committed Nov 24, 2024
1 parent 20df406 commit 7251d4b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/lib/minions/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function addMonsterXPRaw(params: {
});

// Add cannon xp last so it's easy to distinguish
if (params.usingCannon) {
if (params.usingCannon || params.cannonMulti) {
xpBank.add('ranged', Math.floor(hp * 2 * cannonQty), {
duration: params.duration,
minimal: params.minimal ?? true
Expand Down
2 changes: 1 addition & 1 deletion src/lib/util/repeatStoredTrip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ const tripHandlers = {
commandName: 'k',
args: (data: MonsterActivityTaskOptions) => {
let method: PvMMethod = 'none';
if (data.usingCannon) method = 'cannon';
if (data.usingCannon || data.cannonMulti) method = 'cannon';
if (data.chinning) method = 'chinning';
else if (data.bob === SlayerActivityConstants.IceBarrage) method = 'barrage';
else if (data.bob === SlayerActivityConstants.IceBurst) method = 'burst';
Expand Down
28 changes: 5 additions & 23 deletions src/mahoji/lib/abstracted_commands/minionKill/newMinionKill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { mergeDeep } from 'remeda';
import z from 'zod';
import type { BitField, PvMMethod } from '../../../../lib/constants';
import { getSimilarItems } from '../../../../lib/data/similarItems';
import { type CombatOptionsEnum, SlayerActivityConstants } from '../../../../lib/minions/data/combatConstants';
import type { CombatOptionsEnum } from '../../../../lib/minions/data/combatConstants';
import { revenantMonsters } from '../../../../lib/minions/data/killableMonsters/revs';
import {
type AttackStyles,
Expand All @@ -19,41 +19,23 @@ import { type CurrentSlayerInfo, determineCombatBoosts } from '../../../../lib/s
import type { GearBank } from '../../../../lib/structures/GearBank';
import { UpdateBank } from '../../../../lib/structures/UpdateBank';
import type { Peak } from '../../../../lib/tickers';
import {
checkRangeGearWeapon,
formatDuration,
isWeekend,
itemNameFromID,
numberEnum,
zodEnum
} from '../../../../lib/util';
import { checkRangeGearWeapon, formatDuration, isWeekend, itemNameFromID, zodEnum } from '../../../../lib/util';
import getOSItem from '../../../../lib/util/getOSItem';
import { killsRemainingOnTask } from './calcTaskMonstersRemaining';
import { type PostBoostEffect, postBoostEffects } from './postBoostEffects';
import { speedCalculations } from './timeAndSpeed';
import { CombatMethodOptionsSchema, speedCalculations } from './timeAndSpeed';

const newMinionKillReturnSchema = z.object({
duration: z.number().int().positive(),
quantity: z.number().int().positive(),
isOnTask: z.boolean(),
isInWilderness: z.boolean(),
attackStyles: z.array(z.enum(zodEnum(attackStylesArr))),
currentTaskOptions: z.object({
bob: z
.number()
.superRefine(numberEnum([SlayerActivityConstants.IceBarrage, SlayerActivityConstants.IceBurst]))
.optional(),
usingCannon: z.boolean().optional(),
cannonMulti: z.boolean().optional(),
chinning: z.boolean().optional(),
hasWildySupplies: z.boolean().optional(),
died: z.boolean().optional(),
pkEncounters: z.number().int().min(0).optional(),
isInWilderness: z.boolean().optional()
}),
currentTaskOptions: CombatMethodOptionsSchema,
messages: z.array(z.string()),
updateBank: z.instanceof(UpdateBank)
});

export type MinionKillReturn = z.infer<typeof newMinionKillReturnSchema>;
export interface MinionKillOptions {
attackStyles: AttackStyles[];
Expand Down
5 changes: 4 additions & 1 deletion src/mahoji/lib/abstracted_commands/minionKill/speedBoosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ const cannonBoost: Boost = {
return {
percentageReduction: boostCannon,
consumables: [cannonSingleConsumables],
message: `${boostCannon}% for Cannon in singles`
message: `${boostCannon}% for Cannon in singles`,
changes: {
usingCannon: true
}
};
}

Expand Down
18 changes: 17 additions & 1 deletion src/mahoji/lib/abstracted_commands/minionKill/timeAndSpeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,35 @@ import { Bank } from 'oldschooljs';
import { mergeDeep } from 'remeda';
import z from 'zod';

import { SlayerActivityConstants } from '../../../../lib/minions/data/combatConstants';
import { type AttackStyles, getAttackStylesContext } from '../../../../lib/minions/functions';
import reducedTimeFromKC from '../../../../lib/minions/functions/reducedTimeFromKC';
import type { Consumable } from '../../../../lib/minions/types';
import { ChargeBank } from '../../../../lib/structures/Bank';
import { UpdateBank } from '../../../../lib/structures/UpdateBank';
import type { SkillsRequired } from '../../../../lib/types';
import { numberEnum } from '../../../../lib/util';
import { getItemCostFromConsumables } from './handleConsumables';
import { type BoostArgs, type BoostResult, type CombatMethodOptions, mainBoostEffects } from './speedBoosts';

export const CombatMethodOptionsSchema = z.object({
bob: z
.number()
.superRefine(numberEnum([SlayerActivityConstants.IceBarrage, SlayerActivityConstants.IceBurst]))
.optional(),
usingCannon: z.boolean().optional(),
cannonMulti: z.boolean().optional(),
chinning: z.boolean().optional(),
hasWildySupplies: z.boolean().optional(),
died: z.boolean().optional(),
pkEncounters: z.number().int().min(0).optional(),
isInWilderness: z.boolean().optional()
});

const schema = z.object({
timeToFinish: z.number().int().positive(),
messages: z.array(z.string()),
currentTaskOptions: z.object({}),
currentTaskOptions: CombatMethodOptionsSchema,
finalQuantity: z.number().int().positive().min(1),
confirmations: z.array(z.string()),
updateBank: z.instanceof(UpdateBank)
Expand Down
3 changes: 2 additions & 1 deletion src/tasks/minions/monsterActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ export function doMonsterTrip(data: newOptions) {
});

const superiorTable = slayerContext.hasSuperiorsUnlocked && monster.superior ? monster.superior : undefined;
const isInCatacombs = (!usingCannon ? (monster.existsInCatacombs ?? undefined) : undefined) && !isInWilderness;
const isInCatacombs =
(!(usingCannon || cannonMulti) ? (monster.existsInCatacombs ?? undefined) : undefined) && !isInWilderness;

const hasRingOfWealthI = gearBank.gear.wildy.hasEquipped('Ring of wealth (i)') && isInWilderness;
if (hasRingOfWealthI) {
Expand Down

0 comments on commit 7251d4b

Please sign in to comment.