From 0bf6429228b0f014ade89532614913d976d2b894 Mon Sep 17 00:00:00 2001 From: nwjgit <69014816+nwjgit@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:58:33 -0500 Subject: [PATCH] Fix combat method bugs (#6014) --- .../data/killableMonsters/bosses/wildy.ts | 1 + .../data/killableMonsters/konarMonsters.ts | 6 --- .../data/killableMonsters/vannakaMonsters.ts | 16 +----- src/mahoji/commands/config.ts | 15 +----- .../lib/abstracted_commands/minionKill.ts | 52 +++++++++++++++---- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/lib/minions/data/killableMonsters/bosses/wildy.ts b/src/lib/minions/data/killableMonsters/bosses/wildy.ts index 1833c5c640..6463fe595f 100644 --- a/src/lib/minions/data/killableMonsters/bosses/wildy.ts +++ b/src/lib/minions/data/killableMonsters/bosses/wildy.ts @@ -501,6 +501,7 @@ export const wildyKillableMonsters: KillableMonster[] = [ wildy: true, wildyMulti: true, canBePked: true, + canCannon: true, pkActivityRating: 9, pkBaseDeathChance: 9, diff --git a/src/lib/minions/data/killableMonsters/konarMonsters.ts b/src/lib/minions/data/killableMonsters/konarMonsters.ts index 49c0aa5656..aee47059eb 100644 --- a/src/lib/minions/data/killableMonsters/konarMonsters.ts +++ b/src/lib/minions/data/killableMonsters/konarMonsters.ts @@ -249,12 +249,6 @@ export const konarMonsters: KillableMonster[] = [ }, slayerOnly: true, superior: Monsters.NuclearSmokeDevil, - itemInBankBoosts: [ - { - [itemID('Kodai wand')]: 12, - [itemID('Staff of the dead')]: 8 - } - ], healAmountNeeded: 16, attackStyleToUse: GearStat.AttackMagic, attackStylesUsed: [GearStat.AttackMagic], diff --git a/src/lib/minions/data/killableMonsters/vannakaMonsters.ts b/src/lib/minions/data/killableMonsters/vannakaMonsters.ts index 23e6c5ff52..b11ee236b0 100644 --- a/src/lib/minions/data/killableMonsters/vannakaMonsters.ts +++ b/src/lib/minions/data/killableMonsters/vannakaMonsters.ts @@ -117,12 +117,6 @@ export const vannakaMonsters: KillableMonster[] = [ attackStylesUsed: [GearStat.AttackCrush], canCannon: true, canBarrage: true, - itemInBankBoosts: [ - { - [itemID('Kodai wand')]: 12, - [itemID('Staff of the dead')]: 8 - } - ], pkActivityRating: 4, pkBaseDeathChance: 3, revsWeaponBoost: true, @@ -458,12 +452,6 @@ export const vannakaMonsters: KillableMonster[] = [ slayer: 65 }, superior: Monsters.ChokeDevil, - itemInBankBoosts: [ - { - [itemID('Kodai wand')]: 15, - [itemID('Staff of the dead')]: 10 - } - ], canCannon: true, cannonMulti: false, canBarrage: true, @@ -639,9 +627,7 @@ export const vannakaMonsters: KillableMonster[] = [ qpRequired: 0, itemInBankBoosts: [ { - [itemID('Arclight')]: 10, - [itemID('Staff of the dead')]: 15, - [itemID('Kodai wand')]: 20 + [itemID('Arclight')]: 10 } ], existsInCatacombs: true, diff --git a/src/mahoji/commands/config.ts b/src/mahoji/commands/config.ts index 9a79f21fd9..f89d50cd2a 100644 --- a/src/mahoji/commands/config.ts +++ b/src/mahoji/commands/config.ts @@ -528,8 +528,6 @@ async function handleCommandEnable( return `Successfully disabled the \`${command.name}\` command.`; } -const priorityWarningMsg = - "\n\n**Important: By default, 'Always barrage/burst' will take priority if 'Always cannon' is also enabled.**"; async function handleCombatOptions(user: MUser, command: 'add' | 'remove' | 'list' | 'help', option?: string) { const settings = await mahojiUsersSettingsFetch(user.id, { combat_options: true }); if (!command || (command && command === 'list')) { @@ -557,18 +555,12 @@ async function handleCombatOptions(user: MUser, command: 'add' | 'remove' | 'lis return `"${newcbopt.name}" is already ${currentStatus ? 'enabled' : 'disabled'} for you.`; } - let warningMsg = ''; - const hasCannon = settings.combat_options.includes(CombatOptionsEnum.AlwaysCannon); - const hasBurstB = - settings.combat_options.includes(CombatOptionsEnum.AlwaysIceBurst) || - settings.combat_options.includes(CombatOptionsEnum.AlwaysIceBarrage); // If enabling Ice Barrage, make sure burst isn't also enabled: if ( nextBool && newcbopt.id === CombatOptionsEnum.AlwaysIceBarrage && settings.combat_options.includes(CombatOptionsEnum.AlwaysIceBurst) ) { - if (hasCannon) warningMsg = priorityWarningMsg; settings.combat_options = removeFromArr(settings.combat_options, CombatOptionsEnum.AlwaysIceBurst); } // If enabling Ice Burst, make sure barrage isn't also enabled: @@ -577,13 +569,8 @@ async function handleCombatOptions(user: MUser, command: 'add' | 'remove' | 'lis newcbopt.id === CombatOptionsEnum.AlwaysIceBurst && settings.combat_options.includes(CombatOptionsEnum.AlwaysIceBarrage) ) { - if (warningMsg === '' && hasCannon) warningMsg = priorityWarningMsg; settings.combat_options = removeFromArr(settings.combat_options, CombatOptionsEnum.AlwaysIceBarrage); } - // Warn if enabling cannon with ice burst/barrage: - if (nextBool && newcbopt.id === CombatOptionsEnum.AlwaysCannon && warningMsg === '' && hasBurstB) { - warningMsg = priorityWarningMsg; - } if (nextBool && !settings.combat_options.includes(newcbopt.id)) { await user.update({ combat_options: [...settings.combat_options, newcbopt.id] @@ -596,7 +583,7 @@ async function handleCombatOptions(user: MUser, command: 'add' | 'remove' | 'lis return 'Error processing command. This should never happen, please report bug.'; } - return `${newcbopt.name} is now ${nextBool ? 'enabled' : 'disabled'} for you.${warningMsg}`; + return `${newcbopt.name} is now ${nextBool ? 'enabled' : 'disabled'} for you.`; } async function handleRSN(user: MUser, newRSN: string) { diff --git a/src/mahoji/lib/abstracted_commands/minionKill.ts b/src/mahoji/lib/abstracted_commands/minionKill.ts index 3305515811..1784944631 100644 --- a/src/mahoji/lib/abstracted_commands/minionKill.ts +++ b/src/mahoji/lib/abstracted_commands/minionKill.ts @@ -38,6 +38,7 @@ import { iceBarrageConsumables, iceBurstConsumables } from '../../../lib/minions/data/combatConstants'; +import { wildyKillableMonsters } from '../../../lib/minions/data/killableMonsters/bosses/wildy'; import { revenantMonsters } from '../../../lib/minions/data/killableMonsters/revs'; import { quests } from '../../../lib/minions/data/quests'; import type { AttackStyles } from '../../../lib/minions/functions'; @@ -280,7 +281,6 @@ export async function minionKillCommand( const isDragon = osjsMon?.data?.attributes?.includes(MonsterAttribute.Dragon); function applyRevWeaponBoost() { - const style = convertAttackStylesToSetup(user.user.attack_style); const specialWeapon = revSpecialWeapons[style]; const upgradedWeapon = revUpgradedWeapons[style]; @@ -369,10 +369,6 @@ export async function minionKillCommand( } } - if (isInWilderness && monster.revsWeaponBoost) { - applyRevWeaponBoost(); - } - function calculateVirtusBoost() { let virtusPiecesEquipped = 0; @@ -395,6 +391,12 @@ export async function minionKillCommand( : ''; } + if (isInWilderness && monster.revsWeaponBoost) { + if (!combatMethods.includes('barrage') || !combatMethods.includes('burst')) { + applyRevWeaponBoost(); + } + } + if (isDragon && monster.name.toLowerCase() !== 'vorkath') { applyDragonBoost(); } @@ -407,6 +409,18 @@ export async function minionKillCommand( calculateSalveAmuletBoost(); } + // Kodai boost + if (style === 'mage' && (combatMethods.includes('barrage') || combatMethods.includes('burst'))) { + const kodaiEquipped = isInWilderness + ? wildyGear.hasEquipped('Kodai wand') + : user.gear.mage.hasEquipped('Kodai wand'); + + if (kodaiEquipped) { + timeToFinish = reduceNumByPercent(timeToFinish, 15); + boosts.push('15% boost for Kodai wand'); + } + } + // Only choose greater boost: if (salveAmuletBoost || blackMaskBoost) { if (salveAmuletBoost > blackMaskBoost) { @@ -451,7 +465,7 @@ export async function minionKillCommand( const hasCannon = cannonBanks.some(i => user.owns(i)); // Check for cannon - if (method === 'cannon' && !hasCannon) { + if (combatMethods.includes('cannon') && !hasCannon) { return "You don't own a Dwarf multicannon, so how could you use one?"; } @@ -483,10 +497,28 @@ export async function minionKillCommand( cannonMulti = false; } } + + // wildy bosses + for (const wildyMonster of wildyKillableMonsters) { + if (monster.id === wildyMonster.id) { + usingCannon = wildyMonster.canCannon ? isInWilderness : false; + cannonMulti = false; + break; + } + } + + // revenants + for (const revenant of revenantMonsters) { + if (monster.id === revenant.id) { + usingCannon = false; + cannonMulti = false; + break; + } + } } // Burst/barrage check with wilderness conditions - if ((method === 'burst' || method === 'barrage') && !monster?.canBarrage) { + if ((combatMethods.includes('burst') || combatMethods.includes('barrage')) && !monster?.canBarrage) { if (jelly) { if (!isInWilderness) { return `${monster.name} can only be barraged or burst in the wilderness.`; @@ -495,8 +527,8 @@ export async function minionKillCommand( } if (!usingCannon) { - if (method === 'cannon' && !monster?.canCannon) { - return `${monster?.name} cannot be killed with a cannon.`; + if (combatMethods.includes('cannon') && !monster?.canCannon) { + return `${monster?.name} cannot be killed with a cannon.\n\n- Try removing: \`method:cannon\` from \`/k\` \n- Try: \`/config user combat_options action:Remove input:Always Cannon\``; } } @@ -532,7 +564,7 @@ export async function minionKillCommand( consumableCosts.push(cannonSingleConsumables); timeToFinish = reduceNumByPercent(timeToFinish, boostCannon); boosts.push(`${boostCannon}% for Cannon in singles`); - } else if (method === 'chinning' && attackStyles.includes(SkillsEnum.Ranged) && monster?.canChinning) { + } else if (combatMethods.includes('chinning') && attackStyles.includes(SkillsEnum.Ranged) && monster?.canChinning) { chinning = true; // Check what Chinchompa to use const chinchompas = ['Black chinchompa', 'Red chinchompa', 'Chinchompa'];