/// <summary> /// Determines whether a spell will be evaded, based upon the caster's magic skill vs target's magic defense skill /// </summary> /// <param name="casterMagicSkill"></param> /// <param name="targetMagicDefenseSkill"></param> /// <returns></returns> public static bool MagicDefenseCheck(uint casterMagicSkill, uint targetMagicDefenseSkill) { return(Physics.Common.Random.RollDice(0.0f, 1.0f) < (1.0f - SkillCheck.GetSkillChance((int)casterMagicSkill, (int)targetMagicDefenseSkill))); }
public void Examine(WorldObject obj) { //Console.WriteLine($"{Name}.Examine({obj.Name})"); var success = true; var creature = obj as Creature; Player player = null; if (creature != null) { player = obj as Player; var skill = player != null ? Skill.AssessPerson : Skill.AssessCreature; var currentSkill = (int)GetCreatureSkill(skill).Current; int difficulty = (int)creature.GetCreatureSkill(Skill.Deception).Current; if (PropertyManager.GetBool("assess_creature_mod").Item&& skill == Skill.AssessCreature && Skills[Skill.AssessCreature].AdvancementClass < SkillAdvancementClass.Trained) { currentSkill = (int)((Focus.Current + Self.Current) / 2); } var chance = SkillCheck.GetSkillChance(currentSkill, difficulty); if (difficulty == 0 || player == this || player != null && !player.GetCharacterOption(CharacterOption.AttemptToDeceiveOtherPlayers)) { chance = 1.0f; } if ((this is Admin || this is Sentinel) && CloakStatus == CloakStatus.On) { chance = 1.0f; } success = chance >= ThreadSafeRandom.Next(0.0f, 1.0f); } if (creature is Pet || creature is CombatPet) { success = true; } if (success) { CurrentAppraisalTarget = obj.Guid.Full; } Session.Network.EnqueueSend(new GameEventIdentifyObjectResponse(Session, obj, success)); if (!success && player != null && !player.SquelchManager.Squelches.Contains(this, ChatMessageType.Appraisal)) { player.Session.Network.EnqueueSend(new GameMessageSystemChat($"{Name} tried and failed to assess you!", ChatMessageType.Appraisal)); } // pooky logic - handle monsters attacking on appraisal if (creature != null && creature.MonsterState == State.Idle) { if (creature.Tolerance.HasFlag(Tolerance.Appraise)) { creature.AttackTarget = this; creature.WakeUp(); } } }