本文整理汇总了C#中IGame.GetCardInPlay方法的典型用法代码示例。如果您正苦于以下问题:C# IGame.GetCardInPlay方法的具体用法?C# IGame.GetCardInPlay怎么用?C# IGame.GetCardInPlay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGame
的用法示例。
在下文中一共展示了IGame.GetCardInPlay方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Trigger
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());
}
示例2: Trigger
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());
}
示例3: Trigger
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());
}
示例4: GetHandle
public override IEffectHandle GetHandle(IGame game)
{
var controller = game.GetController(CardSource.Id);
if (controller == null)
return base.GetHandle(game);
var resourceful = game.GetCardInPlay<ICharacterInPlay>(CardSource.Id);
if (resourceful == null || resourceful.Resources == 0)
return base.GetHandle(game);
var creatures = game.GetAllCardsInPlay<ICharacterInPlay>().Where(x => x.HasTrait(Trait.Creature) && x.Damage > 0).ToList();
if (creatures.Count == 0)
return base.GetHandle(game);
var builder =
new ChoiceBuilder("Choose a Creature in play", game, controller);
if (resourceful.Resources == 1)
{
builder.Question(string.Format("'{0}' only has 1 resource available do you want to pay that one resource to heal a creature?", CardSource.Title))
.Answer(string.Format("Yes, I want to pay 1 resource from '{0}' to heal a creature", CardSource.Title), true)
.Question("Which Creature do you want to heal?")
.LastAnswers(creatures, item => string.Format("{0} ({1} damage, {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, creature) => HealCreatureInPlay(source, handle, controller, resourceful, creature, 1));
}
else
{
builder.Question("Which Creature do you want to heal?");
foreach (var creature in creatures)
{
//.Answers(creatures, item => string.Format("{0} ({1} damage, {2} hit points)", item.Title, item.Damage, item.Card.PrintedHitPoints), (source, handle, creature) => HealCreatureInPlay(source, handle, controller, resourceful, creature, 1));
//builder.Question(string.Format("How many resources do you want to pay from '{0}' to heal a creature?", CardSource.Title))
//.Answer(string.Format("Yes, I want to pay 1 resource from '{0}' to heal a creature", CardSource.Title), true)
}
}
builder.LastAnswer(string.Format("No, I do not want to pay any resources from '{0}' to heal a creature", CardSource.Title), false, (source, handle, item) => handle.Cancel(string.Format("{0} chose not to have '{1}' pay any resources to heal a creature", controller.Name, CardSource.Title)));
return new EffectHandle(this, builder.ToChoice());
}
示例5: GetHandle
public override IEffectHandle GetHandle(IGame game)
{
var character = game.GetCardInPlay<ICharacterInPlay>(CardSource.Id);
if (character == null || character.Resources == 0)
return base.GetHandle(game);
var controller = game.GetController(CardSource.Id);
if (controller == null)
return base.GetHandle(game);
var builder =
new ChoiceBuilder(string.Format("Pay 1 resource from his resource pool to ready '{0}' after commiting him to the quest", CardSource.Title), game, controller)
.Question(string.Format("{0}, do you want to pay 1 resource from his resource pool to ready '{0}'?", CardSource.Title))
.Answer("Yes, I want to ready him", controller, (source, handle, item) => PayOneResourceToReadyAragorn(source, handle, item))
.LastAnswer("No, I do not want to ready him", false, (source, handle, item) => handle.Cancel(string.Format("", controller.Name)));
return new EffectHandle(this, builder.ToChoice());
}
示例6: DuringCommittingToQuest
public void DuringCommittingToQuest(IGame game)
{
var attachmentInPlay = game.GetCardInPlay<IAttachmentInPlay>(CardSource.Id);
if (attachmentInPlay == null || attachmentInPlay.AttachedTo == null)
return;
var character = attachmentInPlay.AttachedTo as IWillpowerfulInPlay;
if (character == null)
return;
var questPhase = game.CurrentPhase as IQuestPhase;
if (questPhase == null)
return;
if (!questPhase.IsCommittedToQuest(character.Card.Id))
return;
questPhase.CharacterDoesNotExhaustToQuest(character.Card.Id);
}
示例7: PayOneResourceToReadyAragorn
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));
}
示例8: Trigger
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());
}