Skip to content

Commit

Permalink
fix(ability): ability display synced between list and combat
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Sep 12, 2023
1 parent e078643 commit a82bc83
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
margin-right: 12px;

.ability-image-container {
margin-top: 20px;
margin-top: 4px;
max-height: 48px;
border-color: #000;
}
Expand All @@ -27,6 +27,10 @@
.title {
display: flex;
align-items: center;
font-size: 16px;
margin-top: 0;
margin-bottom: 0;
margin-left: 4px;

.name, app-element-icon, .ct, .cd, .type {
margin-right: 5px;
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/pages/combat/combat.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
}

.ability-modal {
--padding-top: 0;
--padding-top: 16px;
}

.ability-list {
Expand Down
24 changes: 22 additions & 2 deletions client/src/app/pages/me/me.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</ion-segment-button>

<ion-segment-button value="abilities">
<ion-label>{{ data.player?.job }} Abilities</ion-label>
<ion-label>Your Abilities</ion-label>
</ion-segment-button>

<ion-segment-button value="levels">
Expand Down Expand Up @@ -67,10 +67,30 @@
<ion-row *ngIf="view === 'abilities'">
<ion-col>
<ion-card>
<ion-card-header>
<ion-card-title>Basic Abilities</ion-card-title>
</ion-card-header>

<ion-card-content>
<ion-list *ngIf="data.player && data.equipment">
<ion-item
*ngFor="let ability of getBasicAbilities(data.player, data.equipment)"
>
<app-combat-ability [ability]="ability"></app-combat-ability>
</ion-item>
</ion-list>
</ion-card-content>
</ion-card>

<ion-card>
<ion-card-header>
<ion-card-title>Job Abilities</ion-card-title>
</ion-card-header>

<ion-card-content>
<ion-list *ngIf="data.player && data.equipment">
<ion-item
*ngFor="let ability of getAbilities(data.player, data.equipment)"
*ngFor="let ability of getJobAbilities(data.player, data.equipment)"
>
<app-combat-ability [ability]="ability"></app-combat-ability>
</ion-item>
Expand Down
13 changes: 9 additions & 4 deletions client/src/app/pages/me/me.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export class MePage implements OnInit {
];
}

getAbilities(
getBasicAbilities(
player: IPlayer,
equipment: Record<ItemSlot, IEquipment>,
): ICombatAbility[] {
Expand All @@ -236,6 +236,13 @@ export class MePage implements OnInit {
.flat(),
];

return [...itemAbilities].filter(Boolean) as ICombatAbility[];
}

getJobAbilities(
player: IPlayer,
equipment: Record<ItemSlot, IEquipment>,
): ICombatAbility[] {
const jobAbilities = Object.values(this.contentService.abilities).filter(
(ability) => {
return (
Expand All @@ -245,9 +252,7 @@ export class MePage implements OnInit {
},
);

return [...itemAbilities, ...jobAbilities].filter(
Boolean,
) as ICombatAbility[];
return [...jobAbilities].filter(Boolean) as ICombatAbility[];
}

nextLevelXp(level: number) {
Expand Down

0 comments on commit a82bc83

Please sign in to comment.