valtech-components 4.0.428 → 4.0.429

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.
@@ -58,7 +58,7 @@ import fixWebmDuration from 'fix-webm-duration';
58
58
  * Current version of valtech-components.
59
59
  * This is automatically updated during the publish process.
60
60
  */
61
- const VERSION = '4.0.428';
61
+ const VERSION = '4.0.429';
62
62
 
63
63
  // Control de estado de refresco (singleton a nivel de módulo)
64
64
  let isRefreshing = false;
@@ -62471,6 +62471,7 @@ const MINI_GAMES_I18N = {
62471
62471
  christianityEmpty: 'Vacío',
62472
62472
  christianityYourHand: 'Tu mano',
62473
62473
  christianityCost: 'Coste',
62474
+ christianityOfferingCard: 'Ofrenda',
62474
62475
  christianityEndTurn: 'Terminar turno',
62475
62476
  christianityPlayCard: 'Jugar carta',
62476
62477
  christianityReset: 'Reiniciar mock',
@@ -62875,6 +62876,7 @@ const MINI_GAMES_I18N = {
62875
62876
  christianityEmpty: 'Empty',
62876
62877
  christianityYourHand: 'Your hand',
62877
62878
  christianityCost: 'Cost',
62879
+ christianityOfferingCard: 'Offering',
62878
62880
  christianityEndTurn: 'End turn',
62879
62881
  christianityPlayCard: 'Play card',
62880
62882
  christianityReset: 'Reset mock',
@@ -67882,11 +67884,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
67882
67884
  }] } });
67883
67885
 
67884
67886
  const STARTER_CARDS = {
67885
- p_scout: { id: 'p_scout', name: 'Scout', cost: 1, attack: 1, life: 1 },
67886
- p_guard: { id: 'p_guard', name: 'Guard', cost: 2, attack: 1, life: 3 },
67887
- p_warrior: { id: 'p_warrior', name: 'Warrior', cost: 2, attack: 2, life: 2 },
67888
- p_elder: { id: 'p_elder', name: 'Elder', cost: 3, attack: 2, life: 4 },
67889
- p_champion: { id: 'p_champion', name: 'Champion', cost: 4, attack: 4, life: 4 },
67887
+ o_simple: { id: 'o_simple', name: 'Ofrenda simple', type: 'offering', cost: 0, attack: 0, life: 1 },
67888
+ p_scout: { id: 'p_scout', name: 'Scout', type: 'character', cost: 1, attack: 1, life: 1 },
67889
+ p_guard: { id: 'p_guard', name: 'Guard', type: 'character', cost: 2, attack: 1, life: 3 },
67890
+ p_warrior: { id: 'p_warrior', name: 'Warrior', type: 'character', cost: 2, attack: 2, life: 2 },
67891
+ p_elder: { id: 'p_elder', name: 'Elder', type: 'character', cost: 3, attack: 2, life: 4 },
67892
+ p_champion: { id: 'p_champion', name: 'Champion', type: 'character', cost: 4, attack: 4, life: 4 },
67890
67893
  };
67891
67894
  const STARTING_GAME = {
67892
67895
  gameId: 'mock-christianity',
@@ -67904,9 +67907,9 @@ const STARTING_GAME = {
67904
67907
  leaderName: 'Adam',
67905
67908
  leaderHp: 15,
67906
67909
  leaderMaxHp: 15,
67907
- maxOfferings: 3,
67908
- offeringPoints: 3,
67909
- hand: ['p_scout', 'p_warrior', 'p_guard', 'p_elder'],
67910
+ offerings: [{ instanceId: 'p1_offering_001', cardId: 'o_simple', name: 'Ofrenda simple', owner: 'P1', ready: true, value: 1 }],
67911
+ offeringPlayedThisTurn: false,
67912
+ hand: ['o_simple', 'p_scout', 'p_warrior', 'p_guard'],
67910
67913
  battleZone: [],
67911
67914
  },
67912
67915
  P2: {
@@ -67915,8 +67918,8 @@ const STARTING_GAME = {
67915
67918
  leaderName: 'Noah',
67916
67919
  leaderHp: 15,
67917
67920
  leaderMaxHp: 15,
67918
- maxOfferings: 3,
67919
- offeringPoints: 3,
67921
+ offerings: [{ instanceId: 'p2_offering_001', cardId: 'o_simple', name: 'Ofrenda simple', owner: 'P2', ready: true, value: 1 }],
67922
+ offeringPlayedThisTurn: false,
67920
67923
  handCount: 4,
67921
67924
  battleZone: [
67922
67925
  {
@@ -67978,11 +67981,15 @@ class ChristianityGameComponent {
67978
67981
  card: cards[index],
67979
67982
  }));
67980
67983
  }
67981
- offeringCards(player) {
67982
- return Array.from({ length: Math.max(0, player.maxOfferings) });
67984
+ readyOfferings(player) {
67985
+ return player.offerings.reduce((total, offering) => total + (offering.ready ? offering.value : 0), 0);
67983
67986
  }
67984
67987
  canPlay(card) {
67985
- return this.isOwnTurn() && this.player().offeringPoints >= card.cost && this.player().battleZone.length < 5;
67988
+ if (!this.isOwnTurn())
67989
+ return false;
67990
+ if (card.type === 'offering')
67991
+ return !this.player().offeringPlayedThisTurn;
67992
+ return this.readyOfferings(this.player()) >= card.cost && this.player().battleZone.length < 5;
67986
67993
  }
67987
67994
  canPlaySelected() {
67988
67995
  const selected = this.selectedHandCard();
@@ -68006,20 +68013,36 @@ class ChristianityGameComponent {
68006
68013
  if (handIndex < 0 || !player.hand)
68007
68014
  return game;
68008
68015
  player.hand.splice(handIndex, 1);
68009
- player.offeringPoints -= card.cost;
68010
- player.battleZone.push({
68011
- instanceId: `p1_${next.revision + 1}_${player.battleZone.length}`,
68012
- cardId: card.id,
68013
- name: card.name,
68014
- owner: 'P1',
68015
- controller: 'P1',
68016
- attack: card.attack,
68017
- currentHp: card.life,
68018
- maxHp: card.life,
68019
- canAttack: false,
68020
- });
68016
+ if (card.type === 'offering') {
68017
+ player.offerings.push({
68018
+ instanceId: `p1_offering_${next.revision + 1}`,
68019
+ cardId: card.id,
68020
+ name: card.name,
68021
+ owner: 'P1',
68022
+ ready: true,
68023
+ value: card.life,
68024
+ });
68025
+ player.offeringPlayedThisTurn = true;
68026
+ }
68027
+ else {
68028
+ this.spendOfferings(player, card.cost);
68029
+ player.battleZone.push({
68030
+ instanceId: `p1_${next.revision + 1}_${player.battleZone.length}`,
68031
+ cardId: card.id,
68032
+ name: card.name,
68033
+ owner: 'P1',
68034
+ controller: 'P1',
68035
+ attack: card.attack,
68036
+ currentHp: card.life,
68037
+ maxHp: card.life,
68038
+ canAttack: false,
68039
+ });
68040
+ }
68021
68041
  next.revision++;
68022
- next.log = [`${card.name} entra en batalla.`, ...next.log].slice(0, 4);
68042
+ next.log = [
68043
+ card.type === 'offering' ? `${card.name} queda lista como ofrenda.` : `${card.name} entra en batalla.`,
68044
+ ...next.log,
68045
+ ].slice(0, 4);
68023
68046
  return next;
68024
68047
  });
68025
68048
  this.selectedHandCard.set(null);
@@ -68076,8 +68099,8 @@ class ChristianityGameComponent {
68076
68099
  next.turnOwner = next.turnOwner === 'P1' ? 'P2' : 'P1';
68077
68100
  next.turnCount++;
68078
68101
  const current = next.players[next.turnOwner];
68079
- current.maxOfferings = Math.min(10, current.maxOfferings + 1);
68080
- current.offeringPoints = current.maxOfferings;
68102
+ current.offeringPlayedThisTurn = false;
68103
+ current.offerings = current.offerings.map(offering => ({ ...offering, ready: true }));
68081
68104
  current.battleZone = current.battleZone.map(card => ({ ...card, canAttack: true }));
68082
68105
  next.revision++;
68083
68106
  next.log = [`Turno de ${current.displayName}.`, ...next.log].slice(0, 4);
@@ -68101,6 +68124,15 @@ class ChristianityGameComponent {
68101
68124
  game.historyZone.push(...destroyed.map(card => card.cardId));
68102
68125
  player.battleZone = player.battleZone.filter(card => card.currentHp > 0);
68103
68126
  }
68127
+ spendOfferings(player, cost) {
68128
+ let remaining = cost;
68129
+ player.offerings = player.offerings.map(offering => {
68130
+ if (remaining <= 0 || !offering.ready)
68131
+ return offering;
68132
+ remaining -= offering.value;
68133
+ return { ...offering, ready: false };
68134
+ });
68135
+ }
68104
68136
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ChristianityGameComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
68105
68137
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: ChristianityGameComponent, isStandalone: true, selector: "val-christianity-game", ngImport: i0, template: `
68106
68138
  <main class="christianity-shell">
@@ -68124,10 +68156,10 @@ class ChristianityGameComponent {
68124
68156
  </div>
68125
68157
  <div class="christianity-offerings">
68126
68158
  <span>{{ t('christianityOfferings') }}</span>
68127
- <strong>{{ opponent().offeringPoints }}/{{ opponent().maxOfferings }}</strong>
68159
+ <strong>{{ readyOfferings(opponent()) }}/{{ opponent().offerings.length }}</strong>
68128
68160
  <div class="christianity-offering-cards" aria-hidden="true">
68129
- @for (_ of offeringCards(opponent()); track $index) {
68130
- <i [class.is-used]="$index >= opponent().offeringPoints"></i>
68161
+ @for (offering of opponent().offerings; track offering.instanceId) {
68162
+ <i [class.is-used]="!offering.ready"></i>
68131
68163
  }
68132
68164
  </div>
68133
68165
  </div>
@@ -68192,10 +68224,10 @@ class ChristianityGameComponent {
68192
68224
  <div class="christianity-player__summary">
68193
68225
  <div class="christianity-offerings">
68194
68226
  <span>{{ t('christianityOfferings') }}</span>
68195
- <strong>{{ player().offeringPoints }}/{{ player().maxOfferings }}</strong>
68227
+ <strong>{{ readyOfferings(player()) }}/{{ player().offerings.length }}</strong>
68196
68228
  <div class="christianity-offering-cards" aria-hidden="true">
68197
- @for (_ of offeringCards(player()); track $index) {
68198
- <i [class.is-used]="$index >= player().offeringPoints"></i>
68229
+ @for (offering of player().offerings; track offering.instanceId) {
68230
+ <i [class.is-used]="!offering.ready"></i>
68199
68231
  }
68200
68232
  </div>
68201
68233
  </div>
@@ -68220,9 +68252,21 @@ class ChristianityGameComponent {
68220
68252
  [class.is-disabled]="!canPlay(card)"
68221
68253
  (click)="selectHandCard(cardId)"
68222
68254
  >
68223
- <small>{{ t('christianityCost') }} {{ card.cost }}</small>
68255
+ <small>
68256
+ @if (card.type === 'offering') {
68257
+ {{ t('christianityOfferingCard') }}
68258
+ } @else {
68259
+ {{ t('christianityCost') }} {{ card.cost }}
68260
+ }
68261
+ </small>
68224
68262
  <span>{{ card.name }}</span>
68225
- <strong>{{ card.attack }} / {{ card.life }}</strong>
68263
+ <strong>
68264
+ @if (card.type === 'offering') {
68265
+ +{{ card.life }}
68266
+ } @else {
68267
+ {{ card.attack }} / {{ card.life }}
68268
+ }
68269
+ </strong>
68226
68270
  </button>
68227
68271
  }
68228
68272
  </section>
@@ -68276,10 +68320,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
68276
68320
  </div>
68277
68321
  <div class="christianity-offerings">
68278
68322
  <span>{{ t('christianityOfferings') }}</span>
68279
- <strong>{{ opponent().offeringPoints }}/{{ opponent().maxOfferings }}</strong>
68323
+ <strong>{{ readyOfferings(opponent()) }}/{{ opponent().offerings.length }}</strong>
68280
68324
  <div class="christianity-offering-cards" aria-hidden="true">
68281
- @for (_ of offeringCards(opponent()); track $index) {
68282
- <i [class.is-used]="$index >= opponent().offeringPoints"></i>
68325
+ @for (offering of opponent().offerings; track offering.instanceId) {
68326
+ <i [class.is-used]="!offering.ready"></i>
68283
68327
  }
68284
68328
  </div>
68285
68329
  </div>
@@ -68344,10 +68388,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
68344
68388
  <div class="christianity-player__summary">
68345
68389
  <div class="christianity-offerings">
68346
68390
  <span>{{ t('christianityOfferings') }}</span>
68347
- <strong>{{ player().offeringPoints }}/{{ player().maxOfferings }}</strong>
68391
+ <strong>{{ readyOfferings(player()) }}/{{ player().offerings.length }}</strong>
68348
68392
  <div class="christianity-offering-cards" aria-hidden="true">
68349
- @for (_ of offeringCards(player()); track $index) {
68350
- <i [class.is-used]="$index >= player().offeringPoints"></i>
68393
+ @for (offering of player().offerings; track offering.instanceId) {
68394
+ <i [class.is-used]="!offering.ready"></i>
68351
68395
  }
68352
68396
  </div>
68353
68397
  </div>
@@ -68372,9 +68416,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
68372
68416
  [class.is-disabled]="!canPlay(card)"
68373
68417
  (click)="selectHandCard(cardId)"
68374
68418
  >
68375
- <small>{{ t('christianityCost') }} {{ card.cost }}</small>
68419
+ <small>
68420
+ @if (card.type === 'offering') {
68421
+ {{ t('christianityOfferingCard') }}
68422
+ } @else {
68423
+ {{ t('christianityCost') }} {{ card.cost }}
68424
+ }
68425
+ </small>
68376
68426
  <span>{{ card.name }}</span>
68377
- <strong>{{ card.attack }} / {{ card.life }}</strong>
68427
+ <strong>
68428
+ @if (card.type === 'offering') {
68429
+ +{{ card.life }}
68430
+ } @else {
68431
+ {{ card.attack }} / {{ card.life }}
68432
+ }
68433
+ </strong>
68378
68434
  </button>
68379
68435
  }
68380
68436
  </section>