Ejemplo n.º 1
0
        public float ScriptFormula(int index)
        {
            float result;

            if (!ScriptFormulaEvaluator.Evaluate(this.PowerSNO, PowerTagHelper.GenerateTagForScriptFormula(index),
                                                 User.Attributes, Rand, out result))
            {
                return(0);
            }

            return(result);
        }
Ejemplo n.º 2
0
        private static ScriptFormula FindScriptFormula(int powerSNO, TagKeyScript scriptTag)
        {
            TagMap tagmap = PowerTagHelper.FindTagMapWithKey(powerSNO, scriptTag);

            if (tagmap != null)
            {
                return(tagmap[scriptTag]);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        private TagMap _FindTagMapWithKey(TagKey key)
        {
            TagMap tagmap = PowerTagHelper.FindTagMapWithKey(PowerSNO, key);

            if (tagmap != null)
            {
                return(tagmap);
            }
            else
            {
                //Logger.Error("could not find tag key {0} in power {1}", key.ID, PowerSNO);
                return(null);
            }
        }
Ejemplo n.º 4
0
        private static bool LoadIdentifier(int powerSNO, TagKeyScript scriptTag, GameAttributeMap attributes, Random rand,
                                           int numb1, int numb2, int numb3, int numb4,
                                           out float result)
        {
            switch (numb1)
            {
            case 0:
                return(LoadAttribute(powerSNO, attributes, numb2, out result));

            case 1:     // slevel
                result = attributes[GameAttribute.Skill, powerSNO];
                return(true);

            case 22:     // absolute power formula ref
                return(Evaluate(numb2, new TagKeyScript(numb3), attributes, rand, out result));

            default:
                if (numb1 >= 23 && numb1 <= 62)     // SF_N, relative power formula ref
                {
                    int          SF_N        = numb1 - 23;
                    TagKeyScript relativeTag = PowerTagHelper.GenerateTagForScriptFormula(SF_N);
                    return(Evaluate(powerSNO, relativeTag, attributes, rand, out result));
                }
                else if (numb1 >= 63 && numb1 <= 72)     // known gamebalance power table id range
                {
                    result = BinaryIntToFloat(numb1);    // simply store id, used later by Table()
                    return(true);
                }
                else
                {
                    Logger.Error("unknown identifier");
                    result = 0;
                    return(false);
                }
            }
        }