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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSO Wildy Changes #5926

Merged
merged 2 commits into from
Jul 2, 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
6 changes: 4 additions & 2 deletions src/lib/minions/data/killableMonsters/custom/demiBosses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ const Malygos: CustomMonster = {
uniques: resolveItems(['Abyssal thread', 'Abyssal cape', 'Ori', 'Dragon hunter lance']),
notifyDrops: resolveItems(['Abyssal cape', 'Ori']),
baseMonster: Monsters.Vorkath,
customMonsterData: { attributes: [MonsterAttribute.Dragon, MonsterAttribute.Fiery] }
customMonsterData: { attributes: [MonsterAttribute.Dragon, MonsterAttribute.Fiery] },
canBePked: true
};

const Treebeard: CustomMonster = {
Expand Down Expand Up @@ -139,7 +140,8 @@ const Treebeard: CustomMonster = {
resolveNameBank({
'Axe of the high sungod': 10
})
]
],
canBePked: true
};

export const QueenBlackDragon: CustomMonster = {
Expand Down
1 change: 1 addition & 0 deletions src/lib/minions/data/killableMonsters/krystiliaMonsters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const krystiliaMonsters: KillableMonster[] = [

difficultyRating: 5,
qpRequired: 0,
canCannon: true,
pkActivityRating: 1,
pkBaseDeathChance: 1,
revsWeaponBoost: true,
Expand Down
55 changes: 14 additions & 41 deletions src/mahoji/lib/abstracted_commands/minionKill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@
const boosts = [];
let messages: string[] = [];

if (!name) return invalidMonsterMsg;

Check warning on line 186 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

Check warning on line 186 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

if (user.usingPet('Ishi')) {
sendToChannelID(channelID.toString(), {

Check warning on line 189 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 189 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
content: `${user} Ishi Says: Let's kill some ogress warriors instead? 馃グ 馃惓`
});
name = 'Ogress Warrior';
Expand All @@ -209,7 +209,7 @@
let monster = findMonster(name);
let revenants = false;

const matchedRevenantMonster = revenantMonsters.find(monster =>

Check warning on line 212 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'monster' is already declared in the upper scope on line 209 column 6

Check warning on line 212 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'monster' is already declared in the upper scope on line 209 column 6
monster.aliases.some(alias => stringMatches(alias, name))
);
if (matchedRevenantMonster) {
Expand Down Expand Up @@ -273,7 +273,7 @@

// Check requirements
const [hasReqs, reason] = hasMonsterRequirements(user, monster);
if (!hasReqs) return reason ?? "You don't have the requirements to fight this monster";

Check warning on line 276 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required

Check warning on line 276 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected value in conditional. A boolean expression is required

if (monster.diaryRequirement) {
const [diary, tier]: [Diary, DiaryTier] = monster.diaryRequirement;
Expand All @@ -286,7 +286,7 @@
const monsterScores = await user.fetchMonsterScores();

if (monster.kcRequirements) {
for (const [key, val] of Object.entries(monster.kcRequirements)) {

Check warning on line 289 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'key' is already declared in the upper scope on line 181 column 8

Check warning on line 289 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'key' is already declared in the upper scope on line 181 column 8
const { id } = BSOMonsters[key as keyof typeof BSOMonsters];
const kc = monsterScores[id] ?? 0;
if (kc < val) {
Expand All @@ -301,7 +301,7 @@
const stats = addStatsOfItemsTogether(
[gear['2h']?.item, gear.weapon?.item, gear.shield?.item].filter(notEmpty)
);
for (const [key, requiredValue] of Object.entries(minimum)) {

Check warning on line 304 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'key' is already declared in the upper scope on line 181 column 8

Check warning on line 304 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'key' is already declared in the upper scope on line 181 column 8
if (requiredValue < 1) continue;
const theirValue = stats[key as GearStat] ?? 0;
if (theirValue < requiredValue) {
Expand Down Expand Up @@ -331,14 +331,14 @@
if (percentReduced >= 1) boosts.push(`${percentReduced}% for KC`);

if (monster.pohBoosts) {
const [boostPercent, messages] = calcPOHBoosts(await getPOH(user.id), monster.pohBoosts);

Check warning on line 334 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'messages' is already declared in the upper scope on line 184 column 6

Check warning on line 334 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'messages' is already declared in the upper scope on line 184 column 6
if (boostPercent > 0) {
timeToFinish = reduceNumByPercent(timeToFinish, boostPercent);
boosts.push(messages.join(' + '));
}
}

for (const [itemID, boostAmount] of Object.entries(resolveAvailableItemBoosts(user, monster, isInWilderness))) {
for (const [itemID, boostAmount] of Object.entries(resolveAvailableItemBoosts(user, monster))) {

Check warning on line 341 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'itemID' is already declared in the upper scope on line 18 column 10

Check warning on line 341 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'itemID' is already declared in the upper scope on line 18 column 10
timeToFinish *= (100 - boostAmount) / 100;
boosts.push(`${boostAmount}% for ${itemNameFromID(parseInt(itemID))}`);
}
Expand Down Expand Up @@ -376,7 +376,7 @@
const isDragon = osjsMon?.data?.attributes?.includes(MonsterAttribute.Dragon);

function applyRevWeaponBoost() {
const style = convertAttackStylesToSetup(user.user.attack_style);

Check warning on line 379 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'style' is already declared in the upper scope on line 180 column 8

Check warning on line 379 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'style' is already declared in the upper scope on line 180 column 8
const specialWeapon = revSpecialWeapons[style];
const upgradedWeapon = revUpgradedWeapons[style];

Expand All @@ -394,13 +394,8 @@
}

function applyDragonBoost() {
const hasDragonLance = isInWilderness
? wildyGear.hasEquipped('Dragon hunter lance')
: user.hasEquippedOrInBank('Dragon hunter lance');
const hasDragonCrossbow = isInWilderness
? wildyGear.hasEquipped('Dragon hunter crossbow')
: user.hasEquippedOrInBank('Dragon hunter crossbow');

const hasDragonLance = user.hasEquippedOrInBank('Dragon hunter lance');
const hasDragonCrossbow = user.hasEquippedOrInBank('Dragon hunter crossbow');
if (
(hasDragonLance && !attackStyles.includes(SkillsEnum.Ranged) && !attackStyles.includes(SkillsEnum.Magic)) ||
(hasDragonCrossbow && attackStyles.includes(SkillsEnum.Ranged))
Expand All @@ -414,18 +409,10 @@
}

function applyBlackMaskBoost() {
const hasInfernalSlayerHelmI = isInWilderness
? wildyGear.hasEquipped('Infernal slayer helmet(i)')
: user.hasEquippedOrInBank('Infernal slayer helmet(i)');
const hasInfernalSlayerHelm = isInWilderness
? wildyGear.hasEquipped('Infernal slayer helmet')
: user.hasEquippedOrInBank('Infernal slayer helmet');
const hasBlackMask = isInWilderness
? wildyGear.hasEquipped('Black mask')
: user.hasEquippedOrInBank('Black mask');
const hasBlackMaskI = isInWilderness
? wildyGear.hasEquipped('Black mask (i)')
: user.hasEquippedOrInBank('Black mask (i)');
const hasInfernalSlayerHelmI = user.hasEquippedOrInBank('Infernal slayer helmet(i)');
const hasInfernalSlayerHelm = user.hasEquippedOrInBank('Infernal slayer helmet');
const hasBlackMask = user.hasEquippedOrInBank('Black mask');
const hasBlackMaskI = user.hasEquippedOrInBank('Black mask (i)');

if (attackStyles.includes(SkillsEnum.Ranged) || attackStyles.includes(SkillsEnum.Magic)) {
if (hasBlackMaskI) {
Expand All @@ -449,27 +436,19 @@
function calculateSalveAmuletBoost() {
let salveBoost = false;
let salveEnhanced = false;
const style = attackStyles[0];

Check warning on line 439 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'style' is already declared in the upper scope on line 180 column 8

Check warning on line 439 in src/mahoji/lib/abstracted_commands/minionKill.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'style' is already declared in the upper scope on line 180 column 8
if (style === 'ranged' || style === 'magic') {
salveBoost = isInWilderness
? wildyGear.hasEquipped('Salve amulet(i)')
: user.hasEquippedOrInBank('Salve amulet (i)');
salveEnhanced = isInWilderness
? wildyGear.hasEquipped('Salve amulet(ei)')
: user.hasEquippedOrInBank('Salve amulet (ei)');
salveBoost = user.hasEquippedOrInBank('Salve amulet (i)');
salveEnhanced = user.hasEquippedOrInBank('Salve amulet (ei)');
if (salveBoost) {
salveAmuletBoost = salveEnhanced ? 20 : oneSixthBoost;
salveAmuletBoostMsg = `${salveAmuletBoost}% for Salve amulet${
salveEnhanced ? '(ei)' : '(i)'
} on non-melee task`;
}
} else {
salveBoost = isInWilderness
? wildyGear.hasEquipped('Salve amulet')
: user.hasEquippedOrInBank('Salve amulet');
salveEnhanced = isInWilderness
? wildyGear.hasEquipped('Salve amulet (e)')
: user.hasEquippedOrInBank('Salve amulet (e)');
salveBoost = user.hasEquippedOrInBank('Salve amulet');
salveEnhanced = user.hasEquippedOrInBank('Salve amulet (e)');
if (salveBoost) {
salveAmuletBoost = salveEnhanced ? 20 : oneSixthBoost;
salveAmuletBoostMsg = `${salveAmuletBoost}% for Salve amulet${
Expand All @@ -487,11 +466,7 @@
let virtusPiecesEquipped = 0;

for (const item of resolveItems(['Virtus mask', 'Virtus robe top', 'Virtus robe legs'])) {
if (isInWilderness) {
if (wildyGear.hasEquipped(item)) {
virtusPiecesEquipped += blackMaskBoost !== 0 && itemNameFromID(item) === 'Virtus mask' ? 0 : 1;
}
} else if (user.gear.mage.hasEquipped(item)) {
if (user.gear.mage.hasEquipped(item)) {
virtusPiecesEquipped += blackMaskBoost !== 0 && itemNameFromID(item) === 'Virtus mask' ? 0 : 1;
}
}
Expand Down Expand Up @@ -763,9 +738,7 @@
convertPvmStylesToGearSetup(attackStyles).includes(degItem.attackStyle) &&
(monster.setupsUsed ? monster.setupsUsed.includes(degItem.attackStyle) : true);

const gearCheck = isInWilderness
? user.gear.wildy.hasEquipped(degItem.item.id)
: user.gear[degItem.attackStyle].hasEquipped(degItem.item.id);
const gearCheck = user.gear[degItem.attackStyle].hasEquipped(degItem.item.id);

if (isUsing && gearCheck) {
// We assume they have enough charges, add the boost, and degrade at the end to avoid doing it twice.
Expand Down Expand Up @@ -1070,7 +1043,7 @@
let hasDied: boolean | undefined = undefined;
let hasWildySupplies = undefined;

if (isInWilderness) {
if (isInWilderness && ![BSOMonsters.Malygos.id, BSOMonsters.Treebeard.id].includes(monster.id)) {
await increaseWildEvasionXp(user, duration);
thePkCount = 0;
hasDied = false;
Expand Down
4 changes: 2 additions & 2 deletions src/mahoji/mahojiSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export function hasMonsterRequirements(user: MUser, monster: KillableMonster) {
return [true];
}

export function resolveAvailableItemBoosts(user: MUser, monster: KillableMonster, isInWilderness: boolean = false) {
export function resolveAvailableItemBoosts(user: MUser, monster: KillableMonster) {
const boosts = new Bank();
if (monster.itemInBankBoosts) {
for (const boostSet of monster.itemInBankBoosts) {
Expand All @@ -320,7 +320,7 @@ export function resolveAvailableItemBoosts(user: MUser, monster: KillableMonster
// find the highest boost that the player has
for (const [itemID, boostAmount] of Object.entries(boostSet)) {
const parsedId = parseInt(itemID);
if (isInWilderness ? !user.hasEquipped(parsedId) : !user.hasEquippedOrInBank(parsedId)) {
if (!user.hasEquippedOrInBank(parsedId)) {
continue;
}
if (boostAmount > highestBoostAmount) {
Expand Down
Loading