fix pp
Browse files
src/lib/components/Piclets/MoveDisplay.svelte
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
|
| 5 |
interface Props {
|
| 6 |
move: DBBattleMove;
|
| 7 |
-
enhancedMove?: { move: BattleMove;
|
| 8 |
expanded?: boolean;
|
| 9 |
showPP?: boolean;
|
| 10 |
}
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
let { move, enhancedMove, expanded = false, showPP = true }: Props = $props();
|
| 13 |
|
| 14 |
// Use enhanced move data if available, otherwise fall back to basic move
|
| 15 |
-
|
| 16 |
-
|
| 17 |
|
| 18 |
function getTypeEmoji(type: string): string {
|
| 19 |
switch (type) {
|
|
@@ -110,8 +110,8 @@
|
|
| 110 |
return desc;
|
| 111 |
}
|
| 112 |
|
| 113 |
-
|
| 114 |
-
|
| 115 |
</script>
|
| 116 |
|
| 117 |
<div class="move-display" class:disabled={isOutOfPP}>
|
|
@@ -137,7 +137,7 @@
|
|
| 137 |
{#if showPP}
|
| 138 |
<div class="pp-display" class:out-of-pp={isOutOfPP}>
|
| 139 |
<span class="pp-label">PP</span>
|
| 140 |
-
<span class="pp-value">{
|
| 141 |
</div>
|
| 142 |
{/if}
|
| 143 |
|
|
|
|
| 4 |
|
| 5 |
interface Props {
|
| 6 |
move: DBBattleMove;
|
| 7 |
+
enhancedMove?: { move: BattleMove; currentPp: number };
|
| 8 |
expanded?: boolean;
|
| 9 |
showPP?: boolean;
|
| 10 |
}
|
|
|
|
| 12 |
let { move, enhancedMove, expanded = false, showPP = true }: Props = $props();
|
| 13 |
|
| 14 |
// Use enhanced move data if available, otherwise fall back to basic move
|
| 15 |
+
const battleMove = $derived(enhancedMove?.move);
|
| 16 |
+
const currentPp = $derived(enhancedMove?.currentPp ?? move.currentPp);
|
| 17 |
|
| 18 |
function getTypeEmoji(type: string): string {
|
| 19 |
switch (type) {
|
|
|
|
| 110 |
return desc;
|
| 111 |
}
|
| 112 |
|
| 113 |
+
const isOutOfPP = $derived(currentPp <= 0);
|
| 114 |
+
const typeColor = $derived(getTypeColor(move.type));
|
| 115 |
</script>
|
| 116 |
|
| 117 |
<div class="move-display" class:disabled={isOutOfPP}>
|
|
|
|
| 137 |
{#if showPP}
|
| 138 |
<div class="pp-display" class:out-of-pp={isOutOfPP}>
|
| 139 |
<span class="pp-label">PP</span>
|
| 140 |
+
<span class="pp-value">{currentPp}/{move.pp}</span>
|
| 141 |
</div>
|
| 142 |
{/if}
|
| 143 |
|
src/lib/components/Piclets/PicletCard.svelte
CHANGED
|
@@ -22,8 +22,8 @@
|
|
| 22 |
const softTypeColor = $derived(`${typeColor}20`); // Add 20% opacity for soft background
|
| 23 |
|
| 24 |
// Get battle definition for enhanced ability info
|
| 25 |
-
|
| 26 |
-
|
| 27 |
</script>
|
| 28 |
|
| 29 |
<button
|
|
|
|
| 22 |
const softTypeColor = $derived(`${typeColor}20`); // Add 20% opacity for soft background
|
| 23 |
|
| 24 |
// Get battle definition for enhanced ability info
|
| 25 |
+
const battleDefinition = $derived(picletInstanceToBattleDefinition(instance));
|
| 26 |
+
const ability = $derived(battleDefinition.specialAbility);
|
| 27 |
</script>
|
| 28 |
|
| 29 |
<button
|
src/lib/components/Piclets/PicletDetail.svelte
CHANGED
|
@@ -23,7 +23,7 @@
|
|
| 23 |
let isSharing = $state(false);
|
| 24 |
|
| 25 |
// Convert to battle definition to get enhanced ability data
|
| 26 |
-
|
| 27 |
|
| 28 |
// Type-based styling
|
| 29 |
const typeData = $derived(TYPE_DATA[instance.primaryType]);
|
|
@@ -490,75 +490,6 @@
|
|
| 490 |
color: #000;
|
| 491 |
}
|
| 492 |
|
| 493 |
-
/* Actions Tab */
|
| 494 |
-
.move-card {
|
| 495 |
-
width: 100%;
|
| 496 |
-
background: #f2f2f7;
|
| 497 |
-
border: 1px solid rgba(0, 123, 255, 0.3);
|
| 498 |
-
border-radius: 8px;
|
| 499 |
-
padding: 12px;
|
| 500 |
-
margin-bottom: 12px;
|
| 501 |
-
cursor: pointer;
|
| 502 |
-
text-align: left;
|
| 503 |
-
transition: all 0.2s;
|
| 504 |
-
}
|
| 505 |
-
|
| 506 |
-
.move-card:active {
|
| 507 |
-
transform: scale(0.98);
|
| 508 |
-
}
|
| 509 |
-
|
| 510 |
-
.move-header {
|
| 511 |
-
display: flex;
|
| 512 |
-
justify-content: space-between;
|
| 513 |
-
align-items: center;
|
| 514 |
-
margin-bottom: 8px;
|
| 515 |
-
}
|
| 516 |
-
|
| 517 |
-
.move-name {
|
| 518 |
-
font-size: 16px;
|
| 519 |
-
font-weight: bold;
|
| 520 |
-
color: #000;
|
| 521 |
-
}
|
| 522 |
-
|
| 523 |
-
.move-badges {
|
| 524 |
-
display: flex;
|
| 525 |
-
gap: 6px;
|
| 526 |
-
}
|
| 527 |
-
|
| 528 |
-
.power-badge {
|
| 529 |
-
background: rgba(255, 59, 48, 0.2);
|
| 530 |
-
color: #ff3b30;
|
| 531 |
-
padding: 4px 8px;
|
| 532 |
-
border-radius: 12px;
|
| 533 |
-
font-size: 12px;
|
| 534 |
-
font-weight: 500;
|
| 535 |
-
}
|
| 536 |
-
|
| 537 |
-
.move-description {
|
| 538 |
-
margin: 0 0 12px;
|
| 539 |
-
font-size: 14px;
|
| 540 |
-
color: #666;
|
| 541 |
-
line-height: 1.3;
|
| 542 |
-
}
|
| 543 |
-
|
| 544 |
-
.move-stats {
|
| 545 |
-
display: flex;
|
| 546 |
-
gap: 16px;
|
| 547 |
-
font-size: 13px;
|
| 548 |
-
color: #8e8e93;
|
| 549 |
-
}
|
| 550 |
-
|
| 551 |
-
.move-details {
|
| 552 |
-
margin-top: 12px;
|
| 553 |
-
padding-top: 12px;
|
| 554 |
-
border-top: 1px solid #e5e5ea;
|
| 555 |
-
font-size: 14px;
|
| 556 |
-
color: #666;
|
| 557 |
-
}
|
| 558 |
-
|
| 559 |
-
.move-details p {
|
| 560 |
-
margin: 0;
|
| 561 |
-
}
|
| 562 |
|
| 563 |
/* Bottom Actions */
|
| 564 |
.bottom-actions {
|
|
|
|
| 23 |
let isSharing = $state(false);
|
| 24 |
|
| 25 |
// Convert to battle definition to get enhanced ability data
|
| 26 |
+
const battleDefinition = $derived(picletInstanceToBattleDefinition(instance));
|
| 27 |
|
| 28 |
// Type-based styling
|
| 29 |
const typeData = $derived(TYPE_DATA[instance.primaryType]);
|
|
|
|
| 490 |
color: #000;
|
| 491 |
}
|
| 492 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 493 |
|
| 494 |
/* Bottom Actions */
|
| 495 |
.bottom-actions {
|