本文整理汇总了C#中Sanguosha.Core.Cards.Card类的典型用法代码示例。如果您正苦于以下问题:C# Card类的具体用法?C# Card怎么用?C# Card使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Card类属于Sanguosha.Core.Cards命名空间,在下文中一共展示了Card类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Activate
public override void Activate(Player p, Card c)
{
while (true)
{
GameEventArgs args = new GameEventArgs();
args.Source = null;
args.Targets = new List<Player>() { p };
args.Card = c;
args.ReadonlyCard = new ReadOnlyCard(c);
try
{
Game.CurrentGame.Emit(GameEvent.CardUsageBeforeEffected, args);
}
catch (TriggerResultException e)
{
Trace.Assert(e.Status == TriggerResult.End);
break;
}
ReadOnlyCard result = Game.CurrentGame.Judge(p, null, c, (judgeResultCard) => { return judgeResultCard.Suit != SuitType.Heart; });
if (result.Suit != SuitType.Heart)
{
Game.CurrentGame.PhasesSkipped.Add(TurnPhase.Play);
}
break;
}
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>();
move.Cards.Add(c);
move.To = new DeckPlace(null, DeckType.Discard);
move.Helper.IsFakedMove = true;
Game.CurrentGame.MoveCards(move, false, Core.Utils.GameDelays.None);
}
示例2: Install
/// <summary>
/// 给某个玩家穿装备
/// </summary>
/// <param name="p"></param>
/// <param name="card"></param>
public void Install(Player p, Card card)
{
ParentCard = card;
CardsMovement attachMove = new CardsMovement();
attachMove.Cards = new List<Card>();
attachMove.Cards.Add(card);
attachMove.To = new DeckPlace(p, DeckType.Equipment);
foreach (Card c in Game.CurrentGame.Decks[p, DeckType.Equipment])
{
if (CardCategoryManager.IsCardCategory(c.Type.Category, this.Category))
{
Equipment e = (Equipment)c.Type;
Trace.Assert(e != null);
Game.CurrentGame.EnterAtomicContext();
Game.CurrentGame.PlayerLostCard(p, new List<Card>() { card });
Game.CurrentGame.HandleCardDiscard(p, new List<Card> () {c});
Game.CurrentGame.MoveCards(attachMove);
Game.CurrentGame.ExitAtomicContext();
return;
}
}
Game.CurrentGame.MoveCards(attachMove);
Game.CurrentGame.PlayerLostCard(p, new List<Card>() {card});
return;
}
示例3: RevealResult
public void RevealResult(Card card1, Card card2)
{
cardLeft.DataContext = new CardViewModel()
{
Card = card1,
Footnote = LogFormatter.Translate(_player1),
IsFootnoteVisible = true
};
cardRight.DataContext = new CardViewModel()
{
Card = card2,
Footnote = LogFormatter.Translate(_player2),
IsFootnoteVisible = true
};
AnimationBase anim;
if (card1.Rank > card2.Rank)
{
anim = new PinDianWinAnimation();
}
else
{
anim = new PinDianLoseAnimation();
}
anim.SetValue(Canvas.LeftProperty, animationCenter.ActualWidth / 2 - anim.Width / 2);
anim.SetValue(Canvas.TopProperty, animationCenter.ActualHeight / 2 - anim.Height / 2);
animationCenter.Children.Add(anim);
anim.Completed += new EventHandler(anim_Completed);
anim.Start();
}
示例4: _FilterCard
void _FilterCard(Player p, Card card)
{
GameEventArgs args = new GameEventArgs();
args.Source = p;
args.Card = card;
Emit(GameEvent.EnforcedCardTransform, args);
}
示例5: Activate
public override void Activate(Player p, Card c)
{
while (true)
{
GameEventArgs args = new GameEventArgs();
args.Source = null;
args.Targets = new List<Player>() { p };
args.Card = c;
args.ReadonlyCard = new ReadOnlyCard(c);
try
{
Game.CurrentGame.Emit(GameEvent.CardUsageBeforeEffected, args);
}
catch (TriggerResultException e)
{
Trace.Assert(e.Status == TriggerResult.End);
break;
}
ReadOnlyCard result = Game.CurrentGame.Judge(p, null, c, (judgeResultCard) => { return judgeResultCard.Suit != SuitType.Heart; });
if (result.Suit != SuitType.Heart)
{
var theTrigger = new LeBuSiShuTrigger() { Priority = int.MaxValue };
theTrigger.Owner = p;
Game.CurrentGame.RegisterTrigger(GameEvent.PhaseOutEvents[TurnPhase.Draw], theTrigger);
}
break;
}
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>();
move.Cards.Add(c);
move.To = new DeckPlace(null, DeckType.Discard);
Game.CurrentGame.MoveCards(move);
}
示例6: Install
/// <summary>
/// 给某个玩家穿装备
/// </summary>
/// <param name="p"></param>
/// <param name="card"></param>
public void Install(Player p, Card card, Player installedBy)
{
ParentCard = card;
CardsMovement attachMove = new CardsMovement();
attachMove.Cards = new List<Card>();
attachMove.Cards.Add(card);
attachMove.To = new DeckPlace(p, DeckType.Equipment);
foreach (Card c in Game.CurrentGame.Decks[p, DeckType.Equipment])
{
if (CardCategoryManager.IsCardCategory(c.Type.Category, this.Category))
{
Equipment e = (Equipment)c.Type;
Trace.Assert(e != null);
Game.CurrentGame.EnterAtomicContext();
if (installedBy != null) Game.CurrentGame.PlayerLostCard(installedBy, new List<Card>() { card });
if (installedBy != p) Game.CurrentGame.PlayerAcquiredCard(p, new List<Card>() { card });
c.Log.GameAction = GameAction.PlaceIntoDiscard;
c.Log.Source = p;
Game.CurrentGame.PlaceIntoDiscard(p, new List<Card>() { c });
Game.CurrentGame.MoveCards(attachMove);
Game.CurrentGame.ExitAtomicContext();
return;
}
}
Game.CurrentGame.MoveCards(attachMove);
if (installedBy != null) Game.CurrentGame.PlayerLostCard(installedBy, new List<Card>() { card });
if (installedBy != p) Game.CurrentGame.PlayerAcquiredCard(p, new List<Card>() { card });
return;
}
示例7: Process
public override void Process(Player source, List<Player> dests, ICard card, ReadOnlyCard readonlyCard)
{
DeckType wuguDeck = new DeckType("WuGu");
DeckType wuguFakeDeck = new DeckType("WuGuFake");
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>();
for (int i = 0; i < dests.Count; i++)
{
Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
Card c = Game.CurrentGame.DrawCard();
move.Cards.Add(c);
}
move.To = new DeckPlace(null, wuguDeck);
Game.CurrentGame.MoveCards(move);
fakeMapping = new Dictionary<Card, Card>();
Game.CurrentGame.Decks[null, wuguFakeDeck].Clear();
foreach (var c in Game.CurrentGame.Decks[null, wuguDeck])
{
var faked = new Card(c);
faked.Place = new DeckPlace(null, wuguFakeDeck);
Game.CurrentGame.Decks[null, wuguFakeDeck].Add(faked);
fakeMapping.Add(faked, c);
}
Game.CurrentGame.NotificationProxy.NotifyWuGuStart(new DeckPlace(null, wuguFakeDeck));
base.Process(source, dests, card, readonlyCard);
Game.CurrentGame.NotificationProxy.NotifyWuGuEnd();
Game.CurrentGame.Decks[null, wuguFakeDeck].Clear();
if (Game.CurrentGame.Decks[null, wuguDeck].Count > 0)
{
move = new CardsMovement();
move.Cards = new List<Card>(Game.CurrentGame.Decks[null, wuguDeck]);
move.To = new DeckPlace(null, DeckType.Discard);
Game.CurrentGame.MoveCards(move);
}
}
示例8: Activate
public override void Activate(Player p, Card c)
{
while (true)
{
GameEventArgs args = new GameEventArgs();
args.Source = null;
args.Targets = new List<Player>() { p };
args.Card = c;
args.ReadonlyCard = new ReadOnlyCard(c);
try
{
Game.CurrentGame.Emit(GameEvent.CardUsageBeforeEffected, args);
}
catch (TriggerResultException e)
{
Trace.Assert(e.Status == TriggerResult.End);
break;
}
ReadOnlyCard result = Game.CurrentGame.Judge(p, null, c, (judgeResultCard) => { return judgeResultCard.Suit == SuitType.Spade && judgeResultCard.Rank >= 2 && judgeResultCard.Rank <= 9; });
if (result.Suit == SuitType.Spade && result.Rank >= 2 && result.Rank <= 9)
{
var roc = new ReadOnlyCard(c);
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>();
move.Cards.Add(c);
move.To = new DeckPlace(null, DeckType.Discard);
Game.CurrentGame.MoveCards(move);
Game.CurrentGame.DoDamage(null, p, 3, DamageElement.Lightning, c, roc);
return;
}
break;
}
RecursiveShanDianDriver(p, p, c);
}
示例9: BiFaGiveCardVerifier
public BiFaGiveCardVerifier(Card card)
{
MaxPlayers = 0;
MaxCards = 1;
MinCards = 1;
this.theCard = card;
Helper.OtherDecksUsed.Add(BiFaDeck);
}
示例10: _ResetCard
void _ResetCard(Card card)
{
if (card.Id > 0)
{
card.Type = GameEngine.CardSet[card.Id].Type;
card.Suit = GameEngine.CardSet[card.Id].Suit;
card.Rank = GameEngine.CardSet[card.Id].Rank;
}
}
示例11: Card
public Card(Card c)
{
Suit = c.Suit;
Rank = c.Rank;
Type = c.Type;
RevealOnce = false;
Place = c.Place;
Id = c.Id;
Attributes = c.Attributes;
Log = new UI.ActionLog();
}
示例12: ReplaceJudgementCard
public void ReplaceJudgementCard(Player player, Player judgePlayer, Card card)
{
Game.CurrentGame.EnterAtomicContext();
List<Card> toDiscard = new List<Card>(Game.CurrentGame.Decks[judgePlayer, DeckType.JudgeResult]);
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>() {card};
move.To = new DeckPlace(judgePlayer, DeckType.JudgeResult);
Game.CurrentGame.MoveCards(move);
Game.CurrentGame.PlayerLostCard(player, new List<Card>() {card});
Game.CurrentGame.HandleCardDiscard(judgePlayer, toDiscard, DiscardReason.Judge);
Game.CurrentGame.ExitAtomicContext();
}
示例13: RichTranslate
public static IList<Inline> RichTranslate(Card c, bool useUiCard = true)
{
IList<Inline> list = new List<Inline>();
if (c.Id < 0) return list;
CardViewModel card = new CardViewModel() { Card = c };
string typeString = Application.Current.TryFindResource(string.Format("Card.{0}.Name", useUiCard ? card.TypeString : c.Type.CardType)) as string;
if (typeString != null)
{
list.Add(new Run("【" + typeString) { Foreground = new SolidColorBrush(Colors.Yellow) });
Run run = new Run();
run.Foreground = Application.Current.Resources[string.Format("Card.Suit.{0}.SuitBrush", useUiCard ? card.Suit : c.Suit)] as Brush;
run.Text = string.Format("{0}{1}", Application.Current.Resources[string.Format("Card.Suit.{0}.SuitText", useUiCard ? card.Suit : c.Suit)], card.RankString);
list.Add(run);
list.Add(new Run("】") { Foreground = new SolidColorBrush(Colors.Yellow) });
}
return list;
}
示例14: ReplaceJudgementCard
public void ReplaceJudgementCard(Player player, Player judgePlayer, Card card, ISkill skill)
{
card.Log = new ActionLog();
card.Log.Source = player;
card.Log.SkillAction = skill;
card.Log.GameAction = GameAction.ReplaceJudge;
Game.CurrentGame.EnterAtomicContext();
var judgeDeck = Game.CurrentGame.Decks[judgePlayer, DeckType.JudgeResult];
List<Card> toDiscard = new List<Card>() {judgeDeck.Last()};
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>() {card};
move.To = new DeckPlace(judgePlayer, DeckType.JudgeResult);
Game.CurrentGame.MoveCards(move);
Game.CurrentGame.PlayerLostCard(card.Place.Player, new List<Card>() {card});
Game.CurrentGame.HandleCardDiscard(judgePlayer, toDiscard, DiscardReason.Judge);
Game.CurrentGame.ExitAtomicContext();
}
示例15: Process
public override void Process(GameEventArgs handlerArgs)
{
var source = handlerArgs.Source;
var dests = handlerArgs.Targets;
var readonlyCard = handlerArgs.ReadonlyCard;
var inResponseTo = handlerArgs.InResponseTo;
var card = handlerArgs.Card;
DeckType wuguDeck = new DeckType("WuGu");
DeckType wuguFakeDeck = new DeckType("WuGuFake");
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>();
for (int i = 0; i < dests.Count; i++)
{
Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
Card c = Game.CurrentGame.DrawCard();
move.Cards.Add(c);
}
move.To = new DeckPlace(null, wuguDeck);
Game.CurrentGame.MoveCards(move);
fakeMapping = new Dictionary<Card, Card>();
Game.CurrentGame.Decks[null, wuguFakeDeck].Clear();
foreach (var c in Game.CurrentGame.Decks[null, wuguDeck])
{
var faked = new Card(c);
faked.Place = new DeckPlace(null, wuguFakeDeck);
Game.CurrentGame.Decks[null, wuguFakeDeck].Add(faked);
fakeMapping.Add(faked, c);
}
Game.CurrentGame.NotificationProxy.NotifyWuGuStart(new CardChoicePrompt("WuGuFengDeng.Init"), new DeckPlace(null, wuguFakeDeck));
base.Process(handlerArgs);
Game.CurrentGame.NotificationProxy.NotifyWuGuEnd();
Game.CurrentGame.Decks[null, wuguFakeDeck].Clear();
if (Game.CurrentGame.Decks[null, wuguDeck].Count > 0)
{
move = new CardsMovement();
move.Cards = new List<Card>(Game.CurrentGame.Decks[null, wuguDeck]);
move.To = new DeckPlace(null, DeckType.Discard);
Game.CurrentGame.MoveCards(move);
}
}