本文整理汇总了C#中Card.AddEventHandler方法的典型用法代码示例。如果您正苦于以下问题:C# Card.AddEventHandler方法的具体用法?C# Card.AddEventHandler怎么用?C# Card.AddEventHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card.AddEventHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Modify
protected override void Modify(Card card)
{
card.Text = "You cannot rest or prepare."
+ "<br/><br/>"
+ "<b>Trophy:</b> Attack -1"
+ "<br/><br/>" + "<b>Village/Dungeon:</b> Select 2 random cards from your hand <i>(excluding this card).</i> "
+ "You may destroy 1 of them to destroy this card.";
card.AddEventHandler(
events => events.Subscribe<CardDrawnToHand>(
ev =>
{
if (ev.Card == card)
card.Player.ValidActions = card.Player.ValidActions.Except(new[] {PlayerAction.Prepare, PlayerAction.Rest});
}));
card.CreateAbility()
.Description("Select 2 random cards from your hand. You may destroy 1 of them to destroy this card.")
.SelectCards(x => x.Select().FromRandomHandSelection(2, c => c != card)
.Caption("Curse of War").Message("Destroy 1 card."))
.OnCardsSelected(x =>
{
x.Player.DestroyCard(x.Selected.First(), card.Name);
x.Player.DestroyCard(card, card.Name);
})
.Condition(p => p.Hand.Count >= 3)
.On(Phase.Village, Phase.Dungeon);
}
示例2: Modify
protected override void Modify(Card card)
{
card.CreateAbility()
.DestroyCard("Destroy a hero.", c => c.IsHero())
.On(Phase.Battle);
card.AddEventHandler(events => events.Subscribe<DungeonHallRefilled>(e => KeepStramstFromAdvancing(card, e)));
}
示例3: Modify
protected override void Modify(Card card)
{
base.Modify(card);
card.PotentialPhysicalAttack = () => 2;
card.CreateAbility()
.EquipWeapon(Attr.PhysicalAttack, 2)
.On(Phase.Equip);
card.AddEventHandler(
events =>
events.Subscribe<SelectingCards>(
message =>
{
if (message.TriggeringAbility != null && message.TriggeringAbility.Phase == Phase.Battle && card.IsEquipped)
message.Selection.Remove(card.GetEquipped().First());
}));
}
示例4: Modify
protected override void Modify(Card card)
{
base.Modify(card);
card.PotentialPhysicalAttack = () => 5;
card.CreateAbility()
.EquipWeapon((player, hero) =>
{
hero.AddModifier(new SetMod(card, Attr.PhysicalAttack, 0));
hero.AddModifier(new SetMod(card, Attr.MagicalAttack, 0));
}).On(Phase.Equip);
card.AddEventHandler(events => events.Subscribe<AttackRankSelected>(e =>
{
if (e.AttackedRank.Number >= 2 && card.IsEquipped)
card.GetEquipped().First().AddModifier(new PlusMod(card, Attr.PhysicalAttack, 5));
}));
}
示例5: Modify
protected override void Modify(Card card)
{
card.CreateAbility()
.Description("If this is the first ability you use this turn, destroy this card. You cannot use any more abilities this turn.")
.Action(x =>
{
x.Player.DestroyCard(card, card.Name);
x.Player.ActiveAbilities.RemoveAll(a => a.Card.Owner == CardOwner.Player);
})
.On(Phase.Village, Phase.Dungeon);
// Add event handler that removes this card's abilities when player uses another card's ability (except equipping)
card.AddEventHandler(events => events.Subscribe<CardAbilityUsed>(e =>
{
var usedCard = e.Ability.Card;
if (e.Ability.Phase != Phase.Equip && usedCard.Owner == CardOwner.Player && usedCard != card)
usedCard.Player.ActiveAbilities.RemoveAll(x => x.Card == card);
}));
}