コード例 #1
0
        private static ReturnTypes CloneObjectSpellAction(SkillData skill, int level, CharacterInstance ch, ObjectInstance obj)
        {
            switch (Macros.SPELL_POWER(skill))
            {
            case (int)SpellPowerTypes.Minor:
                if (CheckFunctions.CheckIfTrueCasting(
                        (ch.Level - obj.Level < 20) || (obj.Cost > ch.Level * ch.GetCurrentIntelligence() / 5),
                        skill, ch, CastingFunctionType.Failed, null, obj))
                {
                    return(ReturnTypes.None);
                }
                break;

            case (int)SpellPowerTypes.Greater:
                if (CheckFunctions.CheckIfTrueCasting((ch.Level - obj.Level < 5) ||
                                                      (obj.Cost > ch.Level * 10 * ch.GetCurrentIntelligence() * ch.GetCurrentWisdom()),
                                                      skill, ch, CastingFunctionType.Failed, null, obj))
                {
                    return(ReturnTypes.None);
                }
                break;

            case (int)SpellPowerTypes.Major:
                if (CheckFunctions.CheckIfTrueCasting((ch.Level - obj.Level < 0) ||
                                                      (obj.Cost > ch.Level * 50 * ch.GetCurrentIntelligence() * ch.GetCurrentWisdom()),
                                                      skill, ch, CastingFunctionType.Failed, null, obj))
                {
                    return(ReturnTypes.None);
                }

                ObjectInstance clonedObj = null;        // TODO Clone ObjectInstance
                clonedObj.Timer = !string.IsNullOrEmpty(skill.Dice) ? magic.ParseDiceExpression(ch, skill.Dice) : 0;
                clonedObj.AddTo(ch);
                ch.SuccessfulCast(skill, null, obj);
                break;

            default:
                if (CheckFunctions.CheckIfTrueCasting((ch.Level - obj.Level < 10) ||
                                                      (obj.Cost > ch.Level * ch.GetCurrentIntelligence() * ch.GetCurrentWisdom()),
                                                      skill, ch, CastingFunctionType.Failed, null, obj))
                {
                    return(ReturnTypes.None);
                }
                break;
            }

            return(ReturnTypes.None);
        }