本文整理汇总了C#中Sanguosha.Core.Players.Player.AskForCardChoice方法的典型用法代码示例。如果您正苦于以下问题:C# Player.AskForCardChoice方法的具体用法?C# Player.AskForCardChoice怎么用?C# Player.AskForCardChoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sanguosha.Core.Players.Player
的用法示例。
在下文中一共展示了Player.AskForCardChoice方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
void Run(Player owner, GameEvent gameEvent, GameEventArgs args)
{
while (owner.HandCards().Count > 0 && owner.DelayedTools().Count > 0)
{
List<List<Card>> answer;
List<DeckPlace> sourceDeck = new List<DeckPlace>();
sourceDeck.Add(new DeckPlace(owner, DeckType.DelayedTools));
sourceDeck.Add(new DeckPlace(owner, DeckType.Hand));
AdditionalCardChoiceOptions options = new AdditionalCardChoiceOptions();
options.IsCancellable = true;
if (owner.AskForCardChoice(new CardChoicePrompt("XiuLuo", owner),
sourceDeck,
new List<string>() { "XLJinNang", "XLShouPai" },
new List<int>() { 1, 1 },
new XiuLuoVerifier(),
out answer,
options))
{
NotifySkillUse();
Game.CurrentGame.HandleCardDiscard(owner, answer[1]);
Game.CurrentGame.HandleCardDiscard(owner, answer[0]);
}
else break;
}
}
示例2: Process
protected override void Process(Player source, Player dest, ICard card, ReadOnlyCard readonlyCard, GameEventArgs inResponseTo)
{
if (source.IsDead) return;
if (dest.HandCards().Count + dest.Equipments().Count == 0) return; // ShunChai -> WuXie(from target) -> WuXie(soemone else) -> target has no card
List<string> resultDeckPlace = new List<string>();
resultDeckPlace.Add("GuoHeChaiQiao");
List<int> resultDeckMax = new List<int>();
resultDeckMax.Add(1);
List<List<Card>> answer;
bool doHandCard = true;
if (dest.Equipments().Count != 0)
{
int result = 0;
source.AskForMultipleChoice(new MultipleChoicePrompt("GuoHeChaiQiao2"), new List<OptionPrompt>() { new OptionPrompt("ShouPai"), new OptionPrompt("ZhuangBeiPai") }, out result);
if (result == 1) doHandCard = false;
}
if (doHandCard)
{
Game.CurrentGame.SyncImmutableCards(source, Game.CurrentGame.Decks[dest, DeckType.Hand]);
Game.CurrentGame.HandCardVisibility[source].Add(dest);
var places = new List<DeckPlace>() { new DeckPlace(dest, DeckType.Hand) };
if (!source.AskForCardChoice(new CardChoicePrompt("GuoHeChaiQiao2"), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(true), out answer))
{
Trace.TraceInformation("Player {0} Invalid answer", source.Id);
answer = new List<List<Card>>();
answer.Add(Game.CurrentGame.PickDefaultCardsFrom(places));
}
foreach (Card c in dest.HandCards()) Game.CurrentGame.HideHandCard(c);
Game.CurrentGame.HandCardVisibility[source].Remove(dest);
Game.CurrentGame.HandleCardDiscard(dest, answer[0]);
}
else
{
var places = new List<DeckPlace>() { new DeckPlace(dest, DeckType.Equipment) };
if (!source.AskForCardChoice(new CardChoicePrompt("GuoHeChaiQiao2"), places, resultDeckPlace, resultDeckMax, new RequireOneCardChoiceVerifier(true), out answer))
{
Trace.TraceInformation("Player {0} Invalid answer", source.Id);
answer = new List<List<Card>>();
answer.Add(Game.CurrentGame.PickDefaultCardsFrom(places));
}
Game.CurrentGame.HandleCardDiscard(dest, answer[0]);
}
}
示例3: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
Owner[FenYong.FenYongStatus] = 0;
int answer = 0;
Player current = Game.CurrentGame.CurrentPlayer;
int choiceCount = Owner.LostHealth;
int currentPlayerCardsCount = current.HandCards().Count + current.Equipments().Count();
List<OptionPrompt> prompts = new List<OptionPrompt>();
prompts.Add(new OptionPrompt("XueHenQiPai", current, choiceCount));
prompts.Add(new OptionPrompt("XueHenSha"));
Owner.AskForMultipleChoice(new MultipleChoicePrompt("XueHen"), prompts, out answer);
if (answer == 0)
{
Owner[XueHenEffect] = 0;
NotifySkillUse();
if (currentPlayerCardsCount <= choiceCount)
{
List<Card> cards = new List<Card>();
cards.AddRange(current.HandCards());
cards.AddRange(current.Equipments());
Game.CurrentGame.HandleCardDiscard(current, cards);
return;
}
List<List<Card>> choiceAnswer;
List<DeckPlace> sourcePlace = new List<DeckPlace>();
sourcePlace.Add(new DeckPlace(current, DeckType.Hand));
sourcePlace.Add(new DeckPlace(current, DeckType.Equipment));
if (!Owner.AskForCardChoice(new CardChoicePrompt("XueHen", current, Owner),
sourcePlace,
new List<string>() { "QiPaiDui" },
new List<int>() { choiceCount },
new RequireCardsChoiceVerifier(choiceCount),
out choiceAnswer,
null,
CardChoiceCallback.GenericCardChoiceCallback))
{
choiceAnswer = new List<List<Card>>();
choiceAnswer.Add(Game.CurrentGame.PickDefaultCardsFrom(new List<DeckPlace>() { new DeckPlace(current, DeckType.Hand), new DeckPlace(current, DeckType.Equipment) }, choiceCount));
}
Game.CurrentGame.HandleCardDiscard(current, choiceAnswer[0]);
}
else
{
ISkill skill;
List<Card> cards;
List<Player> players;
if (!Owner.AskForCardUsage(new CardUsagePrompt("XueHen"), new XueHenShaVerifier(), out skill, out cards, out players))
{
players = new List<Player>();
List<Player> nPlayers = Game.CurrentGame.AlivePlayers;
players.Add(nPlayers[0]);
}
Owner[XueHenEffect] = 1;
NotifySkillUse(players);
GameEventArgs args = new GameEventArgs();
Owner[Sha.NumberOfShaUsed]--;
args.Source = Owner;
args.Targets = players;
args.Skill = new CardWrapper(Owner, new RegularSha());
Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
}
}
示例4: SelectACardFrom
public Card SelectACardFrom(Player from, Player ask, Prompt prompt, String resultdeckname, bool equipExcluded = false, bool delayedToolsExcluded = true, bool noReveal = false)
{
var deck = from.HandCards();
if (!equipExcluded) deck = new List<Card>(deck.Concat(from.Equipments()));
if (!delayedToolsExcluded) deck = new List<Card>(deck.Concat(from.DelayedTools()));
if (deck.Count == 0) return null;
List<DeckPlace> places = new List<DeckPlace>();
places.Add(new DeckPlace(from, DeckType.Hand));
if (!equipExcluded) places.Add(new DeckPlace(from, DeckType.Equipment));
if (!delayedToolsExcluded) places.Add(new DeckPlace(from, DeckType.DelayedTools));
List<List<Card>> answer;
if (!ask.AskForCardChoice(prompt, places, new List<string>() { resultdeckname }, new List<int>() { 1 }, new RequireOneCardChoiceVerifier(noReveal), out answer))
{
Trace.TraceInformation("Player {0} Invalid answer", ask);
answer = new List<List<Card>>();
answer.Add(new List<Card>());
answer[0].Add(deck.First());
}
Card theCard = answer[0][0];
if (noReveal)
{
SyncCard(from, ref theCard);
}
else
{
SyncCardAll(ref theCard);
}
Trace.Assert(answer.Count == 1 && answer[0].Count == 1);
return theCard;
}
示例5: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs, List<Card> cards, List<Player> players)
{
NotifySkillUse(players);
Game.CurrentGame.DrawCards(players[0], 2);
ISkill skill;
List<Card> nCard;
List<Player> nPlayer;
while (true)
{
if (players.Count == 2 && !players[1].IsDead && players[0].AskForCardUsage(new CardUsagePrompt("XuanHuoSha", players[1]), new JieDaoShaRen.JieDaoShaRenVerifier(players[1]), out skill, out nCard, out nPlayer))
{
try
{
players[0][Sha.NumberOfShaUsed]--;
GameEventArgs args = new GameEventArgs();
args.Source = players[0];
args.Targets = nPlayer;
args.Targets.Add(players[1]);
args.Skill = skill;
args.Cards = nCard;
Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
}
catch (TriggerResultException e)
{
Trace.Assert(e.Status == TriggerResult.Retry);
continue;
}
}
else
{
int cardCount = players[0].HandCards().Count + players[0].Equipments().Count;
if (cardCount == 0) break;
List<Card> toGet = new List<Card>();
if (cardCount <= 2)
{
toGet.AddRange(players[0].HandCards());
toGet.AddRange(players[0].Equipments());
}
else
{
List<List<Card>> answer;
List<DeckPlace> sourcePlace = new List<DeckPlace>();
sourcePlace.Add(new DeckPlace(players[0], DeckType.Hand));
sourcePlace.Add(new DeckPlace(players[0], DeckType.Equipment));
if (!Owner.AskForCardChoice(new CardChoicePrompt("XuanHuo", players[0], Owner),
sourcePlace,
new List<string>() { "HuoDe" },
new List<int>() { 2 },
new RequireCardsChoiceVerifier(2, true),
out answer,
null,
CardChoiceCallback.GenericCardChoiceCallback))
{
answer = new List<List<Card>>();
answer.Add(Game.CurrentGame.PickDefaultCardsFrom(sourcePlace, 2));
}
Game.CurrentGame.SyncImmutableCards(Owner, answer[0]);
toGet = answer[0];
}
Game.CurrentGame.HandleCardTransferToHand(players[0], Owner, toGet);
}
break;
}
Game.CurrentGame.CurrentPhaseEventIndex++;
throw new TriggerResultException(TriggerResult.End);
}
示例6: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
ISkill skill;
List<Card> cards;
List<Player> players;
if (Owner.AskForCardUsage(new CardUsagePrompt("JunWei"), new JunWeiVerifier(), out skill, out cards, out players))
{
NotifySkillUse(players);
Game.CurrentGame.HandleCardDiscard(Owner, cards);
Player target = players[0];
if (target.AskForCardUsage(new CardUsagePrompt("JunWeiShowCard"), new JunWeiShowCardVerifier(), out skill, out cards, out players))
{
Card temp = cards[0];
Game.CurrentGame.NotificationProxy.NotifyShowCard(target, temp);
if (!Owner.AskForCardUsage(new CardUsagePrompt("JunWeiGiveShan"), new JunWeiGiveShanVerifier(), out skill, out cards, out players))
{
players = new List<Player>() { Owner };
}
Game.CurrentGame.SyncCardAll(ref temp);
Game.CurrentGame.HandleCardTransferToHand(target, players[0], new List<Card>() { temp });
}
else
{
Game.CurrentGame.LoseHealth(target, 1);
if (target.Equipments().Count == 0) return;
GameDelays.Delay(GameDelayTypes.JunWei);
List<List<Card>> answer;
List<DeckPlace> sourceDecks = new List<DeckPlace>();
sourceDecks.Add(new DeckPlace(target, DeckType.Equipment));
if (!Owner.AskForCardChoice(new CardChoicePrompt("JunWeiChoice", target, Owner),
sourceDecks,
new List<string>() { "JunWei" },
new List<int>() { 1 },
new RequireOneCardChoiceVerifier(),
out answer))
{
answer = new List<List<Card>>();
answer.Add(new List<Card>());
answer[0].Add(target.Equipments().First());
}
junweiTarget.Add(target);
Game.CurrentGame.HandleCardTransfer(target, target, JunWeiDeck, answer[0]);
}
}
}
示例7: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
Owner[FenYong.FenYongStatus] = 0;
int answer = 0;
Player current = Game.CurrentGame.CurrentPlayer;
int choiceCount = Owner.LostHealth;
int currentPlayerCardsCount = current.HandCards().Count + current.Equipments().Count();
List<Player> shaCheck = Game.CurrentGame.AlivePlayers;
shaCheck.Remove(Owner);
bool canUseSha = Game.CurrentGame.PlayerCanBeTargeted(Owner, shaCheck, new Card() { Place = new DeckPlace(Owner, DeckType.None), Type = new Sha() });
if (canUseSha)
{
List<OptionPrompt> prompts = new List<OptionPrompt>();
prompts.Add(new OptionPrompt("XueHenQiPai", current, choiceCount));
prompts.Add(new OptionPrompt("XueHenSha"));
Owner.AskForMultipleChoice(new MultipleChoicePrompt("XueHen"), prompts, out answer);
}
if (answer == 0)
{
XueHenEffect = 0;
NotifySkillUse();
if (currentPlayerCardsCount == 0) return;
List<Card> toDiscard = new List<Card>();
if (currentPlayerCardsCount <= choiceCount)
{
toDiscard.AddRange(current.HandCards());
toDiscard.AddRange(current.Equipments());
}
else
{
List<List<Card>> choiceAnswer;
List<DeckPlace> sourcePlace = new List<DeckPlace>();
sourcePlace.Add(new DeckPlace(current, DeckType.Hand));
sourcePlace.Add(new DeckPlace(current, DeckType.Equipment));
if (!Owner.AskForCardChoice(new CardChoicePrompt("XueHen", current, Owner),
sourcePlace,
new List<string>() { "QiPaiDui" },
new List<int>() { choiceCount },
new RequireCardsChoiceVerifier(choiceCount),
out choiceAnswer,
null,
CardChoiceCallback.GenericCardChoiceCallback))
{
choiceAnswer = new List<List<Card>>();
choiceAnswer.Add(Game.CurrentGame.PickDefaultCardsFrom(new List<DeckPlace>() { new DeckPlace(current, DeckType.Hand), new DeckPlace(current, DeckType.Equipment) }, choiceCount));
}
toDiscard = choiceAnswer[0];
}
Game.CurrentGame.HandleCardDiscard(current, toDiscard);
}
else
{
XueHenEffect = 1;
NotifySkillUse();
Owner[Sha.NumberOfShaUsed]--;
Sha.UseDummyShaTo(Owner, null, new RegularSha(), new CardUsagePrompt("XueHen"), XueHenSha);
}
}
示例8: Run
protected void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
HealthChangedEventArgs arg = eventArgs as HealthChangedEventArgs;
if (arg.Delta > 0)
{
if (Game.CurrentGame.Decks[Owner, bq].Count <= arg.Delta)
{
Game.CurrentGame.HandleCardDiscard(Owner, Game.CurrentGame.Decks[Owner, bq]);
return;
}
else
{
List<List<Card>> answer;
List<DeckPlace> sourceDecks = new List<DeckPlace>() { new DeckPlace(Owner, bq) };
if (!Owner.AskForCardChoice(new CardChoicePrompt("BuQu", Owner),
sourceDecks,
new List<string>() { "QiPaiDui" },
new List<int>() { 1 },
new RequireCardsChoiceVerifier(arg.Delta),
out answer,
null,
CardChoiceCallback.GenericCardChoiceCallback))
{
answer = new List<List<Card>>();
answer.Add(Game.CurrentGame.PickDefaultCardsFrom(sourceDecks, arg.Delta));
}
Game.CurrentGame.HandleCardDiscard(Owner, answer[0]);
}
if (!_useBuQu) return;
List<int> check = new List<int>();
foreach (var c in Game.CurrentGame.Decks[Owner, bq])
{
if (!check.Contains(c.Rank)) check.Add(c.Rank);
}
if (check.Count == Game.CurrentGame.Decks[Owner, bq].Count && Game.CurrentGame.DyingPlayers.Contains(Owner))
{
Owner[Player.SkipDeathComputation] = 1;
}
return;
}
if (!AskForSkillUse()) { Owner[Player.SkipDeathComputation] = 0; _useBuQu = false; return; }
_useBuQu = true;
if (1 - Owner.Health > Game.CurrentGame.Decks[Owner, bq].Count)
{
int toDraw = 1 - Owner.Health - Game.CurrentGame.Decks[Owner, bq].Count;
CardsMovement move = new CardsMovement();
move.To = new DeckPlace(Owner, bq);
move.Helper.PrivateDeckHeroTag = HeroTag;
while (toDraw-- > 0)
{
Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
Card c1 = Game.CurrentGame.DrawCard();
move.Cards.Add(c1);
}
Game.CurrentGame.MoveCards(move);
}
if (Owner.Health <= 0)
{
Dictionary<int, bool> death = new Dictionary<int, bool>();
foreach (Card c in Game.CurrentGame.Decks[Owner, bq])
{
if (death.ContainsKey(c.Rank))
{
return;
}
death.Add(c.Rank, true);
}
Owner[Player.SkipDeathComputation] = 1;
NotifySkillUse();
}
}