Skip to content

Commit

Permalink
Let repeat trips use combat methods, get correct xp for cannoning, pr…
Browse files Browse the repository at this point in the history
…event cannoning in catacombs (#6214)
  • Loading branch information
DayV-git authored and gc committed Dec 11, 2024
1 parent 0ebb4f1 commit 88e48e0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/lib/util/repeatStoredTrip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ export const tripHandlers = {
commandName: 'k',
args: (data: MonsterActivityTaskOptions) => {
let method: PvMMethod = 'none';
if (data.usingCannon) method = 'cannon';
if (data.chinning) (method as string) = 'chinning';
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';
return {
Expand Down
23 changes: 5 additions & 18 deletions src/mahoji/lib/abstracted_commands/minionKill/newMinionKill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import z from 'zod';
import { BitField, type PvMMethod, YETI_ID } from '../../../../lib/constants';
import { getSimilarItems } from '../../../../lib/data/similarItems';
import type { InventionID } from '../../../../lib/invention/inventions';
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 @@ -27,37 +27,24 @@ import {
formatDuration,
isWeekend,
itemID,
itemNameFromID,
numberEnum,
zodEnum
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
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 @@ -322,7 +322,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 88e48e0

Please sign in to comment.