Exemplo n.º 1
0
        public MoveDefinition(string definition)
        {
            this.direction = MoveDirection.None;
            this.condition = MoveCondition.Default;

            foreach (char c in definition)
            {
                if ("^|=><".Contains(c))
                {
                    this.direction |= (MoveDirection)Math.Pow(2, "^|=><".IndexOf(c) + 1);
                }

                if ("12n".Contains(c))
                {
                    this.distance = c == 'n' ? int.MaxValue : (int)char.GetNumericValue(c);
                }

                if ("ico".Contains(c))
                {
                    this.condition |= (MoveCondition)Math.Pow(2, "ico".IndexOf(c) + 1);
                }
            }

            direction &= ~MoveDirection.None;
        }
Exemplo n.º 2
0
        public MoveCondition ToMoveCondition(GameData gameData)
        {
            var newMC = new MoveCondition();

            newMC.type         = Type;
            newMC.tokenType    = TokenType;
            newMC.boolValue    = BoolValue;
            newMC.resourceType = ResourceType;
            newMC.comparison   = Comparison;
            newMC.val          = Val;
            newMC.inverse      = Inverse;

            newMC.tokenDefinition = gameData.Tokens.Get(TokenDefinitionID);

            return(newMC);
        }
Exemplo n.º 3
0
        public MoveConditionInfo(MoveCondition moveCondition)
        {
            if (moveCondition == null)
            {
                throw new ArgumentNullException(nameof(moveCondition));
            }

            Type         = moveCondition.type;
            TokenType    = moveCondition.tokenType;
            BoolValue    = moveCondition.boolValue;
            ResourceType = moveCondition.resourceType;
            Comparison   = moveCondition.comparison;
            Val          = moveCondition.val;
            Inverse      = moveCondition.inverse;

            TokenDefinitionID = moveCondition.tokenDefinition?.id ?? -1;
        }
Exemplo n.º 4
0
            public IfPart Clone()
            {
                MoveCondition condition = (MoveCondition)this.MemberwiseClone();

                return(condition);
            }
Exemplo n.º 5
0
 public MoveDefinition(MoveDirection direction, int distance, MoveCondition condition)
 {
     this.direction = direction;
     this.distance  = distance;
     this.condition = condition;
 }