Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
feat(model): update model to handle phase, bossFights
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Oct 23, 2020
1 parent 6d412c0 commit 6147a93
Show file tree
Hide file tree
Showing 12 changed files with 3,640 additions and 141 deletions.
36 changes: 34 additions & 2 deletions src/lib/model/bossfight.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
import { Entry } from './_entry';
import { Game } from './game';
import { ID } from './_entry';

export class BossFight extends Entry {
interface damageResult {
dmg: number;
dmgType: number;
playerSource: ID;
teamTarget: ID;
}

export class BossFight extends Game {
awayHp: string;
awayMaxHp: string;
homeHp: string;
homeMaxHp: string;
repeatCount: number;

constructor(data?: any) {
super(data);

this.defineStrings([
'awayHp',
'awayMaxHp',
'homeHp',
'homeMaxHp',
]);

}

// "damageResults": "[{\"dmgType\":5,\"teamTarget\":\"40b9ec2a-cb43-4dbb-b836-5accb62e7c20\",\"playerSource\":\"04e14d7b-5021-4250-a3cd-932ba8e0a889\",\"dmg\":382}]",
public get damageResults(): damageResult[] {
if (this.data?.damageResults) {
try {
return JSON.parse(this.data?.damageResults) as damageResult[];
} catch (err) {
console.error('Unable to parse damage results:', err);
}
}
return [];
}
}
Loading

0 comments on commit 6147a93

Please sign in to comment.