public virtual Type GetBoltSelected() { BaseRangedModule module = this.BaseRangedModule; switch (module.m_BoltType) { case BoltType.Normal: return(typeof(Bolt)); case BoltType.Poison: return(typeof(PoisonBolt)); case BoltType.Explosive: return(typeof(ExplosiveBolt)); case BoltType.ArmorPiercing: return(typeof(ArmorPiercingBolt)); case BoltType.Freeze: return(typeof(FreezeBolt)); case BoltType.Lightning: return(typeof(LightningBolt)); default: return(typeof(Bolt)); } }
public virtual Type GetArrowSelected() { BaseRangedModule module = this.BaseRangedModule; switch (module.m_ArrowType) { case ArrowType.Normal: return(typeof(Arrow)); case ArrowType.Poison: return(typeof(PoisonArrow)); case ArrowType.Explosive: return(typeof(ExplosiveArrow)); case ArrowType.ArmorPiercing: return(typeof(ArmorPiercingArrow)); case ArrowType.Freeze: return(typeof(FreezeArrow)); case ArrowType.Lightning: return(typeof(LightningArrow)); default: return(typeof(Arrow)); } }
public virtual Item AmmoBoltSelected() { BaseRangedModule module = this.BaseRangedModule; switch (module.m_BoltType) { case BoltType.Normal: return(new Bolt()); case BoltType.Poison: return(new PoisonBolt()); case BoltType.Explosive: return(new ExplosiveBolt()); case BoltType.ArmorPiercing: return(new ArmorPiercingBolt()); case BoltType.Freeze: return(new FreezeBolt()); case BoltType.Lightning: return(new LightningBolt()); default: return(new Bolt()); } }
public virtual Item AmmoArrowSelected() { BaseRangedModule module = this.BaseRangedModule; switch (module.m_ArrowType) { case ArrowType.Normal: return(new Arrow()); case ArrowType.Poison: return(new PoisonArrow()); case ArrowType.Explosive: return(new ExplosiveArrow()); case ArrowType.ArmorPiercing: return(new ArmorPiercingArrow()); case ArrowType.Freeze: return(new FreezeArrow()); case ArrowType.Lightning: return(new LightningArrow()); default: return(new Arrow()); } }
public static bool CheckForString(Mobile from, string errorMsg, BaseRanged ranged) { BaseRangedModule module = ranged.BaseRangedModule; if (!module.HasBowString) { return(true); } else { if (module.HasBowString && module.StringStrengthSelection == StringStrength.NoString) { from.SendMessage(""); from.SendMessage(33, "--------------------"); from.SendMessage(""); from.SendMessage(33, "The bow has an internal error and is now being fixed..."); from.SendMessage(""); from.SendMessage(33, "--------------------"); from.SendMessage(""); module.HasBowString = false; return(true); } else { from.SendMessage("{0}", errorMsg); return(false); } } }
//--<<Advanced Archery Edit>>---------------------[Start 4/4] public override void OnDoubleClick(Mobile from) { BaseRangedModule module = this.BaseRangedModule; if (IsChildOf(from.Backpack) || Parent == from) { if (module.HasBowString) { if (this is Bow || this is CompositeBow || this is ElvenCompositeLongbow || this is MagicalShortbow || this is Yumi) { from.SendMessage("Please choose which type of arrows you wish to use."); from.Target = new BowTarget(this); } if (this is Crossbow || this is HeavyCrossbow || this is RepeatingCrossbow) { from.SendMessage("Please choose which type of bolts you wish to use."); from.Target = new CrossbowTarget(this); } } else { from.SendMessage("You must string your bow. Please select a bow stringer."); from.Target = new StringerTarget(this); } } else { return; } }
public static void SetPounds(BaseRangedModule module, int code) { if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("AA Check: Code making it passed set pounds."); } if (code == 1) { module.PullWeightSelection = PoundsPerPull.Fourty; } else if (code == 2) { module.PullWeightSelection = PoundsPerPull.Sixty; } else if (code == 3) { module.PullWeightSelection = PoundsPerPull.Eighty; } else if (code == 4) { module.PullWeightSelection = PoundsPerPull.Hundred; } else { return; } }
protected override void OnTarget(Mobile from, object targeted) { Console.WriteLine("Code making it to OnTarget."); BaseRanged rang = it_Ranged as BaseRanged; BaseRangedModule module = rang.BaseRangedModule; if (targeted is Item && targeted is Bolt) { Console.WriteLine("Code making it to bolt check."); Item item = ( Item )targeted; string errorMsg = "You cannot arm a crossbow that does not have a string."; if (!module.HasBowString) { from.SendMessage("{0}", errorMsg); return; } if (item.GetType() == typeof(Bolt)) { module.BoltSelection = BoltType.Normal; rang.InvalidateProperties(); } if (item.GetType() == typeof(PoisonBolt)) { module.BoltSelection = BoltType.Poison; rang.InvalidateProperties(); } if (item.GetType() == typeof(ExplosiveBolt)) { module.BoltSelection = BoltType.Explosive; rang.InvalidateProperties(); } if (item.GetType() == typeof(ArmorPiercingBolt)) { module.BoltSelection = BoltType.ArmorPiercing; rang.InvalidateProperties(); } if (item.GetType() == typeof(FreezeBolt)) { module.BoltSelection = BoltType.Freeze; rang.InvalidateProperties(); } if (item.GetType() == typeof(LightningBolt)) { module.BoltSelection = BoltType.Lightning; rang.InvalidateProperties(); } } else { from.SendMessage("You can only target a bolt."); } }
public static void Conjunction(BaseRangedModule module, int str, int lbs) { if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("AA Check: Code making it passed the conjunction."); } SetPounds(module, lbs); SetStrength(module, str); }
public virtual void CheckStringError(Mobile from, BaseRanged ranged) { BaseRangedModule module = ranged.BaseRangedModule; if (module.HasBowString && module.StringStrengthSelection == StringStrength.NoString) { from.SendMessage("The bow has an internal error. The bow is now being fixed..."); module.HasBowString = false; } }
public virtual bool OnFired(Mobile attacker, Mobile defender) { //--<<Advanced Archery Edit>>---------------------[Start 3/4] PlayerMobile a_pm = attacker as PlayerMobile; Container pack = attacker.Backpack; BaseQuiver quiver = attacker.FindItemOnLayer(Layer.MiddleTorso) as BaseQuiver; BaseRangedModule module = this.BaseRangedModule; if (!module.HasBowString) { if (DateTime.Now >= m_NextStringWarning) { m_NextStringWarning = DateTime.Now + StringWarningDelay; attacker.SendMessage("You need a string to use this bow. See a local fletcher to apply the string."); return(false); } else { return(false); } } if (Ammo == null) { if (DateTime.Now >= m_NextAmmoWarning) { m_NextAmmoWarning = DateTime.Now + AmmoWarningDelay; attacker.SendMessage("You are out of ammo."); return(false); } else { return(false); } } if (attacker.Player && quiver != null && quiver.LowerAmmoCost > Utility.Random(100)) { attacker.MovingEffect(defender, EffectID, 18, 1, false, false); return(true); } if (attacker.Player && (quiver == null || !quiver.ConsumeTotal(AmmoType, 1)) && (pack == null || !pack.ConsumeTotal(AmmoType, 1))) { return(false); } attacker.MovingEffect(defender, EffectID, 18, 1, false, false); return(true); //--<<Advanced Archery Edit>>---------------------[End 3/4] }
public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); BaseRangedModule module = this.BaseRangedModule; if (module != null) { ArrayList strings = new ArrayList(); strings.Add(("---------------")); if (this is Bow || this is CompositeBow || this is ElvenCompositeLongbow || this is MagicalShortbow || this is Yumi) { strings.Add(("Quiver Using: " + module.m_ArrowType)); } if (this is Crossbow || this is HeavyCrossbow || this is RepeatingCrossbow) { strings.Add(("Quiver Using: " + module.m_BoltType)); } strings.Add(("lbs per Pull: " + module.m_PullWeight)); strings.Add(("String Str: " + module.m_Strength)); string toAdd = ""; int amount = strings.Count; int current = 1; foreach (string str in strings) { toAdd += str; if (current != amount) { toAdd += "\n"; } ++current; } if (toAdd != "") { list.Add(1070722, toAdd); } } else { return; } }
public static void CutString(Mobile from, BaseRanged ranged) { BaseRangedModule module = ranged.BaseRangedModule; module.StringStrengthSelection = StringStrength.NoString; module.PullWeightSelection = PoundsPerPull.Zero; module.HasBowString = false; from.PlaySound(0x248); from.SendMessage("You have just removed the string from your bow."); ranged.InvalidateProperties(); }
public override bool CanEquip(Mobile from) { BaseRangedModule module = this.BaseRangedModule; if (from != null && !module.HasBowString) { from.SendMessage("You cannot use that without a string."); return(false); } base.CanEquip(from); return(true); }
public virtual bool BonusDamage(Mobile attacker, Mobile defender, BaseRanged ranged) { BaseRangedModule module = ranged.BaseRangedModule; attacker.SendMessage(""); attacker.SendMessage(0x35, "** Bonus Hit **"); attacker.SendMessage(""); attacker.SendMessage(0x35, "The strength of your bow and your immpecable skill have given you a perfect hit."); attacker.SendMessage(""); defender.Say("* Ouch, that hurt! *"); defender.PlaySound(315); if (module.HasBowString) { if (module.m_PullWeight == PoundsPerPull.Fourty) { attacker.DoHarmful(defender); AOS.Damage(defender, attacker, Utility.RandomMinMax(2, 5), 100, 0, 0, 0, 0); return(true); } else if (module.m_PullWeight == PoundsPerPull.Sixty) { attacker.DoHarmful(defender); AOS.Damage(defender, attacker, Utility.RandomMinMax(6, 10), 100, 0, 0, 0, 0); return(true); } else if (module.m_PullWeight == PoundsPerPull.Eighty) { attacker.DoHarmful(defender); AOS.Damage(defender, attacker, Utility.RandomMinMax(11, 15), 100, 0, 0, 0, 0); return(true); } else if (module.m_PullWeight == PoundsPerPull.Hundred) { attacker.DoHarmful(defender); AOS.Damage(defender, attacker, Utility.RandomMinMax(16, 20), 100, 0, 0, 0, 0); return(true); } else { return(false); } } else { return(true); } }
public static void SetStrength(BaseRangedModule module, int code) { if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("AA Check: Code making it passed set strength."); } if (code == 1) { module.m_Strength = StringStrength.VeryWeak; } else if (code == 2) { module.m_Strength = StringStrength.Weak; } else if (code == 3) { module.m_Strength = StringStrength.Sturdy; } else if (code == 4) { module.m_Strength = StringStrength.Strong; } else if (code == 5) { module.m_Strength = StringStrength.Dependable; } else if (code == 6) { module.m_Strength = StringStrength.Indestructable; } else { return; } }
public virtual void CheckStringCondition(Mobile from, BaseRanged ranged) { BaseRangedModule module = ranged.BaseRangedModule; if (module.HasBowString && module.StringStrengthSelection == StringStrength.NoString) { module.HasBowString = false; } if (!module.HasBowString) { if (module.StringStrengthSelection == StringStrength.NoString) { module.HasBowString = false; //from.SendMessage( "You need a string to use this bow. See a local fletcher to apply the string." ); } else { module.StringStrengthSelection = StringStrength.NoString; } } }
protected override void OnTarget(Mobile from, object targeted) { Console.WriteLine("Code making it to OnTarget."); if (targeted is Item && targeted is BaseRanged) { Console.WriteLine("Code making it to BaseStringer check."); BaseRanged ranged = targeted as BaseRanged; BaseRangedModule module = ranged.BaseRangedModule; if (module.HasBowString) { MoreBaseRanged.CutString(from, ranged); } else { from.SendMessage("This bow is not strung. Using scissors on it is a waste of time."); } } else { from.SendMessage("That is not a bow."); } }
public static void CheckSkill(Mobile from, BaseRanged rang, BaseRangedModule module) { double fletching = from.Skills[SkillName.Fletching].Base; if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("AA Check: Fletching over 100."); } int skillCode; if (fletching > 100.0 && fletching < 105.0) { Conjunction(module, 0, 1); } else if (fletching > 104.9 && fletching < 112) { Conjunction(module, 0, 2); } else if (fletching > 111.9 && fletching < 119.9) { Conjunction(module, 0, 3); } else if (fletching > 119.9) { Conjunction(module, 0, 4); } else { return; } }
public virtual bool CheckStringDamage(Mobile attacker, Mobile defender, BaseRanged ranged) { BaseRangedModule module = ranged.BaseRangedModule; if (module.HasBowString) { if (module.StringStrengthSelection == StringStrength.VeryWeak) { if (.05 > Utility.Random(100)) { BonusDamage(attacker, defender, ranged); return(true); } if (.10 > Utility.Random(1000)) //1 in a 100 chances of breaking. { module.HasBowString = false; module.StringStrengthSelection = StringStrength.NoString; attacker.SendMessage("Your string just broke."); } return(true); } else if (module.StringStrengthSelection == StringStrength.Weak) { if (.10 > Utility.Random(100)) { BonusDamage(attacker, defender, ranged); return(true); } if (.09 > Utility.Random(1000)) //1 in a 110 chances of breaking. { module.HasBowString = false; module.StringStrengthSelection = StringStrength.NoString; attacker.SendMessage("Your string just broke."); } return(true); } else if (module.StringStrengthSelection == StringStrength.Sturdy) { if (.15 > Utility.Random(100)) { BonusDamage(attacker, defender, ranged); return(true); } if (.08 > Utility.Random(1000)) //1 in a 125 chances of breaking. { module.HasBowString = false; module.StringStrengthSelection = StringStrength.NoString; attacker.SendMessage("Your string just broke."); } return(true); } else if (module.StringStrengthSelection == StringStrength.Strong) { if (.20 > Utility.Random(100)) { BonusDamage(attacker, defender, ranged); return(true); } if (.05 > Utility.Random(1000)) //1 in a 200 chances of breaking. { module.HasBowString = false; module.StringStrengthSelection = StringStrength.NoString; attacker.SendMessage("Your string just broke."); } } else if (module.StringStrengthSelection == StringStrength.Dependable) { if (.25 > Utility.Random(100)) { BonusDamage(attacker, defender, ranged); return(true); } if (.03 > Utility.Random(1000)) //1 in a 333 chances of breaking. { module.HasBowString = false; module.StringStrengthSelection = StringStrength.NoString; attacker.SendMessage("Your string just broke."); } return(true); } else if (module.StringStrengthSelection == StringStrength.Indestructable) { if (.33 > Utility.Random(100)) { BonusDamage(attacker, defender, ranged); return(true); } //No chance of breaking. return(true); } else { return(false); } } else { return(false); } return(false); }
protected override void OnTarget(Mobile from, object targeted) { if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("Code making it to OnTarget."); } BaseRanged rang = it_Ranged as BaseRanged; BaseRangedModule module = rang.BaseRangedModule; if (targeted is Item && targeted is BaseStringer) { if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("Code making it to BaseStringer check."); } Item item = ( Item )targeted; if (item == null) { from.SendMessage("You have decided to not apply the string."); } string errorMsg = "This bow already contains a string."; if (MoreBaseRanged.CheckForString(from, errorMsg, rang) == false) { return; } if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("Code making it passed string check."); } double fletching = from.Skills[SkillName.Fletching].Base; if (fletching > 100) { if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("AA Check: Code making it passed gm fletching check."); } if (item.GetType() == typeof(LinenThreadStringer)) { Conjunction(module, 1, 0); CheckSkill(from, rang, module); module.HasBowString = true; item.Delete(); rang.InvalidateProperties(); } if (item.GetType() == typeof(CottonStringer)) { Conjunction(module, 2, 0); CheckSkill(from, rang, module); module.HasBowString = true; item.Delete(); rang.InvalidateProperties(); } if (item.GetType() == typeof(SilkStringer)) { Conjunction(module, 3, 0); CheckSkill(from, rang, module); module.HasBowString = true; item.Delete(); rang.InvalidateProperties(); } if (item.GetType() == typeof(HorseHairStringer)) { Conjunction(module, 4, 0); CheckSkill(from, rang, module); module.HasBowString = true; item.Delete(); rang.InvalidateProperties(); } if (item.GetType() == typeof(HempStringer)) { Conjunction(module, 5, 0); CheckSkill(from, rang, module); module.HasBowString = true; item.Delete(); rang.InvalidateProperties(); } if (item.GetType() == typeof(AngelHairStringer)) { Conjunction(module, 6, 0); CheckSkill(from, rang, module); module.HasBowString = true; item.Delete(); rang.InvalidateProperties(); } } if (fletching < 100) { from.SendMessage("Only a grandmaster bowcrafter can modify this weapon."); return; } if (LucidNagual.DataCenter.DebugAdvancedArchery) { Console.WriteLine("Code making it passed modification check."); } } else { from.SendMessage("You can only target a bow stringer."); } }