private void DiscardChosenAttachment(IGame game, IEffectHandle handle, IPlayer player, IAttachableInPlay attachment) { if (attachment.AttachedTo == null) { handle.Cancel(string.Format("Could not discard '{1}', it was not attached to anything", attachment.Title)); return; } attachment.AttachedTo.RemoveAttachment(attachment); if (attachment.Card is IObjectiveCard) { game.StagingArea.EncounterDeck.Discard(new List <IEncounterCard> { attachment.Card as IObjectiveCard }); } else if (attachment.Card is IPlayerCard) { player.Deck.Discard(new List <IPlayerCard> { attachment.Card as IPlayerCard }); } else { handle.Cancel(string.Format("'{0}' could not be discarded because it is not a valid attachment controlled by {1}", attachment.Title, player.Name)); return; } handle.Resolve(string.Format("{0} chose to have '{1}' discarded by the shadow effect of '{2}'", player.Name, attachment.Title, CardSource.Title)); }
//public override void Validate(IGame game, IEffectHandle handle) //{ // var resourcePayment = handle.Payment as IResourcePayment; // if (resourcePayment == null) // { // handle.Reject(); // return; // } // if (resourcePayment.Characters.Count() != 1) // { // handle.Reject(); // return; // } // var hero = resourcePayment.Characters.First() as IHeroInPlay; // if (hero == null || !hero.HasResourceIcon(Sphere.Spirit)) // { // handle.Reject(); // return; // } // if (resourcePayment.GetPaymentBy(hero.Card.Id) != 1) // { // handle.Reject(); // return; // } // hero.Resources -= 1; // handle.Accept(); //} public override void Trigger(IGame game, IEffectHandle handle) { var card = CardSource as IPlayerCard; if (card == null || card.Owner == null) { handle.Cancel(GetCancelledString()); return; } var ally = card.Owner.Hand.Cards.Where(x => x.Id == source.Id).FirstOrDefault() as IAllyCard; if (ally == null) { handle.Cancel(GetCancelledString()); return; } card.Owner.Hand.RemoveCards(new List <IPlayerCard> { ally }); card.Owner.AddCardInPlay(new AllyInPlay(game, ally)); game.AddEffect(new ReturnToHandAfterSuccessfulQuest(CardSource)); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var allyInPlay = game.GetCardInPlay <IAllyInPlay>(allyId); if (allyInPlay == null) { handle.Cancel(GetCancelledString()); return; } var allyController = game.GetController(allyId); if (allyController == null) { handle.Cancel(GetCancelledString()); return; } allyController.RemoveCardInPlay(allyInPlay); var eventController = game.GetController(CardSource.Id); if (eventController == null) { handle.Cancel(GetCancelledString()); return; } eventController.Hand.AddCards(new List <IPlayerCard> { allyInPlay.Card }); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var questPhase = game.CurrentPhase as IQuestPhase; if (questPhase == null || !questPhase.IsCommittedToQuest(CardSource.Id)) { handle.Cancel(string.Format("This ability only applies while '{0}' is committed to the quest", CardSource.Title)); return; } if (game.StagingArea.RevealedEncounterCard == null) { handle.Cancel(string.Format("There is no revealed encounter card for '{0}' to deal damage to", CardSource.Title)); return; } var enemy = game.StagingArea.RevealedEncounterCard as IEnemyInPlay; if (enemy == null) { handle.Cancel(string.Format("The revealed encounter card, '{0}' is not an enemy", game.StagingArea.RevealedEncounterCard.Title)); return; } enemy.Damage += 1; handle.Resolve(string.Format("'{0}' dealt 1 damage to '{1}' as it was revealed from the encounter deck", CardSource.Title, enemy.Title)); }
private void PlayerDiscardsOneCard(IGame game, IEffectHandle handle, IPlayer player, IPlayerCard card) { if (player.Hand.Cards.Count() == 0) { handle.Cancel(string.Format("{0} does not have any cards in their hand to discard", player.Name)); return; } player.DiscardFromHand(new List <IPlayerCard> { card }); var controller = game.GetController(CardSource.Id); if (controller == null) { handle.Cancel(string.Format("Could not determine the controller of {0}", CardSource.Title)); return; } var willpowerful = controller.CardsInPlay.OfType <IWillpowerfulInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (willpowerful == null) { handle.Cancel(string.Format("'{0}' is no longer in play", CardSource.Title)); return; } game.AddEffect(new WillpowerModifier(game.CurrentPhase.Code, source, willpowerful, TimeScope.Phase, 1)); handle.Resolve(string.Format("{0} discarded a card to give '{0}' +1 Willpower until the end of the phase", player.Name, CardSource.Title)); }
public override void Trigger(IGame game, IEffectHandle handle) { IAttachmentInPlay attachment = null; foreach (var player in game.Players) { attachment = player.CardsInPlay.OfType <IAttachmentInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (attachment != null) { continue; } } if (attachment == null || attachment.AttachedTo == null) { handle.Cancel(GetCancelledString()); return; } var resourceful = attachment.AttachedTo as ICharacterInPlay; if (resourceful == null) { handle.Cancel(GetCancelledString()); return; } resourceful.Resources += 1; handle.Resolve(GetCompletedStatus()); }
private void PlayerDiscardsOneCard(IGame game, IEffectHandle handle, IPlayer player, IPlayerCard card) { if (player.Hand.Cards.Count() == 0) { handle.Cancel(string.Format("{0} does not have any cards in their hand to discard", player.Name)); return; } player.DiscardFromHand(new List<IPlayerCard> { card }); var controller = game.GetController(CardSource.Id); if (controller == null) { handle.Cancel(string.Format("Could not determine the controller of {0}", CardSource.Title)); return; } var willpowerful = controller.CardsInPlay.OfType<IWillpowerfulInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (willpowerful == null) { handle.Cancel(string.Format("'{0}' is no longer in play", CardSource.Title)); return; } game.AddEffect(new WillpowerModifier(game.CurrentPhase.Code, source, willpowerful, TimeScope.Phase, 1)); handle.Resolve(string.Format("{0} discarded a card to give '{0}' +1 Willpower until the end of the phase", player.Name, CardSource.Title)); }
public override void Trigger(IGame game, IEffectHandle handle) { var damageDealt = game.CurrentPhase.GetDamageDealt().Where(x => x.Target.BaseCard.Id == source.Id).FirstOrDefault(); if (damageDealt == null || damageDealt.Damage == 0) { handle.Cancel(GetCancelledString()); return; } var resourceful = game.GetCardInPlay<ICharacterInPlay>(source.Id); if (resourceful == null) { handle.Cancel(GetCancelledString()); return; } resourceful.Resources += damageDealt.Damage; handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var determineStrength = game.CurrentPhase.GetDetermineAttacks().Where(x => x.Attacker.Card.Id == source.Id).FirstOrDefault(); if (determineStrength == null) { handle.Cancel(GetCancelledString()); return; } var damagable = game.GetCardInPlay<IHeroInPlay>(CardSource.Id); if (damagable == null) { handle.Cancel(GetCancelledString()); return; } determineStrength.Attack += damagable.Damage; handle.Resolve(GetCompletedStatus()); }
private void DiscardChosenAttachment(IGame game, IEffectHandle handle, IPlayer player, IAttachableInPlay attachment) { if (attachment.AttachedTo == null) { handle.Cancel(string.Format("Could not discard '{1}', it was not attached to anything", attachment.Title)); return; } attachment.AttachedTo.RemoveAttachment(attachment); if (attachment.Card is IObjectiveCard) { game.StagingArea.EncounterDeck.Discard(new List<IEncounterCard> { attachment.Card as IObjectiveCard }); } else if (attachment.Card is IPlayerCard) { player.Deck.Discard(new List<IPlayerCard> { attachment.Card as IPlayerCard }); } else { handle.Cancel(string.Format("'{0}' could not be discarded because it is not a valid attachment controlled by {1}", attachment.Title, player.Name)); return; } handle.Resolve(string.Format("{0} chose to have '{1}' discarded by the shadow effect of '{2}'", player.Name, attachment.Title, CardSource.Title)); }
public override void Trigger(IGame game, IEffectHandle handle) { var currentStage = game.QuestArea.GetCurrentQuestStage(); if (currentStage == null) { handle.Cancel(GetCancelledString()); return; } var random = new Random(); var number = random.Next(1, 2); if (number == 1) { var dontLeaveThePath = game.QuestArea.QuestDeck.Cards.Where(x => x.Title == "Don't Leave The Path").FirstOrDefault(); if (dontLeaveThePath != null) { currentStage.NextStage = dontLeaveThePath; } } else { var beornsPath = game.QuestArea.QuestDeck.Cards.Where(x => x.Title == "Beorn's Path").FirstOrDefault(); if (beornsPath != null) { currentStage.NextStage = beornsPath; } } handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { if (numberOfCards == 0) { handle.Cancel(GetCancelledString()); return; } player.DrawCards(numberOfCards); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var playersDrawing = game.CurrentPhase.GetPlayersDrawingCards(); if (playersDrawing == null) { handle.Cancel(GetCancelledString()); return; } var firstPlayer = game.Players.Where(x => x.IsFirstPlayer).FirstOrDefault(); if (firstPlayer == null || !playersDrawing.Players.Contains(firstPlayer.StateId)) { handle.Cancel(GetCancelledString()); return; } var numberOfCards = playersDrawing.GetNumberOfCards(firstPlayer.StateId); numberOfCards += 1; playersDrawing.SetNumberOfCards(firstPlayer.StateId, numberOfCards); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemy = game.GetCardInPlay<IEnemyInPlay>(source.Id); if (enemy == null) { handle.Cancel(GetCancelledString()); return; } enemy.Resources += 1; handle.Resolve(GetCompletedStatus()); }
private void PayOneResourceToReadyAragorn(IGame game, IEffectHandle handle, IPlayer controller) { var exhaustable = game.GetCardInPlay<IExhaustableInPlay>(source.Id); if (exhaustable == null) { handle.Cancel(GetCancelledString()); return; } if (!exhaustable.IsExhausted) { handle.Cancel(GetCancelledString()); return; } exhaustable.Ready(); handle.Resolve(string.Format("{0} chose to pay 1 resource from '{0}' to ready him after committing to him to the quest", controller.Name, CardSource.Title)); }
public override void Trigger(IGame game, IEffectHandle handle) { var determineStrength = game.CurrentPhase.GetDetermineAttacks().Where(x => x.Attacker.Card.Id == source.Id).FirstOrDefault(); if (determineStrength == null) { handle.Cancel(GetCancelledString()); return; } var damagable = game.GetCardInPlay <IHeroInPlay>(CardSource.Id); if (damagable == null) { handle.Cancel(GetCancelledString()); return; } determineStrength.Attack += damagable.Damage; handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { if (!collectingResources.IsCollectingResources || collectingResources.ResourcesToCollect == 0) { handle.Cancel(GetCancelledString()); return; } collectingResources.Character.Resources += collectingResources.ResourcesToCollect; handle.Resolve(GetCompletedStatus()); }
private void PayOneResourceToReadyAragorn(IGame game, IEffectHandle handle, IPlayer controller) { var exhaustable = game.GetCardInPlay <IExhaustableInPlay>(source.Id); if (exhaustable == null) { handle.Cancel(GetCancelledString()); return; } if (!exhaustable.IsExhausted) { handle.Cancel(GetCancelledString()); return; } exhaustable.Ready(); handle.Resolve(string.Format("{0} chose to pay 1 resource from '{0}' to ready him after committing to him to the quest", controller.Name, CardSource.Title)); }
public override void Trigger(IGame game, IEffectHandle handle) { var damageDealt = game.CurrentPhase.GetDamageDealt().Where(x => x.Target.BaseCard.Id == source.Id).FirstOrDefault(); if (damageDealt == null || damageDealt.Damage == 0) { handle.Cancel(GetCancelledString()); return; } var resourceful = game.GetCardInPlay <ICharacterInPlay>(source.Id); if (resourceful == null) { handle.Cancel(GetCancelledString()); return; } resourceful.Resources += damageDealt.Damage; handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyAttack == null) { handle.Cancel(GetCancelledString()); return; } var bonus = enemyAttack.IsUndefended ? 3 : 1; game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemyAttack.Enemy, TimeScope.None, bonus)); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemy = game.GetCardInPlay<IEnemyInPlay>(source.Id); if (enemy == null || enemy.Resources == 0) { handle.Cancel(GetCancelledString()); return; } var bonus = enemy.Resources * 2; game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemy, TimeScope.None, bonus)); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { IAttachmentInPlay attachment = null; foreach (var player in game.Players) { attachment = player.CardsInPlay.OfType<IAttachmentInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (attachment != null) continue; } if (attachment == null || attachment.AttachedTo == null) { handle.Cancel(GetCancelledString()); return; } var resourceful = attachment.AttachedTo as ICharacterInPlay; if (resourceful == null) { handle.Cancel(GetCancelledString()); return; } resourceful.Resources += 1; handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var determineAttack = game.CurrentPhase.GetDetermineAttacks().FirstOrDefault(); if (determineAttack == null) { handle.Cancel(GetCancelledString()); return; } determineAttack.Attack += 1; handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemy = game.GetCardInPlay <IEnemyInPlay>(source.Id); if (enemy == null) { handle.Cancel(GetCancelledString()); return; } enemy.Resources += 1; handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var chooseEnemy = game.CurrentPhase.GetEnemiesChosenToAttack().Where(x => x.Attackers.Any(y => y.Card.Id == source.Id)).FirstOrDefault(); if (chooseEnemy == null) { handle.Cancel(GetCancelledString()); return; } foreach (var enemy in game.StagingArea.CardsInStagingArea.OfType<IEnemyInPlay>()) { chooseEnemy.AddEnemy(enemy); } handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyAttack == null) { handle.Cancel(GetCancelledString()); return; } enemyAttack.NumberOfShadowCardsToDeal += 1; handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var location = game.StagingArea.CardsInStagingArea.OfType<ILocationInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (location == null) { handle.Cancel(string.Format("Could Not Travel To '{0}'", CardSource.Title)); return; } game.QuestArea.SetActiveLocation(location); handle.Resolve(string.Format("Traveled To '{0}'", CardSource.Title)); }
public override void Trigger(IGame game, IEffectHandle handle) { var playersDrawingCards = game.CurrentPhase.GetPlayersDrawingCards(); if (playersDrawingCards == null) { handle.Cancel(GetCancelledString()); return; } foreach (var playerId in playersDrawingCards.Players) { playersDrawingCards.DisablePlayerCardDraw(playerId); } handle.Resolve(GetCompletedStatus()); }
private void ExhaustToCancelRevealedTreachery(IGame game, IEffectHandle handle, IExhaustableInPlay exhaustable) { exhaustable.Exhaust(); if (game.StagingArea.RevealedEncounterCard == null) { handle.Cancel(string.Format("There is no revealed encounter card for '{0}' to cancel", CardSource.Title)); return; } if (!(game.StagingArea.RevealedEncounterCard.Card is ITreacheryCard) || !game.StagingArea.RevealedEncounterCard.Card.HasEffect<IWhenRevealedEffect>()) { handle.Cancel(string.Format("The revealed encounter card, '{0}', is not an Treachery with a 'When Revealed' effect for '{1}' to cancel", game.StagingArea.RevealedEncounterCard.Card.Title, CardSource.Title)); return; } var revealedTitle = game.StagingArea.RevealedEncounterCard.Title; game.StagingArea.CancelRevealedCard(this); game.StagingArea.RevealEncounterCard(); handle.Resolve(string.Format("The 'when revealed' effect of '{1}' has been cancelled", CardSource.Title, revealedTitle)); }
public override void Trigger(IGame game, IEffectHandle handle) { var location = game.StagingArea.CardsInStagingArea.OfType <ILocationInPlay>().Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (location == null) { handle.Cancel(string.Format("Could Not Travel To '{0}'", CardSource.Title)); return; } game.QuestArea.SetActiveLocation(location); handle.Resolve(string.Format("Traveled To '{0}'", CardSource.Title)); }
private void ExhaustToCancelRevealedTreachery(IGame game, IEffectHandle handle, IExhaustableInPlay exhaustable) { exhaustable.Exhaust(); if (game.StagingArea.RevealedEncounterCard == null) { handle.Cancel(string.Format("There is no revealed encounter card for '{0}' to cancel", CardSource.Title)); return; } if (!(game.StagingArea.RevealedEncounterCard.Card is ITreacheryCard) || !game.StagingArea.RevealedEncounterCard.Card.HasEffect <IWhenRevealedEffect>()) { handle.Cancel(string.Format("The revealed encounter card, '{0}', is not an Treachery with a 'When Revealed' effect for '{1}' to cancel", game.StagingArea.RevealedEncounterCard.Card.Title, CardSource.Title)); return; } var revealedTitle = game.StagingArea.RevealedEncounterCard.Title; game.StagingArea.CancelRevealedCard(this); game.StagingArea.RevealEncounterCard(); handle.Resolve(string.Format("The 'when revealed' effect of '{1}' has been cancelled", CardSource.Title, revealedTitle)); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyAttack == null) { handle.Cancel(GetCancelledString()); return; } var threat = enemyAttack.IsUndefended ? (byte)8 : (byte)4; enemyAttack.DefendingPlayer.IncreaseThreat(threat); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyAttack == null) { handle.Cancel(GetCancelledString()); return; } var damage = enemyAttack.IsUndefended ? (byte)2 : (byte)1; foreach (var damageable in enemyAttack.DefendingPlayer.CardsInPlay.OfType<ICharacterInPlay>()) { damageable.Damage += damage; } handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemy = game.GetCardInPlay <IEnemyInPlay>(source.Id); if (enemy == null || enemy.Resources == 0) { handle.Cancel(GetCancelledString()); return; } var bonus = enemy.Resources * 2; game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemy, TimeScope.None, bonus)); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyAttack == null) { handle.Cancel(GetCancelledString()); return; } enemyAttack.Attack += 1; if (enemyAttack.IsUndefended) { enemyAttack.DefendingPlayer.IncreaseThreat(3); } handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var questPhase = game.CurrentPhase as IQuestPhase; if (questPhase == null) { handle.Cancel(GetCancelledString()); return; } foreach (var willpowerful in questPhase.GetAllCharactersCommittedToQuest()) { game.AddEffect(new WillpowerModifier(game.CurrentPhase.Code, source, willpowerful, TimeScope.Phase, -1)); } handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var chooseEnemy = game.CurrentPhase.GetEnemiesChosenToAttack().Where(x => x.Attackers.Any(y => y.Card.Id == source.Id)).FirstOrDefault(); if (chooseEnemy == null) { handle.Cancel(GetCancelledString()); return; } foreach (var enemy in game.StagingArea.CardsInStagingArea.OfType <IEnemyInPlay>()) { chooseEnemy.AddEnemy(enemy); } handle.Resolve(GetCompletedStatus()); }
private void AddSpiderToTheStagingArea(IGame game, IEffectHandle handle, IEnemyCard spider) { if (game.StagingArea.EncounterDeck.Cards.Any(x => x.Id == spider.Id)) { game.StagingArea.EncounterDeck.RemoveFromDeck(spider); game.StagingArea.AddToStagingArea(spider); handle.Resolve(string.Format("'{0}' added to the staging area from the encounter deck", spider.Title)); return; } else if (game.StagingArea.EncounterDeck.DiscardPile.Any(x => x.Id == spider.Id)) { game.StagingArea.EncounterDeck.RemoveFromDiscardPile(new List<IEncounterCard> { spider }); game.StagingArea.AddToStagingArea(spider); handle.Resolve(string.Format("'{0}' added to the staging area from the encounter discard pile", spider.Title)); } handle.Cancel(string.Format("'{0}' was not added to the staging area because it could not be located", spider.Title)); }
public override void Trigger(IGame game, IEffectHandle handle) { IEnemyInPlay enemy = null; foreach (var player in game.Players) { enemy = player.EngagedEnemies.Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (enemy != null) break; } if (enemy == null) { handle.Cancel(GetCancelledString()); return; } game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemy, TimeScope.Round, 1)); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var enemyAttack = game.CurrentPhase.GetEnemyAttacks().Where(x => x.Enemy.Card.Id == source.Id).FirstOrDefault(); if (enemyAttack == null) { handle.Cancel(GetCancelledString()); return; } var damage = enemyAttack.IsUndefended ? (byte)2 : (byte)1; foreach (var damageable in enemyAttack.DefendingPlayer.CardsInPlay.OfType <ICharacterInPlay>()) { damageable.Damage += damage; } handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { if (game.StagingArea.CardsInStagingArea.Count() == 0) { game.StagingArea.RevealEncounterCard(); { handle.Cancel(GetCancelledString()); return; } } foreach (var threatening in game.StagingArea.CardsInStagingArea.OfType <IThreateningInPlay>()) { game.AddEffect(new ThreatModifier(game.CurrentPhase.Code, source, threatening, TimeScope.Phase, 1)); } handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { if (game.StagingArea.CardsInStagingArea.Count() == 0) { game.StagingArea.RevealEncounterCard(); { handle.Cancel(GetCancelledString()); return; } } foreach (var threatening in game.StagingArea.CardsInStagingArea.OfType<IThreateningInPlay>()) { game.AddEffect(new ThreatModifier(game.CurrentPhase.Code, source, threatening, TimeScope.Phase, 1)); } handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var defeatedState = new EnemyDefeated(game, enemy, attackers); foreach (var card in game.GetCardsInPlayWithEffect <ICardInPlay, IBeforeEnemyDefeated>()) { foreach (var effect in card.BaseCard.Text.Effects.OfType <IBeforeEnemyDefeated>()) { effect.BeforeEnemyDefeated(defeatedState); } } foreach (var card in game.GetCardsInPlayWithEffect <ICardInPlay, IDuringEnemyDefeated>()) { foreach (var effect in card.BaseCard.Text.Effects.OfType <IDuringEnemyDefeated>()) { effect.DuringEnemyDefeated(defeatedState); } } if (!defeatedState.IsEnemyDefeated) { handle.Cancel(GetCancelledString()); return; } foreach (var card in game.GetCardsInPlayWithEffect <ICardInPlay, IAfterEnemyDefeated>()) { foreach (var effect in card.BaseCard.Text.Effects.OfType <IAfterEnemyDefeated>()) { effect.AfterEnemyDefeated(defeatedState); } } var leavingPlayEffect = new CardLeavesPlayEffect(game, enemy); game.AddEffect(leavingPlayEffect); var leavingPlayHandle = leavingPlayEffect.GetHandle(game); game.TriggerEffect(leavingPlayHandle); handle.Resolve(GetCompletedStatus()); }
private void AddSpiderToTheStagingArea(IGame game, IEffectHandle handle, IEnemyCard spider) { if (game.StagingArea.EncounterDeck.Cards.Any(x => x.Id == spider.Id)) { game.StagingArea.EncounterDeck.RemoveFromDeck(spider); game.StagingArea.AddToStagingArea(spider); handle.Resolve(string.Format("'{0}' added to the staging area from the encounter deck", spider.Title)); return; } else if (game.StagingArea.EncounterDeck.DiscardPile.Any(x => x.Id == spider.Id)) { game.StagingArea.EncounterDeck.RemoveFromDiscardPile(new List <IEncounterCard> { spider }); game.StagingArea.AddToStagingArea(spider); handle.Resolve(string.Format("'{0}' added to the staging area from the encounter discard pile", spider.Title)); } handle.Cancel(string.Format("'{0}' was not added to the staging area because it could not be located", spider.Title)); }
private void PayResourcesToReadyAttachedCharacter(IGame game, IEffectHandle handle, IPlayer player, ICharacterInPlay character) { var refreshPhase = game.CurrentPhase as IRefreshPhase; if (refreshPhase == null) { throw new InvalidOperationException("This effect can only be triggered during the refresh phase"); } var readyingCard = refreshPhase.GetReadyingCards().Where(x => x.Exhaustable.BaseCard.Id == source.Id).FirstOrDefault(); if (readyingCard == null) { handle.Cancel(string.Format("Could not determine the readying state of '{0}'", character.Title)); return; } character.Resources -= 2; readyingCard.IsReadying = true; handle.Resolve(string.Format("{0} chose to pay 2 resources from {1}'s resource pool to allow them to ready ({2})", player.Name, character.Title, CardSource.Title)); }
public override void Trigger(IGame game, IEffectHandle handle) { IEnemyInPlay enemy = null; foreach (var player in game.Players) { enemy = player.EngagedEnemies.Where(x => x.Card.Id == source.Id).FirstOrDefault(); if (enemy != null) { break; } } if (enemy == null) { handle.Cancel(GetCancelledString()); return; } game.AddEffect(new AttackModifier(game.CurrentPhase.Code, source, enemy, TimeScope.Round, 1)); handle.Resolve(GetCompletedStatus()); }
public override void Trigger(IGame game, IEffectHandle handle) { var defeatedState = new EnemyDefeated(game, enemy, attackers); foreach (var card in game.GetCardsInPlayWithEffect<ICardInPlay, IBeforeEnemyDefeated>()) { foreach (var effect in card.BaseCard.Text.Effects.OfType<IBeforeEnemyDefeated>()) { effect.BeforeEnemyDefeated(defeatedState); } } foreach (var card in game.GetCardsInPlayWithEffect<ICardInPlay, IDuringEnemyDefeated>()) { foreach (var effect in card.BaseCard.Text.Effects.OfType<IDuringEnemyDefeated>()) { effect.DuringEnemyDefeated(defeatedState); } } if (!defeatedState.IsEnemyDefeated) { handle.Cancel(GetCancelledString()); return; } foreach (var card in game.GetCardsInPlayWithEffect<ICardInPlay, IAfterEnemyDefeated>()) { foreach (var effect in card.BaseCard.Text.Effects.OfType<IAfterEnemyDefeated>()) { effect.AfterEnemyDefeated(defeatedState); } } var leavingPlayEffect = new CardLeavesPlayEffect(game, enemy); game.AddEffect(leavingPlayEffect); var leavingPlayHandle = leavingPlayEffect.GetHandle(game); game.TriggerEffect(leavingPlayHandle); handle.Resolve(GetCompletedStatus()); }
private void CancelDiscard(IGame game, IEffectHandle handle, IPlayer player) { handle.Cancel(string.Format("{0} decided not to discard a card from their hand", player.Name)); }
private void PayResourcesToReadyAttachedCharacter(IGame game, IEffectHandle handle, IPlayer player, ICharacterInPlay character) { var refreshPhase = game.CurrentPhase as IRefreshPhase; if (refreshPhase == null) throw new InvalidOperationException("This effect can only be triggered during the refresh phase"); var readyingCard = refreshPhase.GetReadyingCards().Where(x => x.Exhaustable.BaseCard.Id == source.Id).FirstOrDefault(); if (readyingCard == null) { handle.Cancel(string.Format("Could not determine the readying state of '{0}'", character.Title)); return; } character.Resources -= 2; readyingCard.IsReadying = true; handle.Resolve(string.Format("{0} chose to pay 2 resources from {1}'s resource pool to allow them to ready ({2})", player.Name, character.Title, CardSource.Title)); }
protected void UnableToPayCost(IGame game, IEffectHandle handler, IPlayer player) { var title = (costlyCard != null) ? costlyCard.Title : cardEffect.ToString(); handler.Cancel(string.Format("{0} was not able to pay the cost for '{1}'", player.Name, title)); }
private void PassOnTakingAnAction(IGame game, IEffectHandle handle) { handle.Cancel(string.Format("{0} passed on taking an action", player.Name)); }
protected void CancelPayingCost(IGame game, IEffectHandle handle, IPlayer player) { var title = (costlyCard != null) ? costlyCard.Title : cardEffect.ToString(); handle.Cancel(string.Format("{0} chose not to pay the cost for '{1}'", player.Name, title)); }
private void CancelEffect(IGame game, IEffectHandle handle, IPlayer controller) { handle.Cancel(string.Format("{0} chose not to exhaust '{0}' to have a player draw 2 cards", controller.Name, CardSource.Title)); }