Skip to content

Commit

Permalink
feat: add Cerberus as first and easier boss Zenoo#947
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambryal committed Oct 15, 2024
1 parent e7da892 commit edaefcc
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
11 changes: 9 additions & 2 deletions client/src/utils/fight/FighterHolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ export default class FighterHolder {
} else if (this.type === 'pet') {
this.#animationType = (fighter.name.startsWith('dog') || fighter.name === 'panther') ? 'dog' : 'bear';
} else {
const bossType = bosses.find((b) => b.name === fighter.name)?.base as 'bear' | 'panther' || 'bear';
this.#animationType = bossType === 'panther' ? 'dog' : bossType;
const bossType = bosses.find((b) => b.name === fighter.name)?.base as 'bear' | 'panther' | 'dog1' || 'bear';
this.#animationType = bossType === 'dog1' || bossType === 'panther' ? 'dog' : bossType;
}

// Get all animations
Expand Down Expand Up @@ -578,6 +578,13 @@ export default class FighterHolder {
green: 0.8,
blue: 0.8,
})];
} else if (fighter.name === BossName.Cerberus) {
this.container.filters = [new AdjustmentFilter({
gamma: 1,
brightness: 0.37,
red: 1.1,
blue: 1.02,
})];
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion client/src/utils/fight/utils/getFighterType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const getFighterType = (
if (fighter.type === 'pet') {
type = fighter.name.startsWith('dog') ? 'dog' : fighter.name as 'bear' | 'panther';
} else if (fighter.type === 'boss') {
type = bosses.find((b) => b.name === fighter.name)?.base as 'bear' | 'panther' || 'bear';
const bossType = bosses.find((b) => b.name === fighter.name)?.base as 'bear' | 'panther' | 'dog1' || 'bear';
type = bossType === 'dog1' ? 'dog' : bossType;
}

return type;
Expand Down
19 changes: 19 additions & 0 deletions core/src/brute/bosses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface Boss {

const bear = pets.find((p) => p.name === PetName.bear) as Pet;
const panther = pets.find((p) => p.name === PetName.panther) as Pet;
const dog1 = pets.find((p) => p.name === PetName.dog1) as Pet;

const bosses: Boss[] = [
{
Expand Down Expand Up @@ -60,6 +61,24 @@ const bosses: Boss[] = [
damage: panther.damage,
reach: 3,
},
{
name: BossName.Cerberus,
base: PetName.dog1,
scale: 2.15,
initiative: 1.5,
strength: dog1.strength * 7.5,
agility: dog1.agility,
speed: dog1.speed,
hp: 30000,
counter: dog1.counter,
combo: 0,
block: dog1.block,
evasion: -0.2,
accuracy: 0.75,
disarm: dog1.disarm,
damage: dog1.damage,
reach: 1,
},
];

export default bosses;
1 change: 1 addition & 0 deletions core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const RESET_PRICE = 100;

export const CLAN_SIZE_LIMIT = 50;
export const BOSS_XP_REWARD = 500;
export const FIRST_BOSS_GOLD_REWARD = 100;
export const BOSS_GOLD_REWARD = 500;

export enum BruteDeletionReason {
Expand Down
5 changes: 2 additions & 3 deletions server/src/controllers/Clans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
ClanCreateResponse,
ClanGetResponse, ClanGetThreadResponse,
ClanGetThreadsResponse, ClanListResponse, ClanSort, ExpectedError, bosses, getFightsLeft,
randomItem,
} from '@labrute/core';
import {
Clan, ClanWarStatus, Prisma, PrismaClient,
Clan, ClanWarStatus, Prisma, PrismaClient, BossName
} from '@labrute/prisma';
import type { Request, Response } from 'express';
import { DISCORD, LOGGER } from '../context.js';
Expand Down Expand Up @@ -165,7 +164,7 @@ const Clans = {
name: clanName,
master: { connect: { id: brute.id } },
brutes: { connect: { id: brute.id } },
boss: randomItem(bosses).name,
boss: BossName.Cerberus,
},
select: { id: true, name: true },
});
Expand Down
12 changes: 8 additions & 4 deletions server/src/utils/fight/generateFight.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-param-reassign */
import {
AchievementsStore,
FIRST_BOSS_GOLD_REWARD,
BOSS_GOLD_REWARD,
Boss,
CLAN_SIZE_LIMIT,
Expand All @@ -12,7 +13,7 @@ import {
weightedRandom,
} from '@labrute/core';
import {
Brute, FightModifier, InventoryItemType, LogType, Prisma, PrismaClient,
Brute, FightModifier, InventoryItemType, LogType, Prisma, PrismaClient, BossName
} from '@labrute/prisma';
import applySpy from './applySpy.js';
import {
Expand Down Expand Up @@ -359,13 +360,15 @@ const generateFight = async ({
count: 1,
})),
});


// Filter out Cerberus from potential bosses most of the time
const potentialBosses = bosses.filter((boss) => boss.name != BossName.Cerberus || Math.random() * 4 < 1)
// Update clan
await prisma.clan.update({
where: { id: clanId },
data: {
// Set new boss
boss: randomItem(bosses).name,
boss: randomItem(potentialBosses).name,
damageOnBoss: 0,
// Increase clan limit
limit: Math.min(CLAN_SIZE_LIMIT, clan.limit + 5),
Expand All @@ -383,7 +386,8 @@ const generateFight = async ({
clan.bossDamages.forEach((damage) => {
userIds.add(damage.brute.userId || '');
});
const goldGains = Math.floor(BOSS_GOLD_REWARD / userIds.size);
const goldReward = bossFighter.name === BossName.Cerberus ? FIRST_BOSS_GOLD_REWARD : BOSS_GOLD_REWARD;
const goldGains = Math.floor(goldReward / userIds.size);

await prisma.user.updateMany({
where: { id: { in: Array.from(userIds) } },
Expand Down

0 comments on commit edaefcc

Please sign in to comment.