private void Unbuff(object state) { object[] states = (object[])state; KingLeonidas toDebuff = (KingLeonidas)states[0]; toDebuff.EndAction(typeof(Spartan)); if (toDebuff.Deleted) { return; } toDebuff.HitsMaxSeed = (int)states[1]; toDebuff.RawStr = (int)states[2]; toDebuff.RawDex = (int)states[3]; toDebuff.Hits = toDebuff.Hits; toDebuff.Stam = toDebuff.Stam; }
public override void OnThink() { if (DateTime.UtcNow >= m_NextAbilityTime) { KingLeonidas toBuff = null; foreach (Mobile m in this.GetMobilesInRange(8)) { if (m is KingLeonidas && IsFriend(m) && m.Combatant != null && CanBeBeneficial(m) && m.CanBeginAction(typeof(JukaMage)) && InLOS(m)) { toBuff = (KingLeonidas)m; break; } } if (toBuff != null) { if (CanBeBeneficial(toBuff) && toBuff.BeginAction(typeof(Spartan))) { m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60)); toBuff.Say(true, "I shall use my armies to destroy you!"); this.Say(true, "Fight well my King!"); DoBeneficial(toBuff); object[] state = new object[] { toBuff, toBuff.HitsMaxSeed, toBuff.RawStr, toBuff.RawDex }; int toScale = toBuff.HitsMaxSeed; if (toScale > 0) { toBuff.HitsMaxSeed += AOS.Scale(toScale, 600); toBuff.Hits += AOS.Scale(toScale, 600); } toScale = toBuff.RawStr; if (toScale > 0) { toBuff.RawStr += AOS.Scale(toScale, 100); } toScale = toBuff.RawDex; if (toScale > 0) { toBuff.RawDex += AOS.Scale(toScale, 100); toBuff.Stam += AOS.Scale(toScale, 100); } toBuff.Hits = toBuff.Hits; toBuff.Stam = toBuff.Stam; toBuff.FixedParticles(0x375A, 10, 15, 5017, EffectLayer.Waist); toBuff.PlaySound(0x1EE); Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(Unbuff), state); bool expired; expired = (DateTime.UtcNow >= m_ExpireTime); if (!expired && m_Owner != null) { expired = m_Owner.Deleted || Map != m_Owner.Map || !InRange(m_Owner, 16); } if (expired) { PlaySound(GetIdleSound()); Delete(); } } else { m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5)); } } base.OnThink(); } }