示例#1
0
        /// <summary>
        /// Determine whether a given creature fits this slot.
        /// </summary>
        /// <param name="card">The creature.</param>
        /// <param name="encounter_level">The level of the encounter.</param>
        /// <returns>True if the creature matches; false otherwise.</returns>
        public bool Match(EncounterCard card, int encounter_level)
        {
            ICreature creature = Session.FindCreature(card.CreatureID, SearchType.Global);

            // Check the level
            int level = encounter_level + fLevelAdjustment;

            if (level < 1)
            {
                level = 1;
            }
            if (creature.Level != level)
            {
                return(false);
            }

            // Check minion status
            bool is_minion = (creature.Role is Minion);

            if (is_minion != fMinions)
            {
                return(false);
            }

            // Check the role matches
            bool role_ok = false;

            if (fRoles.Count == 0)
            {
                // We match any role
                role_ok = true;
            }
            else
            {
                ComplexRole role = creature.Role as ComplexRole;
                foreach (RoleType r in card.Roles)
                {
                    if (fRoles.Contains(role.Type))
                    {
                        role_ok = true;
                        break;
                    }
                }
            }
            if (!role_ok)
            {
                return(false);
            }

            // Check the elite / solo flag matches
            if (fFlag != card.Flag)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Creates a copy of the role.
        /// </summary>
        /// <returns>Returns the copy.</returns>
        public IRole Copy()
        {
            ComplexRole cr = new ComplexRole();

            cr.Type   = fType;
            cr.Flag   = fFlag;
            cr.Leader = fLeader;

            return(cr);
        }
示例#3
0
        public IRole Copy()
        {
            ComplexRole complexRole = new ComplexRole()
            {
                Type   = this.fType,
                Flag   = this.fFlag,
                Leader = this.fLeader
            };

            return(complexRole);
        }
        public bool Match(EncounterCard card, int encounter_level)
        {
            ICreature creature       = Session.FindCreature(card.CreatureID, SearchType.Global);
            int       encounterLevel = encounter_level + this.fLevelAdjustment;

            if (encounterLevel < 1)
            {
                encounterLevel = 1;
            }
            if (creature.Level != encounterLevel)
            {
                return(false);
            }
            if (creature.Role is Minion != this.fMinions)
            {
                return(false);
            }
            bool flag = false;

            if (this.fRoles.Count != 0)
            {
                ComplexRole role = creature.Role as ComplexRole;
                foreach (RoleType roleType in card.Roles)
                {
                    if (!this.fRoles.Contains(role.Type))
                    {
                        continue;
                    }
                    flag = true;
                    break;
                }
            }
            else
            {
                flag = true;
            }
            if (!flag)
            {
                return(false);
            }
            if (this.fFlag != card.Flag)
            {
                return(false);
            }
            return(true);
        }