logs
Browse files
src/lib/battle-engine/BattleEngine.ts
CHANGED
@@ -649,6 +649,25 @@ export class BattleEngine {
|
|
649 |
private calculateStandardDamageWithPower(power: number, attacker: BattlePiclet, target: BattlePiclet, move: Move): number {
|
650 |
const baseDamage = power;
|
651 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
// Type effectiveness
|
653 |
const effectiveness = getEffectivenessMultiplier(
|
654 |
move.type,
|
|
|
649 |
private calculateStandardDamageWithPower(power: number, attacker: BattlePiclet, target: BattlePiclet, move: Move): number {
|
650 |
const baseDamage = power;
|
651 |
|
652 |
+
// Debug logging for type effectiveness calculation
|
653 |
+
console.log('π― Damage calculation debug:', {
|
654 |
+
move: {
|
655 |
+
name: move.name,
|
656 |
+
type: move.type,
|
657 |
+
power: move.power
|
658 |
+
},
|
659 |
+
attacker: {
|
660 |
+
name: attacker.definition.name,
|
661 |
+
primaryType: attacker.definition.primaryType,
|
662 |
+
secondaryType: attacker.definition.secondaryType
|
663 |
+
},
|
664 |
+
target: {
|
665 |
+
name: target.definition.name,
|
666 |
+
primaryType: target.definition.primaryType,
|
667 |
+
secondaryType: target.definition.secondaryType
|
668 |
+
}
|
669 |
+
});
|
670 |
+
|
671 |
// Type effectiveness
|
672 |
const effectiveness = getEffectivenessMultiplier(
|
673 |
move.type,
|
src/lib/types/picletTypes.ts
CHANGED
@@ -233,10 +233,36 @@ export const TYPE_EFFECTIVENESS: Record<AttackType, Record<PicletType, TypeEffec
|
|
233 |
};
|
234 |
|
235 |
export function getTypeEffectiveness(attackType: AttackType, defenseType: PicletType): TypeEffectiveness {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
return TYPE_EFFECTIVENESS[attackType][defenseType];
|
237 |
}
|
238 |
|
239 |
export function getEffectivenessMultiplier(attackType: AttackType, defenseType: PicletType, secondaryType?: PicletType): number {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
let multiplier = getTypeEffectiveness(attackType, defenseType);
|
241 |
|
242 |
if (secondaryType && secondaryType !== defenseType) {
|
|
|
233 |
};
|
234 |
|
235 |
export function getTypeEffectiveness(attackType: AttackType, defenseType: PicletType): TypeEffectiveness {
|
236 |
+
console.log('β‘ Getting type effectiveness:', {
|
237 |
+
attackType,
|
238 |
+
defenseType,
|
239 |
+
typeEffectivenessExists: !!TYPE_EFFECTIVENESS[attackType],
|
240 |
+
defenseTypeExists: TYPE_EFFECTIVENESS[attackType] ? !!TYPE_EFFECTIVENESS[attackType][defenseType] : false
|
241 |
+
});
|
242 |
+
|
243 |
+
if (!TYPE_EFFECTIVENESS[attackType]) {
|
244 |
+
console.error('β Attack type not found in TYPE_EFFECTIVENESS:', attackType);
|
245 |
+
return 1; // Default to neutral effectiveness
|
246 |
+
}
|
247 |
+
|
248 |
+
if (!TYPE_EFFECTIVENESS[attackType][defenseType]) {
|
249 |
+
console.error('β Defense type not found for attack type:', { attackType, defenseType });
|
250 |
+
return 1; // Default to neutral effectiveness
|
251 |
+
}
|
252 |
+
|
253 |
return TYPE_EFFECTIVENESS[attackType][defenseType];
|
254 |
}
|
255 |
|
256 |
export function getEffectivenessMultiplier(attackType: AttackType, defenseType: PicletType, secondaryType?: PicletType): number {
|
257 |
+
console.log('π Type effectiveness lookup:', {
|
258 |
+
attackType,
|
259 |
+
defenseType,
|
260 |
+
secondaryType,
|
261 |
+
attackTypeValid: Object.values(AttackType).includes(attackType),
|
262 |
+
defenseTypeValid: Object.values(PicletType).includes(defenseType),
|
263 |
+
secondaryTypeValid: secondaryType ? Object.values(PicletType).includes(secondaryType) : 'N/A'
|
264 |
+
});
|
265 |
+
|
266 |
let multiplier = getTypeEffectiveness(attackType, defenseType);
|
267 |
|
268 |
if (secondaryType && secondaryType !== defenseType) {
|