public void PlayCard(Player source, Target target) { Game.CardPlayedResult res = Game.Instance.PlayCard(this, source, target); if (res != Game.CardPlayedResult.CARD_PLAYED) HandleCardNotPlayable(res); }
public CardPlayedResult PlayCard(Card card, Player source, Target target) { CardPlayedResult res = IsCardPlayable(card, source, target); if (res == CardPlayedResult.CARD_PLAYED) EventManager.Instance.onCardPlayed(card, source, target); return res; }
private CardPlayedResult IsCardPlayable(Card card, Player source, Target target) { CardPlayedResult result = CardPlayedResult.CARD_PLAYED; int dist = CalculateDistanceBetweenPlayers(source, target.GetPlayer()); if (!IsCorrectTarget(card, target)) { result = CardPlayedResult.INVALID_TARGET; } else if (IsSourceOrCardInRange(source, card, dist)) { result = CardPlayedResult.TARGET_TOO_FAR; } return result; }
internal void onCardPlayed(Card card, Player source, Target target) { card.ApplyEffect(target); source.RemoveCard(card); }
public bool canAffect(Target target) { return target.Type == TargetType.PLAYER || target.Type == TargetType.CARD; }
internal void ApplyEffect(Target target) { throw new NotImplementedException(); }
private bool IsCorrectTarget(Card card, Target target) { throw new NotImplementedException(); }