pokemon-io-core 0.0.56 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/engine.js +12 -0
- package/package.json +1 -1
package/dist/core/engine.js
CHANGED
|
@@ -155,6 +155,7 @@ const computeCritChance = (rules, critStat) => {
|
|
|
155
155
|
return Math.max(0, Math.min(1, raw));
|
|
156
156
|
};
|
|
157
157
|
const computeDamage = (input) => {
|
|
158
|
+
dbg("🧨 computeDamage", { input });
|
|
158
159
|
const { state, attacker, defender, moveTypeId, basePower, isCritical } = input;
|
|
159
160
|
const rules = state.runtime.rules;
|
|
160
161
|
const attackerOff = attacker.effectiveStats.offense;
|
|
@@ -175,7 +176,18 @@ const computeDamage = (input) => {
|
|
|
175
176
|
stabMultiplier *
|
|
176
177
|
critMultiplier *
|
|
177
178
|
randomFactor;
|
|
179
|
+
dbg("🧨 computeDamage", `
|
|
180
|
+
basePower(${basePower}) *
|
|
181
|
+
(attackerOff(${attackerOff}) / Math.max(1, defenderDef(${defenderDef}))) = ${attackerOff / Math.max(1, defenderDef)}*
|
|
182
|
+
typeEffectiveness(${typeEffectiveness}) *
|
|
183
|
+
stabMultiplier(${stabMultiplier}) *
|
|
184
|
+
critMultiplier(${critMultiplier}) *
|
|
185
|
+
randomFactor(${randomFactor}) = ${rawDamage}
|
|
186
|
+
`);
|
|
178
187
|
const finalDamage = Math.max(1, Math.floor(rawDamage));
|
|
188
|
+
dbg("🧨 computeDamage", `
|
|
189
|
+
finalDamage(${finalDamage}) = Math.max(1, Math.floor(rawDamage))
|
|
190
|
+
`);
|
|
179
191
|
return {
|
|
180
192
|
damage: finalDamage,
|
|
181
193
|
effectiveness: typeEffectiveness,
|