public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = null; if (cards == null || cards.Count < 1) { return(VerifierResult.Partial); } if (cards.Count > 1) { return(VerifierResult.Fail); } if (cards[0].Place.DeckType != DeckType.None && cards[0].Owner != Owner && !(Helper.OtherDecksUsed.Count != 0 && Helper.OtherDecksUsed.Contains(cards[0].Place.DeckType))) { return(VerifierResult.Fail); } if (HandCardOnly) { if (cards[0].Place.DeckType != DeckType.Hand) { return(VerifierResult.Fail); } } if (VerifyInput(cards[0], arg)) { card = new CompositeCard(); card.Subcards = new List <Card>(cards); card.Type = PossibleResult; return(VerifierResult.Success); } return(VerifierResult.Fail); }
public ZhuQueYuShanShaSkill() { var trigger = new AutoNotifyPassiveSkillTrigger( this, (p, e, a) => { if (a.Card is CompositeCard) { CompositeCard card = a.Card as CompositeCard; return(a.ReadonlyCard.Type is RegularSha && (card.Subcards == null || card.Subcards.Count == 0)); } return(a.ReadonlyCard.Type is RegularSha); }, (p, e, a) => { a.Card.Type = new HuoSha(); a.ReadonlyCard = new ReadOnlyCard(a.Card); }, TriggerCondition.OwnerIsSource ) { Priority = int.MaxValue }; Triggers.Add(GameEvent.PlayerUsedCard, trigger); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = new CompositeCard(); card.Subcards = new List <Card>(); card.Type = AdditionalType; card[TieSuoLianHuan.ProhibitReforging] = 1; if (AdditionalType == null) { return(VerifierResult.Partial); } if (!CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.Basic) && !CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.ImmediateTool)) { return(VerifierResult.Fail); } if (cards == null || cards.Count == 0) { return(VerifierResult.Partial); } if (cards != null && cards.Count != 1) { return(VerifierResult.Fail); } if (cards[0].Place.DeckType != DeckType.Hand) { return(VerifierResult.Fail); } card.Subcards.Add(cards[0]); return(VerifierResult.Success); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = null; if (cards == null || cards.Count == 0) { return(VerifierResult.Partial); } if (cards.Count > 2) { return(VerifierResult.Fail); } if (cards[0].Owner != Owner || cards[0].Place.DeckType != DeckType.Hand) { return(VerifierResult.Fail); } if (cards.Count == 2 && ((cards[1].Owner != Owner || cards[1].Place.DeckType != DeckType.Hand) || cards[1].Suit != cards[0].Suit)) { return(VerifierResult.Fail); } if (cards.Count == 1) { return(VerifierResult.Partial); } card = new CompositeCard(); card.Subcards = new List <Card>(cards); card.Type = new WanJianQiFa(); return(VerifierResult.Success); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = null; if (cards == null || cards.Count < 1) { return(VerifierResult.Partial); } if (cards.Count > 1) { return(VerifierResult.Fail); } if (cards[0].Owner != Owner || cards[0].Place.DeckType != DeckType.Hand) { return(VerifierResult.Fail); } if (cards[0].Type is Shan) { card = new CompositeCard(); card.Subcards = new List <Card>(cards); card.Type = new RegularSha(); card[CanShuaLiuMang] = 1; return(VerifierResult.Success); } else if (cards[0].Type is Sha) { card = new CompositeCard(); card.Subcards = new List <Card>(cards); card.Type = new Shan(); card[CanShuaLiuMang] = 1; return(VerifierResult.Success); } return(VerifierResult.Fail); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = new CompositeCard(); card.Subcards = new List <Card>(); if (Game.CurrentGame.CurrentPlayer == Owner) { return(VerifierResult.Fail); } if (cards == null || cards.Count == 0) { return(VerifierResult.Partial); } if (cards != null && cards.Count > 1) { return(VerifierResult.Fail); } if (!(cards[0] == Game.CurrentGame.Decks[null, DeckType.Dealing][0] || cards[0] == Game.CurrentGame.Decks[null, DeckType.Dealing][1])) { return(VerifierResult.Fail); } if (cards[0].Type.BaseCategory() != CardCategory.Basic) { return(VerifierResult.Fail); } card.Type = cards[0].Type; card.Subcards.Add(cards[0]); return(VerifierResult.Success); }
public override VerifierResult FastVerify(Player source, ISkill skill, List <Card> cards, List <Player> players) { if (players != null && players.Any(p => p.IsDead)) { return(VerifierResult.Fail); } if (players == null) { players = new List <Player>(); } CompositeCard sha = new CompositeCard() { Type = type }; if (!Game.CurrentGame.PlayerCanBeTargeted(source, players, sha)) { return(VerifierResult.Fail); } List <Player> newList = new List <Player>(players); if (target != null) { if (!newList.Contains(target)) { newList.Insert(0, target); } else { return(VerifierResult.Fail); } } if (cards != null && cards.Count > 0) { return(VerifierResult.Fail); } if (skill is CardTransformSkill) { CardTransformSkill sk = skill as CardTransformSkill; if (sk.TryTransform(dummyCards, null, out sha) != VerifierResult.Success) { return(VerifierResult.Fail); } if (helper != null) { sha[helper] = 1; } return(new Sha().VerifyCore(source, sha, newList)); } else if (skill != null) { return(VerifierResult.Fail); } if (helper != null) { sha[helper] = 1; } return(new Sha().VerifyCore(source, sha, newList)); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = new CompositeCard(); card.Type = handler; card.Subcards = new List <Card>(cards); card.Owner = Owner; return(VerifierResult.Success); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = new CompositeCard(); card.Type = new JueDou(); card.Subcards = new List <Card>(cards); card[WuXieKeJi.CannotBeCountered] = 1; return(VerifierResult.Success); }
public override VerifierResult Validate(GameEventArgs arg) { if (Owner[XieChanUsed] != 0) { return(VerifierResult.Fail); } List <Card> cards = arg.Cards; if (cards != null && cards.Count > 0) { return(VerifierResult.Fail); } if (Owner.HandCards().Count == 0) { return(VerifierResult.Fail); } if (arg.Targets != null && arg.Targets.Count > 1) { return(VerifierResult.Fail); } if (arg.Targets != null && arg.Targets.Count == 1) { if (arg.Targets[0].HandCards().Count == 0) { return(VerifierResult.Fail); } if (arg.Targets[0] == Owner) { return(VerifierResult.Fail); } CompositeCard c = new CompositeCard(); c.Type = new JueDou(); c.Subcards = null; List <Player> dests = new List <Player>(); dests.Add(arg.Targets[0]); if (!Game.CurrentGame.PlayerCanBeTargeted(null, dests, c)) { return(VerifierResult.Fail); } if (!Game.CurrentGame.PlayerCanUseCard(Owner, c)) { return(VerifierResult.Fail); } } if (Owner.HandCards().Count == 0) { return(VerifierResult.Fail); } if (arg.Targets == null || arg.Targets.Count == 0) { return(VerifierResult.Partial); } return(VerifierResult.Success); }
public override VerifierResult Verify(Player source, ICard card, List <Player> targets, bool isLooseVerify) { // @todo: Currently, more than one pair of targets are not supported. if (targets == null || targets.Count < 2) { return(VerifierResult.Partial); } if (targets.Count > 2) { return(VerifierResult.Fail); } if (targets.Count >= 1 && targets[0] == source) { return(VerifierResult.Fail); } bool hasWeapon = false; foreach (var c in Game.CurrentGame.Decks[targets[0], DeckType.Equipment]) { if (c.Type is Weapon) { hasWeapon = true; } } if (!hasWeapon) { return(VerifierResult.Fail); } if (targets.Count == 2) { CompositeCard sha = new CompositeCard() { Type = new Sha() }; if (!Game.CurrentGame.PlayerCanBeTargeted(targets[0], new List <Player>() { targets[1] }, sha)) { return(VerifierResult.Fail); } if ((new Sha()).VerifyCore(targets[0], sha, new List <Player>() { targets[1] }) != VerifierResult.Success) { return(VerifierResult.Fail); } } return(VerifierResult.Success); }
public override void NotifyAction(Player source, List <Player> targets, CompositeCard card) { ActionLog log = new ActionLog(); log.GameAction = GameAction.None; log.CardAction = card; log.SkillAction = this; log.Source = source; log.Targets = targets; log.ShowCueLine = true; log.SpecialEffectHint = GenerateSpecialEffectHintIndex(source, targets, card); Game.CurrentGame.NotificationProxy.NotifySkillUse(log); }
public override void NotifyAction(Player source, List <Player> targets, CompositeCard card) { if (withoutNotify) { return; } ActionLog log = new ActionLog(); log.GameAction = GameAction.None; log.CardAction = card; log.Source = source; log.SpecialEffectHint = GenerateSpecialEffectHintIndex(source, targets, card); Game.CurrentGame.NotificationProxy.NotifySkillUse(log); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = null; if (cards == null || cards.Count == 0) { return(VerifierResult.Partial); } Trace.Assert(Owner != null); if (Owner == null) { return(VerifierResult.Fail); } int X = Math.Max(Owner.Health, 1); if (cards.Count > X) { return(VerifierResult.Fail); } foreach (var cc in cards) { if (cc.Owner != Owner || cc.Suit != cards[0].Suit) { return(VerifierResult.Fail); } } if (cards.Count < X) { return(VerifierResult.Partial); } card = new CompositeCard(); card.Subcards = new List <Card>(cards); if (cards[0].Suit == SuitType.Heart) { card.Type = new Tao(); } if (cards[0].Suit == SuitType.Diamond) { card.Type = new HuoSha(); } if (cards[0].Suit == SuitType.Club) { card.Type = new Shan(); } if (cards[0].Suit == SuitType.Spade) { card.Type = new WuXieKeJi(); } return(VerifierResult.Success); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = new CompositeCard(); card.Type = new Jiu(); if (Owner.IsImprisoned) { return(VerifierResult.Fail); } if (cards != null && cards.Count != 0) { return(VerifierResult.Fail); } return(VerifierResult.Success); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = null; if (cards != null && (cards.Count > 2 || cards.Any(c => c.Place.DeckType != DeckType.Hand))) { return(VerifierResult.Fail); } if (cards == null || cards.Count < 2) { return(VerifierResult.Partial); } card = new CompositeCard(cards); card.Type = new RegularSha(); card.Owner = Owner; card[FuHunSha] = 1; return(VerifierResult.Success); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = null; if (Owner[JiJiangFailed] == 1 && Game.CurrentGame.LastAction is JiJiang && Game.CurrentGame.LastAction.Owner == Owner) { return(VerifierResult.Fail); } if (cards != null && cards.Count != 0) { return(VerifierResult.Fail); } List <Player> toProcess = new List <Player>(Game.CurrentGame.AlivePlayers); toProcess.Remove(Owner); bool noShuHero = true; foreach (var player in toProcess) { if (player.Allegiance == Core.Heroes.Allegiance.Shu) { noShuHero = false; break; } } ; if (noShuHero) { return(VerifierResult.Fail); } card = new CompositeCard(); if (cards == null) { card.Subcards = new List <Card>(); } else { card.Subcards = new List <Card>(cards); } card.Type = new Sha(); return(VerifierResult.Success); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = null; if (cards == null || cards.Count < 1) { return(VerifierResult.Partial); } if (cards.Count > 1) { return(VerifierResult.Fail); } if (cards[0].Type is RegularSha) { card = new CompositeCard(); card.Subcards = new List <Card>(cards); card.Type = new HuoSha(); card[LiHuoSha] = 1; return(VerifierResult.Success); } return(VerifierResult.Fail); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> targets, out CompositeCard card, bool isPlay) { card = new CompositeCard(); card.Type = new RegularSha(); Trace.Assert(cards != null && targets != null); if (cards == null || targets == null) { return(VerifierResult.Fail); } if (isPlay) { return(VerifierResult.Fail); } if (Game.CurrentGame.Decks[Master, NiDeck].Count <= 1) { return(VerifierResult.Fail); } if (cards.Any(cd => cd.Place.Player != master || cd.Place.DeckType != NiDeck)) { return(VerifierResult.Fail); } if (cards.Count < 2) { return(VerifierResult.Partial); } if (cards.Count > 2) { return(VerifierResult.Fail); } card.Subcards = new List <Card>(cards); if (targets.Count == 0) { return(VerifierResult.Success); } if (targets.Contains(Master)) { return(VerifierResult.Success); } return(VerifierResult.Fail); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = new CompositeCard(); card.Subcards = new List <Card>(); card.Type = AdditionalType; card[TieSuoLianHuan.ProhibitReforging] = 1; if (Owner[QiCeUsed] == 1) { return(VerifierResult.Fail); } if (Game.CurrentGame.CurrentPhase != TurnPhase.Play) { return(VerifierResult.Fail); } if (Game.CurrentGame.CurrentPlayer != Owner) { return(VerifierResult.Fail); } if (Owner.HandCards().Count == 0) { return(VerifierResult.Fail); } if (AdditionalType == null) { return(VerifierResult.Partial); } if (!CardCategoryManager.IsCardCategory(AdditionalType.Category, CardCategory.ImmediateTool) || AdditionalType is WuXieKeJi) { return(VerifierResult.Fail); } if (cards != null && cards.Count > 0) { return(VerifierResult.Fail); } card.Subcards.AddRange(Owner.HandCards()); return(VerifierResult.Success); }
public FangTianHuaJiSkill() { var trigger = new AutoNotifyPassiveSkillTrigger( this, (p, e, a) => { bool isLastHandCard = false; Card c = a.Card as Card; if (c != null) { isLastHandCard = c[Card.IsLastHandCard] == 1; } else { CompositeCard cc = a.Card as CompositeCard; Trace.Assert(cc != null); isLastHandCard = cc.Subcards.All(card => card.HistoryPlace1.DeckType == DeckType.Hand) && cc.Subcards.Any(card => card[Card.IsLastHandCard] == 1); } return(a.Targets.Count > 1 && isLastHandCard && a.Card.Type is Sha); }, (p, e, a) => { }, TriggerCondition.OwnerIsSource ) { AskForConfirmation = false }; var trigger2 = new AutoNotifyPassiveSkillTrigger( this, Run, TriggerCondition.OwnerIsSource ) { IsAutoNotify = false, AskForConfirmation = false, Type = TriggerType.Card }; Triggers.Add(GameEvent.PlayerUsedCard, trigger); Triggers.Add(Sha.PlayerShaTargetValidation, trigger2); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = new CompositeCard(); card.Type = new Tao(); if (Owner == Game.CurrentGame.PhasesOwner) { return(VerifierResult.Fail); } if (cards == null || cards.Count < 1) { return(VerifierResult.Partial); } if (cards.Count > 1) { return(VerifierResult.Fail); } if (cards[0].SuitColor != SuitColorType.Red || cards[0].Owner != Owner) { return(VerifierResult.Fail); } card.Subcards = new List <Card>(cards); return(VerifierResult.Success); }
/// <summary> /// Transform a set of cards. /// </summary> /// <param name="cards">Cards to be transformed.</param> /// <param name="arg">Additional args to help the transformation.</param> /// <returns>False if transform is aborted.</returns> /// <exception cref="CardTransformFailureException"></exception> public bool Transform(List <Card> cards, object arg, out CompositeCard card, List <Player> targets, bool isPlay = false) { if (TryTransform(cards, targets, out card, isPlay) != VerifierResult.Success) { throw new CardTransformFailureException(); } NotifyAction(Owner, targets, card); bool ret = DoTransformSideEffect(card, arg, targets, isPlay); if (ret) { card.Owner = Owner; foreach (Card c in card.Subcards) { if (c.Place.Player != null && c.Place.DeckType == DeckType.Equipment && CardCategoryManager.IsCardCategory(c.Type.Category, CardCategory.Equipment)) { Equipment e = c.Type as Equipment; e.UnregisterTriggers(c.Place.Player); } c.Type = card.Type; } } return(ret); }
protected override bool DoTransformSideEffect(CompositeCard card, object arg, List <Player> targets, bool isPlay) { ICard result = null; List <Player> toProcess = new List <Player>(Game.CurrentGame.AlivePlayers); toProcess.Remove(Owner); bool noAnswer = true; foreach (var player in toProcess) { if (player.Allegiance == Core.Heroes.Allegiance.Shu) { bool failToRespond = false; while (true) { IPlayerProxy ui = Game.CurrentGame.UiProxies[player]; SingleCardUsageVerifier v1 = new SingleCardUsageVerifier((c) => { return(c.Type is Sha); }, false); ISkill skill; List <Player> p; List <Card> cards; Game.CurrentGame.Emit(isPlay? GameEvent.PlayerIsAboutToPlayCard : GameEvent.PlayerIsAboutToUseCard, new PlayerIsAboutToUseOrPlayCardEventArgs() { Source = player, Verifier = v1 }); if (!ui.AskForCardUsage(new CardUsagePrompt("JiJiang", Owner), v1, out skill, out cards, out p)) { failToRespond = true; break; } if (!Game.CurrentGame.CommitCardTransform(player, skill, cards, out result, targets, isPlay)) { continue; } noAnswer = false; Trace.TraceInformation("Player {0} Responded JiJiang with SHA, ", player.Id); break; } if (failToRespond) { continue; } break; } } Game.CurrentGame.LastAction = this; if (noAnswer) { Owner[JiJiangFailed] = 1; return(false); } Owner[JiJiangFailed] = 0; Trace.Assert(result != null); card.Subcards = new List <Card>(); if (result is CompositeCard) { card.Subcards.AddRange(((CompositeCard)result).Subcards); card.Type = ((CompositeCard)result).Type; } else { Trace.Assert(result is Card); card.Subcards.Add((Card)result); card.Type = ((Card)result).Type; } return(true); }
protected override int GenerateSpecialEffectHintIndex(Player source, List <Player> targets, CompositeCard card) { if (source.Hero.Name == "LiuShan" || source.Hero2 != null && source.Hero2.Name == "LiuShan") { return(1); } return(0); }
public override VerifierResult TryTransform(List <Card> cards, List <Player> arg, out CompositeCard card, bool isPlay) { card = null; if (Owner.HandCards().Count <= Owner.Health) { return(VerifierResult.Fail); } return(base.TryTransform(cards, arg, out card, isPlay)); }
protected virtual bool DoTransformSideEffect(CompositeCard card, object arg, List <Player> targets, bool isPlay) { return(true); }
/// <summary> /// 尝试使用当前技能转换一组卡牌。 /// </summary> /// <param name="cards">被转化的卡牌。</param> /// <param name="arg">辅助转化的额外参数。</param> /// <param name="card">转换成的卡牌。</param> /// <returns>转换是否成功。</returns> public abstract VerifierResult TryTransform(List <Card> cards, List <Player> targets, out CompositeCard card, bool isPlay = false);
protected virtual int GenerateSpecialEffectHintIndex(Player source, List <Player> targets, CompositeCard card) { return(0); }
public virtual void NotifyAction(Players.Player source, List <Players.Player> targets, CompositeCard card) { ActionLog log = new ActionLog(); log.GameAction = GameAction.None; log.CardAction = card; log.SkillAction = this; log.Source = source; log.SpecialEffectHint = GenerateSpecialEffectHintIndex(source, targets, card); Games.Game.CurrentGame.NotificationProxy.NotifySkillUse(log); if (card.Subcards != null) { foreach (Card c in card.Subcards) { if (c.Log == null) { c.Log = new ActionLog(); } c.Log.SkillAction = this; } } }