public void Activate() { if (!Booster.CanActivate(this.BoosterDefinition, this.Context)) { return; } if (this.IsActive()) { this.OnReactivation(); if (this.BoosterDefinition.BoosterType == BoosterDefinition.Type.ResettingTime) { return; } } else { if (this.BoosterDefinition.BoosterType == BoosterDefinition.Type.Instant) { this.Duration = 0; } else { this.TurnWhenStarted = this.game.Turn; this.Context.AddChild(this); this.ApplyClassTimedDescriptor(); this.ApplyDescriptors(true); this.RemainingTime = this.Duration; } this.ApplyEffects(); this.Context.Refresh(false); } if (this.game != null) { IVisibilityService service = this.game.Services.GetService <IVisibilityService>(); if (service != null && this.empire != null) { service.NotifyVisibilityHasChanged(this.empire); } } if (this.BoosterDefinition.Effects != null) { for (int i = 0; i < this.BoosterDefinition.Effects.Length; i++) { BoosterEffect effect = this.BoosterDefinition.Effects[i]; if (Booster.CheckPrerequisites(effect, this.Context)) { this.ExecuteCommands(effect); } } } IEventService service2 = Services.GetService <IEventService>(); if (service2 != null) { service2.Notify(new EventBoosterActivated(this.empire, this)); } }
private void RefreshBoosterAvailability() { if (this.guiStackedBooster.BoosterDefinition != null && Booster.CanActivate(this.guiStackedBooster.BoosterDefinition, this.empire)) { this.Background.AgeTransform.Visible = true; this.ActivateButton.AgeTransform.Visible = true; return; } this.Background.AgeTransform.Visible = false; this.ActivateButton.AgeTransform.Visible = false; }