Пример #1
0
    public void ApplyCostIncreaseToSkill(int iSkill)
    {
        //TODO BUG (FUTURE) - eventually when you can adapt/switch skills, this will only affect the
        //                    skills at the time this soul effect was applied.  So if you switch to a skill
        //                    then that skill (even if a cantrip) won't have its cost increased.  Will have to
        //                    a trigger listener for a skill switch event that will remove swap the applied cost
        //                    modifier for the old skill and apply it to the newly swapped in skill

        //No need to try to reduce the cost of an skill that is null - likely won't come up once characters get the full amount of skills
        if (chrTarget.arSkillSlots[iSkill].skill == null)
        {
            return;
        }

        Property <Mana> .Modifier costIncrease =
            (mana) => {
            if (chrTarget.arSkillSlots[iSkill].skill.typeUsage.Type() == TypeUsage.TYPE.CANTRIP)
            {
                //Increase the cost if the skill is a cantrip
                return(new Mana(LibFunc.AddArray <int>(mana.arMana, arnCostDebuff, (x, y) => (x + y))));
            }
            else
            {
                //Otherwise, keep the cost the same
                return(mana);
            }
        };

        LinkedListNode <Property <Mana> .Modifier> costChange = chrTarget.arSkillSlots[iSkill].skill.ChangeCost(costIncrease);

        arnodeCostModifier.SetValue(costChange, iSkill);

        //UNNEEDED CURRENTLY - ONLY FOR AFFECTING THE FIRST USED SKILL
        //chrTarget.subPostExecuteSkill.Subscribe(OnSkillUsage);
    }
Пример #2
0
        protected T GetChecked <T>(LibFunc <T, DbRetCode> libFunc)
        {
            var handle = CheckDisposed();
            var ret    = libFunc(handle, out T result);

            ErrorUtil.CheckRetCode(ret);
            return(result);
        }