public static bool SetCurrentMove(Mobile m, SpecialMove move) { if (!Core.SE) { ClearCurrentMove(m); return(false); } if (move != null && !move.Validate(m)) { ClearCurrentMove(m); return(false); } bool sameMove = (move == GetCurrentMove(m)); ClearCurrentMove(m); if (sameMove) { return(true); } if (move != null) { WeaponAbility.ClearCurrentAbility(m); m_Table[m] = move; move.OnUse(m); int moveID = SpellRegistry.GetRegistryNumber(move); if (moveID > 0) { m.Send(new ToggleSpecialAbility(moveID + 1, true)); } move.SendAbilityMessage(m); SkillMasterySpell.CancelSpecialMove(m); } return(true); }
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, IDamageable damageable) { Mobile target = damageable as Mobile; int damage = Utility.Dice(dice, sides, bonus) * 100; int damageBonus = 0; int inscribeSkill = GetInscribeFixed(m_Caster); int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200; damageBonus += inscribeBonus; int intBonus = Caster.Int / 10; damageBonus += intBonus; damageBonus += SpellHelper.GetSpellDamageBonus(m_Caster, target, CastSkill, playerVsPlayer); damage = AOS.Scale(damage, 100 + damageBonus); if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster) { damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100)); } int evalSkill = GetDamageFixed(m_Caster); int evalScale = 30 + ((9 * evalSkill) / 100); damage = AOS.Scale(damage, evalScale); damage = AOS.Scale(damage, (int)(scalar * 100)); #region Skill Mastery SkillMasterySpell spell = SkillMasterySpell.GetHarmfulSpell(Caster, typeof(TribulationSpell)); if (spell != null) { spell.AbsorbDamage(ref damage); } #endregion return(damage / 100); }
public override void OnThink() { base.OnThink(); if (Combatant == null) { return; } if (_NextMastery < DateTime.UtcNow) { if (SkillMasterySpell.HasSpell(this, typeof(RampageSpell)) || Utility.RandomDouble() > 0.5) { SpecialMove.SetCurrentMove(this, SpellRegistry.GetSpecialMove(740)); } else { SkillMasterySpell spell = new RampageSpell(this, null); spell.Cast(); } _NextMastery = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 70)); } }
public static bool CheckHit(Mobile attacker, Mobile defender, WeaponAbility ability, Item weapon) { if (defender == null || (Core.EJ && (ability == WeaponAbility.Disarm || ability == WeaponAbility.InfectiousStrike || SkillMasterySpell.HasSpell(attacker, typeof(SkillMasterySpell))))) { return(false); } SplinteringWeaponContext context = PropertyEffect.GetContext <SplinteringWeaponContext>(attacker, defender, EffectsType.Splintering); if (context == null) { new SplinteringWeaponContext(attacker, defender, weapon); return(true); } return(false); }
public static void Gain(Mobile from, Skill skill) { if (from.Region.IsPartOf(typeof(Regions.Jail))) { return; } if (from is BaseCreature && ((BaseCreature)from).IsDeadPet) { return; } if (skill.SkillName == SkillName.Focus && from is BaseCreature) { return; } if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up) { int toGain = 1; if (skill.Base <= 10.0) { toGain = Utility.Random(4) + 1; } Skills skills = from.Skills; #region Mondain's Legacy if (from is PlayerMobile) { if (Server.Engines.Quests.QuestHelper.EnhancedSkill((PlayerMobile)from, skill)) { toGain *= Utility.RandomMinMax(2, 4); } } #endregion #region Scroll of Alacrity if (from is PlayerMobile) { PlayerMobile pm = from as PlayerMobile; if (pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow) { pm.SendLocalizedMessage(1077956); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll. toGain = Utility.RandomMinMax(2, 5); } } #endregion if (from.Player && (skills.Total / skills.Cap) >= Utility.RandomDouble())//( skills.Total >= skills.Cap ) { for (int i = 0; i < skills.Length; ++i) { Skill toLower = skills[i]; if (toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain) { toLower.BaseFixedPoint -= toGain; break; } } } #region Skill Masteries else if (from is BaseCreature && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned)) { Mobile master = ((BaseCreature)from).GetMaster(); if (master != null) { WhisperingSpell spell = SkillMasterySpell.GetSpell(master, typeof(WhisperingSpell)) as WhisperingSpell; if (spell != null && master.InRange(from.Location, spell.PartyRange) && master.Map == from.Map && spell.EnhancedGainChance >= Utility.Random(100)) { toGain = Utility.RandomMinMax(2, 5); } } } #endregion if (!from.Player || (skills.Total + toGain) <= skills.Cap) { skill.BaseFixedPoint += toGain; } } #region Mondain's Legacy if (from is PlayerMobile) { Server.Engines.Quests.QuestHelper.CheckSkill((PlayerMobile)from, skill); } #endregion if (skill.Lock == SkillLock.Up) { SkillInfo info = skill.Info; // Old gain mechanic if (!Core.ML) { if (from.StrLock == StatLockType.Up && (info.StrGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Str); } else if (from.DexLock == StatLockType.Up && (info.DexGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Dex); } else if (from.IntLock == StatLockType.Up && (info.IntGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Int); } } else { TryStatGain(info, from); } } }
public static void Gain(Mobile from, Skill skill) { if (from.Region.IsPartOf <Jail>()) { return; } if (from is BaseCreature && ((BaseCreature)from).IsDeadPet) { return; } if (skill.SkillName == SkillName.Focus && from is BaseCreature && (!PetTrainingHelper.Enabled || !((BaseCreature)from).Controlled)) { return; } if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up) { var toGain = 1; var skills = from.Skills; if (from is PlayerMobile && Siege.SiegeShard) { var minsPerGain = Siege.MinutesPerGain(from, skill); if (minsPerGain > 0) { if (Siege.CheckSkillGain((PlayerMobile)from, minsPerGain, skill)) { CheckReduceSkill(skills, toGain, skill); if (skills.Total + toGain <= skills.Cap) { skill.BaseFixedPoint += toGain; } } return; } } if (skill.Base <= 10.0) { toGain = Utility.Random(4) + 1; } #region Mondain's Legacy if (from is PlayerMobile && QuestHelper.EnhancedSkill((PlayerMobile)from, skill)) { toGain *= Utility.RandomMinMax(2, 4); } #endregion #region Scroll of Alacrity if (from is PlayerMobile && skill.SkillName == ((PlayerMobile)from).AcceleratedSkill && ((PlayerMobile)from).AcceleratedStart > DateTime.UtcNow) { // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll. ((PlayerMobile)from).SendLocalizedMessage(1077956); toGain = Utility.RandomMinMax(2, 5); } #endregion #region Skill Masteries else if (from is BaseCreature && !(from is Server.Engines.Despise.DespiseCreature) && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned)) { var master = ((BaseCreature)from).GetMaster(); if (master != null) { var spell = SkillMasterySpell.GetSpell(master, typeof(WhisperingSpell)) as WhisperingSpell; if (spell != null && master.InRange(from.Location, spell.PartyRange) && master.Map == from.Map && spell.EnhancedGainChance >= Utility.Random(100)) { toGain = Utility.RandomMinMax(2, 5); } } } #endregion if (from is PlayerMobile) { CheckReduceSkill(skills, toGain, skill); } if (!from.Player || (skills.Total + toGain <= skills.Cap)) { skill.BaseFixedPoint = Math.Min(skill.CapFixedPoint, skill.BaseFixedPoint + toGain); EventSink.InvokeSkillGain(new SkillGainEventArgs(from, skill, toGain)); if (from is PlayerMobile) { UpdateGGS(from, skill); } } } #region Mondain's Legacy if (from is PlayerMobile) { QuestHelper.CheckSkill((PlayerMobile)from, skill); } #endregion if (skill.Lock == SkillLock.Up && (!Siege.SiegeShard || !(from is PlayerMobile) || Siege.CanGainStat((PlayerMobile)from))) { var info = skill.Info; // Old gain mechanic if (!Core.ML) { var scalar = 1.0; if (from.StrLock == StatLockType.Up && (info.StrGain / 33.3) * scalar > Utility.RandomDouble()) { GainStat(from, Stat.Str); } else if (from.DexLock == StatLockType.Up && (info.DexGain / 33.3) * scalar > Utility.RandomDouble()) { GainStat(from, Stat.Dex); } else if (from.IntLock == StatLockType.Up && (info.IntGain / 33.3) * scalar > Utility.RandomDouble()) { GainStat(from, Stat.Int); } } else { TryStatGain(info, from); } } }
public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, IDamageable damageable) { Mobile target = damageable as Mobile; int damage = Utility.Dice(dice, sides, bonus) * 100; int damageBonus = 0; int inscribeSkill = GetInscribeFixed(m_Caster); int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200; damageBonus += inscribeBonus; int intBonus = Caster.Int / 10; damageBonus += intBonus; int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage); #region Mondain's Legacy sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer); #endregion if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage)) { sdiBonus -= 10; } sdiBonus -= Block.GetSpellReduction(target); // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused. if (playerVsPlayer) { if (SpellHelper.HasSpellFocus(m_Caster, CastSkill) && sdiBonus > 30) { sdiBonus = 30; } if (!SpellHelper.HasSpellFocus(m_Caster, CastSkill) && sdiBonus > 15) { sdiBonus = 15; } } damageBonus += sdiBonus; damage = AOS.Scale(damage, 100 + damageBonus); if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster) { damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100)); } int evalSkill = GetDamageFixed(m_Caster); int evalScale = 30 + ((9 * evalSkill) / 100); damage = AOS.Scale(damage, evalScale); damage = AOS.Scale(damage, (int)(scalar * 100)); #region Skill Mastery SkillMasterySpell spell = SkillMasterySpell.GetHarmfulSpell(Caster, typeof(TribulationSpell)); if (spell != null) { spell.AbsorbDamage(ref damage); } #endregion return(damage / 100); }
public static bool CheckHit(Mobile attacker, Mobile defender, WeaponAbility ability, Item weapon) { if (defender == null || ability == WeaponAbility.Disarm || ability == WeaponAbility.InfectiousStrike || SkillMasterySpell.HasSpell(attacker, typeof(SkillMasterySpell)) || VictimIsUnderEffects <SplinteringWeaponContext>(defender)) { return(false); } SplinteringWeaponContext context = GetContext <SplinteringWeaponContext>(attacker, defender); if (context == null) { AddEffects(new SplinteringWeaponContext(attacker, defender, weapon)); return(true); } return(false); }
public static void Gain(Mobile from, Skill skill, int toGain) { if (from.Region.IsPartOf <Jail>()) { return; } if (from is BaseCreature creature && creature.IsDeadPet) { return; } if (skill.SkillName == SkillName.Focus && from is BaseCreature baseCreature && !baseCreature.Controlled) { return; } if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up) { Skills skills = from.Skills; if (from is PlayerMobile mobile && Siege.SiegeShard) { int minsPerGain = Siege.MinutesPerGain(mobile, skill); if (minsPerGain > 0) { if (Siege.CheckSkillGain(mobile, minsPerGain, skill)) { CheckReduceSkill(skills, toGain, skill); if (skills.Total + toGain <= skills.Cap) { skill.BaseFixedPoint += toGain; } } return; } } if (toGain == 1 && skill.Base <= 10.0) { toGain = Utility.Random(4) + 1; } if (from is PlayerMobile playerMobile && QuestHelper.EnhancedSkill(playerMobile, skill)) { toGain *= Utility.RandomMinMax(2, 4); } #region Scroll of Alacrity if (from is PlayerMobile pm && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow) { pm.SendLocalizedMessage(1077956); // You are infused with intense energy. You are under the effects of an accelerated skill gain scroll. toGain = Utility.RandomMinMax(2, 5); } #endregion #region Skill Masteries else if (from is BaseCreature bc && !(bc is Engines.Despise.DespiseCreature) && (bc.Controlled || bc.Summoned)) { Mobile master = bc.GetMaster(); if (master != null) { WhisperingSpell spell = SkillMasterySpell.GetSpell(master, typeof(WhisperingSpell)) as WhisperingSpell; if (spell != null && master.InRange(bc.Location, spell.PartyRange) && master.Map == bc.Map && spell.EnhancedGainChance >= Utility.Random(100)) { toGain = Utility.RandomMinMax(2, 5); } } } #endregion if (from is PlayerMobile) { CheckReduceSkill(skills, toGain, skill); } if (!from.Player || (skills.Total + toGain <= skills.Cap)) { skill.BaseFixedPoint = Math.Min(skill.CapFixedPoint, skill.BaseFixedPoint + toGain); EventSink.InvokeSkillGain(new SkillGainEventArgs(from, skill, toGain)); if (from is PlayerMobile) { UpdateGGS(from, skill); } } }