本文整理汇总了C#中IGame.AddEffect方法的典型用法代码示例。如果您正苦于以下问题:C# IGame.AddEffect方法的具体用法?C# IGame.AddEffect怎么用?C# IGame.AddEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGame
的用法示例。
在下文中一共展示了IGame.AddEffect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayerDiscardsOneCard
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));
}
示例2: Trigger
public override void Trigger(IGame game, IEffectHandle handle)
{
var defeatedEnemies = new List<IEnemyInPlay>();
foreach (var enemy in game.StagingArea.CardsInStagingArea.OfType<IEnemyInPlay>())
{
if (enemy.Damage >= enemy.Card.PrintedHitPoints)
{
defeatedEnemies.Add(enemy);
}
}
foreach (var player in game.Players)
{
foreach (var enemy in player.EngagedEnemies)
{
if (enemy.Damage >= enemy.Card.PrintedHitPoints)
{
defeatedEnemies.Add(enemy);
}
}
}
foreach (var enemy in defeatedEnemies)
{
var defeatedEffect = new EnemyDefeatedEffect(game, enemy, attackers);
var defeatedHandle = defeatedEffect.GetHandle(game);
game.AddEffect(defeatedEffect);
game.TriggerEffect(defeatedHandle);
}
handle.Resolve(GetCompletedStatus());
}
示例3: Travel
public virtual void Travel(IGame game)
{
if (game.QuestArea.ActiveLocation != null)
return;
game.AddEffect(this);
}
示例4: PutAllyIntoPlayFromYourHand
private void PutAllyIntoPlayFromYourHand(IGame game, IEffectHandle handle, IPlayer player, IAllyCard allyCard)
{
player.Hand.RemoveCards(new List<IPlayerCard> { allyCard });
player.AddCardInPlay(new AllyInPlay(game, allyCard));
game.AddEffect(new AtEndOfPhaseReturnAllyToYourHand(CardSource, allyCard.Id));
handle.Resolve(GetCompletedStatus());
}
示例5: AfterCostPaid
protected override void AfterCostPaid(IGame game, IEffectHandle handle, IEnumerable<Tuple<ICharacterInPlay, byte>> charactersAndPayments)
{
var allyCard = source as IAllyCard;
var allyInPlay = new AllyInPlay(game, allyCard);
player.AddCardInPlay(allyInPlay);
player.Hand.RemoveCards(new List<IPlayerCard> { allyCard });
game.AddEffect(new ReturnToHandAfterSuccessfulQuest(cardSource));
}
示例6: AfterCostPaid
protected override void AfterCostPaid(IGame game, IEffectHandle handle, IEnumerable<Tuple<ICharacterInPlay, byte>> charactersAndPayments)
{
var eventEffect = eventCard.Text.Effects.First();
var eventHandle = eventEffect.GetHandle(game);
player.Hand.RemoveCards(new List<IPlayerCard> { eventCard });
game.AddEffect(eventEffect);
game.TriggerEffect(eventHandle);
}
示例7: Trigger
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());
}
示例8: AfterCommittingToQuest
public void AfterCommittingToQuest(IGame game)
{
var questPhase = game.CurrentPhase as IQuestPhase;
if (questPhase == null)
return;
var self = questPhase.GetAllCharactersCommittedToQuest().Where(x => x.Card.Id == source.Id).FirstOrDefault();
if (self == null)
return;
game.AddEffect(this);
}
示例9: Trigger
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());
}
示例10: Trigger
public override void Trigger(IGame game, IEffectHandle handle)
{
foreach (var player in game.Players)
{
//TODO: Check for IDuringDrawingCards effects here
var drawEffect = new DrawingCardsEffect(game, player, 1);
var drawHandle = drawEffect.GetHandle(game);
game.AddEffect(drawEffect);
game.TriggerEffect(drawHandle);
}
handle.Resolve(GetCompletedStatus());
}
示例11: BeforeChoosingEnemyToAttack
public void BeforeChoosingEnemyToAttack(IGame game)
{
var combatPhase = game.CurrentPhase as ICombatPhase;
if (combatPhase == null)
return;
var chooseEnemy = game.CurrentPhase.GetEnemiesChosenToAttack().Where(x => x.Attackers.Any(y => y.Card.Id == source.Id)).FirstOrDefault();
if (chooseEnemy == null)
return;
if (chooseEnemy.Attackers.Count() != 1)
return;
game.AddEffect(this);
}
示例12: Trigger
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());
}
示例13: Trigger
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());
}
示例14: DuringEncounterCardRevealed
public void DuringEncounterCardRevealed(IGame game)
{
var questPhase = game.CurrentPhase as IQuestPhase;
if (questPhase == null)
return;
var revealed = game.StagingArea.RevealedEncounterCard;
if (revealed == null)
return;
if (!(revealed is IEnemyInPlay))
return;
if (!questPhase.IsCommittedToQuest(source.Id))
return;
game.AddEffect(this);
}
示例15: Trigger
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());
}