Example #1
0
    Ability GeneAbility(AbilityBase abilityBase, int level = 1)
    {
        if (level > abilityBase.maxLevel)
        {
            Debug.Log(string.Format("Level of ability '{0}' should not be larger than maxLevel", abilityBase.name));
            throw new System.ArgumentException(string.Format("Level of ability '{0}' should not be larger than maxLevel", abilityBase.name));
        }

        string iconName = abilityBase.icon;

        if (iconName == null)
        {
            iconName = abilityBase.name;
        }
        Texture     icon        = _abilityIconTable[iconName];
        AbilityCast abilityCast = AbilityCastStatic.GetAbilityCast(abilityBase.abilityCast);
//		EffectCard effectCard=EffectCardStatic.GetEffectCard(abilityBase.effectCard);
        Dictionary <string, int> variables    = new Dictionary <string, int>();
        List <string>            variableName = abilityBase._variables;
        List <int> variableValue = abilityBase._variableValueTable[level - 1];

        for (int i = 0; i < variableName.Count; i++)
        {
            variables.Add(variableName[i], variableValue[i]);
        }
        return(new Ability(abilityBase, icon, level, abilityCast, variables));
    }
Example #2
0
    bool CheckAbilityValidity(AbilityBase abilityBase)
    {
        bool bPass = true;

        bPass &= AbilityCastStatic.HasAbilityCast(abilityBase.abilityCast);
//				bPass &= EffectCardStatic.HasEffectCard (abilityBase.effectCard);
        foreach (string variableName in abilityBase.variables)
        {
            bPass &= AbilityVariable.HasVariableString(variableName);
        }
        return(bPass);
    }