コード例 #1
0
        public override List <int> AskForDiscard(List <int> ids, string reason, int discard_num, int min_num, bool optional)
        {
            List <int> result;
            SkillEvent skill = Engine.GetSkillEvent(reason);

            if (skill != null)
            {
                result = skill.OnDiscard(this, self, ids, min_num, discard_num, optional);
                if (result != null)
                {
                    return(result);
                }
            }

            result = new List <int>();
            if (optional)
            {
                return(result);
            }

            SortByKeepValue(ref ids, false);
            for (int i = 0; i < min_num; i++)
            {
                result.Add(ids[i]);
            }

            if (result.Count < discard_num)
            {
                for (int i = result.Count - 1; i < Math.Min(result.Count, ids.Count); i++)
                {
                    if (ids[i] < 0)
                    {
                        result.Add(ids[i]);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            return(result);
        }
コード例 #2
0
        public override List <int> AskForDiscard(List <int> ids, string reason, int discard_num, int min_num, bool optional)
        {
            List <int> result;
            SkillEvent skill = Engine.GetSkillEvent(reason);

            if (skill != null)
            {
                result = skill.OnDiscard(this, self, ids, min_num, discard_num, optional);
                if (result != null)
                {
                    return(result);
                }
            }

            result = new List <int>();
            if (optional)
            {
                return(result);
            }
            {
                bool use = self.FaceUp;
                if (use && (room.Current != self || self.Phase > Player.PlayerPhase.Play || self.GetMark("ThreatenEmperorExtraTurn") == 0))
                {
                    Player next = room.Current;
                    if ((next.Phase > Player.PlayerPhase.Play && (next.GetMark("ThreatenEmperorExtraTurn") == 0 || !next.FaceUp)) || self.Removed)
                    {
                        next = room.GetNextAlive(next, 1, false);
                    }
                    int i = 0;
                    while (next != self)
                    {
                        if (next.FaceUp && !IsFriend(next))
                        {
                            use = false;
                            break;
                        }
                        next = room.GetNextAlive(next, 1, false);
                        i++;
                        if (i > 10)
                        {
                            room.Debug("get next error");
                        }
                    }
                }

                if (use)
                {
                    SortByUseValue(ref ids, false);
                }
                else
                {
                    SortByKeepValue(ref ids, false);
                }

                for (int i = 0; i < min_num; i++)
                {
                    result.Add(ids[i]);
                }

                if (result.Count < discard_num)
                {
                    for (int i = result.Count - 1; i < Math.Min(result.Count, ids.Count); i++)
                    {
                        if (ids[i] < 0)
                        {
                            result.Add(ids[i]);
                        }
                        else
                        {
                            break;
                        }
                    }
                }

                return(result);
            }
        }