66using model . choices . trash ;
77using model . costs ;
88using model . play ;
9- using model . player ;
109using model . timing ;
1110using model . zones ;
1211
1312namespace model . cards . corp {
1413 public class AdvancedAssemblyLines : Card {
15- public AdvancedAssemblyLines ( Game game ) : base ( game ) { }
14+ private Ability pop ;
1615 override public string FaceupArt => "advanced-assembly-lines" ;
1716 override public string Name => "Advanced Assembly Lines" ;
1817 override public Faction Faction => Factions . HAAS_BIOROID ;
@@ -24,27 +23,30 @@ public AdvancedAssemblyLines(Game game) : base(game) { }
2423 new PayToTrash ( 1 , this , game )
2524 } ;
2625
26+ public AdvancedAssemblyLines ( Game game ) : base ( game ) {
27+ pop = new Ability (
28+ cost : new Trash ( this , game . corp . zones . archives . Zone ) ,
29+ effect : new AdvancedAssemblyLinesInstall ( game . corp ) ,
30+ source : this ,
31+ mandatory : false
32+ ) ;
33+ }
34+
2735 async protected override Task Activate ( ) {
2836 await game . corp . credits . Gaining ( 3 ) . Resolve ( ) ;
29- game . Timing . PaidWindowDefined += DefineTrashAbility ;
37+ game . Timing . PaidWindowDefined += DeferPop ;
3038 }
3139
32- async protected override Task Deactivate ( ) {
33- game . Timing . PaidWindowDefined -= DefineTrashAbility ;
40+ protected override Task Deactivate ( ) {
41+ game . Timing . PaidWindowDefined -= DeferPop ;
42+ return Task . CompletedTask ;
3443 }
3544
36- private void DefineTrashAbility ( PaidWindow paidWindow ) {
37- var archives = game . corp . zones . archives . Zone ;
38- var aalInstall = new AdvancedAssemblyLinesInstall ( game . corp ) ;
39- var pop = new Ability (
40- cost : new Conjunction ( paidWindow . Permission ( ) , new Trash ( aal , archives ) , new Active ( aal ) ) ,
41- effect : aalInstall ,
42- aal
43- ) . BelongingTo ( aal ) ;
44- paidWindow . Add ( pop ) ;
45+ private void DeferPop ( PaidWindow paidWindow ) {
46+ paidWindow . GiveOption ( game . corp . pilot , pop ) ;
4547 }
4648
47- private class AdvancedAssemblyLinesInstall : IEffect , IDisposable {
49+ private class AdvancedAssemblyLinesInstall : IEffect {
4850 public bool Impactful => Installables ( ) . Count > 0 ;
4951 public event Action < IEffect , bool > ChangedImpact = delegate { } ;
5052 IEnumerable < string > IEffect . Graphics => new string [ ] { } ;
@@ -55,19 +57,17 @@ public AdvancedAssemblyLinesInstall(Corp corp) {
5557 corp . zones . hq . Zone . Changed += UpdateInstallables ;
5658 }
5759
58- private IList < Card > Installables ( ) => corp . zones . hq . Zone . Cards . Where ( card => ( card . Type . Installable && ! ( card . Type is Agenda ) ) ) . ToList ( ) ;
59-
60- async Task IEffect . Resolve ( IPilot pilot ) {
61- var installable = await corp . pilot . ChooseACard ( ) . Declare ( "Which card to install?" , Installables ( ) ) ;
62- await corp . Installing . InstallingCard ( installable ) . Resolve ( pilot ) ;
63- }
64-
6560 private void UpdateInstallables ( Zone hqZone ) {
6661 ChangedImpact ( this , Impactful ) ;
6762 }
6863
69- public void Dispose ( ) {
70- corp . zones . hq . Zone . Changed -= UpdateInstallables ;
64+ private IList < Card > Installables ( ) => corp . zones . hq . Zone . Cards
65+ . Where ( card => ( card . Type . Installable && ! ( card . Type is Agenda ) ) )
66+ . ToList ( ) ;
67+
68+ async Task IEffect . Resolve ( ) {
69+ var installable = await corp . pilot . ChooseACard ( ) . Declare ( "Which card to install?" , Installables ( ) ) ;
70+ await corp . Installing . InstallingCard ( installable ) . Resolve ( ) ;
7171 }
7272 }
7373 }
0 commit comments