Skip to content

Instantly share code, notes, and snippets.

@zonaryFUND
Created January 26, 2019 12:11
Show Gist options
  • Save zonaryFUND/e6283a71bea8796dfa132ff637a0a53d to your computer and use it in GitHub Desktop.
Save zonaryFUND/e6283a71bea8796dfa132ff637a0a53d to your computer and use it in GitHub Desktop.
using System.Linq;
using Monad;
using Monad.Extensions;
namespace BuildCiv.Model.CardDifinition
{
public readonly struct Barter : IPlayable
{
public int CivilCost => 1;
public bool IsPlayable(ITable table)
=> table.Hand.Cards.Count() > 0;
ContState<ITable, Unit> IPlayable.Play()
=>
from _dispose in (
from disposed in HandEffect.RequestSelection(1)
from _ in HandEffect.Dispose(disposed).Lift()
select _
).ToTable()
from _draw in (
from drawed in TableEffect.Draw(2)
from _ in HandEffect.Add(drawed).ToTable()
select _
).Lift()
select Unit.Default;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment