示例#1
0
        public override TriggerStruct Triggerable(TriggerEvent triggerEvent, Room room, Player player, ref object data, Player ask_who)
        {
            if (triggerEvent == TriggerEvent.TargetChosen && data is CardUseStruct use)
            {
                FunctionCard fcard = use.Card != null?Engine.GetFunctionCard(use.Card.Name) : null;

                if (base.Triggerable(player, room) && use.Card != null && fcard is Slash)
                {
                    List <Player> targets = new List <Player>();
                    foreach (Player to in use.To)
                    {
                        if (RoomLogic.CanDiscard(room, to, to, "he"))
                        {
                            targets.Add(to);
                        }
                    }
                    if (targets.Count > 0)
                    {
                        return(new TriggerStruct(Name, player, targets));
                    }
                }
            }
            else if (triggerEvent == TriggerEvent.Dying && data is DyingStruct dying && dying.Damage.Card != null && dying.Damage.Card.Name.Contains(Slash.ClassName) &&
                     !dying.Damage.Transfer && !dying.Damage.Chain &&
                     dying.Damage.From != null && dying.Damage.From.Alive && base.Triggerable(dying.Damage.From, room) && !player.IsKongcheng())
            {
                if (RoomLogic.CanGetCard(room, dying.Damage.From, player, "h"))
                {
                    return(new TriggerStruct(Name, dying.Damage.From));
                }
            }

            return(new TriggerStruct());
        }
示例#2
0
        public override TriggerStruct Triggerable(TriggerEvent triggerEvent, Room room, Player player, ref object data, Player ask_who)
        {
            if (triggerEvent == TriggerEvent.DamageInflicted && data is DamageStruct damage && damage.Card != null && base.Triggerable(player, room) && player.GetPile(Name).Count == 0)
            {
                FunctionCard fcard = Engine.GetFunctionCard(damage.Card.Name);
                if (!(fcard is SkillCard))
                {
                    WrappedCard card          = damage.Card;
                    List <int>  table_cardids = room.GetCardIdsOnTable(room.GetSubCards(card));
                    List <int>  ids           = new List <int>(card.SubCards);

                    if (table_cardids.Count > 0 && ids.SequenceEqual(table_cardids))
                    {
                        bool check = true;
                        foreach (int id in card.SubCards)
                        {
                            if (room.GetCardPlace(id) != Place.PlaceTable)
                            {
                                check = false;
                                break;
                            }
                        }

                        if (check)
                        {
                            return(new TriggerStruct(Name, player));
                        }
                    }
                }
            }
            return(new TriggerStruct());
        }
示例#3
0
        public override TriggerStruct Triggerable(TriggerEvent triggerEvent, Room room, Player player, ref object data, Player ask_who)
        {
            if (triggerEvent == TriggerEvent.CardFinished && data is CardUseStruct use && base.Triggerable(player, room))
            {
                FunctionCard fcard = Engine.GetFunctionCard(use.Card.Name);
                if (!(fcard is SkillCard))
                {
                    bool dis = false;
                    foreach (int id in use.Card.SubCards)
                    {
                        if (room.GetCardPlace(id) == Place.DiscardPile)
                        {
                            dis = true;
                            break;
                        }
                    }

                    FunctionCard.CardType        type  = fcard.TypeID;
                    List <FunctionCard.CardType> types = player.ContainsTag(Name) ? (List <FunctionCard.CardType>)player.GetTag(Name) : new List <FunctionCard.CardType>();
                    if (dis && !types.Contains(type))
                    {
                        return(new TriggerStruct(Name, player));
                    }
                }
            }
示例#4
0
        public override List <TriggerStruct> Triggerable(TriggerEvent triggerEvent, Room room, Player player, ref object data)
        {
            List <TriggerStruct> triggers = new List <TriggerStruct>();

            if (triggerEvent == TriggerEvent.EventPhaseStart && player.Phase == Player.PlayerPhase.Finish && base.Triggerable(player, room) &&
                !player.IsKongcheng() && ShefuVS.GuhuoCards(room, player).Count > 0)
            {
                triggers.Add(new TriggerStruct(Name, player));
            }
            else if (triggerEvent == TriggerEvent.CardUsed && data is CardUseStruct use && use.Card != null && use.To.Count > 0 && use.IsHandcard)
            {
                FunctionCard fcard = Engine.GetFunctionCard(use.Card.Name);
                if (fcard is SkillCard)
                {
                    return(triggers);
                }

                List <Player> chengyus  = RoomLogic.FindPlayersBySkillName(room, Name);
                string        card_name = fcard.Name;
                if (fcard is Slash)
                {
                    card_name = Slash.ClassName;
                }
                foreach (Player p in chengyus)
                {
                    if (p != player && p.Phase == Player.PlayerPhase.NotActive && p.ContainsTag(string.Format("shefu_{0}", card_name)) &&
                        p.GetTag(string.Format("shefu_{0}", card_name)) is int id && p.GetPile("ambush").Contains(id))
                    {
                        triggers.Add(new TriggerStruct(Name, p));
                    }
                }
            }
示例#5
0
        public override bool TargetFilter(Room room, List <Player> targets, Player to_select, Player Self, WrappedCard card)
        {
            WrappedCard ba = new WrappedCard(card.UserString);

            ba.AddSubCard(card);
            ba = RoomLogic.ParseUseCard(room, ba);
            FunctionCard bcard = Engine.GetFunctionCard(card.UserString);

            return(bcard.TargetFilter(room, targets, to_select, Self, ba));
        }
示例#6
0
        public override TriggerStruct Triggerable(TriggerEvent triggerEvent, Room room, Player player, ref object data, Player ask_who)
        {
            if (triggerEvent == TriggerEvent.Damage && data is DamageStruct damage && damage.To.Alive && !damage.To.IsNude() && base.Triggerable(player, room) &&
                player.ContainsTag(Name) && player.GetTag(Name) is List <int> ids && RoomLogic.CanGetCard(room, player, damage.To, "he") && damage.Card.SubCards.Count == 1 &&
                ids.Contains(damage.Card.SubCards[0]))
            {
                FunctionCard fcard = Engine.GetFunctionCard(damage.Card.Name);
                if (!(fcard is SkillCard))
                {
                    return(new TriggerStruct(Name, player));
                }
            }

            return(new TriggerStruct());
        }
        public override bool IsProhibited(Room room, Player from, Player to, WrappedCard card, List <Player> others = null)
        {
            Player       lord  = RoomLogic.FindPlayerBySkillName(room, Name);
            FunctionCard fcard = Engine.GetFunctionCard(card.Name);

            if (!(fcard is SkillCard) && lord != null && to != null && from != null && from.Camp != to.Camp && lord.Camp == to.Camp)
            {
                foreach (Player p in room.GetOtherPlayers(to))
                {
                    if (p.Hp <= to.Hp && to.Camp == p.Camp)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
        public override List <TriggerStruct> Triggerable(TriggerEvent triggerEvent, Room room, Player player, ref object data)
        {
            List <TriggerStruct> triggers = new List <TriggerStruct>();

            if (triggerEvent == TriggerEvent.CardFinished && player != null && player.Alive && data is CardUseStruct use && use.Card != null && use.Card.Name != Jink.ClassName)
            {
                FunctionCard fcard = Engine.GetFunctionCard(use.Card.Name);
                if (!(fcard is SkillCard))
                {
                    foreach (Player p in use.To)
                    {
                        if (player.Camp != p.Camp && base.Triggerable(p, room))
                        {
                            triggers.Add(new TriggerStruct(Name, p));
                        }
                    }
                }
            }

            return(triggers);
        }
示例#9
0
 public GDFighttogether() : base(ClassName)
 {
     Instance = this;
 }
示例#10
0
 public Reinforcement() : base(ClassName)
 {
     Instance = this;
 }
示例#11
0
 public HoardUp() : base(ClassName)
 {
     Instance = this;
 }
示例#12
0
        public virtual void OnUse(Room room, CardUseStruct card_use)
        {
            Player player = card_use.From;

            room.SortByActionOrder(ref card_use);
            List <Player> targets = card_use.To;

            bool       hidden = (TypeID == CardType.TypeSkill && !WillThrow);
            LogMessage log    = new LogMessage("#UseCard")
            {
                From     = player.Name,
                To       = new List <string>(),
                Card_str = RoomLogic.CardToString(room, card_use.Card)
            };

            if (!TargetFixed(card_use.Card) || card_use.To.Count > 1 || !card_use.To.Contains(card_use.From))
            {
                log.SetTos(card_use.To);
            }


            List <int>             used_cards = new List <int>();
            List <CardsMoveStruct> moves      = new List <CardsMoveStruct>();

            used_cards.AddRange(card_use.Card.SubCards);

            RoomThread thread = room.RoomThread;
            object     data   = card_use;

            thread.Trigger(TriggerEvent.PreCardUsed, room, player, ref data);

            card_use = (CardUseStruct)data;

            if (TypeID != CardType.TypeSkill)
            {
                CardMoveReason reason = new CardMoveReason(CardMoveReason.MoveReason.S_REASON_USE, player.Name, null, card_use.Card.Skill, null)
                {
                    CardString = RoomLogic.CardToString(room, card_use.Card),
                    General    = RoomLogic.GetGeneralSkin(room, player, card_use.Card.Skill, card_use.Card.SkillPosition)
                };
                if (card_use.To.Count == 1)
                {
                    reason.TargetId = card_use.To[0].Name;
                }

                foreach (int id in used_cards)
                {
                    CardsMoveStruct move = new CardsMoveStruct(id, null, Place.PlaceTable, reason);
                    moves.Add(move);
                }
                room.MoveCardsAtomic(moves, true);
                if (used_cards.Count == 0)
                {                                                                                 //show virtual card on table
                    CardsMoveStruct move = new CardsMoveStruct(-1, player, Place.PlaceTable, reason)
                    {
                        From_place       = Place.PlaceUnknown,
                        From             = player.Name,
                        Is_last_handcard = false,
                    };
                    room.NotifyUsingVirtualCard(RoomLogic.CardToString(room, card_use.Card), move);
                }

                room.SendLog(log);
                if (this is Collateral)
                { // put it here for I don't wanna repeat these codes in Card::onUse
                    Player victim = room.FindPlayer((string)card_use.To[0].GetTag("collateralVictim"), true);
                    if (victim != null)
                    {
                        log = new LogMessage("#CollateralSlash")
                        {
                            From = card_use.From.Name,
                            To   = new List <string> {
                                victim.Name
                            },
                        };
                        room.SendLog(log);
                        room.DoAnimate(AnimateType.S_ANIMATE_INDICATE, card_use.To[0].Name, victim.Name);
                    }
                }
            }
            else
            {
                CardMoveReason reason = new CardMoveReason(CardMoveReason.MoveReason.S_REASON_THROW, card_use.From.Name, null,
                                                           card_use.Card.Skill, null)
                {
                    CardString = RoomLogic.CardToString(room, card_use.Card),
                    General    = RoomLogic.GetGeneralSkin(room, player, card_use.Card.Skill, card_use.Card.SkillPosition)
                };

                FunctionCard card = Engine.GetFunctionCard(card_use.Card.Name);
                if (card is SkillCard && WillThrow)
                {
                    room.MoveCardTo(card_use.Card, card_use.From, null, Place.PlaceTable, reason, true);
                }
                room.SendLog(log);

                if (WillThrow)
                {
                    List <int> table_cardids = room.GetCardIdsOnTable(card_use.Card);
                    if (table_cardids.Count > 0)
                    {
                        CardsMoveStruct move = new CardsMoveStruct(table_cardids, player, null, Place.PlaceTable, Place.DiscardPile, reason);
                        room.MoveCardsAtomic(new List <CardsMoveStruct> {
                            move
                        }, true);
                    }
                }
            }
            room.RoomThread.Trigger(TriggerEvent.CardUsedAnnounced, room, player, ref data);
            room.RoomThread.Trigger(TriggerEvent.CardTargetAnnounced, room, player, ref data);

            room.RoomThread.Trigger(TriggerEvent.CardUsed, room, player, ref data);
            room.RoomThread.Trigger(TriggerEvent.CardFinished, room, player, ref data);
        }