Example #1
0
    // Adds a rule to the lists.
    public void AddRule(LoreRule rule, int index)
    {
        if (consumedProperties.Count == 0)
        {
            // Checks if there is no other rule yet, which means it will store everything right away.
            consumedProperties.AddRange(rule.ConsumedProperties);
            producedProperties.Add(rule.ProducedProperties);
            producedStory.Add(rule.RuleStory);
            ruleNumber.Add(index);
        }
        else
        {
            // Checks if the given rule has the same entry requirements as the one saved earlier.
            if (rule.HasSameConsumedProperties(this.consumedProperties))
            {
                // if so, check if this rule doesn't exist yet.
                for (int i = 0; i < producedProperties.Count; i++)
                {
                    if (rule.HasSameProducedProperties(producedProperties[i]))
                    {
                        return;
                    }
                }

                // if not add it to the list.
                producedProperties.Add(rule.ProducedProperties);
                producedStory.Add(rule.RuleStory);
                ruleNumber.Add(index);
            }
        }
    }
Example #2
0
 public LoreProcessedRule(LoreRule rule, int index)
 {
     AddRule(rule, index);
 }