better dmg?
Browse files
src/lib/battle-engine/BattleEngine.ts
CHANGED
@@ -744,11 +744,15 @@ export class BattleEngine {
|
|
744 |
const stab = (move.type.toString() === attacker.definition.primaryType?.toString() ||
|
745 |
move.type.toString() === attacker.definition.secondaryType?.toString()) ? 1.5 : 1;
|
746 |
|
747 |
-
//
|
748 |
const attackStat = attacker.attack;
|
749 |
const defenseStat = target.defense;
|
|
|
750 |
|
751 |
-
|
|
|
|
|
|
|
752 |
damage = Math.floor(damage * effectiveness * stab);
|
753 |
|
754 |
// Random factor (85-100%)
|
@@ -785,11 +789,15 @@ export class BattleEngine {
|
|
785 |
const stab = (move.type.toString() === attacker.definition.primaryType?.toString() ||
|
786 |
move.type.toString() === attacker.definition.secondaryType?.toString()) ? 1.5 : 1;
|
787 |
|
788 |
-
//
|
789 |
const attackStat = attacker.attack;
|
790 |
const defenseStat = target.defense;
|
|
|
791 |
|
792 |
-
|
|
|
|
|
|
|
793 |
damage = Math.floor(damage * effectiveness * stab);
|
794 |
|
795 |
// Random factor (85-100%)
|
|
|
744 |
const stab = (move.type.toString() === attacker.definition.primaryType?.toString() ||
|
745 |
move.type.toString() === attacker.definition.secondaryType?.toString()) ? 1.5 : 1;
|
746 |
|
747 |
+
// Pokemon-style damage calculation for better balance
|
748 |
const attackStat = attacker.attack;
|
749 |
const defenseStat = target.defense;
|
750 |
+
const level = attacker.level;
|
751 |
|
752 |
+
// Core damage formula: ((2 * Level + 10) / 250) * (Attack / Defense) * Power + 2
|
753 |
+
let damage = Math.floor(
|
754 |
+
((2 * level + 10) / 250) * (attackStat / defenseStat) * baseDamage + 2
|
755 |
+
);
|
756 |
damage = Math.floor(damage * effectiveness * stab);
|
757 |
|
758 |
// Random factor (85-100%)
|
|
|
789 |
const stab = (move.type.toString() === attacker.definition.primaryType?.toString() ||
|
790 |
move.type.toString() === attacker.definition.secondaryType?.toString()) ? 1.5 : 1;
|
791 |
|
792 |
+
// Pokemon-style damage calculation for better balance
|
793 |
const attackStat = attacker.attack;
|
794 |
const defenseStat = target.defense;
|
795 |
+
const level = attacker.level;
|
796 |
|
797 |
+
// Core damage formula: ((2 * Level + 10) / 250) * (Attack / Defense) * Power + 2
|
798 |
+
let damage = Math.floor(
|
799 |
+
((2 * level + 10) / 250) * (attackStat / defenseStat) * baseDamage + 2
|
800 |
+
);
|
801 |
damage = Math.floor(damage * effectiveness * stab);
|
802 |
|
803 |
// Random factor (85-100%)
|