protected override void OnTarget(Mobile from, object targeted) { if (from == null || this.m_projectile == null || from.Map == null) { return; } ISiegeWeapon weapon = null; if (targeted is ISiegeWeapon) { // load the cannon weapon = (ISiegeWeapon)targeted; } else if (targeted is SiegeComponent) { weapon = ((SiegeComponent)targeted).Addon as ISiegeWeapon; } if (weapon == null || weapon.Map == null) { from.SendMessage("Invalid target"); return; } // load the cannon weapon.LoadWeapon(from, this.m_projectile); }
public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); ISiegeWeapon weapon = this.Addon as ISiegeWeapon; if (weapon == null) { return; } if (weapon.Projectile == null || weapon.Projectile.Deleted) { //list.Add(1061169, "empty"); // range ~1_val~ list.Add(1042975); // It's empty } else { list.Add(500767); // Reloaded list.Add(1060658, "Type\t{0}", weapon.Projectile.Name); // ~1_val~: ~2_val~ ISiegeProjectile projectile = weapon.Projectile as ISiegeProjectile; if (projectile != null) { list.Add(1061169, projectile.Range.ToString()); // range ~1_val~ } } }
public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { if (Addon is ISiegeWeapon) { ISiegeWeapon weapon = (ISiegeWeapon)Addon; ((BaseSiegeWeapon)Addon).OnSingleClick(from); if (!weapon.FixedFacing) { list.Add(new RotateNextEntry(weapon)); list.Add(new RotatePreviousEntry(weapon)); } if (weapon.IsPackable) { list.Add(new BackpackEntry(from, weapon)); } if (weapon.IsDraggable) { // does it support dragging? XmlDrag a = (XmlDrag)XmlAttach.FindAttachment(weapon, typeof(XmlDrag)); if (a != null) { // is it currently being dragged? // only allow user to disconnect a siege wep if (a.DraggedBy != null && !a.DraggedBy.Deleted && a.DraggedBy == from) { list.Add(new ReleaseEntry(from, a)); } else { list.Add(new ConnectEntry(from, a)); } } } } base.GetContextMenuEntries(from, list); }
public override void GetContextMenuEntries(Mobile from, ArrayList list) { if (Addon is ISiegeWeapon) { ISiegeWeapon weapon = (ISiegeWeapon)Addon; if (!weapon.FixedFacing) { list.Add(new RotateNextEntry(weapon)); list.Add(new RotatePreviousEntry(weapon)); } if (weapon.IsPackable) { list.Add(new BackpackEntry(from, weapon)); } if (weapon.IsDraggable) { // does it support dragging? XmlDrag a = (XmlDrag)XmlAttach.FindAttachment(weapon, typeof(XmlDrag)); if (a != null) { // is it currently being dragged? if (a.DraggedBy != null && !a.DraggedBy.Deleted) { list.Add(new ReleaseEntry(from, a)); } else { list.Add(new ConnectEntry(from, a)); } } } } base.GetContextMenuEntries(from, list); }
public RotatePreviousEntry(ISiegeWeapon weapon) : base(405) { m_weapon = weapon; }
public void OnHit(Mobile from, ISiegeWeapon weapon, IEntity target, Point3D targetloc) { if (weapon == null || from == null) return; // play explosion sound at target Effects.PlaySound(targetloc, weapon.Map, 0x11D); ArrayList damagelist = new ArrayList(); // deal with the fact that for multis, the targetloc and the actual multi location may differ // so deal the multi damage first if (target is BaseMulti) { XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(target, typeof(XmlSiege)); if (a != null) { damagelist.Add(a); } } // apply splash damage to objects with a siege attachment IPooledEnumerable itemlist = from.Map.GetItemsInRange(targetloc, Area); if (itemlist != null) { foreach (Item item in itemlist) { if (item == null || item.Deleted) continue; XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(item, typeof(XmlSiege)); if (a != null && !damagelist.Contains(a)) { damagelist.Add(a); } else // if it had no siege attachment and the item is an addoncomponent, then check the parent addon if (item is AddonComponent) { a = (XmlSiege)XmlAttach.FindAttachment(((AddonComponent)item).Addon, typeof(XmlSiege)); if (a != null && !damagelist.Contains(a)) { damagelist.Add(a); } } } } int scaledfiredamage = (int)(FireDamage * StructureDamageMultiplier * weapon.WeaponDamageFactor); int scaledphysicaldamage = (int)(PhysicalDamage * StructureDamageMultiplier * weapon.WeaponDamageFactor); foreach (XmlSiege a in damagelist) { // apply siege damage a.ApplyScaledDamage(from, scaledfiredamage, scaledphysicaldamage); } // apply splash damage to mobiles ArrayList mobdamage = new ArrayList(); IPooledEnumerable moblist = from.Map.GetMobilesInRange(targetloc, Area); if (moblist != null) { foreach (Mobile m in moblist) { if (m == null || m.Deleted || !from.CanBeHarmful(m, false)) continue; mobdamage.Add(m); } } int totaldamage = FireDamage + PhysicalDamage; if (totaldamage > 0) { int scaledmobdamage = (int)(totaldamage * MobDamageMultiplier * weapon.WeaponDamageFactor); int phys = 100 * PhysicalDamage / totaldamage; int fire = 100 * FireDamage / totaldamage; foreach (Mobile m in mobdamage) { // AOS.Damage( Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy ) AOS.Damage(m, from, scaledmobdamage, phys, fire, 0, 0, 0); } } // consume the ammunition Consume(1); weapon.Projectile = this; }
public void OnHit(Mobile from, ISiegeWeapon weapon, IEntity target, Point3D targetloc) { if (weapon == null || from == null) { return; } // play explosion sound at target Effects.PlaySound(targetloc, weapon.Map, 0x11D); // show effects in the area around target int explosion = 0x36b0; int firecolumn = 0x3709; var rectangle = new Rectangle2D(targetloc.X - Area, targetloc.Y - Area, Area * 2 + 1, Area * 2 + 1); // iterate coordinates of rectangle for (int x = rectangle.Start.X; x < rectangle.End.X; x++) { for (int y = rectangle.Start.Y; y < rectangle.End.Y; y++) { if (Utility.RandomBool()) { Effects.SendLocationEffect(new Point3D(x, y, targetloc.Z), from.Map, explosion, 13); } else { Effects.SendLocationEffect(new Point3D(x, y, targetloc.Z), from.Map, firecolumn, 15); } } } ArrayList damagelist = new ArrayList(); // deal with the fact that for multis, the targetloc and the actual multi location may differ // so deal the multi damage first if (target is BaseMulti) { XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(target, typeof(XmlSiege)); if (a != null) { damagelist.Add(a); } } // apply splash damage to objects with a siege attachment IPooledEnumerable itemlist = from.Map.GetItemsInRange(targetloc, Area); if (itemlist != null) { foreach (Item item in itemlist) { if (item == null || item.Deleted) { continue; } XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(item, typeof(XmlSiege)); if (a != null && !damagelist.Contains(a)) { damagelist.Add(a); } else // if it had no siege attachment and the item is an addoncomponent, then check the parent addon if (item is AddonComponent) { a = (XmlSiege)XmlAttach.FindAttachment(((AddonComponent)item).Addon, typeof(XmlSiege)); if (a != null && !damagelist.Contains(a)) { damagelist.Add(a); } } } itemlist.Free(); } int scaledfiredamage = (int)(FireDamage * StructureDamageMultiplier * weapon.WeaponDamageFactor); int scaledphysicaldamage = (int)(PhysicalDamage * StructureDamageMultiplier * weapon.WeaponDamageFactor); foreach (XmlSiege a in damagelist) { // apply siege damage a.ApplyScaledDamage(from, scaledfiredamage, scaledphysicaldamage); } // apply splash damage to mobiles ArrayList mobdamage = new ArrayList(); IPooledEnumerable moblist = from.Map.GetMobilesInRange(targetloc, Area); if (moblist != null) { foreach (Mobile m in moblist) { if (m == null || m.Deleted || !from.CanBeHarmful(m, false)) { continue; } mobdamage.Add(m); } moblist.Free(); } int totaldamage = FireDamage + PhysicalDamage; if (totaldamage > 0) { int scaledmobdamage = (int)(totaldamage * MobDamageMultiplier * weapon.WeaponDamageFactor); int phys = 100 * PhysicalDamage / totaldamage; int fire = 100 * FireDamage / totaldamage; foreach (Mobile m in mobdamage) { // AOS.Damage( Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy ) AOS.Damage(m, from, scaledmobdamage, phys, fire, 0, 0, 0); } } // consume the ammunition if (!weapon.FreeConsume()) { Consume(1); } weapon.Projectile = this; }
public void OnHit(Mobile from, ISiegeWeapon weapon, IEntity target, Point3D targetloc) { if (weapon == null || from == null) { return; } // play explosion sound at target Effects.PlaySound(targetloc, weapon.Map, 0x11D); ArrayList damagelist = new ArrayList(); // deal with the fact that for multis, the targetloc and the actual multi location may differ // so deal the multi damage first if (target is BaseMulti) { XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(target, typeof(XmlSiege)); if (a != null) { damagelist.Add(a); } } // apply splash damage to objects with a siege attachment IPooledEnumerable itemlist = from.Map.GetItemsInRange(targetloc, this.Area); if (itemlist != null) { foreach (Item item in itemlist) { if (item == null || item.Deleted) { continue; } XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(item, typeof(XmlSiege)); if (a != null && !damagelist.Contains(a)) { damagelist.Add(a); } else if (item is AddonComponent) { a = (XmlSiege)XmlAttach.FindAttachment(((AddonComponent)item).Addon, typeof(XmlSiege)); if (a != null && !damagelist.Contains(a)) { damagelist.Add(a); } } } } int scaledfiredamage = (int)(this.FireDamage * this.StructureDamageMultiplier * weapon.WeaponDamageFactor); int scaledphysicaldamage = (int)(this.PhysicalDamage * this.StructureDamageMultiplier * weapon.WeaponDamageFactor); foreach (XmlSiege a in damagelist) { // apply siege damage a.ApplyScaledDamage(from, scaledfiredamage, scaledphysicaldamage); } // apply splash damage to mobiles ArrayList mobdamage = new ArrayList(); IPooledEnumerable moblist = from.Map.GetMobilesInRange(targetloc, this.Area); if (moblist != null) { foreach (Mobile m in moblist) { if (m == null || m.Deleted || !from.CanBeHarmful(m, false)) { continue; } mobdamage.Add(m); } } int totaldamage = this.FireDamage + this.PhysicalDamage; if (totaldamage > 0) { int scaledmobdamage = (int)(totaldamage * this.MobDamageMultiplier * weapon.WeaponDamageFactor); int phys = 100 * this.PhysicalDamage / totaldamage; int fire = 100 * this.FireDamage / totaldamage; foreach (Mobile m in mobdamage) { // AOS.Damage( Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy ) AOS.Damage(m, from, scaledmobdamage, phys, fire, 0, 0, 0); } } // consume the ammunition this.Consume(1); weapon.Projectile = this; }
public BackpackEntry(Mobile from, ISiegeWeapon weapon) : base(2139) { this.m_weapon = weapon; this.m_from = from; }
public SetupEntry(Mobile from, ISiegeWeapon weapon) : base(97) { this.m_weapon = weapon; this.m_from = from; }
public RotateNextEntry(ISiegeWeapon weapon) : base(406) { this.m_weapon = weapon; }
public RotatePreviousEntry(ISiegeWeapon weapon) : base(405) { this.m_weapon = weapon; }
public RotateNextEntry(ISiegeWeapon weapon) : base(406) { m_weapon = weapon; }
public BackpackEntry(Mobile from, ISiegeWeapon weapon) : base(2139) { m_weapon = weapon; m_from = from; }
public RotatePreviousEntry(ISiegeWeapon weapon) : base(405, 3) { m_weapon = weapon; }
public RotateNextEntry(ISiegeWeapon weapon) : base(406, 3) { m_weapon = weapon; }
public SetupEntry(Mobile from, ISiegeWeapon weapon) : base(97) { m_weapon = weapon; m_from = from; }