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