TetraStats/lib/data_objects/finesse.dart

30 lines
769 B
Dart
Raw Permalink Normal View History

2024-09-05 21:42:21 +00:00
// ignore_for_file: hash_and_equals
import 'dart:math';
class Finesse {
late int combo;
late int faults;
late int perfectPieces;
Finesse({required this.combo, required this.faults, required this.perfectPieces});
Finesse.fromJson(Map<String, dynamic> json) {
combo = json['combo'];
faults = json['faults'];
perfectPieces = json['perfectpieces'];
}
Finesse operator + (Finesse other){
return Finesse(combo: max(combo, other.combo), faults: faults + other.faults, perfectPieces: perfectPieces + other.perfectPieces);
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['combo'] = combo;
data['faults'] = faults;
data['perfectpieces'] = perfectPieces;
return data;
}
}