static bool cardPlayable(MauMauGame game, MauMauCard card) { MauMauCard topCard = game.Stacks["discard-pile"].TopCard; MauMauCardType topCardType = (MauMauCardType)topCard.Type; var alwaysPlayableValues = new Values[] { Values.Jack }; bool colorMatch = topCardType.Color == ((MauMauCardType)card.Type).Color; bool valueMatch = topCardType.Value == ((MauMauCardType)card.Type).Value; bool alwaysPlayable = alwaysPlayableValues.Contains(((MauMauCardType)card.Type).Value); return(colorMatch || valueMatch || alwaysPlayable); }
static bool playCard(MauMauGame game, MauMauCard card) { if (cardPlayable(game, card)) { card.moveTo(game.Stacks["discard-pile"]); card.activateEffects(); return(true); } else { return(false); } }