public static int GetPreUORDamage(SpellCircle Circle) { int circle = (int)Circle; if (circle < 0 || circle > 7) { return(1); } else { int row = circle; int dmg = Utility.Dice(DamageTable[row * 3], DamageTable[row * 3 + 1], DamageTable[row * 3 + 2]); return(dmg); } /*switch ( Circle ) * { * case SpellCircle.First: return Utility.Dice( 1, 3, 3 ); * case SpellCircle.Second: return Utility.Dice( 1, 8, 4 ); * case SpellCircle.Third: return Utility.Dice( 4, 4, 4 ); * case SpellCircle.Fourth: return Utility.Dice( 3, 8, 5 ); * case SpellCircle.Fifth: return Utility.Dice( 5, 8, 6 ); * case SpellCircle.Sixth: return Utility.Dice( 6, 8, 8 ); * case SpellCircle.Seventh: return Utility.Dice( 7, 8, 10 ); * case SpellCircle.Eighth: return Utility.Dice( 7, 8, 10 ); * default: return 1; * }*/ }
public void AddPointInWorldSpace(Vector3 pointInWorldSpace, SpellCircle spellPlane) { // Project the point onto the spell plane // For some reason, I need to use spellPlane.transform.forward as the up dir. Not sure why. Vector3 newPoint = Vector3.ProjectOnPlane(pointInWorldSpace, spellPlane.transform.forward); // Translate to local space, (-inf, inf, z) newPoint -= spellPlane.transform.position; // Undo any rotation on the spell plane newPoint = Quaternion.Inverse(spellPlane.transform.rotation) * newPoint; // Throw away the z value - having this populated causes issues when we start to rotate newPoint.z = 0f; points.Add(newPoint); // -- Update the bounding box if (points.Count == 1) { boundingBox[0] = newPoint; boundingBox[1] = newPoint; } else { UpdateBoundingBox(newPoint); } }
public virtual double GetResistPercentForCircle( Mobile target, SpellCircle circle ) { double firstPercent = target.Skills[SkillName.MagicResist].Value / 5.0; double secondPercent = target.Skills[SkillName.MagicResist].Value - (((Caster.Skills[CastSkill].Value - 20.0) / 5.0) + (1 + (int)circle) * 5.0); return (firstPercent > secondPercent ? firstPercent : secondPercent) / 2.0; // Seems should be about half of what stratics says. }
public Vector3 TranslatePointToSpellPlane(Vector3 point, SpellCircle spellPlane) { // Shift from (-inf, inf) to (0, inf) point.x -= boundingBox[0].x; point.y -= boundingBox[0].y; // -- Scale the sigil to match the size of the spell plane // We scale x/y by the same amount, to avoid spline distortion // Scale both so that they fit in the spell plane float scaleDelta; if (sigilWidth > sigilHeight) { scaleDelta = spellPlane.diameter / sigilWidth; } else { scaleDelta = spellPlane.diameter / sigilHeight; } point *= scaleDelta; // -- Center the scaled sigil point.x -= sigilWidth / 2 * scaleDelta; point.y -= sigilHeight / 2 * scaleDelta; return(point); }
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle) { double firstPercent = target.Skills[SkillName.MagicResist].Value / 5.0; double secondPercent = target.Skills[SkillName.MagicResist].Value - (((m_Caster.Skills[CastSkill].Value - 20.0) / 5.0) + (1 + (int)circle) * 5.0); return((firstPercent > secondPercent ? firstPercent : secondPercent) / 2.0); // Seems should be about half of what stratics says. }
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle) { double firstPercent = target.Skills[SkillName.MagicResist].Value / 5.0; double secondPercent = target.Skills[SkillName.MagicResist].Value - (((Caster.Skills[CastSkill].Value - 20.0) / 5.0) + (1 + (int)circle) * 5.0); return((firstPercent > secondPercent ? firstPercent : secondPercent) / 2.0); }
// Use this for spawn this instance void Awake() { if (instance == null) instance = this; else Destroy(gameObject); gameObject.SetActive(false); }
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle) { double value = GetResistSkill(target); double firstPercent = value / 5.0; double secondPercent = value - (((Caster.Skills[CastSkill].Value - 20.0) / 5.0) + (Math.Max(5, 1 + (int)circle)) * 5.0); return((firstPercent > secondPercent ? firstPercent : secondPercent) / 2.0); // Seems should be about half of what stratics says. }
public void DrawBoundingBox(SpellCircle spellPlane, LineRenderer lineRenderer) { lineRenderer.positionCount = 4; lineRenderer.SetPosition(0, TranslatePointToSpellPlane(new Vector3(boundingBox[0].x, boundingBox[0].y, 0), spellPlane)); lineRenderer.SetPosition(1, TranslatePointToSpellPlane(new Vector3(boundingBox[1].x, boundingBox[0].y, 0), spellPlane)); lineRenderer.SetPosition(2, TranslatePointToSpellPlane(new Vector3(boundingBox[1].x, boundingBox[1].y, 0), spellPlane)); lineRenderer.SetPosition(3, TranslatePointToSpellPlane(new Vector3(boundingBox[0].x, boundingBox[1].y, 0), spellPlane)); }
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle) { var magicResist = target.Skills.MagicResist.Value; var firstPercent = magicResist / 5.0; var secondPercent = magicResist - ((Caster.Skills[CastSkill].Value - 20.0) / 5.0 + (1 + (int)circle) * 5.0); // Seems should be about half of what stratics says. return((firstPercent > secondPercent ? firstPercent : secondPercent) / 2.0); }
public static bool TryResist(Mobile caster, Mobile target, SpellCircle circle) { if (!caster.Alive || !target.Alive || target.Hidden) { return(false); } var points = (int)circle * 40.0; var magery = caster.Skills[SkillName.Magery].Value; var resist = target.Skills[SkillName.MagicResist].Value; var chance = resist / 6.0; var secondaryChance = resist - ((magery / 4.0) + ((int)circle * 6.0)); if (secondaryChance > chance) { chance = secondaryChance; } if (target.ClassContainsSkill(SkillName.Magery)) { chance *= target.GetClassModifier(SkillName.Magery); } /* * TODO: Replace hacky class checking * This is a bit of a hack since we don't want to reference "Warrior" as a class so we're not tightly coupled * because the Warrior class can be replaced or removed entirely. This approximates checking a melee-like class. * A better solution might be to have positive/negative affinities, i.e. Warrior has negative affinity to magic */ else if (target.ClassContainsSkill(SkillName.Swords, SkillName.Macing, SkillName.Anatomy)) { var bonus = target.GetClassModifier(SkillName.Swords); chance = chance / bonus / 2; resist /= bonus; } // Same as above, just the inverse for the caster if (caster.ClassContainsSkill(SkillName.Magery)) { chance /= caster.GetClassModifier(SkillName.Magery); } else if (caster.ClassContainsSkill(SkillName.Swords, SkillName.Macing, SkillName.Anatomy)) { var bonus = caster.GetClassModifier(SkillName.Swords); chance = chance * bonus * 2; resist *= bonus; } if (resist < 25.0) { AwardPoints(target, SkillName.MagicResist, (int)points / 3); } return(Utility.RandomMinMax(0, 100) <= chance); }
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle) { double firstPercent = target.Skills[SkillName.MagicResist].Value * SpellDamageController.__MaxFirstPercent * 0.01; double secondPercent = 0.01 * ((target.Skills[SkillName.MagicResist].Value) - (Caster.Skills[CastSkill].Value * SpellDamageController.__MaxSecondPercentMageryAffect)) - (1 + (int)circle) * SpellDamageController.__SecondPercentCircleAffect; return((firstPercent > secondPercent ? firstPercent : secondPercent) * SpellDamageController.__GlobalResistChanceMultiplier); // Seems should be about half of what stratics says. }
public DamageEffect(SpellCircle circle, int snd, int effiid, int spd, int dur, int eff, EffectLayer layer) { m_Circle = circle; m_Snd = snd; m_EffIID = effiid; m_Spd = spd; m_Exp = dur; m_Eff = eff; m_ExpSnd = -(((int)layer) + 1); }
public DamageEffect(SpellCircle circle, int snd, int effiid, int spd, int eff, int exp, int expsnd) { m_Circle = circle; m_Snd = snd; m_EffIID = effiid; m_Spd = spd; m_Eff = eff; m_Exp = exp; m_ExpSnd = expsnd; }
public static int TryResistDamage(Mobile caster, Mobile target, SpellCircle circle, int damage) { if (TryResist(caster, target, circle)) { target.SendLocalizedMessage(502635); // You feel yourself resisting magical energy! target.PlaySound(0x1E6); target.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Waist); damage = GetDamageAfterResist(caster, target, damage); } return(damage); }
// -------------------------------------------------------------------------------- // Point Manipulation // -------------------------------------------------------------------------------- public void AddPointRaw(Vector3 point, SpellCircle spellPlane) { points.Add(point); // -- Update the bounding box if (points.Count == 1) { boundingBox[0] = point; boundingBox[1] = point; } else { UpdateBoundingBox(point); } }
public SpellInfo( string name, string mantra, SpellCircle circle, int action, int leftHandEffect, int rightHandEffect, bool allowTown, params Type[] regs ) { m_Name = name; m_Mantra = mantra; m_Circle = circle; m_Action = action; m_Reagents = regs; m_AllowTown = allowTown; m_LeftHandEffect = leftHandEffect; m_RightHandEffect = rightHandEffect; m_Amounts = new int[regs.Length]; for ( int i = 0; i < regs.Length; ++i ) m_Amounts[i] = 1; }
public SpellInfo(string name, string mantra, SpellCircle circle, int action, int leftHandEffect, int rightHandEffect, bool allowTown, params Type[] regs) { m_Name = name; m_Mantra = mantra; m_Circle = circle; m_Action = action; m_Reagents = regs; m_AllowTown = allowTown; m_LeftHandEffect = leftHandEffect; m_RightHandEffect = rightHandEffect; m_Amounts = new int[regs.Length]; for (int i = 0; i < regs.Length; ++i) { m_Amounts[i] = 1; } }
public static int CalcSpellDamage(Mobile caster, Mobile target, SpellCircle spellCircle, bool areaSpell = false) { const int mageryDivider = 5; const int playerDivider = 3; const int circleMultiplier = 3; const int dices = 5; if (!caster.Alive || !target.Alive || target.Hidden) { return(0); } var circle = (int)spellCircle; if (areaSpell) { circle -= 3; } if (circle < 1) { circle = 1; } var damage = Utility.RandomMinMax(circle * circleMultiplier, circle * circleMultiplier * dices) + caster.Skills[SkillName.Magery].Value / mageryDivider; var circleMaxDamage = circle * (13 + circle); if (damage > circleMaxDamage) { damage = circleMaxDamage; } if (target.Player) { damage /= playerDivider; } return((int)damage); }
public override double GetResistPercentForCircle(Mobile target, SpellCircle circle) { if (Caster.EraUOR) { var p = Caster as PlayerMobile; if (p != null && p.DuelContext != null && !p.DuelContext.Ruleset.GetOption("Skills", "Poisoning")) { return(0.5 + ((target.Skills[SkillName.MagicResist].Value - (Caster.Skills[SkillName.Magery].Value + 10)) / 40)); } var poison = (0.5 + ((target.Skills[SkillName.MagicResist].Value - (Caster.Skills[SkillName.Magery].Value + 10)) / 40)) * (1.0 - (Caster.Skills[SkillName.Poisoning].Value / 100)); if (poison <= 0) { poison = 0.05; } return(poison); } if (Caster.EraT2A) { var p = Caster as PlayerMobile; if (p != null && p.DuelContext != null && p.DuelContext.Ruleset.GetOption("Skills", "Poisoning")) { return(0.5 + ((target.Skills[SkillName.MagicResist].Value - (Caster.Skills[SkillName.Magery].Value + 10)) / 40)); } return((0.5 + ((target.Skills[SkillName.MagicResist].Value - (Caster.Skills[SkillName.Magery].Value + 10)) / 40)) * (1.0 - (Caster.Skills[SkillName.Poisoning].Value / 100))); } return(base.GetResistPercentForCircle(target, circle) - (0.01 * Caster.Skills[SkillName.Poisoning].Value * SpellDamageController._PoisonSkillResistModifier)); }
public override double GetResistPercentForCircle(Mobile target, SpellCircle circle) { if (Caster.EraUOR) { var p = Caster as PlayerMobile; if (p != null && p.DuelContext != null && !p.DuelContext.Ruleset.GetOption("Skills", "Poisoning")) { return (0.5 + ((target.Skills[SkillName.MagicResist].Value - (Caster.Skills[SkillName.Magery].Value + 10)) / 40)); } var poison = (0.5 + ((target.Skills[SkillName.MagicResist].Value - (Caster.Skills[SkillName.Magery].Value + 10)) / 40)) * (1.0 - (Caster.Skills[SkillName.Poisoning].Value / 100)); if (poison <= 0) poison = 0.05; return poison; } if (Caster.EraT2A) { var p = Caster as PlayerMobile; if (p != null && p.DuelContext != null && p.DuelContext.Ruleset.GetOption("Skills", "Poisoning")) { return (0.5 + ((target.Skills[SkillName.MagicResist].Value - (Caster.Skills[SkillName.Magery].Value + 10)) / 40)); } return (0.5 + ((target.Skills[SkillName.MagicResist].Value - (Caster.Skills[SkillName.Magery].Value + 10)) / 40)) * (1.0 - (Caster.Skills[SkillName.Poisoning].Value / 100)); } return base.GetResistPercentForCircle(target, circle) - (0.01 * Caster.Skills[SkillName.Poisoning].Value * SpellDamageController._PoisonSkillResistModifier); }
public static int GetPreUORDamage(SpellCircle Circle) { switch (Circle) { case SpellCircle.First: return(Utility.Dice(1, 3, 3)); case SpellCircle.Second: return(Utility.Dice(1, 8, 4)); case SpellCircle.Third: return(Utility.Dice(4, 4, 4)); case SpellCircle.Fourth: return(Utility.Dice(3, 8, 5)); case SpellCircle.Fifth: return(Utility.Dice(5, 8, 6)); case SpellCircle.Sixth: return(Utility.Dice(6, 8, 8)); case SpellCircle.Seventh: return(Utility.Dice(7, 8, 10)); case SpellCircle.Eighth: return(Utility.Dice(7, 8, 10)); } return(1); }
// When transformSigilToSpellPlane is true, the sigil will be scaled and centered // When scaled, it'll be scaled uniformly towards spellPlane.diameter public override void DrawSigil(SpellCircle spellPlane, LineRenderer lineRenderer, bool transformSigil) { if (points.Count < 2) { return; } lineRenderer.enabled = true; lineRenderer.positionCount = points.Count; for (int i = 0; i < lineRenderer.positionCount; i++) { if (transformSigil) { lineRenderer.SetPosition(i, TranslatePointToSpellPlane(points[i], spellPlane)); } else { lineRenderer.SetPosition(i, points[i]); } } // TODO: Snap point to hand if currently drawing }
// -------------------------------------------------------------------------------- // Sigil rendering // -------------------------------------------------------------------------------- public override void DrawSigil(SpellCircle spellPlane, LineRenderer lineRenderer, bool transformToSpellPlane) { if (numPointsInSigil < 1) { Debug.LogError("Not enough points given to draw this spline!"); return; } lineRenderer.enabled = true; lineRenderer.positionCount = numPointsInSigil; Vector3 point = sigil.GetPointLocalSpace(0f); if (transformToSpellPlane) { lineRenderer.SetPosition(0, TranslatePointToSpellPlane(point, spellPlane)); } else { lineRenderer.SetPosition(0, point); } for (int i = 1; i < numPointsInSigil; i++) { float splineIndex = (float)i / (numPointsInSigil - 1); point = sigil.GetPointLocalSpace(splineIndex); if (transformToSpellPlane) { lineRenderer.SetPosition(i, TranslatePointToSpellPlane(point, spellPlane)); } else { lineRenderer.SetPosition(i, point); } } }
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle) { return(GetResistPercentForCircleStatic(target, Caster, (int)circle)); }
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle) { return(0.0); }
public virtual double GetResistPercentForCircle(Mobile target, SpellCircle circle) { double firstPercent = target.Skills[SkillName.MagicResist].Value * SpellDamageController.__MaxFirstPercent * 0.01; double secondPercent = 0.01 * ((target.Skills[SkillName.MagicResist].Value) - (Caster.Skills[CastSkill].Value * SpellDamageController.__MaxSecondPercentMageryAffect)) - (1 + (int)circle) * SpellDamageController.__SecondPercentCircleAffect; return (firstPercent > secondPercent ? firstPercent : secondPercent) * SpellDamageController.__GlobalResistChanceMultiplier; // Seems should be about half of what stratics says. }
// -------------------------------------------------------------------------------- // Sigil rendering // -------------------------------------------------------------------------------- public abstract void DrawSigil(SpellCircle spellPlane, LineRenderer lineRenderer, bool transformToSpellPlane);
// -------------------------------------------------------------------------------- // Sigil position // -------------------------------------------------------------------------------- public Vector3 GetPointOnSpellPlane(float t, SpellCircle spellPlane) { return(TranslatePointToSpellPlane(sigil.GetPointLocalSpace(t), spellPlane)); }
public SpellInfo(string name, string mantra, SpellCircle circle, bool allowTown, params Type[] regs) : this(name, mantra, circle, 16, 0, 0, allowTown, regs) { }
public SpellInfo( string name, string mantra, SpellCircle circle, int action, int handEffect, bool allowTown, params Type[] regs ) : this( name, mantra, circle, action, handEffect, handEffect, allowTown, regs ) { }
public static TimeSpan GetCastDelay(SpellCircle circle) { return(TimeSpan.FromSeconds(0.5 + (0.25 * (int)circle))); }
public static int GetPreUORDamage(SpellCircle Circle) { int circle = (int)Circle; if (circle < 0 || circle > 7) return 1; else { int row = circle; int dmg = Utility.Dice(DamageTable[row * 3], DamageTable[row * 3 + 1], DamageTable[row * 3 + 2]); return dmg; } /*switch ( Circle ) { case SpellCircle.First: return Utility.Dice( 1, 3, 3 ); case SpellCircle.Second: return Utility.Dice( 1, 8, 4 ); case SpellCircle.Third: return Utility.Dice( 4, 4, 4 ); case SpellCircle.Fourth: return Utility.Dice( 3, 8, 5 ); case SpellCircle.Fifth: return Utility.Dice( 5, 8, 6 ); case SpellCircle.Sixth: return Utility.Dice( 6, 8, 8 ); case SpellCircle.Seventh: return Utility.Dice( 7, 8, 10 ); case SpellCircle.Eighth: return Utility.Dice( 7, 8, 10 ); default: return 1; }*/ }
public SpellInfo( string name, string mantra, SpellCircle circle, bool allowTown, params Type[] regs ) : this( name, mantra, circle, 16, 0, 0, allowTown, regs ) { }
public SpellInfo(string name, string mantra, SpellCircle circle, int action, int handEffect, bool allowTown, params Type[] regs) : this(name, mantra, circle, action, handEffect, handEffect, allowTown, regs) { }
public SpellInfo(string name, string mantra, SpellCircle circle, int action, params Type[] regs) : this(name, mantra, circle, action, 0, 0, true, regs) { }
public override double GetResistPercentForCircle(Mobile target, SpellCircle circle) { return(base.GetResistPercentForCircle(target, circle) - (Caster.Skills[SkillName.Poisoning].Value * 0.2)); }
public virtual double GetResistPercentForCircle( Mobile target, SpellCircle circle ) { return GetResistPercentForCircleStatic( target, Caster, (int)circle ); }
public WandMenu(EmptyWand wand, string[] spells, SpellCircle circle) : base("Select a spell...", spells) { m_Wand = wand; m_SpellCircle = circle; }
public SpellInfo( string name, string mantra, SpellCircle circle, int action, params Type[] regs ) : this( name, mantra, circle, action, 0, 0, true, regs ) { }
public static int GetPreUORDamage( SpellCircle Circle ) { switch ( Circle ) { case SpellCircle.First: return Utility.Dice( 1,3,3 ); case SpellCircle.Second:return Utility.Dice( 1,8,4 ); case SpellCircle.Third: return Utility.Dice( 4,4,4 ); case SpellCircle.Fourth:return Utility.Dice( 3,8,5 ); case SpellCircle.Fifth: return Utility.Dice( 5,8,6 ); case SpellCircle.Sixth: return Utility.Dice( 6,8,8 ); case SpellCircle.Seventh:return Utility.Dice(7,8,10); case SpellCircle.Eighth:return Utility.Dice( 7,8,10); } return 1; }
public override double GetResistPercentForCircle( Mobile target, SpellCircle circle ) { return base.GetResistPercentForCircle( target, circle ) - Caster.Skills[SkillName.Poisoning].Value * 0.2; }