Exemplo n.º 1
0
        public FixPoint GetVariable(ExpressionVariable variable, int index)
        {
            int vid = variable[index];

            if (index == variable.MaxIndex)
            {
                if (vid == ExpressionVariable.VID_Value)
                {
                    return(Value);
                }
                else if (vid == ExpressionVariable.VID_BaseValue)
                {
                    return(BaseValue);
                }
                else
                {
                    return(ObjectUtil.GetVariable(m_owner_component.ParentObject, vid));
                }
            }
            else if (vid == ExpressionVariable.VID_LevelTable)
            {
                return(m_owner_component.GetLogicWorld().GetConfigProvider().GetLevelBasedNumber(variable[index + 1], ObjectUtil.GetLevel(m_owner_component.ParentObject)));
            }
            else if (vid == ExpressionVariable.VID_ModifierList)
            {
                ++index;
                vid = variable[index];
                return(GetModifierValueOfOneCategory(vid));
            }
            else
            {
                return(m_owner_component.GetVariable(variable, index));
            }
        }
Exemplo n.º 2
0
        public virtual FixPoint GetVariable(ExpressionVariable variable, int index)
        {
            int vid = variable[index];

            if (index == variable.MaxIndex)
            {
                FixPoint value;
                if (GetVariable(vid, out value))
                {
                    return(value);
                }
                else
                {
                    return(ObjectUtil.GetVariable(GetOwnerObject(), vid));
                }
            }
            else if (vid == ExpressionVariable.VID_LevelTable)
            {
                return(GetLogicWorld().GetConfigProvider().GetLevelBasedNumber(variable[index + 1], ObjectUtil.GetLevel(GetOwnerObject())));
            }
            else if (vid == ExpressionVariable.VID_Object)
            {
                Object owner_object = GetOwnerObject();
                if (owner_object != null)
                {
                    return(owner_object.GetVariable(variable, index + 1));
                }
            }
            else if (vid == ExpressionVariable.VID_Entity)
            {
                Object owner_entity = GetOwnerEntity();
                if (owner_entity != null)
                {
                    return(owner_entity.GetVariable(variable, index + 1));
                }
            }
            else if (vid == ExpressionVariable.VID_Player)
            {
                Object owner_player = GetOwnerPlayer();
                if (owner_player != null)
                {
                    return(owner_player.GetVariable(variable, index + 1));
                }
            }
            Object owner = GetOwnerObject();

            if (owner != null)
            {
                return(owner.GetVariable(variable, index));
            }
            else
            {
                return(FixPoint.Zero);
            }
        }
Exemplo n.º 3
0
        public FixPoint GetVariable(ExpressionVariable variable, int index)
        {
            int vid = variable[index];

            if (index == variable.MaxIndex)
            {
                return(ObjectUtil.GetVariable(this, vid));
            }
            else if (vid == ExpressionVariable.VID_LevelTable)
            {
                return(GetLogicWorld().GetConfigProvider().GetLevelBasedNumber(variable[index + 1], ObjectUtil.GetLevel(this)));
            }
            else if (vid == ExpressionVariable.VID_Attribute)
            {
                AttributeManagerComponent cmp = GetComponent(AttributeManagerComponent.ID) as AttributeManagerComponent;
                if (cmp != null)
                {
                    return(cmp.GetVariable(variable, index + 1));
                }
            }
            else if (vid == ExpressionVariable.VID_Object)
            {
                Object owner_object = GetOwnerObject();
                if (owner_object != null)
                {
                    return(owner_object.GetVariable(variable, index + 1));
                }
            }
            else if (vid == ExpressionVariable.VID_Entity)
            {
                Object owner_entity = GetOwnerEntity();
                if (owner_entity != null)
                {
                    return(owner_entity.GetVariable(variable, index + 1));
                }
            }
            else if (vid == ExpressionVariable.VID_Player)
            {
                Object owner_player = GetOwnerPlayer();
                if (owner_player != null)
                {
                    return(owner_player.GetVariable(variable, index + 1));
                }
            }
            else if (vid == ExpressionVariable.VID_Master)
            {
                Object master = GetOwnerEntity();
                SummonedEntityComponent summoned_component = GetComponent(SummonedEntityComponent.ID) as SummonedEntityComponent;
                if (summoned_component != null)
                {
                    Entity entity = GetLogicWorld().GetEntityManager().GetObject(summoned_component.MasterID);
                    if (entity != null)
                    {
                        master = entity;
                    }
                }
                return(master.GetVariable(variable, index + 1));
            }
            else if (vid == ExpressionVariable.VID_UltimateMaster)
            {
                Object master = GetOwnerEntity();
                SummonedEntityComponent summoned_component = GetComponent(SummonedEntityComponent.ID) as SummonedEntityComponent;
                while (summoned_component != null)
                {
                    Entity entity = GetLogicWorld().GetEntityManager().GetObject(summoned_component.MasterID);
                    if (entity == null)
                    {
                        break;
                    }
                    master             = entity;
                    summoned_component = entity.GetComponent(SummonedEntityComponent.ID) as SummonedEntityComponent;
                }
                return(master.GetVariable(variable, index + 1));
            }
            Object owner = GetOwnerObject();

            if (owner != null)
            {
                return(owner.GetVariable(variable, index));
            }
            else
            {
                return(FixPoint.Zero);
            }
        }