Example #1
0
 public void GiveGroupExperience(Character expEarner, long expGained, string reason)
 {
     if (this.groupMemberIDList != null)
     {
         int membersInView = 0;
         for (int a = 0; a < this.groupMemberIDList.Count; a++)
         {
             if (TargetAcquisition.FindTargetInView(expEarner, PC.GetOnline((int)groupMemberIDList[a]).Name, true, true) != null)
             {
                 membersInView++;
             }
         }
         for (int a = 0; a < this.groupMemberIDList.Count; a++)
         {
             Character groupMember = PC.GetOnline((int)groupMemberIDList[a]);
             if (Math.Abs(this.HighestLevel - groupMember.Level) <= LEVEL_DIFFERENCE_LIMIT)
             {
                 if (TargetAcquisition.FindTargetInView(expEarner, groupMember.Name, true, true) != null)
                 {
                     groupMember.Experience += Convert.ToInt64(expGained / membersInView);
                 }
             }
         }
     }
     else
     {
         expEarner.Experience += expGained;
     }
 }
Example #2
0
 public void GiveGroupFlag(Character expEarner, string flag, string reason)
 {
     if (this.GroupMemberIDList != null)
     {
         for (int a = 0; a < this.GroupMemberIDList.Count; a++)
         {
             Character groupMember = PC.GetOnline((int)groupMemberIDList[a]);
             if (groupMember != null)
             {
                 if (TargetAcquisition.FindTargetInView(expEarner, groupMember.Name, true, true) != null)
                 {
                     string[] s       = flag.Split(ProtocolYuusha.VSPLIT.ToCharArray());
                     int      questID = Convert.ToInt32(s[0]);
                     if (questID <= 0 || groupMember.GetQuest(questID) != null)
                     {
                         if (!groupMember.QuestFlags.Contains(flag))
                         {
                             groupMember.QuestFlags.Add(flag);
                             groupMember.WriteToDisplay("You have received a quest flag!");
                         }
                     }
                 }
             }
         }
     }
 }
Example #3
0
 public void TeleportGroup(Character teleporter, Cell cell, string reason)
 {
     // cellLock can be used in conjunction with this, check the cell.cellLock
     try
     {
         if (this.GroupMemberIDList != null)
         {
             for (int a = 0; a < this.GroupMemberIDList.Count; a++)
             {
                 Character groupMember = TargetAcquisition.FindTargetInView(teleporter, PC.GetOnline((int)GroupMemberIDList[a]).Name, true, true);
                 if (groupMember != null)
                 {
                     if (cell.cellLock == null || !Cell.PassesCellLock(groupMember, cell.cellLock, true))
                     {
                         groupMember.CurrentCell = cell;
                         if (reason != null && reason != "")
                         {
                             groupMember.WriteToDisplay(reason);
                         }
                     }
                     else
                     {
                         if (cell.cellLock != null && !Cell.PassesCellLock(groupMember, cell.cellLock, false))
                         {
                             if (cell.cellLock.lockFailureString != "")
                             {
                                 groupMember.WriteToDisplay(cell.cellLock.lockFailureString);
                             }
                         }
                     }
                 }
                 else
                 {
                     PC pc = PC.GetOnline((int)GroupMemberIDList[a]);
                     if (pc != null)
                     {
                         this.SendGroupMessage(pc.Name + " was not in view of " + teleporter.Name + " and failed to teleport with the group.", pc.UniqueID);
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Utils.LogException(e);
     }
 }
Example #4
0
 public void impgetnpcfx(string args)
 {
     if ((_chr as PC).ImpLevel < Globals.eImpLevel.DEV)
     {
         _chr.WriteToDisplay("I don't understand your command.");
         return;
     }
     else
     {
         if (args == null)
         {
             _chr.WriteToDisplay("getnpceffects (target)");
             return;
         }
         else
         {
             string[]  sArgs  = args.Split(" ".ToCharArray());
             Character target = TargetAcquisition.FindTargetInView(_chr, sArgs[0], false, true);
             if (target != null)
             {
                 string effectslisting = "";
                 foreach (Effect fx in target.EffectsList.Values)
                 {
                     effectslisting += " [" + Effect.GetEffectName(fx.EffectType) + " Amount: " + fx.Power + " Duration: " + fx.Duration + "]";
                 }
                 _chr.WriteToDisplay(target.Name + "'s Effects " + effectslisting);
                 _chr.WriteToDisplay(target.Name + "'s Protections FIRE: Resist: " + target.FireResistance + " Pro: " + target.FireProtection + " ICE: Resist: " + target.ColdResistance + " Pro: " + target.ColdProtection + " LIGHTNING: Resist: " + target.LightningResistance + " Pro: " + target.LightningProtection +
                                     " POISON: Resist: " + target.PoisonResistance + " Pro: " + target.PoisonProtection + " BLIND: Resist: " + target.BlindResistance + " STUN: Resist: " + target.StunResistance + " DEATH: Resist: " + target.DeathResistance + " Pro: " + target.DeathProtection + " BRWATER: " + target.CanBreatheWater.ToString() +
                                     " FEATHERFALL: " + target.HasFeatherFall.ToString() + " CANSWIM: " + target.CanBreatheWater.ToString() + " CANFLY: " + target.CanFly.ToString() + " CANCOMMAND: " + target.canCommand.ToString() + " Shield: " + target.Shielding + " NV: " + target.HasNightVision.ToString());
             }
             else
             {
                 _chr.WriteToDisplay("Could not find " + sArgs[0] + ".");
                 return;
             }
         }
     }
 }
Example #5
0
        public bool OnPerform(Character chr, string args)
        {
            // if character does not have a hand free they cannot steal
            if (chr.GetFirstFreeHand() == (int)Globals.eWearOrientation.None)
            {
                chr.WriteToDisplay("You don't have a hand free to steal with.");
                return(false);
            }

            // get the array of arguments -- should be target at [1] or item at [1] and target at [2]
            List <string> sArgs = new List <string>(args.Split(" ".ToCharArray()));

            sArgs.RemoveAll(s => s.Equals("from"));

            // target should be the last argument
            Character target = null;

            string itemTarget = "";

            if (sArgs.Count == 1)
            {
                target = TargetAcquisition.FindTargetInCell(chr, sArgs[0]);
            }
            else if (sArgs.Count >= 2)
            {
                if (Int32.TryParse(sArgs[0], out int countTo)) // steal from # <target>
                {
                    target = TargetAcquisition.FindTargetInCell(chr, sArgs[sArgs.Count - 1], countTo);
                }
                else if (sArgs.Count >= 3 && Int32.TryParse(sArgs[1], out countTo)) // steal <item> from # <target>
                {
                    itemTarget = sArgs[0];
                    target     = TargetAcquisition.FindTargetInCell(chr, sArgs[sArgs.Count - 1], countTo);
                }
            }

            // target not found
            if (target == null)
            {
                chr.WriteToDisplay("You don't see " + sArgs[sArgs.Count - 1] + " here.");
                return(false);
            }

            if (target == chr)
            {
                chr.WriteToDisplay("You cannot steal from yourself.");
                return(false);
            }

            if (target != null && target.IsImage)
            {
                chr.WriteToDisplay("You cannot steal from a conjured image.");
                return(false);
            }

            // give experience for a steal attempt
            if (target.IsPC && chr.IsPC)
            {
                Skills.GiveSkillExp(chr, Skills.GetSkillLevel(chr.thievery) - Rules.GetExpLevel(target.Experience), Globals.eSkillType.Thievery);
            }
            else
            {
                Skills.GiveSkillExp(chr, target, Globals.eSkillType.Thievery);
            }

            // 50 percent base chance to steal
            int successChance = 50;

            // if going after a specific item success is reduced by max skill level minus thievery level
            if (sArgs.Count >= 2 && itemTarget != "")
            {
                successChance -= 19 - Skills.GetSkillLevel(chr.thievery);
            }

            Item item = null;

            // this is the 100 sided die roll plus the character's thievery skill level
            int roll = Rules.RollD(1, 100);

            // you successfully steal when the roll plus thievery skill level x 2 is greater than the chance
            if (roll + (Skills.GetSkillLevel(chr.thievery) * 2) > successChance)
            {
                if (target.sackList.Count <= 0)
                {
                    chr.WriteToDisplay("Your target has nothing to steal.");
                    return(true);
                }

                double sackGold = 0;

                foreach (Item sackItem in target.sackList)
                {
                    if (sackItem.itemType == Globals.eItemType.Coin)
                    {
                        sackGold = sackItem.coinValue;
                    }
                }

                // if there is no specific item being sought after
                if (itemTarget == "")
                {
                    // steal gold if gold is in sack and another d100 roll is equal to or greater than base chance
                    if (sackGold > 0 && Rules.RollD(1, 100) >= successChance)
                    {
                        item = Item.CopyItemFromDictionary(Item.ID_COINS);
                        double amount = Rules.RollD(1, (int)sackGold);
                        item.coinValue = amount;
                        sackGold      -= amount;
                        foreach (Item sackItem in target.sackList)
                        {
                            if (sackItem.itemType == Globals.eItemType.Coin)
                            {
                                sackItem.coinValue = sackGold;
                            }
                        }
                    }
                    else
                    {
                        int randomItem = Rules.Dice.Next(target.sackList.Count - 1);
                        item = (Item)target.sackList[randomItem];

                        // Attempting to steal an artifact.
                        if (item.IsArtifact() && chr.PossessesItem(item.itemID))
                        {
                            chr.WriteToDisplay("You have been caught!");
                            target.WriteToDisplay(chr.GetNameForActionResult() + " has attempted to steal " + item.shortDesc + " from you.");
                            Combat.DoFlag(chr, target);
                            Rules.BreakHideSpell(chr);
                            return(true);
                        }

                        target.sackList.RemoveAt(randomItem);
                    }
                }
                else
                {
                    if (!itemTarget.StartsWith("coin"))
                    {
                        item = target.RemoveFromSack(itemTarget);

                        // Attempting to steal an artifact.
                        if (item.IsArtifact() && (chr as PC).PossessesItem(item.itemID))
                        {
                            target.SackItem(item);

                            chr.WriteToDisplay("You have been caught!");
                            target.WriteToDisplay(chr.GetNameForActionResult() + " has attempted to steal " + item.shortDesc + " from you.");
                            Combat.DoFlag(chr, target);
                            Rules.BreakHideSpell(chr);
                            return(true);
                        }
                    }
                    else
                    {
                        if (sackGold > 0)
                        {
                            item = Item.CopyItemFromDictionary(Item.ID_COINS);
                            double amount = Rules.RollD(1, (int)sackGold);
                            item.coinValue = amount;
                            sackGold      -= amount;
                            foreach (Item sackItem in target.sackList)
                            {
                                if (sackItem.itemType == Globals.eItemType.Coin)
                                {
                                    sackItem.coinValue = sackGold;
                                }
                            }
                        }
                        else
                        {
                            chr.WriteToDisplay("You could not find a " + itemTarget + ".");
                            return(true);
                        }
                    }

                    if (item == null)
                    {
                        chr.WriteToDisplay("You could not find a " + itemTarget + ".");
                        return(true);
                    }
                    // further chance to be caught if going after a specific item
                    else if (roll - (Skills.GetSkillLevel(chr.thievery) * 2) > (successChance / 2))
                    {
                        chr.WriteToDisplay("You have been caught!");
                        target.WriteToDisplay(chr.GetNameForActionResult() + " has stolen " + item.shortDesc + " from you.");
                        Combat.DoFlag(chr, target);
                        Rules.BreakHideSpell(chr);
                    }
                }

                chr.EquipEitherHandOrDrop(item);

                Skills.GiveSkillExp(chr, Skills.GetSkillLevel(chr.thievery) * 50, Globals.eSkillType.Thievery);
                //if (target.IsPC && chr.IsPC)
                //    Skills.GiveSkillExp(chr, Skills.GetSkillLevel(chr.thievery) - Rules.GetExpLevel(target.Experience), Globals.eSkillType.Thievery);
                //else
                //    Skills.GiveSkillExp(chr, target, Globals.eSkillType.Thievery);

                chr.WriteToDisplay("You have stolen " + item.shortDesc + " from " + target.GetNameForActionResult(true) + ".");
            }
            else
            {
                chr.WriteToDisplay("You have been caught!");
                target.WriteToDisplay(chr.Name + " has attempted to steal from you!");
                Combat.DoFlag(chr, target);
                Rules.BreakHideSpell(chr);
            }
            return(true);
        }
Example #6
0
        public bool OnPerform(Character chr, string args)
        {
            if (args == null)
            {
                chr.WriteToDisplay("DaggerStorm who?");
                return(false);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            Character target = TargetAcquisition.AcquireTarget(chr, sArgs, GameWorld.Cell.DEFAULT_VISIBLE_DISTANCE, 0);

            // failed to find the target
            if (target == null)
            {
                chr.WriteToDisplay("You don't see a " + (sArgs.Length >= 2 ? sArgs[0] + " " + sArgs[1] : sArgs[0]) + " here.");
                return(false);
            }

            // one hand must be free
            if (chr.RightHand != null && chr.LeftHand != null)
            {
                chr.WriteToDisplay("You must have one hand free to perform DaggerStorm.");
                return(false);
            }

            int daggerCount = (Skills.GetSkillLevel(chr.dagger) / 2) + 1;

            int prevSavageryPower = 0;

            if (!chr.EffectsList.ContainsKey(Effect.EffectTypes.Savagery))
            {
                Effect.CreateCharacterEffect(Effect.EffectTypes.Savagery, 50, chr, 0, null);
            }
            else if (chr.EffectsList[Effect.EffectTypes.Savagery].Power < 50)
            {
                prevSavageryPower = chr.EffectsList[Effect.EffectTypes.Savagery].Power;
                chr.EffectsList[Effect.EffectTypes.Savagery].Power = 50;
            }

            for (int a = 0; a <= daggerCount; a++)
            {
                Item shadowDagger = Item.CopyItemFromDictionary(Item.ID_DAGGER_PLUS_TWO);
                shadowDagger.special   += " " + Item.EXTRAPLANAR;
                shadowDagger.name       = "shadowdagger";
                shadowDagger.combatAdds = daggerCount;
                shadowDagger.longDesc   = "a slender dagger made from the very fabric of shadow";

                if (!chr.EquipEitherHand(shadowDagger))
                {
                    if (chr.RightHand != null && chr.RightHand.name == "shadowdagger")
                    {
                        chr.UnequipRightHand(chr.RightHand);
                    }
                    if (chr.LeftHand != null && chr.LeftHand.name == "shadowdagger")
                    {
                        chr.UnequipLeftHand(chr.LeftHand);
                    }

                    return(true);
                }

                if (!target.IsDead)
                {
                    CommandTasker.ParseCommand(chr, "throw", "shadowdagger at " + target.UniqueID);
                    chr.CommandWeight = 0;
                }
                else
                {
                    if (chr.RightHand != null && chr.RightHand.name == "shadowdagger")
                    {
                        chr.UnequipRightHand(chr.RightHand);
                    }
                    if (chr.LeftHand != null && chr.LeftHand.name == "shadowdagger")
                    {
                        chr.UnequipLeftHand(chr.LeftHand);
                    }
                    return(true);
                }
            }

            if (prevSavageryPower > 0)
            {
                chr.EffectsList[Effect.EffectTypes.Savagery].Power = prevSavageryPower;
            }
            else if (chr.EffectsList.ContainsKey(Effect.EffectTypes.Savagery))
            {
                chr.EffectsList[Effect.EffectTypes.Savagery].StopCharacterEffect();
            }

            if (chr.RightHand != null && chr.RightHand.name == "shadowdagger")
            {
                chr.UnequipRightHand(chr.RightHand);
            }
            if (chr.LeftHand != null && chr.LeftHand.name == "shadowdagger")
            {
                chr.UnequipLeftHand(chr.LeftHand);
            }

            return(true);
        }
Example #7
0
        public bool OnPerform(Character chr, string args)
        {
            if (args == null)
            {
                chr.WriteToDisplay("Gage who?");
                return(false);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            Character target = TargetAcquisition.AcquireTarget(chr, sArgs, GameWorld.Cell.DEFAULT_VISIBLE_DISTANCE, 0);

            // failed to find the target
            if (target == null)
            {
                chr.WriteToDisplay("You don't see a " + (sArgs.Length >= 2 ? sArgs[0] + " " + sArgs[1] : sArgs[0]) + " here.");
                return(false);
            }

            string gageMessage = target.GetNameForActionResult();

            if (target.Level > chr.Level)
            {
                if (target.Level - chr.Level >= 5)
                {
                    gageMessage += " appears far more experienced than you.";
                }
                else
                {
                    gageMessage += " appears more experienced than you.";
                }
            }
            else if (target.Level == chr.Level)
            {
                gageMessage += " appears as experienced as you are.";
            }
            else
            {
                if (chr.Level - target.Level >= 5)
                {
                    gageMessage += " appears far less experienced than you.";
                }
                else
                {
                    gageMessage += " appears less experienced than you.";
                }
            }

            if (target.talentsDictionary != null && target.talentsDictionary.Count > 0)
            {
                gageMessage += " " + Character.PRONOUN[(int)target.gender] + " looks talented.";
            }

            // Fighter specialization.
            if (target.RightHand != null && target.RightHand.skillType == target.fighterSpecialization)
            {
                gageMessage += " " + Character.PRONOUN[(int)target.gender] + " appears to really know how to use " + Character.POSSESSIVE[(int)target.gender].ToLower() + " " + target.RightHand.name + ".";
            }

            // spell warming professions of the same profession can gage more info
            if (chr.IsSpellWarmingProfession && target.IsSpellWarmingProfession && chr.BaseProfession == target.BaseProfession)
            {
                if (target.GetSkillExperience(Globals.eSkillType.Magic) > chr.GetSkillExperience(Globals.eSkillType.Magic))
                {
                    gageMessage += " " + Character.PRONOUN[(int)target.gender] + " looks more skilled than you in " + Spells.GameSpell.GetSpellCastingNoun(target.BaseProfession);
                }
                else if (target.GetSkillExperience(Globals.eSkillType.Magic) < chr.GetSkillExperience(Globals.eSkillType.Magic))
                {
                    gageMessage += " " + Character.PRONOUN[(int)target.gender] + " looks less skilled than you in " + Spells.GameSpell.GetSpellCastingNoun(target.BaseProfession);
                }
                else
                {
                    gageMessage += " " + Character.PRONOUN[(int)target.gender] + " looks as skilled as you in " + Spells.GameSpell.GetSpellCastingNoun(target.BaseProfession);
                }
            }

            chr.WriteToDisplay(gageMessage.Trim());

            return(true);
        }
Example #8
0
        /// <summary>
        /// Interpret incoming command. To be moved to a Command Manager or GameCommand in the near future.
        /// </summary>
        /// <param name="command"></param>
        /// <param name="args"></param>
        /// <returns>False if invalid command. True if the command was completed.</returns>
        public bool InterpretCommand(string command, string args)
        {
            var i           = 0;
            var sCmdAndArgs = command + " " + args;
            var newArgs     = "";

            // Dead characters can only rest or quit.
            if (_chr.IsDead && command.ToLower() != "rest" && command.ToLower() != "quit")
            {
                _chr.WriteToDisplay("You are dead, you can either wait to be resurrected or rest.");
                return(true);
            }

            #region If a command is being interpreted then the character is no longer resting or meditating.
            if (_chr.IsResting && !_chr.IsMeditating)
            {
                if (command.ToLower() != "rest" &&
                    !command.StartsWith(((char)27).ToString()) &&
                    !command.StartsWith("show"))
                {
                    _chr.WriteToDisplay("You are no longer resting.");

                    _chr.IsResting = false;
                }
            }

            if (_chr.IsMeditating)
            {
                // using the "meditate" command while meditating will cancel meditation
                if (command.ToLower() != "memorize" &&
                    !command.StartsWith(((char)27).ToString()) && // protocol command
                    !command.StartsWith("show"))
                {
                    _chr.WriteToDisplay("You are no longer meditating.");
                    _chr.IsResting    = false;
                    _chr.IsMeditating = false;
                }
            }
            #endregion

            // Any command while peeking will be an automatic rest and break the character out of the trance.
            if (_chr.IsPeeking)
            {
                command = "rest";
                args    = "";
            }

            #region If wizard eye
            // Only movement, look, rest and again are acceptable commands when in wizard eye.
            if (_chr.IsWizardEye)
            {
                command = command.ToLower();
                switch (command.ToLower())
                {
                case "n":
                case "north":
                case "s":
                case "south":
                case "e":
                case "east":
                case "w":
                case "west":
                case "ne":
                case "northeast":
                case "nw":
                case "northwest":
                case "se":
                case "southeast":
                case "sw":
                case "southwest":
                case "d":
                case "down":
                case "u":
                case "up":
                case "a":
                case "again":
                case "l":
                case "look":
                case "rest":
                    break;

                default:
                    _chr.WriteToDisplay("You cannot use that command while polymorphed.");
                    return(true);
                }
            }
            #endregion

            if (_chr.protocol == DragonsSpineMain.Instance.Settings.DefaultProtocol)
            {
                if (ProtocolYuusha.CheckGameCommand(_chr, command, args))
                {
                    return(true);
                }
            }

            // catch some commands before they go through the parser

            #region If Speech. Command starts with a / or a " while in game.
            if (command.StartsWith("/") || command.StartsWith("\""))
            {
                if (!_chr.IsImmortal && _chr.HasEffect(Effect.EffectTypes.Silence))
                {
                    _chr.WriteToDisplay("You have been silenced and are unable to speak.");
                    return(true);
                }

                if (args.IndexOf("/!") != -1)
                {
                    _chr.SendShout(_chr.Name + ": " + args.Substring(0, args.IndexOf("/!")));
                    if (_chr.IsPC)
                    {
                        _chr.WriteToDisplay("You shout: " + args.Substring(0, args.IndexOf("/!")));
                        Utils.Log(_chr.Name + ": " + args.Substring(0, args.IndexOf("/!")), Utils.LogType.PlayerChat);
                    }
                    return(true);
                }
                else if (args.IndexOf("\"!") != -1)
                {
                    _chr.SendShout(_chr.Name + ": " + args.Substring(0, args.IndexOf("\"!")));
                    if (_chr.IsPC)
                    {
                        _chr.WriteToDisplay("You shout: " + args.Substring(0, args.IndexOf("\"!")));
                        Utils.Log(_chr.Name + ": " + args.Substring(0, args.IndexOf("\"!")), Utils.LogType.PlayerChat);
                    }
                    return(true);
                }
                else
                {
                    _chr.SendToAllInSight(_chr.Name + ": " + args);
                    if (_chr.IsPC)
                    {
                        _chr.WriteToDisplay("You say: " + args);
                        Utils.Log(_chr.Name + ": " + args, Utils.LogType.PlayerChat);
                    }
                    return(true);
                }
            }
            #endregion

            #region NPC interaction. Command ends with a comma (,)
            else if (command.EndsWith(","))// && !command.ToLower().StartsWith("all"))
            {
                if (!_chr.IsImmortal && _chr.HasEffect(Effect.EffectTypes.Silence))
                {
                    _chr.WriteToDisplay("You have been silenced and are unable to speak.");
                    return(true);
                }

                try
                {
                    // djinn, take halberd
                    // djinn, take 2 halberd
                    // 2 djinn, take 2 halberd
                    // all, follow me

                    string targetName = command.Substring(0, command.IndexOf(",")); // definitely going to be a comma

                    string[] targetArgs = targetName.Split(" ".ToCharArray());      // if this is longer than 1 in length probably using #

                    args = args.Trim();

                    string[] sArgs = args.Split(" ".ToCharArray());

                    if (String.IsNullOrEmpty(sArgs[0]) || sArgs.Length == 0)
                    {
                        return(false);
                    }

                    string order = sArgs[0];

                    args = args.Replace(order, "");

                    args = args.Trim();

                    #region All, do something
                    if (command.ToLower().StartsWith("all"))
                    {
                        if (_chr.Pets == null || _chr.Pets.Count == 0)
                        {
                            _chr.WriteToDisplay("There is nothing here to interact with.");
                            return(true);
                        }

                        bool interactPositive = false;

                        foreach (NPC pet in new List <NPC>(_chr.Pets))
                        {
                            if (TargetAcquisition.FindTargetInView(_chr, pet) != null)
                            {
                                interactPositive = AI.Interact(_chr, pet, order, args);
                            }
                        }

                        return(interactPositive);
                    }
                    #endregion

                    Character target = null;

                    var countTo = 0;

                    // Not using ALL, try 2 <target>, do something.
                    if (targetArgs.Length > 1 && Int32.TryParse(targetArgs[0], out countTo))
                    {
                        target = TargetAcquisition.FindTargetInView(_chr, targetArgs[1].ToLower(), countTo);
                    }

                    // Not using ALL, try <target>, do something.
                    if (target == null && targetArgs.Length == 1)
                    {
                        target = TargetAcquisition.FindTargetInView(_chr, targetArgs[0].ToLower(), 1);

                        if (target == null)
                        {
                            target = TargetAcquisition.FindTargetInView(_chr, targetName, false, false);
                        }
                    }

                    if (target == null)
                    {
                        _chr.WriteToDisplay("You do not see " + targetName + " here.");
                        return(true);
                    }
                    else
                    {
                        return(AI.Interact(_chr, target, order, args));
                    }
                }
                catch (Exception e)
                {
                    Utils.LogException(e);
                    return(false);
                }
            }
            #endregion
            else
            {
                int andStrPos = 0;

                #region Check for command joining, split them then parse and int
                // If command has the word "and" for joining two commands.
                // 9/24/2019 We don't still need this.
                //if (_chr.PCState == Globals.ePlayerState.PLAYING && sCmdAndArgs.IndexOf(" and ") != -1 && command.ToLower() != "tell" && )
                //    sCmdAndArgs = sCmdAndArgs.Replace(" and ", ";");

                andStrPos = sCmdAndArgs.IndexOf(";", 0, sCmdAndArgs.Length);

                if (andStrPos > 0)
                {
                    //Break out the two commands
                    string[] sCommands = sCmdAndArgs.Split(";".ToCharArray());

                    if (sCommands[0].Length > 0)
                    {
                        //get the command and the args
                        sCommands[0] = sCommands[0].Trim();//.ToLower();

                        string[] sArgss = sCommands[0].Split(" ".ToCharArray());

                        for (i = 1; i <= sArgss.GetUpperBound(0); i++)
                        {
                            newArgs = newArgs + " " + sArgss[i];
                        }

                        ParseCommand(_chr, sArgss[0].ToString().Trim(), newArgs.Trim());
                        //chr.FirstJoinedCommand = chr.CommandsProcessed[0];
                        //chr.FirstJoinedCommand = chr.CommandType;
                    }

                    if (sCommands[1].Length > 0)
                    {
                        //get the command and the args
                        sCommands[1] = sCommands[1].Trim();//.ToLower();

                        string[] s2Argss = sCommands[1].Split(" ".ToCharArray());

                        newArgs = "";

                        for (i = 1; i <= s2Argss.GetUpperBound(0); i++)
                        {
                            if (s2Argss[i].ToLower() != "it")
                            {
                                newArgs = newArgs + " " + s2Argss[i];
                            }
                            else
                            {
                                string[] sArgss = sCommands[0].Split(" ".ToCharArray());
                                newArgs = newArgs + " " + sArgss[1];
                            }
                        }

                        ParseCommand(_chr, s2Argss[0].ToString().Trim(), newArgs.Trim());
                        //chr.FirstJoinedCommand = CommandType.None;
                    }

                    return(true);
                }
                #endregion

                if (command.StartsWith("$"))
                {
                    if (command.Contains("list"))
                    {
                        args = "list";
                    }
                    else if (command.Length > 1 && command.Length < 4)
                    {
                        args = command.Substring(1, command.Length - 1) + " " + args;
                        args.Trim();
                    }

                    command = "macro";
                }

                // lower case
                command = command.ToLower();

                #region Check command aliases and change the command if an alias is found.
                if (GameCommand.GameCommandAliases.ContainsKey(command))
                {
                    command = GameCommand.GameCommandAliases[command];
                }
                else if (GameCommand.GameCommandAliases.ContainsKey(command + " " + args))
                {
                    command = GameCommand.GameCommandAliases[command + " " + args];
                }
                #endregion

                // check for the command in the dictionary
                if (GameCommand.GameCommandDictionary.ContainsKey(command))
                {
                    // non player characters make no checks to perform commands
                    if (!(_chr is PC))
                    {
                        return(GameCommand.GameCommandDictionary[command].Handler.OnCommand(_chr, args));
                    }

                    GameCommand gc = GameCommand.GameCommandDictionary[command];

                    // check player ImpLevel and the command may be executed while playing the game
                    if ((_chr as PC).ImpLevel >= (Globals.eImpLevel)gc.PrivLevel &&
                        Array.IndexOf(gc.States, _chr.PCState) > -1)
                    {
                        _chr.CommandWeight += gc.Weight;

                        return(GameCommand.GameCommandDictionary[command].Handler.OnCommand(_chr, args));
                    }

                    return(false);
                }
                else if (Talents.GameTalent.GameTalentDictionary.ContainsKey(command))
                {
                    Talents.GameTalent gameTalent = Talents.GameTalent.GameTalentDictionary[command];

                    // immortal flag added for testing purposes
                    if ((_chr.IsImmortal || _chr.talentsDictionary.ContainsKey(command)) && !gameTalent.IsPassive)
                    {
                        if (_chr.IsImmortal || (DateTime.UtcNow - gameTalent.DownTime >= _chr.talentsDictionary[command]))
                        {
                            if (!gameTalent.MeetsPerformanceCost(_chr))
                            {
                                _chr.WriteToDisplay("You do not have enough stamina to perform the " + gameTalent.Name + " talent.");
                                return(true);
                            }

                            if (!Talents.GameTalent.GameTalentDictionary[command].Handler.OnPerform(_chr, args))
                            {
                                _chr.WriteToDisplay("Talent not performed.");
                            }
                            else
                            {
                                gameTalent.SuccessfulPerformance(_chr);
                            }
                        }
                        else
                        {
                            int roundsRemaining = Utils.TimeSpanToRounds(gameTalent.DownTime - (DateTime.UtcNow - _chr.talentsDictionary[command]));
                            _chr.WriteToDisplay("Talent timer has not reset yet. It will be available " + (roundsRemaining > 0 ? "in " + roundsRemaining : "next") + " round" + (roundsRemaining > 1 ? "s" : "") + ".");
                        }
                    }
                    else if (_chr.talentsDictionary.ContainsKey(command) && gameTalent.IsPassive)
                    {
                        _chr.WriteToDisplay(gameTalent.Name + " is a passive talent.");
                    }
                    else
                    {
                        _chr.WriteToDisplay("You do not know how to perform the " + gameTalent.Name + " talent.");
                    }

                    return(true);
                }
                else // command does not exist in the dictionary
                {
                    MethodInfo[] methodInfo = typeof(CommandTasker).GetMethods();

                    try
                    {
                        foreach (MethodInfo m in methodInfo)
                        {
                            int length = m.Name.Length;
                            if (m.Name.IndexOf("_") != -1)
                            {
                                length = m.Name.IndexOf("_");
                            }
                            if (m.Name.ToLower().Substring(0, length) == command)
                            {
                                _chr.CommandWeight += 1; // add one to the command weight

                                object[] obj = new object[1];

                                obj[0] = args;

                                try
                                {
                                    m.Invoke(this, obj);
                                }
                                catch (Exception e)
                                {
                                    Utils.LogException(e);
                                }
                                return(true);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        _chr.WriteToDisplay("Error processing your command. Please report this.");
                        Utils.Log("Failure at Command.interpretCommand(" + command + ", " + args + ")", Utils.LogType.SystemFailure);
                        Utils.LogException(e);
                        return(false);
                    }
                }
            }

            #region Spell Chant Exists
            if (_chr.spellDictionary.ContainsValue(command.ToLower() + " " + args.ToLower()))
            {
                if (!_chr.IsImmortal && _chr.InUnderworld)
                {
                    _chr.WriteToDisplay(TextManager.COMMAND_NOT_UNDERSTOOD);
                    return(true);
                }

                if (!_chr.IsImmortal && _chr.HasEffect(Effect.EffectTypes.Silence))
                {
                    _chr.WriteToDisplay("You have been silenced and are unable to warm spells.");
                    return(true);
                }

                if (_chr.preppedSpell != null) // TODO talent here to automatically clear prepped spell
                {
                    _chr.WriteToDisplay("You already have a spell warmed. Either cast it or rest to clear your mind.");
                    return(true);
                }
                else
                {
                    _chr.CommandWeight += 3;

                    if (_chr.CommandWeight == 3)
                    {
                        _chr.CommandType = CommandType.Chant;
                        foreach (int spellID in _chr.spellDictionary.Keys)
                        {
                            if (_chr.spellDictionary[spellID] == (command.ToLower() + " " + args.ToLower()))
                            {
                                _chr.WarmSpell(spellID);
                                break;
                            }
                        }

                        //if(_chr is PC)
                        //    World.magicCordThisRound.Add(_chr.FacetID + "|" + _chr.LandID + "|" + _chr.MapID + "|" + _chr.X + "|" + _chr.Y + "|" + _chr.Z);

                        _chr.PreppedRound = DragonsSpineMain.GameRound;
                        int  bitcount = 0;
                        Cell curCell  = null;
                        // this is the same logic from chr.sendToAllInSight, however we add spell info in some situations
                        // loop through all visible cells

                        for (int ypos = -3; ypos <= 3; ypos += 1)
                        {
                            for (int xpos = -3; xpos <= 3; xpos += 1)
                            {
                                if (Cell.CellRequestInBounds(_chr.CurrentCell, xpos, ypos))
                                {
                                    if (_chr.CurrentCell.visCells[bitcount]) // check the PC list, and char list of the cell
                                    {
                                        curCell = Cell.GetCell(_chr.FacetID, _chr.LandID, _chr.MapID, _chr.X + xpos, _chr.Y + ypos, _chr.Z);

                                        if (curCell != null)
                                        {
                                            foreach (Character character in curCell.Characters.Values)                    // search for the character in the charlist of the cell
                                            {
                                                if (character != _chr && character is PC)                                 // players sending messages to other players
                                                {
                                                    if (Array.IndexOf((character as PC).ignoreList, _chr.UniqueID) == -1) // ignore list
                                                    {
                                                        if ((_chr.Group != null && _chr.preppedSpell != null && _chr.Group.GroupMemberIDList.Contains(character.UniqueID)) ||
                                                            (character as PC).ImpLevel >= Globals.eImpLevel.GM ||
                                                            character.HasEffect(Effect.EffectTypes.Gnostikos))
                                                        {
                                                            character.WriteToDisplay(_chr.Name + ": " + command + " " + args + " <" + _chr.preppedSpell.Name + ">");
                                                        }
                                                        else
                                                        {
                                                            character.WriteToDisplay(_chr.Name + ": " + command + " " + args);
                                                        }
                                                    }
                                                }
                                                else if (character != _chr && character.IsPC && !_chr.IsPC) // non players sending messages to other players
                                                {
                                                    character.WriteToDisplay(_chr.Name + ": " + command + " " + args);
                                                }

                                                //TODO: else... detect spell casting by sensitive NPC
                                            }
                                        }
                                    }
                                    bitcount++;
                                }
                            }
                        }
                    }
                    else
                    {
                        _chr.WriteToDisplay("Warming a spell requires your full concentration.");
                    }
                }
                return(true);
            }
            #endregion

            Utils.Log(_chr.GetLogString() + " Invalid command: " + command + " args: " + args, Utils.LogType.CommandFailure);
            _chr.WriteToDisplay("I don't understand your command. For a full list of game commands visit the Dragon's Spine forums.");
            return(false);
        }
Example #9
0
        public bool OnCommand(Character chr, string args)
        {
            if (chr.CommandWeight > 3)
            {
                chr.WriteToDisplay("Command weight limit exceeded. Kick command not processed.");
                return(true);
            }

            if (args == null)
            {
                chr.WriteToDisplay("Who do you want to kick?");
                return(true);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            if (sArgs[0] == null)
            {
                chr.WriteToDisplay("Who do you want to kick?");
                return(true);
            }

            Character target = null;

            if (sArgs.Length == 2)
            {
                int countTo = 0;

                try
                {
                    countTo = Convert.ToInt32(sArgs[0]);
                    target  = TargetAcquisition.FindTargetInView(chr, sArgs[1].ToLower(), countTo);
                }
                catch
                {
                    target = TargetAcquisition.FindTargetInCell(chr, sArgs[0].ToLower());
                }
            }
            else
            {
                target = TargetAcquisition.FindTargetInCell(chr, sArgs[0].ToLower());
            }

            if (target == null)
            {
                chr.WriteToDisplay(GameSystems.Text.TextManager.NullTargetMessage(sArgs[0]));
            }
            else
            {
                chr.CommandType = CommandTasker.CommandType.Kick;

                chr.Stamina -= 1;

                Globals.eEncumbranceLevel encumbDesc = Rules.GetEncumbrance(chr);
                if (encumbDesc == Globals.eEncumbranceLevel.Moderately)
                {
                    chr.Stamina -= 1;
                }
                else if (encumbDesc == Globals.eEncumbranceLevel.Heavily)
                {
                    chr.Stamina -= 2;
                }
                else if (encumbDesc == Globals.eEncumbranceLevel.Severely)
                {
                    chr.Stamina -= 3;
                }

                if (chr.Stamina < 0)
                {
                    Combat.DoDamage(chr, chr, Math.Abs(chr.Stamina), false);
                    chr.Stamina = 0;
                }

                Combat.DoCombat(chr, target, chr.GetInventoryItem(Globals.eWearLocation.Feet));
            }

            return(true);
        }
Example #10
0
        public bool OnPerform(Character chr, string args)
        {
            if (args == null)
            {
                chr.WriteToDisplay("Assasinate who?");
                return(false);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            Character target = TargetAcquisition.AcquireTarget(chr, args, GameWorld.Cell.DEFAULT_VISIBLE_DISTANCE, 0);

            // failed to find the target
            if (target == null)
            {
                chr.WriteToDisplay("You don't see a " + (sArgs.Length >= 2 ? sArgs[0] + " " + sArgs[1] : sArgs[0]) + " here.");
                return(false);
            }

            if (target.CurrentCell != chr.CurrentCell)
            {
                if (!PathTest.SuccessfulPathTest(PathTest.RESERVED_NAME_JUMPKICKCOMMAND, chr.CurrentCell, target.CurrentCell))
                {
                    return(false);
                }
            }

            if (target.IsPC)
            {
                chr.WriteToDisplay("Fellow players may not be assassinated, yet.");
                return(false);
            }

            if (target is NPC && (target as NPC).lairCritter)
            {
                chr.WriteToDisplay("Your target has a lair and is on guard for assassination attempts.");
                return(false);
            }

            if (target.seenList.Contains(chr) && (target is PC || ((target is NPC) && (target as NPC).enemyList.Contains(chr))))
            {
                chr.WriteToDisplay("Your intended target is aware of your presence.");
                return(false);
            }

            if (target is NPC && (target as NPC).friendList.Count > 0)
            {
                if ((target as NPC).friendList.Count == 1 && (target as NPC).friendList.Contains(chr))
                {
                    // continue, thief was visible briefly and appeared as a friend
                }
                else
                {
                    chr.WriteToDisplay("Your target has allies nearby. An assassination target must be alone.");
                    return(false);
                }
            }

            if (target is NPC && (target as NPC).enemyList.Count > 0)
            {
                chr.WriteToDisplay("Your target has visible enemies nearby. An assassination target must be alone.");
                return(false);
            }

            // Only humans, humanoids and giantkin may be assassinated.
            if (!Autonomy.EntityBuilding.EntityLists.IsHumanOrHumanoid(target) &&
                !Autonomy.EntityBuilding.EntityLists.IsGiantKin(target))
            {
                chr.WriteToDisplay("Only humans, humanoids and giantkin may be the target of an assassination.");
                return(false);
            }

            // Unique entities cannot be assassinated.
            if (Autonomy.EntityBuilding.EntityLists.UNIQUE.Contains(target.entity))
            {
                chr.WriteToDisplay("Unique entities cannot be assassinated. They have a level of perception that keeps them aware of such attempts.");
                return(false);
            }

            // Assassination requires Speed.
            if (!chr.HasSpeed)
            {
                chr.WriteToDisplay("You must be enchanted with Speed to carry out an assassination.");
                return(false);
            }

            int distance           = DragonsSpine.GameWorld.Cell.GetCellDistance(chr.X, chr.Y, target.X, target.Y);
            int thieverySkillLevel = Skills.GetSkillLevel(chr.thievery);

            // check minimum thievery skill requirement for allowed distance
            if (distance > 2 && (thieverySkillLevel < MoveThreeAndAssassinateSkillRequirement))
            {
                chr.WriteToDisplay("Your intended target is too far away. Improve your thievery skill.");
                return(false);
            }

            // verify path is not blocked
            if (distance > 0)
            {
                if (!PathTest.SuccessfulPathTest(PathTest.RESERVED_NAME_COMMANDSUFFIX, chr.CurrentCell, target.CurrentCell))
                {
                    chr.WriteToDisplay(GameSystems.Text.TextManager.PATH_IS_BLOCKED);
                    return(false);
                }
            }

            Item weapon = null;

            if (chr.RightHand != null && chr.RightHand.itemType == Globals.eItemType.Weapon)
            {
                weapon = chr.RightHand;
            }
            else if (chr.LeftHand != null && chr.LeftHand.itemType == Globals.eItemType.Weapon)
            {
                weapon = chr.LeftHand;
            }

            if (weapon == null)
            {
                return(false);
            }

            chr.CommandType = CommandTasker.CommandType.Assassinate;
            chr.CurrentCell = target.CurrentCell;
            chr.updateMap   = true;
            Combat.DoCombat(chr, target, weapon);

            chr.CommandsProcessed.RemoveAll(cmdType => cmdType == CommandTasker.CommandType.Assassinate);

            // give skill experience
            Skills.GiveSkillExp(chr, Skills.GetSkillLevel(chr.thievery) * 75, Globals.eSkillType.Thievery);

            if (!chr.HasSpeed || !Map.IsNextToWall(chr) || !Rules.FullStatCheck(chr, Globals.eAbilityStat.Dexterity))
            {
                chr.IsHidden = false;
            }
            else if (thieverySkillLevel < RemainHiddenAfterAssassinate && !Rules.FullStatCheck(chr, Globals.eAbilityStat.Dexterity))
            {
                Map.CheckHiddenStatus(chr);
            }

            if (chr.IsHidden && !chr.EffectsList[Effect.EffectTypes.Hide_in_Shadows].IsPermanent)
            {
                chr.WriteToDisplay(GameSystems.Text.TextManager.REMAINED_HIDDEN);
            }

            return(true);
        }
Example #11
0
        public bool OnPerform(Character chr, string args)
        {
            if (!chr.IsHidden && !chr.IsImmortal)
            {
                chr.WriteToDisplay("You must be hidden to be successful.");
                return(false);
            }

            if (args == null)
            {
                chr.WriteToDisplay("Snoop at who?");
                return(false);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            Character target;

            int countTo;

            if (sArgs.Length >= 2 && Int32.TryParse(sArgs[0], out countTo))
            {
                target = TargetAcquisition.FindTargetInCell(chr, sArgs[1], countTo);
            }
            else
            {
                target = TargetAcquisition.FindTargetInCell(chr, sArgs[0]);
            }

            // failed to find the target
            if (target == null)
            {
                chr.WriteToDisplay("You don't see a " + (sArgs.Length >= 2 ? sArgs[0] + " " + sArgs[1] : sArgs[0]) + " here.");
                return(false);
            }

            int successChance = 19 - Skills.GetSkillLevel(chr.thievery);

            if (chr.IsImmortal || Rules.RollD(1, 20) > successChance)
            {
                if (target.sackList.Count > 0)
                {
                    int       z = 0, i = 0;
                    string    dispMsg     = "";
                    double    itemcount   = 0;
                    bool      moreThanOne = false;
                    ArrayList templist    = new ArrayList();
                    Item[]    itemList    = new Item[target.sackList.Count];
                    target.sackList.CopyTo(itemList);
                    foreach (Item item in itemList)
                    {
                        templist.Add(item);
                    }
                    z       = templist.Count - 1;
                    dispMsg = "In " + target.GetNameForActionResult(true) + "'s sack you see ";
                    while (z >= 0)
                    {
                        Item item = (Item)templist[z];

                        itemcount = 0;
                        for (i = templist.Count - 1; i > -1; i--)
                        {
                            Item tmpitem = (Item)templist[i];
                            if (tmpitem.name == item.name && tmpitem.name.IndexOf("coin") > -1)
                            {
                                templist.RemoveAt(i);
                                itemcount = itemcount + (int)item.coinValue;
                                z         = templist.Count;
                            }
                            else if (tmpitem.name == item.name)
                            {
                                templist.RemoveAt(i);
                                z          = templist.Count;
                                itemcount += 1;
                            }
                        }
                        if (itemcount > 0)
                        {
                            if (moreThanOne)
                            {
                                if (z == 0)
                                {
                                    dispMsg += " and ";
                                }
                                else
                                {
                                    dispMsg += ", ";
                                }
                            }
                            dispMsg += GameSystems.Text.TextManager.ConvertNumberToString(itemcount) + Item.GetLookShortDesc(item, itemcount);
                        }
                        moreThanOne = true;
                        z--;
                    }
                    dispMsg += ".";
                    chr.WriteToDisplay(dispMsg);
                }
                else
                {
                    chr.WriteToDisplay(target.GetNameForActionResult() + " isn't carrying anything in " + Character.POSSESSIVE[(int)target.gender].ToLower() + " sack.");
                }

                if (target.pouchList.Count > 0)
                {
                    int       z = 0, i = 0;
                    string    dispMsg     = "";
                    double    itemcount   = 0;
                    bool      moreThanOne = false;
                    ArrayList templist    = new ArrayList();
                    Item[]    itemList    = new Item[target.pouchList.Count];
                    target.pouchList.CopyTo(itemList);
                    foreach (Item item in itemList)
                    {
                        templist.Add(item);
                    }
                    z       = templist.Count - 1;
                    dispMsg = "In " + target.GetNameForActionResult(true) + "'s pouch you see ";
                    while (z >= 0)
                    {
                        Item item = (Item)templist[z];

                        itemcount = 0;
                        for (i = templist.Count - 1; i > -1; i--)
                        {
                            Item tmpitem = (Item)templist[i];
                            if (tmpitem.name == item.name && tmpitem.name.IndexOf("coin") > -1)
                            {
                                templist.RemoveAt(i);
                                itemcount = itemcount + (int)item.coinValue;
                                z         = templist.Count;
                            }
                            else if (tmpitem.name == item.name)
                            {
                                templist.RemoveAt(i);
                                z          = templist.Count;
                                itemcount += 1;
                            }
                        }
                        if (itemcount > 0)
                        {
                            if (moreThanOne)
                            {
                                if (z == 0)
                                {
                                    dispMsg += " and ";
                                }
                                else
                                {
                                    dispMsg += ", ";
                                }
                            }
                            dispMsg += GameSystems.Text.TextManager.ConvertNumberToString(itemcount) + Item.GetLookShortDesc(item, itemcount);
                        }
                        moreThanOne = true;
                        z--;
                    }
                    dispMsg += ".";
                    chr.WriteToDisplay(dispMsg);
                }
                else
                {
                    chr.WriteToDisplay(target.GetNameForActionResult() + " isn't carrying anything in " + Character.POSSESSIVE[(int)target.gender].ToLower() + " pouch.");
                }
            }
            else
            {
                chr.WriteToDisplay("Your attempt to snoop has failed.");

                // if an intelligence check succeeds then the peeking thief has been caught
                if (Rules.CheckPerception(target))
                {
                    target.WriteToDisplay(chr.Name + " has attempted to peek at your belongings.");
                    chr.WriteToDisplay("Your failure has been noticed!");
                    Rules.BreakHideSpell(chr);
                    Combat.DoFlag(chr, target);
                }
            }

            // give skill experience
            Skills.GiveSkillExp(chr, Skills.GetSkillLevel(chr.thievery) * 20, Globals.eSkillType.Thievery);

            return(true);
        }
Example #12
0
        public bool OnPerform(Character chr, string args)
        {
            if (args == null)
            {
                chr.WriteToDisplay("Backstab who?");
                return(false);
            }

            if (chr.RightHand == null && chr.LeftHand == null)
            {
                chr.WriteToDisplay("You are not holding a weapon to backstab with.");
                return(false);
            }

            if (Rules.GetEncumbrance(chr) > Globals.eEncumbranceLevel.Moderately)
            {
                chr.WriteToDisplay("You are too encumbered to backstab.");
                return(false);
            }

            Item weapon = null;

            if (chr.RightHand != null && chr.RightHand.itemType == Globals.eItemType.Weapon)
            {
                weapon = chr.RightHand;
            }
            else if (chr.LeftHand != null && chr.LeftHand.itemType == Globals.eItemType.Weapon)
            {
                weapon = chr.LeftHand;
            }

            if (weapon == null)
            {
                chr.WriteToDisplay("You are not holding a weapon you can backstab with.");
                return(false);
            }

            if (!AllowedBackstabItemBaseTypes.Contains(weapon.baseType))
            {
                chr.WriteToDisplay("You are not holding a weapon you can backstab with.");
                return(false);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            Character target = TargetAcquisition.AcquireTarget(chr, args, GameWorld.Cell.DEFAULT_VISIBLE_DISTANCE, 0);

            // failed to find the target
            if (target == null)
            {
                chr.WriteToDisplay("You don't see a " + (sArgs.Length >= 2 ? sArgs[0] + " " + sArgs[1] : sArgs[0]) + " here.");
                return(false);
            }

            if (target.seenList.Contains(chr))
            {
                chr.WriteToDisplay("Your intended target is aware of your presence.");
                return(false);
            }

            if (!chr.HasSpeed)
            {
                chr.WriteToDisplay("You must be enchanted with Speed to perform a backstab.");
                return(false);
            }

            int distance           = DragonsSpine.GameWorld.Cell.GetCellDistance(chr.X, chr.Y, target.X, target.Y);
            int thieverySkillLevel = Skills.GetSkillLevel(chr.thievery);

            // check minimum thievery skill requirement
            if (distance > 2 && (thieverySkillLevel < MoveThreeAndBackstabSkillRequirement))
            {
                chr.WriteToDisplay("Your intended target is too far away. Improve your thievery skill.");
                return(false);
            }

            // verify path is not blocked
            if (distance > 0)
            {
                if (!PathTest.SuccessfulPathTest(PathTest.RESERVED_NAME_COMMANDSUFFIX, chr.CurrentCell, target.CurrentCell))
                {
                    chr.WriteToDisplay(GameSystems.Text.TextManager.PATH_IS_BLOCKED);
                    return(false);
                }
            }

            chr.CommandType = CommandTasker.CommandType.Backstab;
            chr.CurrentCell = target.CurrentCell;
            chr.updateMap   = true;
            Combat.DoCombat(chr, target, weapon);

            chr.CommandsProcessed.RemoveAll(cmdType => cmdType == CommandTasker.CommandType.Backstab);

            // give skill experience
            Skills.GiveSkillExp(chr, Skills.GetSkillLevel(chr.thievery) * 50, Globals.eSkillType.Thievery);

            if (thieverySkillLevel < RemainHiddenAfterBackstabWithSpeed && !Rules.FullStatCheck(chr, Globals.eAbilityStat.Dexterity))
            {
                chr.IsHidden = false;
            }
            else if (!chr.HasSpeed || !Map.IsNextToWall(chr) || !Rules.FullStatCheck(chr, Globals.eAbilityStat.Dexterity))
            {
                chr.IsHidden = false;
            }
            else
            {
                Map.CheckHiddenStatus(chr);
            }

            if (chr.IsHidden && !chr.EffectsList[Effect.EffectTypes.Hide_in_Shadows].IsPermanent)
            {
                chr.WriteToDisplay(GameSystems.Text.TextManager.REMAINED_HIDDEN);
            }

            return(true);
        }
Example #13
0
        public bool OnCommand(Character chr, string args)
        {
            if (args == null || args == "")
            {
                chr.WriteToDisplay("Format: give <item> to <target>");
                return(false);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            if (sArgs.Length < 3)
            {
                chr.WriteToDisplay("Format: give <item> to <target>");
                return(false);
            }

            try
            {
                string giveItemName = sArgs[0];
                string giveTarget   = sArgs[2];

                Character target = TargetAcquisition.FindTargetInCell(chr, giveTarget);

                if (target == null)
                {
                    chr.WriteToDisplay("You do not see " + giveTarget + " here.");
                    return(false);
                }

                if (chr.WhichHand(giveItemName) == (int)Globals.eWearOrientation.None)
                {
                    chr.WriteToDisplay("You do not appear to have a " + giveItemName + " in your hands.");
                    return(false);
                }

                // Give target is a player.
                if (target.IsPC)
                {
                    if (Array.IndexOf((target as PC).ignoreList, chr.UniqueID) != -1)
                    {
                        chr.WriteToDisplay("You cannot give an item to " + target.Name + ".");
                        return(false);
                    }

                    int hand = target.GetFirstFreeHand();

                    if (hand == (int)Globals.eWearOrientation.None)
                    {
                        chr.WriteToDisplay(target.Name + " does not have an empty hand.");
                        target.WriteToDisplay(chr.Name + " would like to give you an item but you do not have an empty hand.");
                        return(false);
                    }

                    Item giveItem = chr.GetHeldItem(giveItemName);

                    if (giveItem.IsArtifact() && target.PossessesItem(giveItem.itemID))
                    {
                        chr.WriteToDisplay(target.GetNameForActionResult() + " attempted to give you an artifact you already possess.");
                        target.WriteToDisplay(chr.GetNameForActionResult() + " already possesses this artifact.");
                        return(true);
                    }

                    if (giveItem != null)
                    {
                        switch (hand)
                        {
                        case (int)Globals.eWearOrientation.Right:
                            if (!target.EquipRightHand(giveItem))
                            {
                                giveItem = null;
                            }
                            break;

                        case (int)Globals.eWearOrientation.Left:
                            if (!target.EquipLeftHand(giveItem))
                            {
                                giveItem = null;
                            }
                            break;
                        }
                    }

                    if (giveItem != null)
                    {
                        string itemDesc = giveItem.shortDesc + ".";

                        if (giveItem.venom > 0)
                        {
                            itemDesc += " It is coated with a caustic venom.";
                        }

                        target.WriteToDisplay(chr.Name + " has given you " + itemDesc);

                        if (giveItem == chr.RightHand)
                        {
                            chr.UnequipRightHand(chr.RightHand);
                        }
                        else if (giveItem == chr.LeftHand)
                        {
                            chr.UnequipLeftHand(giveItem);
                        }
                    }

                    return(true);
                }
                else
                {
                    NPC npc = (NPC)target;

                    Item item = chr.GetHeldItem(giveItemName);

                    if (item == null)
                    {
                        chr.WriteToDisplay("You do not have a " + giveItemName);
                        return(true);
                    }

                    if (item.attunedID > 0 && item.attunedID != chr.UniqueID)
                    {
                        if (!npc.animal && npc.Alignment == chr.Alignment)
                        {
                            npc.SendToAllInSight(npc.Name + ": The " + item.name + " does not belong to you, " + chr.Name + ". I cannot accept it.");
                        }
                        chr.EquipEitherHandOrDrop(item);
                        return(false);
                    }

                    if (npc.receivedItems.ContainsKey(chr.UniqueID))
                    {
                        if (!npc.receivedItems[chr.UniqueID].Contains(item) && (item.attunedID <= 0 || item.attunedID == chr.UniqueID))
                        {
                            npc.receivedItems[chr.UniqueID].Add(item);
                        }
                        else
                        {
                            goto manageItem;
                        }
                    }
                    else
                    {
                        List <Item> itemList = new List <Item>();
                        itemList.Add(item);
                        npc.receivedItems.Add(chr.UniqueID, itemList);
                    }

                    #region Pets
                    if (npc.PetOwner == chr)
                    {
                        if (Autonomy.EntityBuilding.EntityLists.ANIMAL.Contains(npc.entity) && !Autonomy.EntityBuilding.EntityLists.ANIMALS_WIELDING_WEAPONS.Contains(npc.entity))
                        {
                            chr.WriteToDisplay(npc.GetNameForActionResult(false) + " cannot hold items.");
                            goto manageItem;
                        }

                        if (npc.GetFirstFreeHand() != (int)Globals.eWearOrientation.None) // either right or left hand is free
                        {
                            if (npc.EquipEitherHand(item))
                            {
                                chr.WriteToDisplay("You have given " + item.shortDesc + " to " + npc.GetNameForActionResult(true) + ".");
                                return(true);
                            }
                            else
                            {
                                chr.WriteToDisplay("You were unable to give " + item.shortDesc + " to " + npc.GetNameForActionResult(true) + ".");
                                goto manageItem;
                            }
                        }
                        else
                        {
                            chr.WriteToDisplay(npc.GetNameForActionResult(false) + " does not have a free hand.");
                            goto manageItem;
                        }
                    }
                    #endregion

                    #region Confessor AI
                    if ((npc is Merchant) && (npc as Merchant).interactiveType == Merchant.InteractiveType.Confessor)
                    {
                        if (item.baseType == Globals.eItemBaseType.Dagger && item.silver) // any silver dagger will work
                        {
                            if (chr.Alignment == Globals.eAlignment.Neutral && chr.BaseProfession != Character.ClassType.Thief)
                            {
                                chr.Alignment = Globals.eAlignment.Lawful;
                                chr.WriteToDisplay(npc.Name + ": You are forgiven, " + chr.Name + ".");
                                return(true);
                            }
                            else if (chr.Alignment == Globals.eAlignment.Evil && Array.IndexOf(World.EvilProfessions, chr.BaseProfession) != -1)
                            {
                                chr.WriteToDisplay(npc.Name + ": You are inherently evil. There is no returning to the light for you. Maybe you should reroll as a goody two-shoes knight?");
                                return(true);
                            }
                            else if (chr.Alignment == Globals.eAlignment.Evil && Array.IndexOf(World.EvilProfessions, chr.BaseProfession) == -1)
                            {
                                chr.Alignment = Globals.eAlignment.Neutral;
                                chr.WriteToDisplay(npc.Name + ": You have taken the first step back to the light.");
                                return(true);
                            }
                        }
                        else if (item.baseType == Globals.eItemBaseType.Figurine || item.figExp > 0)
                        {
                            if ((chr as PC).currentKarma > 0)
                            {
                                (chr as PC).currentKarma--;
                                chr.WriteToDisplay(npc.Name + ": You have been absolved of " + ((chr as PC).currentKarma > 0 ? "some" : "all") + " guilt, " + chr.Name + ".");
                            }

                            return(true);
                        }
                    }
                    #endregion

                    #region Quest NPC
                    if (npc.QuestList.Count > 0)
                    {
                        foreach (GameQuest quest in npc.QuestList)
                        {
                            GameQuest activeQuest = chr.GetQuest(quest.QuestID);

                            short a = 0;

                            if (quest.RequiredItems.ContainsValue(item.itemID) && quest.PlayerMeetsRequirements((PC)chr, true))
                            {
                                if (quest.StepOrder)                                               // this quest has a specified order
                                {
                                    if (activeQuest != null)                                       // chr already has this quest and has not yet completed it, or has already completed it
                                    {
                                        if (quest.IsRepeatable || activeQuest.TimesCompleted <= 0) // quest can be repeated
                                        {
                                            if (activeQuest.Requirements[activeQuest.CurrentStep] == GameQuest.QuestRequirement.Item &&
                                                activeQuest.RequiredItems[activeQuest.CurrentStep] == item.itemID)
                                            {
                                                activeQuest.FinishStep(npc, (PC)chr, activeQuest.CurrentStep);
                                                return(true);
                                            }
                                            else
                                            {
                                                goto manageItem;
                                            }
                                        }
                                        else
                                        {
                                            chr.WriteToDisplay("You have already completed \"" + quest.Name + "\".");
                                            chr.EquipEitherHandOrDrop(item);
                                            return(true);
                                        }
                                    }
                                }
                                else
                                {
                                    if (activeQuest != null)                                       // chr already has this quest, or has completed it
                                    {
                                        if (quest.IsRepeatable || activeQuest.TimesCompleted <= 0) // quest can be repeated
                                        {
                                            a = 0;

                                            foreach (Item recvdItem in npc.receivedItems[chr.UniqueID]) // count received items
                                            {
                                                a++;
                                            }

                                            if (a == quest.RequiredItems.Count)
                                            {
                                                if (quest.CoinValues.ContainsKey(a))
                                                {
                                                    if (item.coinValue < quest.CoinValues[a])
                                                    {
                                                        goto manageItem;
                                                    }
                                                }

                                                goto questCompleted;
                                            }
                                            else
                                            {
                                                if (quest.CoinValues.ContainsKey(a))
                                                {
                                                    if (item.coinValue < quest.CoinValues[a])
                                                    {
                                                        goto manageItem;
                                                    }
                                                }

                                                if (a > 0)
                                                {
                                                    quest.FinishStep((NPC)target, (PC)chr, a);
                                                }
                                                return(true);
                                            }
                                        }
                                        else
                                        {
                                            chr.WriteToDisplay("You have already completed \"" + quest.Name + "\".");
                                            chr.EquipEitherHandOrDrop(item);
                                            return(true);
                                        }
                                    }
                                    else // chr does not already have this quest, or has never completed it
                                    {
                                        quest.BeginQuest((PC)chr, true);

                                        a = 0;

                                        foreach (Item recvdItem in npc.receivedItems[chr.UniqueID]) // count received items
                                        {
                                            a++;
                                        }

                                        if (a == quest.RequiredItems.Count)
                                        {
                                            if (quest.CoinValues.ContainsKey(a))
                                            {
                                                if (item.coinValue < quest.CoinValues[a])
                                                {
                                                    goto manageItem;
                                                }
                                            }

                                            goto questCompleted;
                                        }
                                        else
                                        {
                                            if (quest.CoinValues.ContainsKey(a))
                                            {
                                                if (item.coinValue < quest.CoinValues[a])
                                                {
                                                    goto manageItem;
                                                }
                                            }

                                            if (a > 0 && quest.FinishStrings.ContainsKey(a))
                                            {
                                                if (quest.FinishStrings[a] != "")
                                                {
                                                    chr.WriteToDisplay(npc.Name + ": " + quest.FinishStrings[a]);
                                                }
                                            }
                                            return(true);
                                        }
                                    }
                                }

questCompleted:

                                // break out of this now so the player does not lose an item for a quest that is not available yet
                                if (!quest.PlayerMeetsRequirements((PC)chr, true))
                                {
                                    chr.EquipEitherHandOrDrop(item);
                                    return(false);
                                }

                                // verify the quest is started
                                if (activeQuest == null)
                                {
                                    activeQuest = chr.GetQuest(quest.QuestID);
                                    quest.BeginQuest((PC)chr, false);
                                }

                                activeQuest.FinishStep(npc, (PC)chr, a);

                                // clear npc's received items list
                                npc.receivedItems[chr.UniqueID].Clear();

                                return(true); // break the foreach loop
                            }
                        }
                    }
                    #endregion

manageItem:

                    // Give the item back to the player or drop it
                    chr.EquipEitherHandOrDrop(item);
                    npc.receivedItems.Clear();
                    return(false);
                }
            }
            catch (Exception e)
            {
                Utils.LogException(e);
                return(false);
            }
        }
Example #14
0
        public bool OnCommand(Character chr, string args)
        {
            if (args == null || args == "")
            {
                chr.WriteToDisplay("Who do you want to pet?");
                return(false);
            }

            Character target = TargetAcquisition.FindTargetInCell(chr, args);

            if (target == null)
            {
                chr.WriteToDisplay("You do not see " + args + " here.");
                return(true);
            }

            if ((target is NPC) && (target as NPC).IsSummoned && target.Alignment == chr.Alignment)
            {
                if (target.special.Contains("figurine"))
                {
                    chr.WriteToDisplay("You pet " + target.GetNameForActionResult(true) + ".");
                    Rules.DespawnFigurine(target as NPC);
                }
                else
                {
                    chr.WriteToDisplay("You pet " + target.GetNameForActionResult(true) + ".");
                }
                return(true);
            }

            chr.WriteToDisplay("You pet " + target.GetNameForActionResult(true) + ".");

            if (target.canCommand)
            {
                Effect.CreateCharacterEffect(Effect.EffectTypes.Dog_Follow, 0, target, Rules.RollD(1, 10), chr);
            }

            // good luck dogs
            if (target.entity == Autonomy.EntityBuilding.EntityLists.Entity.Dog && (target.Alignment == Globals.eAlignment.Lawful || target.Alignment == chr.Alignment))
            {
                if (Rules.RollD(1, 20) > 12)
                {
                    chr.WriteToDisplay("The dog wags its tail.");
                    target.EmitSound(Sound.GetCommonSound(Sound.CommonSound.DogBark));
                    Effect.CreateCharacterEffect(Effect.EffectTypes.Animal_Affinity, 0, chr, Rules.RollD(2, 100) + 10, null);
                }
                else if (Rules.RollD(1, 100) < 50)
                {
                    target.SendToAllInSight(target.Name + ": Woof woof woof!");
                    target.EmitSound(Sound.GetCommonSound(Sound.CommonSound.DogBark));
                }

                return(true);
            }

            if (target.IsPC)
            {
                target.WriteToDisplay(chr.GetNameForActionResult(false) + " is petting you.");

                if (chr.FlaggedUniqueIDs.RemoveAll(id => id == target.UniqueID) > 0)
                {
                    chr.WriteToDisplay(target.GetNameForActionResult(false) + " is no longer flagged.");
                }
            }

            return(true);
        }
Example #15
0
        public bool OnCommand(Character chr, string args)
        {
            if (chr.CommandWeight > 3)
            {
                chr.WriteToDisplay("Command weight limit exceeded. Chase command not processed.");
                return(true);
            }

            if (args == null || args == "")
            {
                chr.WriteToDisplay("Chase who?");
                return(true);
            }
            else
            {
                string[]  sArgs  = args.Split(" ".ToCharArray());
                Character target = null;

                if (sArgs.Length == 2)
                {
                    int countTo = 0;
                    try
                    {
                        countTo = Convert.ToInt32(sArgs[0]);
                        target  = TargetAcquisition.FindTargetInView(chr, sArgs[1].ToLower(), countTo);
                    }
                    catch
                    {
                        target = TargetAcquisition.FindTargetInView(chr, sArgs[0].ToLower(), false, false);
                    }
                }
                else
                {
                    target = TargetAcquisition.FindTargetInView(chr, sArgs[0].ToLower(), false, false);
                }

                if (target == null)
                {
                    chr.WriteToDisplay(GameSystems.Text.TextManager.NullItemMessage(sArgs[0]));
                    return(true);
                }
                else
                {
                    chr.FollowID = target.UniqueID;
                    if (chr.CurrentCell != target.CurrentCell)
                    {
                        if (!PathTest.SuccessfulPathTest(PathTest.RESERVED_NAME_COMMANDSUFFIX, chr.CurrentCell, target.CurrentCell))
                        {
                            if (chr is NPC)
                            {
                                NPC chaser = chr as NPC;
                                chaser.AIGotoXYZ(target.CurrentCell.X, target.CurrentCell.Y, target.CurrentCell.Z);
                            }
                            return(false);
                        }
                        else
                        {
                            chr.CurrentCell = target.CurrentCell;
                        }
                    }
                    chr.CommandType = CommandTasker.CommandType.Movement;
                }
            }

            return(true);
        }
Example #16
0
        public bool OnCommand(Character chr, string args)
        {
            if (chr.CommandWeight > 3)
            {
                chr.WriteToDisplay("Command weight limit exceeded. Jumpkick command not processed.");
                return(true);
            }

            if (args == null || args == "")
            {
                chr.WriteToDisplay("Jumpkick who?");
                return(true);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            if (sArgs[0] == null)
            {
                chr.WriteToDisplay("Who do you want to jumpkick?");
                return(true);
            }

            Character target        = null;
            bool      includeHidden = chr.IsImmortal;

            if (sArgs.Length == 2)
            {
                int countTo = 0;

                try
                {
                    countTo = Convert.ToInt32(sArgs[0]);
                    target  = TargetAcquisition.FindTargetInView(chr, sArgs[1].ToLower(), countTo);
                }
                catch
                {
                    target = TargetAcquisition.FindTargetInView(chr, sArgs[0].ToLower(), false, includeHidden);
                }
            }
            else
            {
                target = TargetAcquisition.FindTargetInView(chr, sArgs[0].ToLower(), false, includeHidden);
            }

            if (target == null)
            {
                chr.WriteToDisplay(GameSystems.Text.TextManager.NullTargetMessage(sArgs[0]));
            }
            else
            {
                if (target.CurrentCell != chr.CurrentCell)
                {
                    PathTest pathTest = new PathTest(PathTest.RESERVED_NAME_JUMPKICKCOMMAND, chr.CurrentCell);

                    if (!pathTest.SuccessfulPathTest(target.CurrentCell))
                    {
                        chr.WriteToDisplay(GameSystems.Text.TextManager.PATH_IS_BLOCKED);
                        pathTest.RemoveFromWorld();
                        return(true);
                    }
                    pathTest.RemoveFromWorld();
                }

                chr.CommandType = CommandTasker.CommandType.Jumpkick;

                chr.Stamina -= Cell.GetCellDistance(chr.X, chr.Y, target.X, target.Y);

                Globals.eEncumbranceLevel encumbDesc = Rules.GetEncumbrance(chr);
                if (encumbDesc == Globals.eEncumbranceLevel.Moderately)
                {
                    chr.Stamina -= 2;
                }
                else if (encumbDesc == Globals.eEncumbranceLevel.Heavily)
                {
                    chr.Stamina -= 4;
                }
                else if (encumbDesc == Globals.eEncumbranceLevel.Severely)
                {
                    chr.Stamina -= 6;
                }

                if (chr.Stamina < 0)
                {
                    Combat.DoDamage(chr, chr, Math.Abs(chr.Stamina), false);
                    chr.Stamina = 0;
                }

                chr.CurrentCell = target.CurrentCell;

                chr.updateMap = true;

                Combat.DoJumpKick(chr, target);
            }

            return(true);
        }
Example #17
0
        public bool OnCommand(Character chr, string args)
        {
            if (chr is PC && chr.CommandWeight > 3)
            {
                return(true);
            }

            if (chr.CommandsProcessed.Contains(CommandTasker.CommandType.Movement))
            {
                if (chr is PC && !chr.HasEffect(Effect.EffectTypes.Speed))
                {
                    chr.WriteToDisplay("You do not have the ability to move and attack in the same round.");
                    return(true);
                }
                else if (chr is NPC && (chr as NPC).Speed <= 3 && !chr.HasEffect(Effect.EffectTypes.Speed))
                {
                    chr.WriteToDisplay("You do not have the ability to move and attack in the same round.");
                    return(true);
                }
            }

            if (string.IsNullOrEmpty(args))
            {
                chr.WriteToDisplay("Fight what?");
                return(true);
            }

            chr.CommandType = CommandTasker.CommandType.Attack;

            Item weapon = chr.RightHand;

            string[] sArgs = args.Split(" ".ToCharArray());

            Character target = null;

            // If hands are empty and gauntlets are worn, gauntlets become the weapon used for calculations.
            if (weapon == null)
            {
                weapon = chr.GetInventoryItem(Globals.eWearLocation.Hands);
            }

            if (sArgs.Length == 2)
            {
                if (int.TryParse(sArgs[0], out int countTo))
                {
                    target = TargetAcquisition.FindTargetInView(chr, sArgs[1].ToLower(), countTo);
                }
                else
                {
                    target = TargetAcquisition.FindTargetInCell(chr, sArgs[0].ToLower());
                }
            }
            else
            {
                target = TargetAcquisition.FindTargetInCell(chr, sArgs[0].ToLower());
            }

            if (target == null)
            {
                if (EntityLists.EntityListContains(EntityLists.LONGARMED, chr.entity))
                {
                    target = TargetAcquisition.FindTargetInNextCells(chr, sArgs[0].ToLower());
                }

                if (target == null)
                {
                    chr.WriteToDisplay(GameSystems.Text.TextManager.NullTargetMessage(sArgs[0]));
                    return(true);
                }
            }

            if (weapon != null)
            {
                if (weapon.skillType == Globals.eSkillType.Bow) // check if a bow is nocked
                {
                    chr.WriteToDisplay("You must nock a bow before shooting it.");
                    return(true);
                }

                if (weapon.IsAttunedToOther(chr)) // check if a weapon is attuned
                {
                    chr.CurrentCell.Add(weapon);
                    chr.WriteToDisplay("The " + weapon.name + " leaps from your hand!");
                    chr.UnequipRightHand(weapon);
                    return(true);
                }

                if (!weapon.AlignmentCheck(chr)) // check if a weapon has an alignment
                {
                    chr.CurrentCell.Add(weapon);
                    chr.WriteToDisplay("The " + weapon.name + " singes your hand and falls to the ground!");
                    if (weapon.wearLocation == Globals.eWearLocation.Hands)
                    {
                        chr.RemoveWornItem(weapon);
                    }
                    else
                    {
                        chr.UnequipRightHand(weapon);
                    }
                    Combat.DoDamage(chr, chr, Rules.RollD(1, 4), false);
                    return(true);
                }
            }

            // Do combat.
            Combat.DoCombat(chr, target, weapon);

            // Check double attack.
            Combat.CheckDoubleAttack(chr, target, weapon);

            // Hummingbird special attribute is an extra attack.
            Combat.CheckSpecialWeaponAttack(chr, target, weapon);

            // Check dual wield. Double attack is checked again for dual wielded weapon. Dual wielded hummingbird longsword is also checked here.
            Combat.CheckDualWield(chr, target, chr.LeftHand);

            return(true);
        }