void AfterDraw(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs) { ISkill skill; List <Card> cards; List <Player> players; int qxCount = Game.CurrentGame.Decks[Owner, 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, QiXingDeck]); move.To = new DeckPlace(Owner, DeckType.Hand); move.Helper.IsFakedMove = true; move.Helper.PrivateDeckHeroTag = HeroTag; Game.CurrentGame.MoveCards(move); if (!Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("QiXing", qxCount), new QiXingVerifier(qxCount), out skill, out cards, out players)) { cards = new List <Card>(); cards.AddRange(Game.CurrentGame.Decks[Owner, DeckType.Hand].GetRange(0, qxCount)); } move.Cards = new List <Card>(cards); move.To = new DeckPlace(Owner, QiXingDeck); move.Helper.IsFakedMove = true; move.Helper.PrivateDeckHeroTag = HeroTag; Game.CurrentGame.MoveCards(move); }
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(); }
public void HandleCardTransfer(Player from, Player to, DeckType target, List <Card> cards, Hero tag = null) { cards = new List <Card>(cards); if (to.IsDead) { if (cards.Any(cd => cd.Place.DeckType != DeckType.Hand && cd.Place.DeckType != DeckType.Equipment && cd.Place.DeckType != DeckType.DelayedTools)) { CardsMovement move1 = new CardsMovement(); move1.Cards = new List <Card>(cards); move1.To = new DeckPlace(null, DeckType.Discard); MoveCards(move1); PlayerLostCard(from, cards); } return; } CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(cards); move.To = new DeckPlace(to, target); move.Helper = new MovementHelper(); move.Helper.PrivateDeckHeroTag = tag; MoveCards(move); bool triggerAcquiredCard = target == DeckType.Hand || target == DeckType.Equipment; EnterAtomicContext(); PlayerLostCard(from, cards); if (triggerAcquiredCard) { PlayerAcquiredCard(to, cards); } ExitAtomicContext(); }
public void HandleCardTransferToHand(Player from, Player to, List <Card> cards, MovementHelper helper = null) { cards = new List <Card>(cards); if (to.IsDead) { if (cards.Any(cd => cd.Place.DeckType != DeckType.Hand && cd.Place.DeckType != DeckType.Equipment && cd.Place.DeckType != DeckType.DelayedTools)) { CardsMovement move1 = new CardsMovement(); move1.Cards = new List <Card>(cards); move1.To = new DeckPlace(null, DeckType.Discard); MoveCards(move1); PlayerLostCard(from, cards); } return; } CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(cards); move.To = new DeckPlace(to, DeckType.Hand); if (helper != null) { move.Helper = helper; } MoveCards(move); EnterAtomicContext(); PlayerLostCard(from, cards); PlayerAcquiredCard(to, cards); ExitAtomicContext(); }
public override void Run(GameEvent gameEvent, GameEventArgs eventArgs) { var card = eventArgs.Card; if (!(card.Type is WuGuFengDeng)) { return; } var wugu = card.Type as WuGuFengDeng; var dests = eventArgs.Targets; DeckType wuguDeck = DeckType.Register("WuGu"); DeckType wuguFakeDeck = DeckType.Register("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, false, Core.Utils.GameDelays.None); wugu.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); wugu.FakeMapping.Add(faked, c); } Game.CurrentGame.NotificationProxy.NotifyWuGuStart(new CardChoicePrompt("WuGuFengDeng.Init"), new DeckPlace(null, wuguFakeDeck)); }
public void OnJudgeBegin(Player player, GameEvent gameEvent, GameEventArgs eventArgs) { if (player.HandCards().Count == 0 && !player.Equipments().Any(card => card.SuitColor == SuitColorType.Black)) { return; } ISkill skill; List <Card> cards; List <Player> players; Card c = Game.CurrentGame.Decks[eventArgs.Source, DeckType.JudgeResult].Last(); if (Game.CurrentGame.UiProxies[player].AskForCardUsage(new CardUsagePrompt("GuiDao", eventArgs.Source, c.Suit, c.Rank), new GuiDaoVerifier(), out skill, out cards, out players)) { NotifySkillUse(); Card theCard = cards[0]; theCard.Log = new ActionLog(); theCard.Log.Source = player; theCard.Log.SkillAction = this; theCard.Log.GameAction = GameAction.ReplaceJudge; Game.CurrentGame.EnterAtomicContext(); List <Card> toDiscard = new List <Card>() { Game.CurrentGame.Decks[eventArgs.Source, DeckType.JudgeResult].Last() }; CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(); move.Cards.AddRange(cards); move.To = new DeckPlace(eventArgs.Source, DeckType.JudgeResult); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerLostCard(player, cards); Game.CurrentGame.HandleCardTransferToHand(null, player, toDiscard); Game.CurrentGame.ExitAtomicContext(); } }
protected void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs) { Game.CurrentGame.SyncImmutableCard(Owner, Game.CurrentGame.PeekCard(0)); Card c1 = Game.CurrentGame.DrawCard(); bool toDiscard = Game.CurrentGame.Decks[Owner, bq].Any(cd => cd.Rank == c1.Rank); CardsMovement move = new CardsMovement(); move.Cards = new List <Card>() { c1 }; move.To = new DeckPlace(Owner, bq); Game.CurrentGame.MoveCards(move); if (toDiscard) { Game.CurrentGame.PlaceIntoDiscard(Owner, new List <Card>() { c1 }); } else { Game.CurrentGame.RecoverHealth(Owner, Owner, 1); } }
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs) { DeckType HuoShouDeck = DeckType.Register("HuoShou"); CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(); int toDraw = Owner.LostHealth; for (int i = 0; i < toDraw; i++) { Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0)); Card c = Game.CurrentGame.DrawCard(); move.Cards.Add(c); } move.To = new DeckPlace(null, HuoShouDeck); Game.CurrentGame.MoveCards(move); List <Card> toDiscard = new List <Card>(); foreach (var c in move.Cards) { if (c.Suit == SuitType.Heart) { toDiscard.Add(c); Game.CurrentGame.RecoverHealth(Owner, Owner, 1); } } Game.CurrentGame.HandleCardDiscard(null, toDiscard); Game.CurrentGame.HandleCardTransferToHand(null, Owner, Game.CurrentGame.Decks[null, HuoShouDeck]); Game.CurrentGame.CurrentPhaseEventIndex++; throw new TriggerResultException(TriggerResult.End); }
public void HandleCardDiscard(Player p, List <Card> cards, DiscardReason reason = DiscardReason.Discard) { cards = new List <Card>(cards); CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(cards); foreach (Card c in cards) { c.Log.Source = p; if (reason == DiscardReason.Discard) { c.Log.GameAction = GameAction.Discard; } else if (reason == DiscardReason.Play) { c.Log.GameAction = GameAction.Play; } else if (reason == DiscardReason.Use) { c.Log.GameAction = GameAction.Use; } } List <Card> backup = new List <Card>(move.Cards); move.To = new DeckPlace(null, DeckType.Discard); PlayerAboutToDiscardCard(p, move.Cards, reason); MoveCards(move, false, GameDelays.Discard); if (p != null) { PlayerLostCard(p, move.Cards); PlayerDiscardedCard(p, backup, reason); } }
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs) { DeckType shelieDeck = DeckType.Register("SheLie"); CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(); for (int i = 0; i < 5; i++) { Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0)); Card c = Game.CurrentGame.DrawCard(); move.Cards.Add(c); } move.To = new DeckPlace(null, shelieDeck); Game.CurrentGame.MoveCards(move); List <List <Card> > answer; if (!Game.CurrentGame.UiProxies[Owner].AskForCardChoice(new CardChoicePrompt("SheLie", Owner), new List <DeckPlace>() { new DeckPlace(null, shelieDeck) }, new List <string>() { "AcquiredCards" }, new List <int>() { 4 }, new SheLieVerifier(Game.CurrentGame.Decks[null, shelieDeck]), out answer, null, CardChoiceCallback.GenericCardChoiceCallback)) { Trace.TraceInformation("Invalid answer for SheLie, choosing for you"); answer = new List <List <Card> >(); answer.Add(new List <Card>()); HashSet <SuitType> choice = new HashSet <SuitType>(); foreach (Card c in Game.CurrentGame.Decks[null, shelieDeck]) { if (!choice.Contains(c.Suit)) { answer[0].Add(c); choice.Add(c.Suit); } } } Game.CurrentGame.HandleCardTransferToHand(null, Owner, answer[0]); foreach (var c in Game.CurrentGame.Decks[null, shelieDeck]) { c.Log.SkillAction = this; c.Log.GameAction = GameAction.PlaceIntoDiscard; } Game.CurrentGame.PlaceIntoDiscard(null, new List <Card>(Game.CurrentGame.Decks[null, shelieDeck])); Game.CurrentGame.CurrentPhaseEventIndex++; throw new TriggerResultException(TriggerResult.End); }
void GetTheirCards(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs) { ISkill skill; List <Card> cards; List <Player> players; if (Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("TuXi"), new TuXiVerifier(), out skill, out cards, out players)) { Game.CurrentGame.SortByOrderOfComputation(Game.CurrentGame.CurrentPlayer, players); NotifySkillUse(players); StagingDeckType TuXiDeck = new StagingDeckType("TuXi"); CardsMovement move = new CardsMovement(); move.Helper.IsFakedMove = true; foreach (Player p in players) { if (p.HandCards().Count == 0) { continue; } 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) })); } move.Cards = answer[0]; move.To = new DeckPlace(p, TuXiDeck); Game.CurrentGame.MoveCards(move, false, Core.Utils.GameDelays.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, TuXiDeck]); } cards = new List <Card>(move.Cards); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerAcquiredCard(Owner, cards); Game.CurrentGame.CurrentPhaseEventIndex++; Game.CurrentGame.NotificationProxy.NotifyActionComplete(); throw new TriggerResultException(TriggerResult.End); } }
public override void Run(GameEvent gameEvent, GameEventArgs eventArgs) { if (gameEvent == GameEvent.PlayerSkillSetChanged) { SkillSetChangedEventArgs args = eventArgs as SkillSetChangedEventArgs; Trace.Assert(args != null); if (!args.IsLosingSkill) { return; } foreach (var sk in args.Skills) { if (deckCleanup.ContainsKey(sk)) { foreach (var deck in deckCleanup[sk]) { if (Game.CurrentGame.Decks[args.Source, deck].Count > 0) { List <Card> toDiscard = new List <Card>(Game.CurrentGame.Decks[args.Source, deck]); if (toDiscard.Any(c => c.Type.IsCardCategory(CardCategory.Hero))) { //HuaShenDeck if (Game.CurrentGame.IsClient) { foreach (var hc in toDiscard) { hc.Id = Card.UnknownHeroId; hc.Type = new UnknownHeroCardHandler(); } } CardsMovement move = new CardsMovement(); move.Cards = toDiscard; move.To = new DeckPlace(null, DeckType.Heroes); move.Helper.IsFakedMove = true; Game.CurrentGame.MoveCards(move); } else { Game.CurrentGame.HandleCardDiscard(args.Source, toDiscard); } } } } if (markCleanup.ContainsKey(sk)) { foreach (var player in Game.CurrentGame.Players) { foreach (var mark in markCleanup[sk]) { player[mark] = 0; } } } } } }
/// <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 }); } Game.CurrentGame.HandleCardDiscard(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; }
/// <summary> /// 处理玩家打出卡牌 /// </summary> /// <param name="p"></param> /// <param name="skill"></param> /// <param name="cards"></param> /// <param name="targets"></param> /// <returns></returns> public bool HandleCardPlay(Player p, ISkill skill, List <Card> cards, List <Player> targets) { Trace.Assert(cards != null); CardsMovement m = new CardsMovement(); ICard result; bool status = CommitCardTransform(p, skill, cards, out result, targets, true); if (!status) { return(false); } if (skill != null) { var r = result as CompositeCard; Trace.Assert(r != null); cards.Clear(); cards.AddRange(r.Subcards); } m.Cards = new List <Card>(cards); m.To = new DeckPlace(null, DeckType.Discard); Player isDoingAFavor = p; foreach (var checkFavor in m.Cards) { if (checkFavor.Owner != p) { Trace.TraceInformation("Acting on behalf of others"); isDoingAFavor = checkFavor.Owner; break; } } result.Type.TagAndNotify(p, targets, result, GameAction.Play); List <Card> backup = new List <Card>(m.Cards); if (isDoingAFavor != p) { PlayerAboutToDiscardCard(isDoingAFavor, m.Cards, DiscardReason.Play); MoveCards(m, false, GameDelays.PlayerAction); PlayerLostCard(p, m.Cards); PlayerPlayedCard(isDoingAFavor, targets, result); PlayerPlayedCard(p, targets, result); PlayerDiscardedCard(isDoingAFavor, backup, DiscardReason.Play); } else { PlayerAboutToDiscardCard(p, m.Cards, DiscardReason.Play); MoveCards(m, false, GameDelays.PlayerAction); PlayerLostCard(p, m.Cards); PlayerPlayedCard(p, targets, result); PlayerDiscardedCard(p, backup, DiscardReason.Play); } Game.CurrentGame.LastAction = skill; return(true); }
public override void Run(GameEvent gameEvent, GameEventArgs eventArgs) { if (Game.CurrentGame.Decks[player, JiJiDeck].Count > 0) { CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(Game.CurrentGame.Decks[player, JiJiDeck]); move.To = new DeckPlace(player, DeckType.Equipment); Game.CurrentGame.MoveCards(move); Game.CurrentGame.UnregisterTrigger(GameEvent.HeroDebut, this); } }
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs, List <Card> cards, List <Player> players) { CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(cards); move.To = new DeckPlace(players[0], BiFaDeck); move.Helper = new MovementHelper(); move.Helper.IsFakedMove = true; Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerLostCard(Owner, cards); Game.CurrentGame.RegisterTrigger(GameEvent.PhaseBeginEvents[TurnPhase.Start], new BiFaTrigger(players[0], this)); }
public void PlaceIntoDiscard(Player target, List <Card> list) { CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(list); move.To = new DeckPlace(null, DeckType.Discard); move.Helper = new MovementHelper(); MoveCards(move); if (target != null) { PlayerLostCard(target, list); } }
public static void AcquireHeroCard(Player player, Hero tag) { Card card = Game.CurrentGame.Decks[DeckType.Heroes][0]; Game.CurrentGame.SyncImmutableCard(player, card); CardsMovement move = new CardsMovement(); move.Cards = new List <Card>() { card }; move.To = new DeckPlace(player, HuaShenDeck); move.Helper.PrivateDeckHeroTag = tag; Game.CurrentGame.MoveCards(move); }
protected override void GetJudgeCards(List <Card> list) { if (list[0].Suit == SuitType.Heart) { return; } GameDelays.Delay(GameDelays.JudgeEnd); GameDelays.Delay(GameDelays.JudgeEnd); CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(list); move.To = new DeckPlace(Owner, TianDeck); move.Helper.PrivateDeckHeroTag = tag; Game.CurrentGame.MoveCards(move); }
public override bool Commit(GameEventArgs arg) { Owner[DiMengUsed] = 1; List <Card> cards = arg.Cards; if (cards.Count > 0) { Game.CurrentGame.HandleCardDiscard(Owner, cards); } Player src1 = arg.Targets[0]; Player src2 = arg.Targets[1]; StagingDeckType DiMengDeck = new StagingDeckType("DiMeng"); Game.CurrentGame.EnterAtomicContext(); CardsMovement move = new CardsMovement(); move.Helper.IsFakedMove = true; cards = new List <Card>(Game.CurrentGame.Decks[src1, DeckType.Hand]); move.Cards = new List <Card>(cards); move.To = new DeckPlace(src1, DiMengDeck); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerLostCard(src1, cards); cards = new List <Card>(Game.CurrentGame.Decks[src2, DeckType.Hand]); move.Cards = new List <Card>(cards); move.To = new DeckPlace(src2, DiMengDeck); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerLostCard(src2, cards); Game.CurrentGame.ExitAtomicContext(); move.Helper.IsFakedMove = false; Game.CurrentGame.SyncImmutableCards(src1, Game.CurrentGame.Decks[src2, DiMengDeck]); Game.CurrentGame.SyncImmutableCards(src2, Game.CurrentGame.Decks[src1, DiMengDeck]); Game.CurrentGame.EnterAtomicContext(); cards = new List <Card>(Game.CurrentGame.Decks[src2, DiMengDeck]); move.Cards = new List <Card>(cards); move.To = new DeckPlace(src1, DeckType.Hand); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerAcquiredCard(src1, cards); cards = new List <Card>(Game.CurrentGame.Decks[src1, DiMengDeck]); move.Cards = new List <Card>(cards); move.To = new DeckPlace(src2, DeckType.Hand); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerAcquiredCard(src2, cards); Game.CurrentGame.ExitAtomicContext(); return(true); }
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.GameDelays.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(); }
public override void Process(GameEventArgs handlerArgs) { base.Process(handlerArgs); DeckType wuguDeck = DeckType.Register("WuGu"); DeckType wuguFakeDeck = DeckType.Register("WuGuFake"); CardsMovement move = new CardsMovement(); 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, false, Core.Utils.GameDelays.Draw); } }
public void InsertAfterDeal(Player target, List <Card> list, MovementHelper helper = null) { CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(list); move.To = new DeckPlace(null, DeckType.Dealing); move.Helper.IsFakedMove = true; if (helper != null) { move.Helper = helper; } MoveCards(move, false, GameDelays.None); if (target != null) { PlayerLostCard(target, list); } }
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])); }
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); }
void Run(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs) { if (Owner[ZuiXiangDone] == 1) { return; } if (Owner[ZuiXiangUsed] == 0) { if (AskForSkillUse()) { NotifySkillUse(new List <Player>()); Owner[ZuiXiangUsed] = 1; } } if (Owner[ZuiXiangUsed] == 1) { CardsMovement move = new CardsMovement(); for (int i = 0; i < 3; i++) { Game.CurrentGame.SyncImmutableCardAll(Game.CurrentGame.PeekCard(0)); Card c = Game.CurrentGame.DrawCard(); move.Cards.Add(c); } move.To = new DeckPlace(Owner, ZuiXiangDeck); Game.CurrentGame.MoveCards(move); Dictionary <int, bool> gg = new Dictionary <int, bool>(); foreach (var card in Game.CurrentGame.Decks[Owner, ZuiXiangDeck]) { if (gg.ContainsKey(card.Rank)) { Owner[ZuiXiangDone] = 1; break; } gg.Add(card.Rank, true); } if (Owner[ZuiXiangDone] == 1) { move = new CardsMovement(); move.Cards = new List <Card>(Game.CurrentGame.Decks[Owner, ZuiXiangDeck]); move.To = new DeckPlace(Owner, DeckType.Hand); Game.CurrentGame.MoveCards(move); } } }
void GameStart(Player Owner, GameEvent gameEvent, GameEventArgs eventArgs) { ISkill skill; List <Card> cards; List <Player> players; if (!Game.CurrentGame.UiProxies[Owner].AskForCardUsage(new CardUsagePrompt("QiXing", 7), new QiXingVerifier(7), out skill, out cards, out players)) { cards = new List <Card>(); cards.AddRange(Game.CurrentGame.Decks[Owner, DeckType.Hand].GetRange(0, 7)); } CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(cards); move.To = new DeckPlace(Owner, QiXingDeck); move.Helper.IsFakedMove = true; move.Helper.PrivateDeckHeroTag = HeroTag; Game.CurrentGame.MoveCards(move); }
bool RecursiveShanDianDriver(Player start, Player current, Card c) { List <Player> toProcess = new List <Player>(Game.CurrentGame.AlivePlayers); toProcess.Remove(current); Game.CurrentGame.SortByOrderOfComputation(current, toProcess); foreach (var next in toProcess) { List <Player> targets = new List <Player>(); targets.Add(next); if (next == start) { return(false); } if (Game.CurrentGame.PlayerCanBeTargeted(null, targets, c)) { if (DelayedToolConflicting(next)) { Card nextCard = null; foreach (var card in Game.CurrentGame.Decks[next, DeckType.DelayedTools]) { if (card.Type is ShanDian) { nextCard = card; break; } } Trace.Assert(nextCard != null); if (!RecursiveShanDianDriver(start, next, nextCard)) { return(false); } } CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(); move.Cards.Add(c); move.To = new DeckPlace(next, DeckType.DelayedTools); Game.CurrentGame.MoveCards(move); return(true); } } return(false); }
public CangJi() { var trigger = new AutoNotifyPassiveSkillTrigger( this, (p, e, a) => { return(p.Equipments().Count > 0); }, (p, e, a) => { CardsMovement move = new CardsMovement(); move.Cards = new List <Card>(p.Equipments()); move.To = new DeckPlace(p, JiJiDeck); Game.CurrentGame.MoveCards(move); Game.CurrentGame.RegisterTrigger(GameEvent.HeroDebut, new ZombieJiJiTrigger(p)); }, TriggerCondition.OwnerIsTarget ); Triggers.Add(GameEvent.PlayerIsDead, trigger); IsAutoInvoked = true; }
public override bool Commit(GameEventArgs arg) { Owner[GanLuUsed] = 1; List <Card> cards; Player src1 = arg.Targets[0]; Player src2 = arg.Targets[1]; StagingDeckType GanLuDeck = new StagingDeckType("GanLu"); Game.CurrentGame.EnterAtomicContext(); CardsMovement move = new CardsMovement(); move.Helper.IsFakedMove = true; cards = new List <Card>(src1.Equipments()); move.Cards = new List <Card>(cards); move.To = new DeckPlace(src1, GanLuDeck); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerLostCard(src1, cards); cards = new List <Card>(src2.Equipments()); move.Cards = new List <Card>(cards); move.To = new DeckPlace(src2, GanLuDeck); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerLostCard(src2, cards); Game.CurrentGame.ExitAtomicContext(); Game.CurrentGame.EnterAtomicContext(); move.Helper.IsFakedMove = false; cards = new List <Card>(Game.CurrentGame.Decks[src2, GanLuDeck]); move.Cards = new List <Card>(cards); move.To = new DeckPlace(src1, DeckType.Equipment); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerAcquiredCard(src1, cards); cards = new List <Card>(Game.CurrentGame.Decks[src1, GanLuDeck]); move.Cards = new List <Card>(cards); move.To = new DeckPlace(src2, DeckType.Equipment); Game.CurrentGame.MoveCards(move); Game.CurrentGame.PlayerAcquiredCard(src2, cards); Game.CurrentGame.ExitAtomicContext(); return(true); }