Skip to content

Commit

Permalink
Merge pull request #421 from Ariemeth/fix_peace_officers
Browse files Browse the repository at this point in the history
fixed the cost of peace officers faction mod
  • Loading branch information
Ariemeth authored Nov 22, 2024
2 parents c957d69 + ed36689 commit adb1230
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
40 changes: 26 additions & 14 deletions lib/v3/models/mods/factionUpgrades/peace_river.dart
Original file line number Diff line number Diff line change
Expand Up @@ -419,23 +419,35 @@ class PeaceRiverFactionMods extends FactionModification {
return (cgWithMod.isEmpty || cgWithMod.any((c) => c!.name == cg!.name));
}

return PeaceRiverFactionMods(
final mod = PeaceRiverFactionMods(
name: 'Peace Officers',
requirementCheck: reqCheck,
id: peaceOfficersID,
)
..addMod<int>(UnitAttribute.tv, createSimpleIntMod(1),
description: 'TV: +1')
..addMod<List<Weapon>>(UnitAttribute.weapons, (value) {
return List<Weapon>.from(value)
.where(
(existingWeapon) => existingWeapon.code != weaponCodeToRemove)
.toList();
}, dynamicDescription: () {
return unitRPToRemove.isNotEmpty ? '-$unitRPToRemove' : '';
})
..addMod(UnitAttribute.traits, createAddTraitToList(Trait.shield()),
description: '+Shield');
);
mod.addMod<int>(UnitAttribute.tv, (value) {
final hasRP = unit
.attribute<List<Weapon>>(UnitAttribute.weapons,
modIDToSkip: peaceOfficersID)
.any((w) => w.code == 'RP');
return hasRP ? value : value + 1;
}, dynamicDescription: () {
final hasRP = unit
.attribute<List<Weapon>>(UnitAttribute.weapons,
modIDToSkip: peaceOfficersID)
.any((w) => w.code == 'RP');
return hasRP ? 'TV: 0' : 'TV: +1';
});
mod.addMod<List<Weapon>>(UnitAttribute.weapons, (value) {
return List<Weapon>.from(value)
.where((existingWeapon) => existingWeapon.code != weaponCodeToRemove)
.toList();
}, dynamicDescription: () {
return unitRPToRemove.isNotEmpty ? '-$unitRPToRemove' : '';
});
mod.addMod(UnitAttribute.traits, createAddTraitToList(Trait.shield()),
description: '+Shield');

return mod;
}
/*
G-SWAT Sniper: One gear with a rifle, per combat group, may purchase the
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.16.4
version: 1.16.5
environment:
sdk: ">=3.0.0"

Expand Down

0 comments on commit adb1230

Please sign in to comment.