Fraser commited on
Commit
1bb845a
·
1 Parent(s): 6530b95

simple counters

Browse files
src/lib/battle-engine/BattleEngine.ts CHANGED
@@ -1225,13 +1225,12 @@ export class BattleEngine {
1225
  }
1226
  }
1227
 
1228
- private processCounterEffect(effect: { counterType: string; strength: string }, attacker: BattlePiclet, _target: BattlePiclet): void {
1229
  // Store counter effect for later processing when the user is attacked
1230
  // Counter effects should persist until triggered, not expire after 1 turn
1231
  attacker.temporaryEffects.push({
1232
  effect: {
1233
  type: 'counter',
1234
- counterType: effect.counterType,
1235
  strength: effect.strength
1236
  } as any,
1237
  duration: 5 // Persist for multiple turns until triggered
@@ -1376,9 +1375,7 @@ export class BattleEngine {
1376
  const tempEffect = target.temporaryEffects[i];
1377
  if (tempEffect.effect.type === 'counter') {
1378
  const counterEffect = tempEffect.effect as any;
1379
- const shouldCounter = counterEffect.counterType === 'any' ||
1380
- (counterEffect.counterType === 'physical' && move.flags.includes('contact')) ||
1381
- (counterEffect.counterType === 'special' && !move.flags.includes('contact'));
1382
 
1383
  if (shouldCounter) {
1384
  // Calculate counter damage
 
1225
  }
1226
  }
1227
 
1228
+ private processCounterEffect(effect: { strength: string }, attacker: BattlePiclet, _target: BattlePiclet): void {
1229
  // Store counter effect for later processing when the user is attacked
1230
  // Counter effects should persist until triggered, not expire after 1 turn
1231
  attacker.temporaryEffects.push({
1232
  effect: {
1233
  type: 'counter',
 
1234
  strength: effect.strength
1235
  } as any,
1236
  duration: 5 // Persist for multiple turns until triggered
 
1375
  const tempEffect = target.temporaryEffects[i];
1376
  if (tempEffect.effect.type === 'counter') {
1377
  const counterEffect = tempEffect.effect as any;
1378
+ const shouldCounter = true; // All counters now work against any attack type
 
 
1379
 
1380
  if (shouldCounter) {
1381
  // Calculate counter damage
src/lib/battle-engine/advanced-effects.test.ts CHANGED
@@ -332,15 +332,14 @@ describe('Advanced Battle Effects - TDD Implementation', () => {
332
  effects: [
333
  {
334
  type: 'counter',
335
- counterType: 'physical',
336
  strength: 'strong'
337
  }
338
  ]
339
  };
340
 
341
- // Test would verify counter moves work against physical attacks
342
  expect(counterMove.effects[0].type).toBe('counter');
343
- expect(counterMove.effects[0].counterType).toBe('physical');
344
  });
345
 
346
  it('should handle special counter moves', () => {
@@ -355,13 +354,12 @@ describe('Advanced Battle Effects - TDD Implementation', () => {
355
  effects: [
356
  {
357
  type: 'counter',
358
- counterType: 'special',
359
  strength: 'strong'
360
  }
361
  ]
362
  };
363
 
364
- expect(specialCounterMove.effects[0].counterType).toBe('special');
365
  });
366
  });
367
 
 
332
  effects: [
333
  {
334
  type: 'counter',
 
335
  strength: 'strong'
336
  }
337
  ]
338
  };
339
 
340
+ // Test would verify counter moves work against any attacks
341
  expect(counterMove.effects[0].type).toBe('counter');
342
+ expect(counterMove.effects[0].strength).toBe('strong');
343
  });
344
 
345
  it('should handle special counter moves', () => {
 
354
  effects: [
355
  {
356
  type: 'counter',
 
357
  strength: 'strong'
358
  }
359
  ]
360
  };
361
 
362
+ expect(specialCounterMove.effects[0].strength).toBe('strong');
363
  });
364
  });
365
 
src/lib/battle-engine/missing-features.test.ts CHANGED
@@ -304,7 +304,6 @@ describe('Missing Battle System Features', () => {
304
  effects: [
305
  {
306
  type: 'counter',
307
- counterType: 'physical',
308
  strength: 'strong'
309
  }
310
  ]
 
304
  effects: [
305
  {
306
  type: 'counter',
 
307
  strength: 'strong'
308
  }
309
  ]
src/lib/battle-engine/tempest-wraith.test.ts CHANGED
@@ -464,7 +464,6 @@ describe('Complete Tempest Wraith Implementation', () => {
464
  effects: [
465
  {
466
  type: 'counter',
467
- counterType: 'any',
468
  strength: 'strong'
469
  }
470
  ]
 
464
  effects: [
465
  {
466
  type: 'counter',
 
467
  strength: 'strong'
468
  }
469
  ]
src/lib/battle-engine/types.ts CHANGED
@@ -105,7 +105,6 @@ export interface FieldEffect {
105
 
106
  export interface CounterEffect {
107
  type: 'counter';
108
- counterType: 'physical' | 'special' | 'any';
109
  strength: CounterStrength;
110
  condition?: EffectCondition;
111
  }
 
105
 
106
  export interface CounterEffect {
107
  type: 'counter';
 
108
  strength: CounterStrength;
109
  condition?: EffectCondition;
110
  }
src/lib/components/Piclets/AbilityDisplay.svelte CHANGED
@@ -104,7 +104,7 @@
104
  if (effect.stackable) desc += ` (stackable)`;
105
  break;
106
  case 'counter':
107
- desc += ` - ${effect.counterType} (${effect.strength})`;
108
  break;
109
  case 'removeStatus':
110
  desc += ` - ${effect.status}`;
 
104
  if (effect.stackable) desc += ` (stackable)`;
105
  break;
106
  case 'counter':
107
+ desc += `(${effect.strength})`;
108
  break;
109
  case 'removeStatus':
110
  desc += ` - ${effect.status}`;
src/lib/components/Piclets/MoveDisplay.svelte CHANGED
@@ -118,7 +118,7 @@
118
  if (effect.amount) desc += ` ${effect.amount}`;
119
  break;
120
  case 'counter':
121
- desc += ` - ${effect.counterType} (${effect.strength})`;
122
  break;
123
  case 'removeStatus':
124
  desc += ` - ${effect.status}`;
 
118
  if (effect.amount) desc += ` ${effect.amount}`;
119
  break;
120
  case 'counter':
121
+ desc += ` (${effect.strength})`;
122
  break;
123
  case 'removeStatus':
124
  desc += ` - ${effect.status}`;