Skip to content

Commit

Permalink
Units that have an inherent SP no longer have that SP doubled
Browse files Browse the repository at this point in the history
issue found by RoBear and verified by Jaeton
  • Loading branch information
Ariemeth committed Mar 9, 2024
1 parent 82df56a commit 5aa70d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
22 changes: 10 additions & 12 deletions lib/models/unit/unit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -453,32 +453,30 @@ class Unit extends ChangeNotifier {
if (commandLevel != CommandLevel.none) {
// all commanders get 1 base cp
cp = cp + 1;
cp = cp + _calculateSkillPoints();
// commanders convert their sp to cp
cp = cp + skillPoints;
}

return cp;
}

int get skillPoints {
return _calculateSkillPoints();
}

int _calculateSkillPoints() {
var sp = core.attribute(UnitAttribute.sp);
var sp = 0;

for (var mod in this._mods) {
sp = mod.applyMods(UnitAttribute.sp, sp);
}

final numSPMods =
traits.where((trait) => trait.isSameType(Trait.SP(0))).length;

sp += numSPMods;

if (isVeteran) {
if (this.isVeteran) {
sp += 1;
}

for (var trait in this.traits) {
if (trait.isSameType(Trait.SP(0))) {
sp += trait.level ?? 0;
}
}

return sp;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/screens/roster/roster.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'package:url_launcher/url_launcher_string.dart';
const double _leftPanelWidth = 670.0;
const double _titleHeight = 40.0;
const double _menuTitleHeight = 50.0;
const String _version = '1.2.23';
const String _version = '1.2.24';
const String _bugEmailAddress = '[email protected]';
const String _dp9URL = 'https://www.dp9.com/';
const String _sourceCodeURL = 'https://github.com/Ariemeth/gearforce-flutter';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

version: 1.2.23
version: 1.2.24
environment:
sdk: ">=3.0.0"

Expand Down

0 comments on commit 5aa70d8

Please sign in to comment.