本文整理汇总了C#中Sanguosha.Core.Triggers.GameEvent类的典型用法代码示例。如果您正苦于以下问题:C# GameEvent类的具体用法?C# GameEvent怎么用?C# GameEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameEvent类属于Sanguosha.Core.Triggers命名空间,在下文中一共展示了GameEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
var card = Game.CurrentGame.Judge(Owner, this, null, (judgeResultCard) => { return judgeResultCard.SuitColor == SuitColorType.Black; });
if (card.SuitColor == SuitColorType.Black)
{
ISkill skill;
List<Card> cards;
List<Player> players;
int toDraw = Owner.LostHealth;
List<Card> remainingCards = new List<Card>();
CardsMovement move = new CardsMovement();
for (int i = 0; i < toDraw; i++)
{
Game.CurrentGame.SyncImmutableCard(Owner, Game.CurrentGame.PeekCard(0));
Card c = Game.CurrentGame.DrawCard();
move.Cards.Add(c);
remainingCards.Add(c);
}
move.To = new DeckPlace(Owner, DeckType.Hand);
move.Helper.IsFakedMove = true;
Game.CurrentGame.MoveCards(move);
if (!Owner.AskForCardUsage(new CardUsagePrompt("MiJi"), new MiJiVerifier(), out skill, out cards, out players))
{
players = new List<Player>() { Owner };
}
Game.CurrentGame.InsertBeforeDeal(null, remainingCards, new MovementHelper() { IsFakedMove = true });
Game.CurrentGame.DrawCards(players[0], toDraw);
}
}
示例2: 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);
}
示例3: 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);
}
示例4: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
foreach (Card c in eventArgs.Cards)
{
if (c.HistoryPlace1.DeckType == DeckType.Equipment && c.HistoryPlace1.Player == Owner)
{
if (Owner.LostHealth == 0)
{
if (AskForSkillUse())
{
Game.CurrentGame.DrawCards(Owner, 2);
}
}
else
{
int answer;
if (Owner.AskForMultipleChoice(new MultipleChoicePrompt("XiaoJi"), new List<OptionPrompt>() { OptionPrompt.NoChoice, new OptionPrompt("MoPai"), new OptionPrompt("HuiFu") }, out answer))
{
NotifySkillUse(new List<Player>());
if (answer == 1)
{
Game.CurrentGame.DrawCards(Owner, 2);
}
if (answer == 2)
{
Game.CurrentGame.RecoverHealth(Owner, Owner, 1);
}
}
}
}
}
}
示例5: 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 });
}
}
}
示例6: Run
public override void Run(GameEvent gameEvent, GameEventArgs eventArgs)
{
if (eventArgs.Targets[0] != Owner ||
!(eventArgs.ReadonlyCard.Type.IsCardCategory(CardCategory.ImmediateTool) || eventArgs.ReadonlyCard.Type is Sha))
return;
throw new TriggerResultException(TriggerResult.End);
}
示例7: Run
protected void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
var equipDeck = Game.CurrentGame.Decks[eventArgs.Targets[0], DeckType.Equipment];
Card c;
if (equipDeck.Count(s => (s.Type is DefensiveHorse) || (s.Type is OffensiveHorse)) > 1)
{
int answer = 0;
Game.CurrentGame.UiProxies[Owner].AskForMultipleChoice(new MultipleChoicePrompt("QiLinGong", this), new List<String> { Prompt.MultipleChoiceOptionPrefix + "JiaYiZuoJi", Prompt.MultipleChoiceOptionPrefix + "JianYiZuoJi" },
out answer);
if (answer == 1)
{
var results = from equip in equipDeck where equip.Type is OffensiveHorse select equip;
Trace.Assert(results.Count() == 1);
c = results.First();
}
else
{
Trace.Assert(answer == 0);
var results = from equip in equipDeck where equip.Type is DefensiveHorse select equip;
Trace.Assert(results.Count() == 1);
c = results.First();
}
}
else
{
var results = from equip in equipDeck where (equip.Type is DefensiveHorse) || (equip.Type is OffensiveHorse) select equip;
Trace.Assert(results.Count() == 1);
c = results.First();
}
Game.CurrentGame.HandleCardDiscard(eventArgs.Targets[0], new List<Card>() { c });
}
示例8: Run
protected void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
List<Card> cards;
List<Player> players;
ISkill skill;
int halfHC = Game.CurrentGame.Decks[owner, DeckType.Hand].Count / 2;
if (!Game.CurrentGame.UiProxies[owner].AskForCardUsage(new CardUsagePrompt("HaoShi"), new HaoShiVerifier(halfHC), out skill, out cards, out players))
{
cards = new List<Card>();
cards.AddRange(Game.CurrentGame.Decks[owner, DeckType.Hand].GetRange(0, halfHC));
int minHC = int.MaxValue;
Player p = null;
foreach (var pl in Game.CurrentGame.AlivePlayers)
{
int count = Game.CurrentGame.Decks[owner, DeckType.Hand].Count;
if (pl != owner && count < minHC)
{
p = pl;
minHC = count;
}
}
players = new List<Player>() { p };
}
Game.CurrentGame.HandleCardTransferToHand(owner, players[0], cards);
}
示例9: GetTheirCards
void GetTheirCards(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
ISkill skill;
List<Card> cards;
List<Player> players;
if (Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("TuXi2"), new TuXiVerifier(), out skill, out cards, out players))
{
Game.CurrentGame.SortByOrderOfComputation(Game.CurrentGame.CurrentPlayer, players);
NotifySkillUse(players);
var p = players[0];
List<List<Card>> answer;
if (!Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("TuXi"), new List<DeckPlace>() { new DeckPlace(p, DeckType.Hand) },
new List<string>() { "TuXi" }, new List<int>() { 1 }, new RequireOneCardChoiceVerifier(true), out answer))
{
answer = new List<List<Card>>();
answer.Add(Game.CurrentGame.PickDefaultCardsFrom(new List<DeckPlace>() { new DeckPlace(p, DeckType.Hand) }));
}
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>(answer[0]);
move.To = new DeckPlace(Owner, DeckType.Hand);
Game.CurrentGame.MoveCards(move);
Owner[Player.DealAdjustment]--;
}
}
示例10: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
DeckType daXiangDeck = DeckType.Register("DaXiang");
CardsMovement move = new CardsMovement();
move.Cards = new List<Card>();
for (int i = 0; i < 4; i++)
{
Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0));
Card c = Game.CurrentGame.DrawCard();
move.Cards.Add(c);
}
move.To = new DeckPlace(null, daXiangDeck);
Game.CurrentGame.MoveCards(move);
List<List<Card>> answer;
if (Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("ChengXiang", Owner),
new List<DeckPlace>() { new DeckPlace(null, daXiangDeck) },
new List<string>() { "AcquiredCards" },
new List<int>() { 4 },
new DaXiangVerifier(Game.CurrentGame.Decks[null, daXiangDeck]),
out answer,
null,
CardChoiceCallback.GenericCardChoiceCallback))
{
Game.CurrentGame.HandleCardTransferToHand(null, Owner, answer[0]);
}
foreach (var c in Game.CurrentGame.Decks[null, daXiangDeck])
{
c.Log.SkillAction = this;
c.Log.GameAction = GameAction.PlaceIntoDiscard;
}
Game.CurrentGame.PlaceIntoDiscard(null, new List<Card>(Game.CurrentGame.Decks[null, daXiangDeck]));
}
示例11: Run
protected void Run(Player owner, GameEvent gameEvent, GameEventArgs eventArgs, List<Card> cards, List<Player> players)
{
int x = owner.MaxHealth - owner.Health;
int answer = 0;
Game.CurrentGame.UiProxies[owner].AskForMultipleChoice(new MultipleChoicePrompt("YingHun"), new List<string>() { "YingHun1", "YingHun2" }, out answer);
if (answer == 0)
{
Game.CurrentGame.DrawCards(players[0], x);
Game.CurrentGame.ForcePlayerDiscard(players[0],
(p, i) =>
{
return 1 - i;
},
true);
}
else
{
Game.CurrentGame.DrawCards(players[0], 1);
Game.CurrentGame.ForcePlayerDiscard(players[0],
(p, i) =>
{
return x - i;
},
true);
}
}
示例12: Run
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
Owner[FenXinUsed] = 1;
Player target = eventArgs.Targets[0];
Card role1 = Game.CurrentGame.Decks[Owner, RoleGame.RoleDeckType][0];
Card role2 = Game.CurrentGame.Decks[target, RoleGame.RoleDeckType][0];
Game.CurrentGame.SyncCard(target, ref role1);
Game.CurrentGame.SyncCard(Owner, ref role2);
List<CardsMovement> moves = new List<CardsMovement>();
CardsMovement move1 = new CardsMovement();
move1.Cards = new List<Card>() { role1 };
move1.To = new DeckPlace(target, RoleGame.RoleDeckType);
moves.Add(move1);
CardsMovement move2 = new CardsMovement();
move2.Cards = new List<Card>() { role2 };
move2.To = new DeckPlace(Owner, RoleGame.RoleDeckType);
moves.Add(move2);
Game.CurrentGame.MoveCards(moves);
var role = role2.Type as RoleCardHandler;
if (role != null)
{
Owner.Role = role.Role;
}
role = role1.Type as RoleCardHandler;
if (role != null)
{
target.Role = role.Role;
}
GameDelays.Delay(GameDelays.RoleDistribute);
}
示例13: Draw
protected void Draw(Player player, GameEvent gameEvent, GameEventArgs eventArgs, List<Card> cards, List<Player> players)
{
Game.CurrentGame.SortByOrderOfComputation(Game.CurrentGame.CurrentPlayer, players);
StagingDeckType QiaoBianDeck = new StagingDeckType("QiaoBian");
CardsMovement move = new CardsMovement();
move.Helper.IsFakedMove = true;
foreach (Player p in players)
{
if (p.HandCards().Count == 0) continue;
List<List<Card>> answer;
var places = new List<DeckPlace>() { new DeckPlace(p, DeckType.Hand) };
if (!Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("QiaoBian", Owner), places,
new List<string>() { "QiaoBian" }, new List<int>() { 1 }, new RequireOneCardChoiceVerifier(true), out answer))
{
answer = new List<List<Card>>();
answer.Add(Game.CurrentGame.PickDefaultCardsFrom(places));
}
move.Cards = answer[0];
move.To = new DeckPlace(p, QiaoBianDeck);
Game.CurrentGame.MoveCards(move, false, Core.Utils.GameDelayTypes.None);
Game.CurrentGame.PlayerLostCard(p, answer[0]);
}
move.Cards.Clear();
move.Helper.IsFakedMove = false;
move.To = new DeckPlace(Owner, DeckType.Hand);
foreach (Player p in players)
{
move.Cards.AddRange(Game.CurrentGame.Decks[p, QiaoBianDeck]);
}
cards = new List<Card>(move.Cards);
Game.CurrentGame.MoveCards(move);
Game.CurrentGame.PlayerAcquiredCard(Owner, cards);
Game.CurrentGame.NotificationProxy.NotifyActionComplete();
}
示例14: OnPlayerIsCardTarget
public void OnPlayerIsCardTarget(Player owner, GameEvent gameEvent, GameEventArgs eventArgs)
{
if (!(eventArgs.ReadonlyCard.Type is Sha) || Game.CurrentGame.AlivePlayers.Count <= 2 && eventArgs.Source != owner)
{
return;
}
ISkill skill;
List<Card> cards;
List<Player> players;
if (Game.CurrentGame.UiProxies[owner].AskForCardUsage(new CardUsagePrompt("LiuLi"), new LiuLiVerifier(eventArgs.Source), out skill, out cards, out players))
{
NotifySkillUse(players);
Game.CurrentGame.HandleCardDiscard(owner, cards);
int index = eventArgs.Targets.IndexOf(owner);
eventArgs.Targets.Remove(owner);
GameEventArgs newArgs = new GameEventArgs();
newArgs.Source = eventArgs.Source;
newArgs.UiTargets = players;
newArgs.Targets = players;
newArgs.Card = eventArgs.Card;
newArgs.ReadonlyCard = eventArgs.ReadonlyCard;
newArgs.InResponseTo = eventArgs.InResponseTo;
Game.CurrentGame.Emit(GameEvent.CardUsageTargetConfirming, newArgs);
eventArgs.Targets.Insert(index, newArgs.Targets[0]);
}
}
示例15: 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);
}
}
}