protected override void OnTarget(Mobile from, object targeted) { if (m_Bandage.Deleted) { return; } if (targeted is Mobile) { if (from.InRange(m_Bandage.GetWorldLocation(), Bandage.Range)) { if (BandageContext.BeginHeal(from, (Mobile)targeted) != null) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else if (targeted is PlagueBeastInnard) { if (((PlagueBeastInnard)targeted).OnBandage(from)) { m_Bandage.Consume(); } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } }
public static void BandSelf_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; if (from != null) { Container backpack = from.Backpack; if (backpack != null) { Bandage bandage = (Bandage)backpack.FindItemByType(typeof(Bandage)); if (bandage != null) { Targeting.Target.Cancel(from); from.RevealingAction(); if (BandageContext.BeginHeal(from, from) != null) { bandage.Consume(); } } else { e.Mobile.SendMessage("Cannot find bandage."); } } else { from.SendMessage("You don't have a Backpack."); } } }
protected override void OnTick() { // Scriptiz : arrêt du sort après un certain temps en rajoutant ceci devant tout : m_Ticks++ > m_Duration || if (/*++m_Ticks > m_Duration || */ m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Body != m_Body || m_Mobile.Hue != m_Hue) { AnimalForm.RemoveContext(m_Mobile, true); Stop(); } else { if (m_Body == 0x115) // Cu Sidhe { if (m_Counter++ >= 8) { if (m_Mobile.Hits < m_Mobile.HitsMax && m_Mobile.Backpack != null) { Bandage b = m_Mobile.Backpack.FindItemByType(typeof(Bandage)) as Bandage; if (b != null) { m_Mobile.Hits += Utility.RandomMinMax(20, 50); b.Consume(); } } m_Counter = 0; } } else if (m_Body == 0x114) // Reptalon { if (m_Mobile.Combatant != null && m_Mobile.Combatant != m_LastTarget) { m_Counter = 1; m_LastTarget = m_Mobile.Combatant; } if (m_Mobile.Warmode && m_LastTarget != null && m_LastTarget.Alive && !m_LastTarget.Deleted && m_Counter-- <= 0) { if (m_Mobile.CanBeHarmful(m_LastTarget) && m_LastTarget.Map == m_Mobile.Map && m_LastTarget.InRange(m_Mobile.Location, BaseCreature.DefaultRangePerception) && m_Mobile.InLOS(m_LastTarget)) { m_Mobile.Direction = m_Mobile.GetDirectionTo(m_LastTarget); m_Mobile.Freeze(TimeSpan.FromSeconds(1)); m_Mobile.PlaySound(0x16A); Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(1.3), new TimerStateCallback <Mobile>(BreathEffect_Callback), m_LastTarget); } m_Counter = Math.Min((int)m_Mobile.GetDistanceToSqrt(m_LastTarget), 10); } } } }
protected override void OnTick() { if (this.m_Mobile.Deleted || !this.m_Mobile.Alive || this.m_Mobile.Body != this.m_Body || this.m_Mobile.Hue != this.m_Hue) { AnimalForm.RemoveContext(this.m_Mobile, true); this.Stop(); } else { if (this.m_Body == 0x115) // Cu Sidhe { if (this.m_Counter++ >= 8) { if (this.m_Mobile.Hits < this.m_Mobile.HitsMax && this.m_Mobile.Backpack != null) { Bandage b = this.m_Mobile.Backpack.FindItemByType(typeof(Bandage)) as Bandage; if (b != null) { this.m_Mobile.Hits += Utility.RandomMinMax(20, 50); b.Consume(); } } this.m_Counter = 0; } } else if (this.m_Body == 0x114) // Reptalon { if (this.m_Mobile.Combatant != null && this.m_Mobile.Combatant != this.m_LastTarget) { this.m_Counter = 1; this.m_LastTarget = this.m_Mobile.Combatant; } if (this.m_Mobile.Warmode && this.m_LastTarget != null && this.m_LastTarget.Alive && !this.m_LastTarget.Deleted && this.m_Counter-- <= 0) { if (this.m_Mobile.CanBeHarmful(this.m_LastTarget) && this.m_LastTarget.Map == this.m_Mobile.Map && this.m_LastTarget.InRange(this.m_Mobile.Location, BaseCreature.DefaultRangePerception) && this.m_Mobile.InLOS(this.m_LastTarget)) { this.m_Mobile.Direction = this.m_Mobile.GetDirectionTo(this.m_LastTarget); this.m_Mobile.Freeze(TimeSpan.FromSeconds(1)); this.m_Mobile.PlaySound(0x16A); Timer.DelayCall <Mobile>(TimeSpan.FromSeconds(1.3), new TimerStateCallback <Mobile>(BreathEffect_Callback), this.m_LastTarget); } this.m_Counter = Math.Min((int)this.m_Mobile.GetDistanceToSqrt(this.m_LastTarget), 10); } } } }
public static void BandageRequest(NetState state, PacketReader pvSrc) { Mobile from = state.Mobile; if (from.Alive) { if (from.AccessLevel >= AccessLevel.Counselor || DateTime.UtcNow >= from.NextActionTime) { Serial use = pvSrc.ReadInt32(); Serial targ = pvSrc.ReadInt32(); Bandage bandage = World.FindItem(use) as Bandage; if (bandage != null && !bandage.Deleted) { if (from.InRange(bandage.GetWorldLocation(), 2)) { //from.RevealingAction(); Mobile to = World.FindMobile(targ); if (to != null) { if (BandageContext.BeginHeal(from, to) != null) { bandage.Consume(); } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } from.NextActionTime = DateTime.UtcNow + Mobile.ServerWideObjectDelay; } } else { from.SendActionMessage(); } } else { from.SendLocalizedMessage(500949); // You can't do that when you're dead. } }
public override void OnDamage(int amount, Mobile m, bool willKill) { if (this.Hits < this.HitsMax && m_Bandage == false && this.Hidden == false) { m_Bandage = true; Container backpack = this.Backpack; Bandage bandage = (Bandage)backpack.FindItemByType(typeof(Bandage)); if (bandage != null) { if (BandageContext.BeginHeal(this, this) != null) { bandage.Consume(); } BandageTimer bt = new BandageTimer(this); bt.Start(); } } }
public static void BandageRequest(NetState state, PacketReader pvSrc) { Mobile from = state.Mobile; if (from.AccessLevel >= AccessLevel.Counselor || Core.TickCount >= from.NextActionTime) { Serial use = pvSrc.ReadInt32(); Serial targ = pvSrc.ReadInt32(); Bandage bandage = World.FindItem(use) as Bandage; if (bandage != null && from.InRange(bandage.GetWorldLocation(), Core.AOS ? 2 : 1)) { from.RevealingAction(); Mobile to = World.FindMobile(targ); if (to != null) { if (from.InRange(bandage.GetWorldLocation(), Core.AOS ? 2 : 1)) { if (BandageContext.BeginHeal(from, to) != null) { bandage.Consume(); } } else { from.SendLocalizedMessage(500295); // You are too far away to do that. } } else { from.SendLocalizedMessage(500970); // Bandages can not be used on that. } from.NextActionTime = Core.TickCount + Mobile.ActionDelay; } } else { from.SendActionMessage(); } }
public override bool DoActionWander() { m_Mobile.DebugSay("I have no combatant"); if ((m_Mobile.Hits < m_Mobile.HitsMax * 0.75 || m_Mobile.Poisoned) && m_Mobile.Backpack != null) //75% health { if (BandageContext.GetContext(m_Mobile) == null && m_Mobile.Backpack.GetAmount(typeof(Server.Items.Bandage), true) >= 1) { Bandage b = null; for (int i = 0; i < m_Mobile.Backpack.Items.Count; i++) { if (m_Mobile.Backpack.Items[i] is Bandage) { b = m_Mobile.Backpack.Items[i] as Bandage; break; } } if (b != null && BandageContext.BeginHeal(m_Mobile, m_Mobile) != null) { b.Consume(1); } } } if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I have detected {0}, attacking", m_Mobile.FocusMob.Name); } m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; } else { base.DoActionWander(); } return(true); }
// public override bool CanHeal { get { return true; } } public override void OnThink() { base.OnThink(); // Use bandages if ((this.IsHurt() || this.Poisoned) && m_Bandaging == false) { Bandage m_Band = (Bandage)this.Backpack.FindItemByType(typeof(Bandage)); if (m_Band != null) { m_Bandaging = true; if (BandageContext.BeginHeal(this, this) != null) { m_Band.Consume(); } BandageTimer bt = new BandageTimer(this); bt.Start(); } } }
public static void BandSelf_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; if (from == null) { return; } Container bp = from.Backpack; if (bp == null) { return; } Bandage b = (Bandage)bp.FindItemByType(typeof(Bandage)); if (b == null) { from.SendMessage("You must have bandages in your backpack to heal!"); return; } BandageContext.BeginHeal(from, from); b.Consume(); }
public override void OnThink() { if (!m_HasTeleportedAway && Hits < (HitsMax / 2) && Poisoned == false) { Map map = this.Map; if (map != null) { for (int i = 0; i < 10; ++i) { int x = X + (Utility.RandomMinMax(5, 10) * (Utility.RandomBool() ? 1 : -1)); int y = Y + (Utility.RandomMinMax(5, 10) * (Utility.RandomBool() ? 1 : -1)); int z = Z; if (!map.CanFit(x, y, z, 16, false, false)) { continue; } Point3D from = this.Location; Point3D to = new Point3D(x, y, z); this.Location = to; this.ProcessDelta(); this.Hidden = true; this.Combatant = null; Effects.SendLocationParticles(EffectItem.Create(from, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); Effects.PlaySound(to, map, 0x1FE); m_HasTeleportedAway = true; m_SoundTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(2.5), new TimerCallback(SendTrackingSound)); this.UseSkill(SkillName.Stealth); AIObject.Action = ActionType.Flee; break; } } } if (this.Hits < (this.HitsMax - 10) && m_Bandage == false) { m_Bandage = true; Container backpack = this.Backpack; Bandage bandage = (Bandage)backpack.FindItemByType(typeof(Bandage)); if (bandage != null) { if (BandageContext.BeginHeal(this, this) != null) { bandage.Consume(); } BandageTimer bt = new BandageTimer(this); bt.Start(); } } base.OnThink(); }
public override bool DoActionCombat() { Mobile combatant = m_Mobile.Combatant; if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet) { m_Mobile.DebugSay("My combatant is gone, so my guard is up"); Action = ActionType.Guard; return(true); } if (!m_Mobile.InRange(combatant, m_Mobile.RangePerception)) { // They are somewhat far away, can we find something else? if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else if (!m_Mobile.InRange(combatant, m_Mobile.RangePerception * 3)) { m_Mobile.Combatant = null; } combatant = m_Mobile.Combatant; if (combatant == null) { m_Mobile.DebugSay("My combatant has fled, so I am on guard"); Action = ActionType.Guard; return(true); } } /*if ( !m_Mobile.InLOS( combatant ) ) * { * if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) * { * m_Mobile.Combatant = combatant = m_Mobile.FocusMob; * m_Mobile.FocusMob = null; * } * }*/ if (MoveTo(combatant, true, m_Mobile.RangeFight)) { m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant); } else if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { if (m_Mobile.Debug) { m_Mobile.DebugSay("My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name); } m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; return(true); } else if (m_Mobile.GetDistanceToSqrt(combatant) > m_Mobile.RangePerception + 1) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I cannot find {0}, so my guard is up", combatant.Name); } Action = ActionType.Guard; return(true); } else { if (m_Mobile.Debug) { m_Mobile.DebugSay("I should be closer to {0}", combatant.Name); } } if ((m_Mobile.Hits < m_Mobile.HitsMax * 0.75 || m_Mobile.Poisoned) && m_Mobile.Backpack != null) //75% health { if (BandageContext.GetContext(m_Mobile) == null && m_Mobile.Backpack.GetAmount(typeof(Server.Items.Bandage), true) >= 1) { Bandage b = null; for (int i = 0; i < m_Mobile.Backpack.Items.Count; i++) { if (m_Mobile.Backpack.Items[i] is Bandage) { b = m_Mobile.Backpack.Items[i] as Bandage; break; } } if (b != null && BandageContext.BeginHeal(m_Mobile, m_Mobile) != null) { b.Consume(1); } } } if (!m_Mobile.Controlled && !m_Mobile.Summoned) { if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100) { // We are low on health, should we flee? bool flee = false; if (m_Mobile.Hits < combatant.Hits) { // We are more hurt than them int diff = combatant.Hits - m_Mobile.Hits; flee = (Utility.Random(0, 100) < (10 + diff)); // (10 + diff)% chance to flee } else { flee = Utility.Random(0, 100) < 10; // 10% chance to flee } if (flee) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name); } Action = ActionType.Flee; } } } return(true); }