public void NotifyIntermediateJudgeResults(Player player, ActionLog log, JudgementResultSucceed intermDel) { Trace.Assert(Game.CurrentGame.Decks[player, DeckType.JudgeResult].Count > 0); Card c = Game.CurrentGame.Decks[player, DeckType.JudgeResult][0]; bool? succeed = null; if (intermDel != null) { succeed = intermDel(c); } Game.CurrentGame.NotificationProxy.NotifyJudge(player, c, log, succeed, false); }
public ReadOnlyCard Judge(Player player, ISkill skill = null, ICard handler = null, JudgementResultSucceed del = null) { ActionLog log = new ActionLog(); log.SkillAction = skill; log.CardAction = handler; log.Source = player; CardsMovement move = new CardsMovement(); Card c; int initCount = decks[player, DeckType.JudgeResult].Count; SyncImmutableCardAll(PeekCard(0)); c = DrawCard(); move = new CardsMovement(); move.Cards = new List<Card>(); move.Cards.Add(c); move.To = new DeckPlace(player, DeckType.JudgeResult); MoveCards(move); GameEventArgs args = new GameEventArgs(); args.Source = player; if (triggers.ContainsKey(GameEvent.PlayerJudgeBegin) && triggers[GameEvent.PlayerJudgeBegin].Count > 0) { NotifyIntermediateJudgeResults(player, log, del); } Emit(GameEvent.PlayerJudgeBegin, args); c = Decks[player, DeckType.JudgeResult].Last(); args.ReadonlyCard = new ReadOnlyCard(c); args.Cards = new List<Card>() { c }; args.Skill = skill; args.Card = handler; Emit(GameEvent.PlayerJudgeDone, args); Trace.Assert(args.Source == player); Trace.Assert(args.ReadonlyCard is ReadOnlyCard); bool? succeed = null; if (del != null) { succeed = del(args.ReadonlyCard); } Card uiCard = new Card(args.ReadonlyCard); uiCard.Id = (args.ReadonlyCard as ReadOnlyCard).Id; if (uiCard.Log == null) { uiCard.Log = new ActionLog(); } uiCard.Log.Source = player; uiCard.Log.CardAction = handler; uiCard.Log.SkillAction = skill; uiCard.Log.GameAction = GameAction.Judge; NotificationProxy.NotifyJudge(player, uiCard, log, succeed); if (decks[player, DeckType.JudgeResult].Count > initCount) { c = decks[player, DeckType.JudgeResult].Last(); move = new CardsMovement(); move.Cards = new List<Card>(); List<Card> backup = new List<Card>(move.Cards); move.Cards.Add(c); move.To = new DeckPlace(null, DeckType.Discard); move.Helper = new MovementHelper(); PlayerAboutToDiscardCard(player, move.Cards, DiscardReason.Judge); MoveCards(move); PlayerDiscardedCard(player, backup, DiscardReason.Judge); } GameDelays.Delay(GameDelayTypes.JudgeEnd); return args.ReadonlyCard as ReadOnlyCard; }
public ReadOnlyCard Judge(Player player, ISkill skill = null, ICard handler = null, JudgementResultSucceed del = null) { CardsMovement move = new CardsMovement(); Card c; if (decks[player, DeckType.JudgeResult].Count != 0) { c = decks[player, DeckType.JudgeResult][0]; move = new CardsMovement(); move.Cards = new List<Card>(); List<Card> backup = new List<Card>(move.Cards); move.Cards.Add(c); move.To = new DeckPlace(null, DeckType.Discard); PlayerAboutToDiscardCard(player, move.Cards, DiscardReason.Judge); MoveCards(move); PlayerDiscardedCard(player, backup, DiscardReason.Judge); } SyncImmutableCardAll(PeekCard(0)); c = Game.CurrentGame.DrawCard(); move = new CardsMovement(); move.Cards = new List<Card>(); move.Cards.Add(c); move.To = new DeckPlace(player, DeckType.JudgeResult); MoveCards(move); GameEventArgs args = new GameEventArgs(); args.Source = player; Game.CurrentGame.Emit(GameEvent.PlayerJudgeBegin, args); c = Game.CurrentGame.Decks[player, DeckType.JudgeResult][0]; args.Card = new ReadOnlyCard(c); args.Cards = new List<Card>() { c }; Game.CurrentGame.Emit(GameEvent.PlayerJudgeDone, args); Trace.Assert(args.Source == player); Trace.Assert(args.Card is ReadOnlyCard); ActionLog log = new ActionLog(); log.SkillAction = skill; log.CardAction = handler; log.Source = player; bool? succeed = null; if (del != null) { succeed = del(args.Card); } Card uiCard = new Card(args.Card); uiCard.Id = (args.Card as ReadOnlyCard).Id; Game.CurrentGame.NotificationProxy.NotifyJudge(player, uiCard, log, succeed); if (decks[player, DeckType.JudgeResult].Count != 0) { c = decks[player, DeckType.JudgeResult][0]; move = new CardsMovement(); move.Cards = new List<Card>(); List<Card> backup = new List<Card>(move.Cards); move.Cards.Add(c); move.To = new DeckPlace(null, DeckType.Discard); move.Helper = new MovementHelper(); PlayerAboutToDiscardCard(player, move.Cards, DiscardReason.Judge); MoveCards(move); PlayerDiscardedCard(player, backup, DiscardReason.Judge); } return args.Card as ReadOnlyCard; }
public ReadOnlyCard Judge(Player player, ISkill skill = null, ICard handler = null, JudgementResultSucceed del = null) { ActionLog log = new ActionLog(); log.SkillAction = skill; log.CardAction = handler; log.Source = player; log.GameAction = GameAction.Judge; CardsMovement move = new CardsMovement(); Card c; int initCount = decks[player, DeckType.JudgeResult].Count; SyncImmutableCardAll(PeekCard(0)); c = DrawCard(); c.Log = log; move = new CardsMovement(); move.Cards = new List <Card>(); move.Cards.Add(c); move.To = new DeckPlace(player, DeckType.JudgeResult); MoveCards(move, false, GameDelays.None); GameEventArgs args = new GameEventArgs(); args.Source = player; if (triggers.ContainsKey(GameEvent.PlayerJudgeBegin) && triggers[GameEvent.PlayerJudgeBegin].Count > 0) { NotifyIntermediateJudgeResults(player, log, del); } Emit(GameEvent.PlayerJudgeBegin, args); c = Decks[player, DeckType.JudgeResult].Last(); args.ReadonlyCard = new ReadOnlyCard(c); args.Cards = new List <Card>() { c }; args.Skill = skill; args.Card = handler; bool?succeed = null; if (del != null) { succeed = del(args.ReadonlyCard); } Card uiCard = new Card(args.ReadonlyCard); uiCard.Id = (args.ReadonlyCard as ReadOnlyCard).Id; if (uiCard.Log == null) { uiCard.Log = new ActionLog(); } uiCard.Log = log; NotificationProxy.NotifyJudge(player, uiCard, log, succeed); Emit(GameEvent.PlayerJudgeDone, args); Trace.Assert(args.Source == player); Trace.Assert(args.ReadonlyCard is ReadOnlyCard); if (decks[player, DeckType.JudgeResult].Count > initCount) { c = decks[player, DeckType.JudgeResult].Last(); move = new CardsMovement(); move.Cards = new List <Card>(); move.Cards.Add(c); List <Card> backup = new List <Card>(move.Cards); move.To = new DeckPlace(null, DeckType.Discard); move.Helper = new MovementHelper(); PlayerAboutToDiscardCard(player, move.Cards, DiscardReason.Judge); MoveCards(move, false, GameDelays.None); PlayerDiscardedCard(player, backup, DiscardReason.Judge); } GameDelays.Delay(GameDelays.JudgeEnd); return(args.ReadonlyCard as ReadOnlyCard); }