Exemplo n.º 1
0
        public static string TypeToString(this SuperType superType)
        {
            List <string> types = new List <string>();

            if (superType.HasFlag(SuperType.Basic))
            {
                types.Add("Basic");
            }
            if (superType.HasFlag(SuperType.Legendary))
            {
                types.Add("Legendary");
            }
            if (superType.HasFlag(SuperType.Snow))
            {
                types.Add("Snow");
            }
            if (superType.HasFlag(SuperType.Elite))
            {
                types.Add("Elite");
            }
            if (superType.HasFlag(SuperType.World))
            {
                types.Add("World");
            }
            return(string.Join(" ", types));
        }
        public static List <string> GetSuperTypes(Dictionary <string, string> query = null)
        {
            try
            {
                string queryString = string.Empty;
                HttpResponseMessage stringTask;
                List <string>       superTypes = new List <string>();
                query = QueryBuilderHelper.GetDefaultQuery(query);

                using (HttpClient client = QueryBuilderHelper.SetupClient())
                {
                    stringTask = QueryBuilderHelper.BuildTaskString(query, ref queryString, client, ResourceTypes.SuperTypes);
                    SuperType type = QueryBuilderHelper.CreateObject <SuperType>(stringTask);
                    superTypes.AddRange(type.Types);
                    return(superTypes);
                }
            }
            catch (Exception ex)
            {
                List <string> errors = new List <string>()
                {
                    ex.Message
                };
                return(errors);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Adds a prefix for subtypes.
 /// </summary>
 private void GetPrefix(StringBuilder prefix)
 {
     if (SuperType != null)
     {
         SuperType.GetPrefix(prefix);
         prefix.Append("--");
     }
 }
Exemplo n.º 4
0
            public void OfType_WhenUnassignable_ReturnsNoneOfAssignedType()
            {
                Option <SuperType> super = new SuperType();

                var result = super.OfType <DerivedType>();

                result.Should().BeOfType <None <DerivedType> >();
            }
Exemplo n.º 5
0
        public string Factory(ICondition condition)
        {
            SuperType superType = new SuperType();
            superType._condition = condition;
            GetStatus getStatus=new GetStatus();
            superType.Accept(getStatus);

            return getStatus.status;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Compare with Cypher orderability semantics for disjoint types
        /// </summary>
        /// <param name="lhs"> </param>
        /// <param name="rhs">
        /// @return </param>
        public static int Compare(object lhs, object rhs)
        {
            if (lhs == rhs)
            {
                return(0);
            }
            // null is greater than any other type
            else if (lhs == Values.NO_VALUE || lhs == null)
            {
                return(1);
            }
            else if (rhs == Values.NO_VALUE || rhs == null)
            {
                return(-1);
            }
            else if (lhs is AnyValue)
            {
                AnyValue rhsValue = (rhs is AnyValue) ? ( AnyValue )rhs : ValueUtils.of(rhs);
                return(AnyValues.COMPARATOR.Compare(( AnyValue )lhs, rhsValue));
            }
            else if (rhs is AnyValue)
            {
                AnyValue lhsValue = ValueUtils.of(lhs);
                return(AnyValues.COMPARATOR.Compare(lhsValue, ( AnyValue )rhs));
            }
            // Compare the types
            // TODO: Test coverage for the Orderability CIP
            SuperType leftType  = SuperType.ofValue(lhs);
            SuperType rightType = SuperType.ofValue(rhs);

            int typeComparison = SuperType.TYPE_ID_COMPARATOR.compare(leftType, rightType);

            if (typeComparison != 0)
            {
                // Types are different an decides the order
                return(typeComparison);
            }

            return(leftType.comparator.compare(lhs, rhs));
        }
Exemplo n.º 7
0
 public void AddSuper(Super super, SuperType type)
 {
     this.mBeeHive.Supers.Add(super, type);
 }
Exemplo n.º 8
0
        private void AddSuper(InventoryItem item, SuperType type)
        {
            var lSuper = (Super) item.Tag;

            this.mBeeHive.Supers.Add(lSuper, type);
            this.mPlayer.Supers.Remove(lSuper);
        }
Exemplo n.º 9
0
        public Card(string name, string edition)
        {
            try
            {
                m_tags = new List<CardTag>();
                m_colors = new List<CardColor>();
                m_fix = new List<CardColor>();
                m_name = name;
                m_edition = edition;

                m_pic = Image.FromFile(edition + @"\Img\" + name + ".dmf-img");

                StreamReader reader = new StreamReader(edition + @"\Card\" + name + ".dmf-card");

                var lineX = reader.ReadLine().Split('|');
                m_cc = lineX[0];
                var hybridSections = m_cc.Split('/');
                int hybridSym = hybridSections.Length;
                m_cmc = hybridSections.Length - 1;
                string newCC = m_cc;
                if (m_cc.Contains('/'))
                {
                    for (int i = 0; i < hybridSections.Length; i++)
                    {
                        if (i == 0)
                            newCC = hybridSections[i].Remove(hybridSections[i].Length - 1);
                        else if (i == hybridSections.Length - 1)
                            newCC += hybridSections[i].Remove(0, 1);
                        else
                        {
                            string toAttach = hybridSections[i].Remove(hybridSections[i].Length - 1);
                            newCC += toAttach.Remove(0, 1);
                        }
                    }
                }
                m_cmc += InstancesOf('W', newCC);
                m_cmc += InstancesOf('U', newCC);
                m_cmc += InstancesOf('B', newCC);
                m_cmc += InstancesOf('R', newCC);
                m_cmc += InstancesOf('G', newCC);
                m_cmc += gInclude.Parse.String2Int(newCC.Replace('W', ' ').Replace('U', ' ').Replace('B', ' ').Replace('R', ' ').Replace('G', ' '));


                if (lineX.Length == 3)
                {
                    m_power = gInclude.Parse.String2Int(lineX[1]);
                    m_toughness = gInclude.Parse.String2Int(lineX[2]);
                }
                else if (lineX.Length == 2)
                    m_toughness = gInclude.Parse.String2Int(lineX[1]);

                var line = reader.ReadLine().Split('|');
                m_superType = (SuperType)Enum.Parse(typeof(SuperType), line[0]);
                m_isTribal = String2Bool(line[1]);
                m_isLegend = String2Bool(line[2]);

                line = reader.ReadLine().Split('|');
                m_color = (CardColor)Enum.Parse(typeof(CardColor), line[0]);
                m_rarity = (Rarity)Enum.Parse(typeof(Rarity), reader.ReadLine());
                var tmp = reader.ReadLine();
                if (tmp == null)
                    m_tags.Add(CardTag.Misc);
                else
                {
                    var tempX = tmp.Split('|');
                    foreach (string tag in tempX)
                        m_tags.Add((CardTag)Enum.Parse(typeof(CardTag), tag));
                }

                if (line.Length > 1 && (m_color == CardColor.Multicolor || m_color == CardColor.Hybrid))
                {
                    for (int i = 1; i < line.Length; i++)
                        m_colors.Add((CardColor)Enum.Parse(typeof(CardColor), line[i]));
                }

                var temp = reader.ReadLine();
                if (temp != null)
                {
                    line = temp.Split('|');
                    foreach (string clr in line)
                        m_fix.Add((CardColor)Enum.Parse(typeof(CardColor), clr));
                }

                reader.Close();

                reader = new StreamReader(edition + @"\Tip\" + name + ".dmf-tip");
                m_tip = reader.ReadLine();
                m_defRating = gInclude.Parse.String2Int(reader.ReadLine());
                line = reader.ReadLine().Split('|');
                m_playerRating = gInclude.Parse.String2Int(line[0]);
                if (line.Length > 1)
                    m_drafted = gInclude.Parse.String2Int(line[1]);
                else
                    m_drafted = 0;
                reader.Close();

                if (m_playerRating < 0)
                    m_playerRating = 0;
            }
            catch (Exception e) { throw new ArgumentException("ERROR with card " + name + " - " + e.Data + "; " + e.Message); }
        }
Exemplo n.º 10
0
    public void LaunchSuper(Vector2 direction, CurrentPlayer throwingPlayer, float addedPower, Vector2 playerThrowDirection, GameObject ball, int overrideSuperId = 0, GameObject lastSuperEffect = null)
    {
        _ball = ball;
        SuperType tmpSuper = Super;

        if (overrideSuperId == 0) // Normal Super
        {
            _ball.GetComponent <BallBehavior>().SuperId         = Super.GetHashCode();
            _ball.GetComponent <BallBehavior>().LastSuperEffect = Effect;
            _overridenEffect = null;
        }
        else // Thrown Back Super
        {
            tmpSuper         = (SuperType)overrideSuperId;
            _overridenEffect = lastSuperEffect;
        }
        _currentThrowDirection = direction;
        _playerThrowDirection  = playerThrowDirection;
        //_currentPlayer = GameObject.Find (throwingPlayer.ToString());
        switch (tmpSuper)
        {
        case SuperType.Super01:
            direction = ExtremeFromCurrentDirection();
            BasicEffectThrow(direction, throwingPlayer, addedPower);
            _ball.GetComponent <BallBehavior> ().onWallCollisionDelegate = StraightOnCollision;
            break;

        case SuperType.Super02:
            BasicEffectThrow(playerThrowDirection, throwingPlayer, addedPower);
            Invoke("InstantiateZigzag", _zigzagDelay);
            break;

        case SuperType.Super03:
            BasicEffectThrow(direction, throwingPlayer, addedPower);
            _bounce = _bounceCount;
            _ball.GetComponent <BallBehavior> ().onPlayerCollisionDelegate = PanzerBounce;
            break;

        case SuperType.Super04:
            FreezeGoals();
            BasicEffectThrow(direction, throwingPlayer, addedPower);
            break;

        case SuperType.Super05:
            _superEffectDelay = _superEffectDelay / 1.5f;
            BasicEffectThrow(direction, throwingPlayer, addedPower, 8);
            Invoke("ResetSuperEffectDelay", 1.0f);
            break;

        case SuperType.Super06:
            //if (!_hasInstantiateNewDisc) InstantiateNewDisc();
            //_superEffectDelay = _superEffectDelay * 3;
            direction = OnlySideFromCurrentDirection();
            BasicEffectThrow(direction, throwingPlayer, addedPower);
            ShadowThrow(new Vector2(direction.x * -1.0f, direction.y), throwingPlayer, addedPower);
            //Invoke ("DisableInstantiate", 1.0f);
            //Invoke ("ResetSuperEffectDelay", 5.0f);
            break;

        default:
            break;
        }
    }