예제 #1
0
        public static string GetSkillToUse(SMCharacter attackingCharacter)
        {
            string skillToUse = "Brawl";

            if (!attackingCharacter.AreHandsEmpty())
            {
                // Get the equipped item from the character if any
                SMItem smi = attackingCharacter.GetEquippedItem();
                skillToUse = "Basic Attack";

                if ((smi != null) && (smi.RequiredSkills != null))
                {
                    // Check the player has the required skills
                    bool hasAllRequiredSkills = true;
                    bool isFirst = true;

                    foreach (SMRequiredSkill smrs in smi.RequiredSkills)
                    {
                        if (hasAllRequiredSkills)
                        {
                            hasAllRequiredSkills = attackingCharacter.HasRequiredSkill(smrs.SkillName, smrs.SkillLevel);
                            if (isFirst)
                            {
                                skillToUse = smrs.SkillName;
                            }
                        }
                    }

                    // If the player has all the required skills
                    if (!hasAllRequiredSkills)
                    {
                        // Tell the player they can't really wield that item.
                        attackingCharacter.sendMessageToPlayer(ResponseFormatterFactory.Get().General($"You are not skilled with the {smi.ItemFamily}, practicing gives you a chance to increase your skill"));
                    }
                }
            }
            return(skillToUse);
        }