public bool TryPlayOperation(Operation operation) { // card must be in the players hand if (!_game.Player.Hand.Contains(operation)) { return(false); } // need enough money if (operation.BaseCost > _game.Player.Credits) { return(false); } // playing operations costs a click if (_game.Player.Clicks < 1) { return(false); } // if we get here is all good, play the card _actions.Add(new OperationAction(operation)); if (operation.OnPlay != null) { operation.OnPlay(_game, _game.Player); } _game.Player.ChangeCredits(-operation.BaseCost); _game.Player.Hand.Remove(operation); if (operation.OperationType == OperationType.ONESHOT) { _game.Player.Discard.Add(operation); GameViewController.DestroyCardTransform(operation); } else { _game.Player.OngoingOperations.Add(operation); GameViewController.MoveToConstructionArea(operation, true); } ChangeClicks(-1); GameViewController.AddGameLogMessage(string.Format("<b>You</b> play {0}", operation.CardName)); return(true); }