Skip to content

Commit

Permalink
Merge branch 'master' into Camdozaal-Golems
Browse files Browse the repository at this point in the history
  • Loading branch information
nwjgit authored Oct 20, 2023
2 parents 107e33f + ce5f0fc commit 7463e50
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 83 deletions.
1 change: 0 additions & 1 deletion src/meta/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ export interface MonsterKillOptions {
*/
hasSuperiors?: SimpleMonster;
farmingLevel?: number;
skulled?: boolean;
isAwakened?: boolean;
lootTableOptions?: LootTableRollOptions;
}
Expand Down
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantCyclops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantCyclopsTable,
aliases: ['revenant cyclops'],
customKillLogic: makeRevTable({
seeds: [2440, 1342],
uniqueTable: [6507, 3579],
ancientEmblem: [1626, 5368],
ancientTotem: [2440, 1342],
ancientCrystal: [3253, 1789],
ancientStatuette: [4880, 2684],
topThree: [9760, 5368]
seeds: [1342, 1342],
uniqueTable: [3579, 716],
ancientEmblem: [5368, 5368],
ancientTotem: [1342, 1342],
ancientCrystal: [1789, 1789],
ancientStatuette: [2684, 2684],
topThree: [5368, 5368]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantDarkBeast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantDarkBeastTable,
aliases: ['revenant dark beast'],
customKillLogic: makeRevTable({
seeds: [2220, 1210],
uniqueTable: [5867, 3227],
ancientEmblem: [1466, 4840],
ancientTotem: [2200, 1210],
ancientCrystal: [2933, 1613],
ancientStatuette: [4400, 2420],
topThree: [8800, 4840]
seeds: [1210, 1210],
uniqueTable: [3227, 645],
ancientEmblem: [4840, 4840],
ancientTotem: [1210, 1210],
ancientCrystal: [1613, 1613],
ancientStatuette: [2420, 2420],
topThree: [4840, 4840]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantDemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantDemonTable,
aliases: ['revenant demon'],
customKillLogic: makeRevTable({
seeds: [2440, 1342],
uniqueTable: [6507, 3579],
ancientEmblem: [1626, 5368],
ancientTotem: [2440, 1342],
ancientCrystal: [3253, 1789],
ancientStatuette: [4880, 2684],
topThree: [9760, 4840]
seeds: [1342, 1342],
uniqueTable: [3579, 716],
ancientEmblem: [5368, 5368],
ancientTotem: [1342, 1342],
ancientCrystal: [1789, 1789],
ancientStatuette: [2684, 2684],
topThree: [5368, 5368]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantDragon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export default new SimpleMonster({
table: RevenantDragonTable,
aliases: ['revenant dragon'],
customKillLogic: makeRevTable({
seeds: [2000, 1100],
uniqueTable: [5333, 2933],
ancientEmblem: [1333, 4400],
ancientTotem: [2000, 1100],
ancientCrystal: [2666, 1466],
ancientStatuette: [4000, 2000],
topThree: [8000, 4400]
seeds: [1100, 1100],
uniqueTable: [2933, 587],
ancientEmblem: [4400, 4400],
ancientTotem: [1100, 1100],
ancientCrystal: [1467, 1467],
ancientStatuette: [2000, 2000],
topThree: [4400, 4400]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantGoblin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantGoblinTable,
aliases: ['revenant goblin'],
customKillLogic: makeRevTable({
seeds: [7330, 1342],
uniqueTable: [19_467, 10_751],
ancientEmblem: [1626, 5368],
ancientTotem: [2440, 1342],
ancientCrystal: [3253, 1789],
ancientStatuette: [4880, 2684],
topThree: [9760, 5368]
seeds: [4032, 4032],
uniqueTable: [10_751, 2150],
ancientEmblem: [16_126, 16_126],
ancientTotem: [4032, 4032],
ancientCrystal: [5375, 5375],
ancientStatuette: [8063, 8063],
topThree: [16_126, 16_126]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantHellhound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantHellhoundTable,
aliases: ['revenant hellhound'],
customKillLogic: makeRevTable({
seeds: [2440, 1342],
uniqueTable: [6507, 3579],
ancientEmblem: [1626, 5368],
ancientTotem: [2440, 1342],
ancientCrystal: [3253, 1789],
ancientStatuette: [4880, 2684],
topThree: [9760, 5368]
seeds: [1342, 1342],
uniqueTable: [3579, 716],
ancientEmblem: [5368, 5368],
ancientTotem: [1342, 1342],
ancientCrystal: [1789, 1789],
ancientStatuette: [2684, 2684],
topThree: [5368, 5368]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantHobgoblin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export default new SimpleMonster({
table: RevenantHobgoblinTable,
aliases: ['revenant hobgoblin'],
customKillLogic: makeRevTable({
seeds: [3140, 1727],
uniqueTable: [8373, 4605],
ancientEmblem: [2093, 6908],
ancientTotem: [3140, 1727],
ancientCrystal: [4186, 2302],
ancientStatuette: [6280, 3454],
topThree: [12_560, 6908]
seeds: [1727, 1727],
uniqueTable: [4605, 921],
ancientEmblem: [6908, 6908],
ancientTotem: [1727, 1727],
ancientCrystal: [2302, 2302],
ancientStatuette: [3454, 3454],
topThree: [6908, 6908]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantImp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantImpTable,
aliases: ['revenant imp'],
customKillLogic: makeRevTable({
seeds: [11_000, 6050],
uniqueTable: [29_333, 16_133],
ancientEmblem: [7333, 24_200],
ancientTotem: [11_000, 6050],
ancientCrystal: [14_666, 8066],
ancientStatuette: [22_000, 12_000],
topThree: [44_000, 24_200]
seeds: [6050, 6050],
uniqueTable: [161_334, 3226],
ancientEmblem: [24_200, 24_200],
ancientTotem: [6050, 6050],
ancientCrystal: [8067, 8067],
ancientStatuette: [12_100, 12_000],
topThree: [24_200, 24_200]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantKnight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantKnightTable,
aliases: ['revenant knight'],
customKillLogic: makeRevTable({
seeds: [2000, 1100],
uniqueTable: [5333, 2933],
ancientEmblem: [1333, 4400],
ancientTotem: [2000, 1100],
ancientCrystal: [2666, 1466],
ancientStatuette: [4000, 2200],
topThree: [8000, 4400]
seeds: [1100, 1100],
uniqueTable: [2933, 587],
ancientEmblem: [4400, 4400],
ancientTotem: [1100, 1100],
ancientCrystal: [1467, 1467],
ancientStatuette: [2200, 2200],
topThree: [4400, 4400]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantOrk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantOrkTable,
aliases: ['revenant ork'],
customKillLogic: makeRevTable({
seeds: [2200, 1210],
uniqueTable: [5867, 3227],
ancientEmblem: [1466, 1210],
ancientTotem: [2200, 1210],
ancientCrystal: [2933, 1613],
ancientStatuette: [4400, 2420],
topThree: [8800, 4840]
seeds: [1210, 1210],
uniqueTable: [3227, 645],
ancientEmblem: [4840, 4840],
ancientTotem: [1210, 1210],
ancientCrystal: [1613, 1613],
ancientStatuette: [2420, 2420],
topThree: [4840, 4840]
})
});
14 changes: 7 additions & 7 deletions src/simulation/monsters/low/n-s/RevenantPyrefiend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export default new SimpleMonster({
table: RevenantPyrefiendTable,
aliases: ['revenant pyrefiend'],
customKillLogic: makeRevTable({
seeds: [3140, 1727],
uniqueTable: [8373, 4605],
ancientEmblem: [2093, 6908],
ancientTotem: [3140, 1727],
ancientCrystal: [4186, 2302],
ancientStatuette: [6280, 3454],
topThree: [12_560, 6908]
seeds: [1727, 1727],
uniqueTable: [4605, 921],
ancientEmblem: [6908, 6908],
ancientTotem: [1727, 1727],
ancientCrystal: [2303, 2303],
ancientStatuette: [3454, 3454],
topThree: [6908, 6908]
})
});
27 changes: 23 additions & 4 deletions src/structures/SimpleMonster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { roll } from 'e';

import { MonsterSlayerMaster } from '../meta/monsterData';
import { CustomKillLogic, MonsterKillOptions, MonsterOptions } from '../meta/types';
import { getAncientShardChanceFromHP, getBrimKeyChanceFromCBLevel, getTotemChanceFromHP } from '../util/util';
import {
getAncientShardChanceFromHP,
getBrimKeyChanceFromCBLevel,
getLarranKeyChanceFromCBLevel,
getSlayersEnchantmentChanceFromHP,
getTotemChanceFromHP
} from '../util/util';
import Bank from './Bank';
import LootTable from './LootTable';
import Monster from './Monster';
Expand Down Expand Up @@ -37,15 +43,28 @@ export default class SimpleMonster extends Monster {

public kill(quantity = 1, options: MonsterKillOptions = {}): Bank {
const loot = new Bank();
const canGetKey = options.onSlayerTask && options.slayerMaster === MonsterSlayerMaster.Konar;
const canGetBrimKey = options.onSlayerTask && options.slayerMaster === MonsterSlayerMaster.Konar;
const canGetSlayersEnchantment = options.onSlayerTask && options.slayerMaster === MonsterSlayerMaster.Krystilia;
const canGetLarranKey = options.onSlayerTask && options.slayerMaster === MonsterSlayerMaster.Krystilia;
const slayerMonster: boolean = Boolean(options.onSlayerTask && this.data.slayerLevelRequired > 1);

for (let i = 0; i < quantity; i++) {
if (canGetKey) {
if (canGetBrimKey) {
if (roll(getBrimKeyChanceFromCBLevel(this.data.combatLevel))) {
loot.add('Brimstone key');
}
}
if (options.inCatacombs && this.data.hitpoints) {
if (canGetSlayersEnchantment && this.data.hitpoints) {
if (roll(getSlayersEnchantmentChanceFromHP(this.data.hitpoints))) {
loot.add("Slayer's enchantment");
}
}
if (canGetLarranKey) {
if (roll(getLarranKeyChanceFromCBLevel(this.data.combatLevel, slayerMonster))) {
loot.add("Larran's key");
}
}
if (options.inCatacombs && this.data.hitpoints && !canGetLarranKey) {
if (roll(getAncientShardChanceFromHP(this.data.hitpoints))) {
loot.add('Ancient shard');
}
Expand Down
24 changes: 23 additions & 1 deletion src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,23 @@ export function getBrimKeyChanceFromCBLevel(combatLevel: number): number {
return Math.max(Math.round((-1 / 5) * combatLevel + 120), 50);
}

export function getLarranKeyChanceFromCBLevel(combatLevel: number, slayerMonster: boolean): number {
let baseChance = 0;

if (combatLevel <= 80) {
baseChance = (3 / 10) * Math.pow(80 - combatLevel, 2) + 100;
} else if (combatLevel <= 350) {
baseChance = (-5 / 27) * combatLevel + 115;
} else {
baseChance = 50;
}

// Reduce the base chance by 20% if slayerMonster is true
const adjustedChance = slayerMonster ? baseChance * 0.8 : baseChance;

return adjustedChance;
}

export function JSONClone<O>(object: O): O {
return JSON.parse(JSON.stringify(object));
}
Expand All @@ -182,6 +199,11 @@ export function getTotemChanceFromHP(hitpoints: number): number {
return 500 - hitpoints;
}

export function getSlayersEnchantmentChanceFromHP(hitpoints: number): number {
let chanceHitpoints = Math.min(hitpoints, 300);
return Math.round(320 - (chanceHitpoints * 8) / 10);
}

export interface RevTable {
uniqueTable: RevTableItem;
ancientEmblem: RevTableItem;
Expand All @@ -202,7 +224,7 @@ export const revsUniqueTable = new LootTable()

export function makeRevTable(table: RevTable): CustomKillLogic {
return (options: MonsterKillOptions, currentLoot: Bank) => {
const index = options.skulled ? 1 : 0;
const index = options.onSlayerTask ? 1 : 0;
if (roll(table.uniqueTable[index])) {
currentLoot.add(revsUniqueTable.roll());
return;
Expand Down

0 comments on commit 7463e50

Please sign in to comment.