Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish Wyrm Agility #6149

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/skilling/skills/agility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const courses: Course[] = [
xp: agilLevel => (agilLevel >= 62 ? 650 : 520),
lapTime: 60,
cantFail: true,
petChance: 50_000, //TODO: Update with real rate when it's confirmed
petChance: agilLevel => (agilLevel >= 62 ? 25_406 : 28_503),
requiredQuests: [QuestID.ChildrenOfTheSun]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/skilling/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export interface Course {
marksPer60?: number;
lapTime: number;
cantFail?: boolean;
petChance: number;
petChance: number | ((agilityLevel: number) => number);
aliases: string[];
qpRequired?: number;
requiredQuests?: QuestID[];
Expand Down
55 changes: 37 additions & 18 deletions src/tasks/minions/agilityActivity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Time, increaseNumByPercent, randInt, roll } from 'e';
import { Time, increaseNumByPercent, percentChance, randInt, roll } from 'e';
import { Bank } from 'oldschooljs';
import type { ItemBank } from 'oldschooljs/dist/meta/types';

Expand Down Expand Up @@ -94,9 +94,11 @@ export function calculateAgilityResult({

// Calculate failed laps
let lapsFailed = 0;
for (let t = 0; t < quantity; t++) {
if (randInt(1, 100) < chanceOfFailingAgilityPyramid(agilityLevel)) {
lapsFailed += 1;
if (!course.cantFail) {
for (let t = 0; t < quantity; t++) {
if (randInt(1, 100) < chanceOfFailingAgilityPyramid(agilityLevel)) {
lapsFailed += 1;
}
}
}

Expand All @@ -108,6 +110,18 @@ export function calculateAgilityResult({
loot.add('Crystal shard', quantity);
}

// Wyrm Course
if (course.name === 'Colossal Wyrm Agility Course') {
for (let i = 0; i < quantity; i++) {
if (roll(3)) {
loot.add('termites', randInt(8, 10));
if (percentChance(75)) {
loot.add('blessed bone shards', randInt(22, 28));
}
}
}
}

// Agility pyramid
if (course.name === 'Agility Pyramid') {
loot.add('Coins', 10_000 * (quantity - lapsFailed));
Expand Down Expand Up @@ -200,6 +214,18 @@ export const agilityTask: MinionTask = {
);
}

// Roll for monkey backpacks
if (course.name === 'Ape Atoll Agility Course') {
const currentLapCount = (newLapScores as ItemBank)[course.id];
for (const monkey of Agility.MonkeyBackpacks) {
if (currentLapCount < monkey.lapsRequired) break;
if (!user.hasEquippedOrInBank(monkey.id)) {
loot.add(monkey.id);
messages.push(`You received the ${monkey.name} monkey backpack!`);
}
}
}

if (alch) {
const alchedItem = getOSItem(alch.itemID);
const alchGP = alchedItem.highalch! * alch.quantity;
Expand All @@ -214,19 +240,7 @@ export const agilityTask: MinionTask = {

let str = `${user}, ${user.minionName} finished ${quantity} ${course.name} laps and fell on ${lapsFailed} of them.\nYou received: ${loot}.\n${xpRes}`;

// Roll for monkey backpacks
if (course.id === 6) {
const currentLapCount = (newLapScores as ItemBank)[course.id];
for (const monkey of Agility.MonkeyBackpacks) {
if (currentLapCount < monkey.lapsRequired) break;
if (!user.hasEquippedOrInBank(monkey.id)) {
loot.add(monkey.id);
messages.push(`You received the ${monkey.name} monkey backpack!`);
}
}
}

// Roll for pets
// Roll for custom pets & loot
if (duration >= MIN_LENGTH_FOR_PET) {
if (course.id === 4) {
const scruffyDroprate = clAdjustedDroprate(
Expand Down Expand Up @@ -286,8 +300,13 @@ export const agilityTask: MinionTask = {
}
}
}

// Roll for pet
const { petDropRate } = skillingPetDropRate(user, SkillsEnum.Agility, course.petChance);
const { petDropRate } = skillingPetDropRate(
user,
SkillsEnum.Agility,
typeof course.petChance === 'number' ? course.petChance : course.petChance(currentLevel)
);
if (roll(petDropRate / quantity)) {
loot.add('Giant squirrel');
petMessages.push("You have a funny feeling you're being followed...");
Expand Down