Ejemplo n.º 1
0
        public override void Apply()
        {
            if (skill != null)
            {
                uint requiredSkillValue = method.RequiredSkillValue;
                uint diff = skill.ActualValue - (requiredSkillValue == 1U ? 0U : requiredSkillValue);
                if (!CheckSuccess(diff))
                {
                    m_cast.Cancel(SpellFailedReason.TryAgain);
                    return;
                }

                skill.CurrentValue = (ushort)Math.Min(skill.ActualValue + (ushort)Gain(diff),
                                                      skill.MaxValue);
            }

            Character chr = m_cast.CasterChar;

            chr.AddMessage(() =>
            {
                if (lockable is ObjectBase && !((ObjectBase)lockable).IsInWorld)
                {
                    return;
                }
                LockEntry.Handle(chr, lockable,
                                 method != null ? method.InteractionType : LockInteractionType.None);
            });
        }
Ejemplo n.º 2
0
        public override void Apply()
        {
            if (skill != null)
            {
                // check if the skill works
                var reqSkill = method.RequiredSkillValue;
                var diff     = skill.ActualValue - (reqSkill == 1 ? 0 : reqSkill);

                if (!CheckSuccess(diff))
                {
                    // failed
                    m_cast.Cancel(SpellFailedReason.TryAgain);
                    return;
                }

                // skill gain
                var skillVal = skill.ActualValue;
                skillVal          += (ushort)Gain(diff);
                skillVal           = Math.Min(skillVal, skill.MaxValue);
                skill.CurrentValue = (ushort)skillVal;
            }

            // open lock
            var chr = m_cast.CasterChar;

            chr.AddMessage(() =>
            {
                if (lockable is ObjectBase && !((ObjectBase)lockable).IsInWorld)
                {
                    return;
                }

                LockEntry.Handle(chr, lockable, method != null ? method.InteractionType : LockInteractionType.None);
            });
        }