Skip to content

Commit

Permalink
Fix combat method bugs (oldschoolgg#6014)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwjgit authored Aug 24, 2024
1 parent c97e99b commit 0bf6429
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 45 deletions.
1 change: 1 addition & 0 deletions src/lib/minions/data/killableMonsters/bosses/wildy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ export const wildyKillableMonsters: KillableMonster[] = [
wildy: true,
wildyMulti: true,
canBePked: true,
canCannon: true,
pkActivityRating: 9,
pkBaseDeathChance: 9,

Expand Down
6 changes: 0 additions & 6 deletions src/lib/minions/data/killableMonsters/konarMonsters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
16 changes: 1 addition & 15 deletions src/lib/minions/data/killableMonsters/vannakaMonsters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 1 addition & 14 deletions src/mahoji/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down Expand Up @@ -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:
Expand All @@ -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]
Expand All @@ -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) {
Expand Down
52 changes: 42 additions & 10 deletions src/mahoji/lib/abstracted_commands/minionKill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -369,10 +369,6 @@ export async function minionKillCommand(
}
}

if (isInWilderness && monster.revsWeaponBoost) {
applyRevWeaponBoost();
}

function calculateVirtusBoost() {
let virtusPiecesEquipped = 0;

Expand All @@ -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();
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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?";
}

Expand Down Expand Up @@ -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.`;
Expand All @@ -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\``;
}
}

Expand Down Expand Up @@ -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'];
Expand Down

0 comments on commit 0bf6429

Please sign in to comment.