Fraser commited on
Commit
d1ebfb6
·
1 Parent(s): 139e455
src/lib/battle-engine/BattleEngine.ts CHANGED
@@ -135,9 +135,11 @@ export class BattleEngine {
135
  const baseCatchRate = getCatchRateForTier(tier);
136
 
137
  // Get status effect for capture bonus
138
- let statusEffect: string | null = null;
139
  if (targetPiclet.statusEffects.length > 0) {
140
- statusEffect = targetPiclet.statusEffects[0];
 
 
141
  }
142
 
143
  return calculateCapturePercentage({
@@ -404,10 +406,12 @@ export class BattleEngine {
404
  const baseCatchRate = getCatchRateForTier(tier);
405
 
406
  // Get status effect for capture bonus
407
- let statusEffect: string | null = null;
408
  if (targetPiclet.statusEffects.length > 0) {
409
  // Use the first status effect (most Pokemon games only allow one)
410
- statusEffect = targetPiclet.statusEffects[0];
 
 
411
  }
412
 
413
  // Calculate capture percentage for display
@@ -437,14 +441,14 @@ export class BattleEngine {
437
  };
438
 
439
  // Log the attempt
440
- this.log(`Player threw a camera at ${targetPiclet.definition.name}!`);
441
 
442
  // Log shakes
443
  if (result.shakes === 0) {
444
- this.log('The camera broke immediately!');
445
  } else {
446
  const shakeText = result.shakes === 1 ? 'once' : result.shakes === 2 ? 'twice' : 'three times';
447
- this.log(`The camera shook ${shakeText}...`);
448
  }
449
 
450
  if (result.success) {
 
135
  const baseCatchRate = getCatchRateForTier(tier);
136
 
137
  // Get status effect for capture bonus
138
+ let statusEffect: 'sleep' | 'freeze' | 'poison' | 'burn' | 'paralysis' | 'toxic' | null = null;
139
  if (targetPiclet.statusEffects.length > 0) {
140
+ const firstStatus = targetPiclet.statusEffects[0];
141
+ // Cast to proper type (status effects in battle engine match capture service types)
142
+ statusEffect = firstStatus as 'sleep' | 'freeze' | 'poison' | 'burn' | 'paralysis' | 'toxic';
143
  }
144
 
145
  return calculateCapturePercentage({
 
406
  const baseCatchRate = getCatchRateForTier(tier);
407
 
408
  // Get status effect for capture bonus
409
+ let statusEffect: 'sleep' | 'freeze' | 'poison' | 'burn' | 'paralysis' | 'toxic' | null = null;
410
  if (targetPiclet.statusEffects.length > 0) {
411
  // Use the first status effect (most Pokemon games only allow one)
412
+ const firstStatus = targetPiclet.statusEffects[0];
413
+ // Cast to proper type (status effects in battle engine match capture service types)
414
+ statusEffect = firstStatus as 'sleep' | 'freeze' | 'poison' | 'burn' | 'paralysis' | 'toxic';
415
  }
416
 
417
  // Calculate capture percentage for display
 
441
  };
442
 
443
  // Log the attempt
444
+ this.log(`Player took a Pic-ture of ${targetPiclet.definition.name}!`);
445
 
446
  // Log shakes
447
  if (result.shakes === 0) {
448
+ this.log('The Pic-ture broke immediately!');
449
  } else {
450
  const shakeText = result.shakes === 1 ? 'once' : result.shakes === 2 ? 'twice' : 'three times';
451
+ this.log(`The Pic-ture shook ${shakeText}...`);
452
  }
453
 
454
  if (result.success) {
src/lib/components/Pages/Battle.svelte CHANGED
@@ -139,8 +139,12 @@
139
  try {
140
  // Create capture action
141
  const captureAction = { type: 'capture' as const, piclet: 'player' as const };
142
- // Create a no-op enemy action
143
- const enemyAction = { type: 'move' as const, piclet: 'opponent' as const, moveIndex: 0 };
 
 
 
 
144
 
145
  // Get log entries before action to track new messages
146
  const logBefore = battleEngine.getLog();
 
139
  try {
140
  // Create capture action
141
  const captureAction = { type: 'capture' as const, piclet: 'player' as const };
142
+ // Get proper enemy action (same as normal turns)
143
+ const enemyAction = selectEnemyMove();
144
+ if (!enemyAction) {
145
+ processingTurn = false;
146
+ return;
147
+ }
148
 
149
  // Get log entries before action to track new messages
150
  const logBefore = battleEngine.getLog();