Skip to content

Commit 2f67bc8

Browse files
committed
fix: Prevent infinite fights with high deflect
1 parent acd8a56 commit 2f67bc8

File tree

6 files changed

+24
-15
lines changed

6 files changed

+24
-15
lines changed

client/src/components/Brute/PetTooltip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ const PetTooltip = ({
6161
return (
6262
<Text bold sx={{ color }} {...textProps}>
6363
{(tieredPet[stat][tieredPet.tier - 1] ?? 0) > 0 ? '+' : '-'}
64-
{uniqueValue ? Math.round(
64+
{uniqueValue ? Math.abs(Math.round(
6565
getPetScaledStat(chaos, brute, tieredPet, stat, precision) * 100,
66-
) : (
66+
)) : (
6767
<>
6868
[
6969
{tieredPet[stat].map((_, index) => (

client/src/utils/Fetch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ const Fetch = <ReturnType>(url: string, data = {}, method = 'GET', additionalURL
8484
} else {
8585
response.text().then((text) => {
8686
if (response.status === 999) {
87-
window.location.href = '/generating-tournaments';
87+
if (window.location.pathname !== '/generating-tournaments') {
88+
window.location.href = '/generating-tournaments';
89+
}
8890
}
8991

9092
reject({

core/src/brute/skills.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,12 @@ export const SkillModifiers: Record<
523523
[FightStat.COMBO]: { percent: [0.2, 0.3, 0.4] },
524524
},
525525
[SkillName.shield]: {
526-
[FightStat.BLOCK]: { percent: [0.45, 0.55, 0.65] },
527-
[FightStat.DAMAGE]: { percent: [-0.25, -0.30, -0.35] },
526+
[FightStat.BLOCK]: { percent: [0.45, 0.50, 0.55] },
527+
[FightStat.DAMAGE]: { percent: [-0.25, -0.25, -0.25] },
528528
},
529529
[SkillName.armor]: {
530-
[FightStat.ARMOR]: { percent: [0.25, 0.35, 0.45] },
531-
[FightStat.SPEED]: { percent: [-0.15, -0.20, -0.25] },
530+
[FightStat.ARMOR]: { percent: [0.25, 0.30, 0.35] },
531+
[FightStat.SPEED]: { percent: [-0.15, -0.15, -0.15] },
532532
},
533533
[SkillName.toughenedSkin]: {
534534
[FightStat.ARMOR]: { percent: [0.1, 0.15, 0.2] },
@@ -558,7 +558,7 @@ export const SkillModifiers: Record<
558558
weaponType: WeaponType.BLUNT,
559559
opponent: true,
560560
},
561-
[FightStat.EVASION]: { percent: [-0.15, -0.2, -0.25] },
561+
[FightStat.EVASION]: { percent: [-0.15, -0.15, -0.15] },
562562
},
563563
[SkillName.balletShoes]: {
564564
[FightStat.EVASION]: { percent: [0.1, 0.15, 0.2] },
@@ -569,7 +569,7 @@ export const SkillModifiers: Record<
569569
},
570570
[SkillName.resistant]: {},
571571
[SkillName.reconnaissance]: {
572-
[FightStat.INITIATIVE]: { flat: [-200, -250, -300] },
572+
[FightStat.INITIATIVE]: { flat: [-200, -200, -200] },
573573
[FightStat.SPEED]: { flat: [5, 10, 15], percent: [1.5, 2, 2.5] },
574574
[FightStat.CRITICAL_DAMAGE]: { percent: [0.5, 0.6, 0.7] },
575575
},
@@ -600,8 +600,8 @@ export const SkillModifiers: Record<
600600
},
601601
[SkillName.monk]: {
602602
[FightStat.COUNTER]: { percent: [0.4, 0.45, 0.5] },
603-
[FightStat.INITIATIVE]: { flat: [-200, -250, -300] },
604-
[FightStat.HIT_SPEED]: { percent: [-1, -1.1, -1.2] },
603+
[FightStat.INITIATIVE]: { flat: [-200, -200, -200] },
604+
[FightStat.HIT_SPEED]: { percent: [-1, -1, -1] },
605605
},
606606
[SkillName.vampirism]: {},
607607
[SkillName.chaining]: {},

core/src/brute/weapons.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ export const weapons: Record<WeaponName, Weapon> = {
208208
tempo: [2, 2, 2],
209209
reversal: [-0.3, -0.3, -0.3],
210210
evasion: [-0.3, -0.3, -0.3],
211-
dexterity: [-0.65, -0.65, -0.65],
211+
dexterity: [-0.65, -0.60, -0.55],
212212
block: [-0.3, -0.3, -0.3],
213213
accuracy: [0.3, 0.4, 0.5],
214214
disarm: [0.1, 0.15, 0.2],
215-
combo: [-0.6, -0.6, -0.6],
215+
combo: [-0.6, -0.55, -0.5],
216216
deflect: [0, 0, 0],
217217
criticalChance: [0.2, 0.3, 0.4],
218218
criticalDamage: [0, 0, 0],

server/src/utils/fight/fightMethods.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,13 @@ const deflectProjectile = (chaos: boolean, fighter: DetailedFighter, timesDeflec
16811681

16821682
const random = Math.random();
16831683

1684-
return random < getFighterStat(chaos, fighter, 'deflect', deflectWithWeapon ? undefined : 'fighter');
1684+
// Max 90% chance to deflect
1685+
const stat = Math.min(
1686+
getFighterStat(chaos, fighter, 'deflect', deflectWithWeapon ? undefined : 'fighter'),
1687+
0.9,
1688+
);
1689+
1690+
return random < stat;
16851691
};
16861692

16871693
const attack = (

server/src/utils/fight/getDamage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ export const getDamage = (
181181
}
182182

183183
// Reduce damage with opponent's armor if not thrown
184+
// Max 90% armor reduction
184185
if (!thrown) {
185-
damage = Math.ceil(damage * (1 - opponent.armor));
186+
damage = Math.ceil(damage * (1 - Math.min(opponent.armor, 0.9)));
186187
}
187188

188189
// Set minimum damage to 1

0 commit comments

Comments
 (0)