本文整理汇总了C#中Sanguosha.Core.Players.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于Sanguosha.Core.Players命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Move
protected void Move(Player player, GameEvent gameEvent, GameEventArgs eventArgs, List<Card> cards, List<Player> players)
{
Game.CurrentGame.HandleCardDiscard(player, cards);
Player source = players[0];
Player dest = players[1];
List<DeckPlace> places = new List<DeckPlace>();
places.Add(new DeckPlace(source, DeckType.Equipment));
places.Add(new DeckPlace(source, DeckType.DelayedTools));
places.Add(new DeckPlace(dest, DeckType.Equipment));
places.Add(new DeckPlace(dest, DeckType.DelayedTools));
List<string> resultDeckPlace = new List<string>();
resultDeckPlace.Add("QiaoBian");
List<int> resultDeckMax = new List<int>();
resultDeckMax.Add(1);
List<List<Card>> answer;
if (Game.CurrentGame.UiProxies[player].AskForCardChoice(new CardChoicePrompt("QiaoBian"), places, resultDeckPlace, resultDeckMax, new QiaoBianMoveVerifier(source, dest), out answer))
{
Card theCard = answer[0][0];
DeckType targetDeck = theCard.Place.DeckType;
if (theCard.Place.Player == source)
{
Game.CurrentGame.HandleCardTransfer(source, dest, targetDeck, new List<Card>() { theCard });
}
else
{
Game.CurrentGame.HandleCardTransfer(dest, source, targetDeck, new List<Card>() { theCard });
}
}
Game.CurrentGame.CurrentPhase++;
Game.CurrentGame.CurrentPhaseEventIndex = 2;
throw new TriggerResultException(TriggerResult.End);
}
示例2: OnAfterDamageInflicted
public void OnAfterDamageInflicted(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
NotifySkillUse(new List<Player>() { eventArgs.Source });
List<DeckPlace> deck = new List<DeckPlace>();
deck.Add(new DeckPlace(eventArgs.Source, DeckType.Hand));
deck.Add(new DeckPlace(eventArgs.Source, DeckType.Equipment));
List<int> max = new List<int>() { 1 };
List<List<Card>> result;
List<string> deckname = new List<string>() {"FanKui choice"};
Card theCard;
int windowId = 0;
if (!Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("FanKui", eventArgs.Source), deck, deckname, max, new RequireOneCardChoiceVerifier(), out result, new List<bool>() { false }, ref windowId))
{
Trace.TraceInformation("Invalid choice for FanKui");
theCard = Game.CurrentGame.Decks[eventArgs.Source, DeckType.Hand]
.Concat(Game.CurrentGame.Decks[eventArgs.Source, DeckType.Equipment]).First();
}
else
{
theCard = result[0][0];
}
List<Card> cards = new List<Card>();
cards.Add(theCard);
Game.CurrentGame.HandleCardTransferToHand(eventArgs.Source, owner, cards);
}
示例3: CardRevealPolicy
public override void CardRevealPolicy(Player p, List<Card> cards, List<Player> players)
{
foreach (Card c in cards)
{
c.RevealOnce = true;
}
}
示例4: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
ISkill skill;
List<Card> cards;
List<Player> players;
List<Card> originalCards = new List<Card>(Game.CurrentGame.Decks[Owner, QiXing.QiXingDeck]);
int qxCount = Game.CurrentGame.Decks[Owner, QiXing.QiXingDeck].Count;
// hack the cards to owner's hand. do not trigger anything
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>(Game.CurrentGame.Decks[Owner, QiXing.QiXingDeck]);
move.To = new DeckPlace(Owner, DeckType.Hand);
move.Helper.IsFakedMove = true;
Game.CurrentGame.MoveCards(move);
if (Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("DaWu"), new DaWuVerifier(originalCards), out skill, out cards, out players))
{
NotifySkillUse(players);
foreach (var mark in players)
{
mark[DaWuMark] = 1;
}
dawuTargets = players;
foreach (Card cc in cards) originalCards.Remove(cc);
Game.CurrentGame.HandleCardDiscard(null, cards);
}
move.Cards = new List<Card>(originalCards);
move.To = new DeckPlace(Owner, QiXing.QiXingDeck);
Game.CurrentGame.MoveCards(move);
}
示例5: 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;
}
示例6: FastVerify
public override VerifierResult FastVerify(Player source, ISkill skill, List<Card> cards, List<Player> players)
{
if (skill != null || (cards != null && cards.Count != 0))
{
return VerifierResult.Fail;
}
if (players == null || players.Count == 0)
{
return VerifierResult.Partial;
}
foreach (Player p in players)
{
if (p == source)
{
return VerifierResult.Fail;
}
if (Game.CurrentGame.Decks[p, DeckType.Hand].Count == 0)
{
return VerifierResult.Fail;
}
}
if (players.Count > 2)
{
return VerifierResult.Fail;
}
return VerifierResult.Success;
}
示例7: 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);
}
示例8: Process
public override void Process(Player source, List<Player> dests, ICard card, ReadOnlyCard cardr)
{
Trace.Assert(dests == null || dests.Count == 0);
Trace.Assert(card is Card);
Card c = (Card)card;
Install(source, c);
}
示例9: Verify
protected override VerifierResult Verify(Player source, ICard card, List<Player> targets)
{
if (Game.CurrentGame.IsDying.Count == 0 && targets != null && targets.Count >= 1)
{
return VerifierResult.Fail;
}
if (Game.CurrentGame.IsDying.Count > 0 && (targets == null || targets.Count != 1))
{
return VerifierResult.Fail;
}
Player p;
if (Game.CurrentGame.IsDying.Count == 0)
{
p = source;
}
else
{
p = targets[0];
}
if (p.Health >= p.MaxHealth)
{
return VerifierResult.Fail;
}
return VerifierResult.Success;
}
示例10: WeiDi
public WeiDi()
{
var trigger = new AutoNotifyPassiveSkillTrigger(
this,
(p, e, a) => { return a.Source == ruler; },
(p, e, a) =>
{
bool nothingChanged = true;
foreach (var sk in a.Source.ActionableSkills)
{
if (sk.IsRulerOnly)
{
if (!theSkills.ContainsKey(sk))
nothingChanged = false;
}
}
foreach (var sk in theSkills)
{
if (!a.Source.ActionableSkills.Contains(sk.Key))
nothingChanged = false;
}
if (!nothingChanged)
{
UninstallSkills();
InstallSkills(p);
}
},
TriggerCondition.Global
) { AskForConfirmation = false, IsAutoNotify = false };
Triggers.Add(GameEvent.PlayerSkillSetChanged, trigger);
IsEnforced = true;
ruler = null;
theSkills = new Dictionary<ISkill, ISkill>();
}
示例11: canTrigger
bool canTrigger(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
if (gameEvent == GameEvent.CardsLost)
{
foreach (Card card in eventArgs.Cards)
{
if (card.HistoryPlace1.Player == Owner && card.HistoryPlace1.DeckType == DeckType.Equipment)
{
return true;
}
}
return false;
}
else if (gameEvent == GameEvent.CardsEnteredDiscardDeck)
{
if (!(Game.CurrentGame.PhasesOwner == Owner && Game.CurrentGame.CurrentPhase == TurnPhase.Discard && Owner[XuanFengUsed] == 0))
{
return false;
}
if (eventArgs.Cards != null)
{
Owner[XuanFengUsable] += eventArgs.Cards.Count;
}
return Owner[XuanFengUsable] >= 2;
}
return true;
}
示例12: Verify
protected override VerifierResult Verify(Player source, ICard card, List<Player> targets)
{
if (Game.CurrentGame.IsDying.Count == 0 && targets != null && targets.Count >= 1)
{
return VerifierResult.Fail;
}
if (Game.CurrentGame.IsDying.Count > 0 && (targets == null || targets.Count != 1))
{
return VerifierResult.Fail;
}
if (Game.CurrentGame.IsDying.Count == 0)
{
if (source[JiuUsed] == 1)
{
return VerifierResult.Fail;
}
}
else
{
if (targets[0] != source)
{
return VerifierResult.Fail;
}
}
return VerifierResult.Success;
}
示例13: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
var args = eventArgs as DiscardCardEventArgs;
if (args.Source == null || args.Source == Owner || args.Reason != DiscardReason.Use)
{
return;
}
List<Card> cardsToProcess = new List<Card>(eventArgs.Cards);
foreach (Card c in cardsToProcess)
{
if (c.Type is NanManRuQin)
{
ActionLog log = new ActionLog();
log.GameAction = GameAction.None;
log.SkillAction = this;
log.Source = Owner;
log.CardAction = c;
Game.CurrentGame.NotificationProxy.NotifySkillUse(log);
List<Card> cc = new List<Card>();
cc.Add(c);
Game.CurrentGame.HandleCardTransferToHand(null, Owner, cc);
eventArgs.Cards.Remove(c);
}
}
}
示例14: TianMingProcess
bool TianMingProcess(Player player)
{
int discardedCount = Math.Min(player.HandCards().Count + player.Equipments().Count, 2);
ISkill skill;
List<Card> cards;
List<Player> players;
CardUsagePrompt prompt = new CardUsagePrompt("TianMing");
CardUsagePrompt otherPrompt = new CardUsagePrompt("TianMingOther", discardedCount);
CardUsagePrompt otherIsNakedPrompt = new CardUsagePrompt("TianMingOtherIsNaked");
if (player.AskForCardUsage(player == Owner ? prompt : (discardedCount == 0 ? otherIsNakedPrompt : otherPrompt), new TianMingVerifier(discardedCount), out skill, out cards, out players))
{
if (player == Owner)
{
TianMingEffect = 0;
}
else if (player.IsMale)
{
TianMingEffect = 1;
}
else
{
TianMingEffect = 2;
}
NotifySkillUse();
if (cards.Count > 0)
{
Game.CurrentGame.HandleCardDiscard(player, cards);
}
Game.CurrentGame.DrawCards(player, 2);
return true;
}
return false;
}
示例15: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
int answer = 0;
List<OptionPrompt> JiLeiQuestion = new List<OptionPrompt>();
JiLeiQuestion.Add(new OptionPrompt("JiBen"));
JiLeiQuestion.Add(new OptionPrompt("JinNang"));
JiLeiQuestion.Add(new OptionPrompt("ZhuangBei"));
JiLeiQuestion.Add(Prompt.NoChoice);
if (Game.CurrentGame.UiProxies[Owner].AskForMultipleChoice(
new MultipleChoicePrompt("JiLei", eventArgs.Source), JiLeiQuestion, out answer))
{
Trace.Assert(answer >= 0 && answer <= 3);
if (answer != 3)
{
NotifySkillUse(new List<Player>());
eventArgs.Source[JiLeiInEffect] = 1;
JiLeiImplementation trigger = new JiLeiImplementation(eventArgs.Source, answer);
Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanDiscardCard, trigger);
Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanUseCard, trigger);
Game.CurrentGame.RegisterTrigger(GameEvent.PlayerCanPlayCard, trigger);
JiLeiRemoval trigger2 = new JiLeiRemoval(eventArgs.Source, trigger);
Game.CurrentGame.RegisterTrigger(GameEvent.PhaseEndEvents[TurnPhase.End], trigger2);
Game.CurrentGame.NotificationProxy.NotifyLogEvent(new LogEvent("JiLei", eventArgs.Source, JiLeiQuestion[answer]), new List<Player>() { Owner, eventArgs.Source });
}
}
}