import { Component, OnInit, Input } from '@angular/core'; import { SBGArmyList, SBGWarband, SBGWarrior, GameSystemArmyList } from 'tournee.businesslogic'; import { UtilityService } from 'src/app/shared/services/utility.service'; @Component({ selector: 'app-user-selectable-listing-warbands', templateUrl: './user-selectable-listing-warbands.component.html', styleUrls: ['./user-selectable-listing-warbands.component.css'] }) export class UserSelectableListingWarbandsComponent implements OnInit { @Input() ArmyList: SBGArmyList constructor(public utility: UtilityService) { } ngOnInit() { } addWarband() { this.ArmyList.warbands.push(SBGWarband.create()); } addWarriors(warband: SBGWarband) { warband.warriors.push(SBGWarrior.create()); } deleteWarband(warband_number: number) { this.ArmyList.warbands.splice(warband_number, 1); } disable_add_warband() { if (!this.ArmyList.game_system || !this.ArmyList.list_name) { return true; } else { if (this.ArmyList.warbands.length == 0) { return false; } else { return !this.ArmyList.valid(); } } } filter_army_list_for_good_or_evil(army_lists: Array) { return army_lists.filter((al) => { return al.is_good == this.ArmyList.is_good}); } }