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); }
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); }
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); } }
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); }
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); }
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); }