protected override void OnTick() { int damage = Utility.RandomMinMax(10, 15 + (int)(m_from.PlayerLevel / 4)); m_from.MovingParticles(m_targ, 0x36E4, 5, 0, false, false, 3006, 4006, 0); m_from.PlaySound(0x1E5); SpellHelper.Damage(TimeSpan.Zero, m_targ, m_from, damage, d_ph, d_fi, d_co, d_po, d_en); if (!m_from.CanSee(m_targ) || !m_from.InLOS(m_targ)) { RunCount = MaxCount; } if (!m_targ.Alive) { RunCount = MaxCount; } if (RunCount == MaxCount) { if (m_targ is TeiravonMobile) { TeiravonMobile pctarg = (TeiravonMobile)m_targ; pctarg.ShadowShotReady = false; } } if (RunCount < MaxCount && m_from.Alive) { RunCount++; Timer m_EffectTimer = new EffectTimer(m_from, m_targ, d_ph, d_fi, d_en, d_co, d_po, RunCount, MaxCount, DateTime.Now + TimeSpan.FromSeconds(0.25)); m_EffectTimer.Start(); } }
protected override void OnTick() { foreach (NetState state in m_Player.GetClientsInRange(15)) { if (m_Count % 2 != 0) { state.Mobile.PlaySound(287); } else { state.Mobile.PlaySound(288); } } m_Count++; if (m_Count == 2) { EffectTimer et = new EffectTimer(m_Player); et.Start(); } if (m_Count > 4) { Stop(); return; } }
protected override void OnTarget(Mobile from, object targ) { TeiravonMobile m_player = (TeiravonMobile)from; if (targ is Mobile) { if (!(targ is TeiravonMobile)) { Mobile m_targ = (Mobile)targ; Timer m_EffectTimer = new EffectTimer(m_player, m_targ, phys, fire, nrgy, cold, pois, 0, 1 + (int)(m_player.PlayerLevel / 3), DateTime.Now + TimeSpan.FromSeconds(0.25)); m_EffectTimer.Start(); m_player.Mana -= 5 + (5 * (int)(m_player.PlayerLevel / 3)); } else { TeiravonMobile pctarg = (TeiravonMobile)targ; if (pctarg.ShadowShotReady) { m_player.SendMessage("This spell is already active on that target!"); } else { Timer m_EffectTimer = new EffectTimer(m_player, pctarg, phys, fire, nrgy, cold, pois, 0, 1 + (int)(m_player.PlayerLevel / 3), DateTime.Now + TimeSpan.FromSeconds(0.25)); m_EffectTimer.Start(); m_player.Mana -= 5 + (5 * (int)(m_player.PlayerLevel / 3)); pctarg.ShadowShotReady = true; //using shadowshotready to show spell active on target } } } else { from.SendMessage("Only Mobiles may be targeted"); } }
/// <summary> /// Таймер игры /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GameTimer_Tick(object sender, EventArgs e) { timer.Text = m + ":" + s; s = s - 1; if (s == -1) { m = m - 1; s = 59; } if (m == -1 && !no_reply) { timer.Text = "Время вышло"; GameTimer.Stop(); // Останавливаем таймер игры EffectTimer.Stop(); // Останавливаем действующие эффекты GlobalTimer.Stop(); // Останавливаем передвижение игроков if (Mouse.mice.Count == 4) { ServerTimer.Stop(); // Прекращаем обмен данных с сервером Server.ConclusionOfGame(); // Подведение итогов Close(); } else if (Mouse.mice.Count == 1) { MessageBox.Show("Время вышло!", "Конец игры"); Close(); } no_reply = true; } }
// Appellé à chaque fois que l'utilisateur clique sur un target. // Gère aussi quand est-ce que la fonction Effect() est appellée. private void OnNewTarget() { if (target1 != null) // Si le player a cancellé. { if (target1rdy && (target2rdy || info.nbTarget <= 1) && (target3rdy || info.nbTarget <= 2)) { // CREATION DU TIMER. effectTimer = new EffectTimer(this, info.duree, info.intervale); } // Si on veut plus de targets, on en créée un nouveau. if (target2 == null && info.nbTarget >= 2) { Caster.Target = new InternalTarget(this, 2); } else if (target3 == null && info.nbTarget >= 3) { Caster.Target = new InternalTarget(this, 3); } else { FinishSequence(); } } }
/// <summary> /// Действия после закрытия GameForm /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GameForm_FormClosed(object sender, FormClosedEventArgs e) { no_reply = false; GameTimer.Stop(); // Останавливаем таймер игры EffectTimer.Stop(); // Останавливаем действующие эффекты GlobalTimer.Stop(); // Останавливаем передвижение игроков ServerTimer.Stop(); // Останавливаем обмен данных с сервером MenuForm menu_form = Owner as MenuForm; menu_form.Show(); // Вызываем FormMenu }
public override void UseSpellSelfTimer() { if (CheckSequence()) // Si le mana, les ingrédients... etc sont corrects. { // CREATION DU TIMER. effectTimer = new EffectTimer(this, info.duree, info.intervale); } else { FinishSequence(); } }
public void ApplyEffect(FoodEffect effect, Boolean silent) { if (FoodEffectsCore.Core == null || !FoodEffectsCore.Core.Enabled || !Core.AOS) { EffectExpired(true); return; } if (LinkedMobile != null) { if (m_Timer != null) { m_Timer.Stop(); m_Timer = null; } LinkedMobile.RemoveStatMod("Food-StrBonus"); LinkedMobile.RemoveStatMod("Food-DexBonus"); LinkedMobile.RemoveStatMod("Food-IntBonus"); if (m_BuffInfo != null) BuffInfo.RemoveBuff(LinkedMobile, m_BuffInfo); if (m_FoodEffect != null) FoodEffectsCore.InvokeOnEffectCanceled(LinkedMobile, m_FoodEffect); m_FoodEffect = new FoodEffect(effect.RegenHits, effect.RegenStam, effect.RegenMana, effect.StrBonus, effect.DexBonus, effect.IntBonus, effect.Duration); if (m_FoodEffect.StrBonus != 0) LinkedMobile.AddStatMod(new StatMod(StatType.Str, "Food-StrBonus", m_FoodEffect.StrBonus, m_FoodEffect.EffectTimeSpan)); if (m_FoodEffect.DexBonus != 0) LinkedMobile.AddStatMod(new StatMod(StatType.Dex, "Food-DexBonus", m_FoodEffect.DexBonus, m_FoodEffect.EffectTimeSpan)); if (m_FoodEffect.IntBonus != 0) LinkedMobile.AddStatMod(new StatMod(StatType.Int, "Food-IntBonus", m_FoodEffect.IntBonus, m_FoodEffect.EffectTimeSpan)); if (!silent) { LinkedMobile.FixedEffect(0x375A, 10, 15); LinkedMobile.PlaySound(0x1EE); LinkedMobile.SendMessage(12, "The food you ate is now affecting your performance..."); } m_Timer = new EffectTimer(this); FoodEffectsCore.InvokeOnEffectActivated(LinkedMobile, m_FoodEffect); m_BuffInfo = new BuffInfo(BuffIcon.ActiveMeditation, 1074240, 1114057, m_FoodEffect.EffectTimeSpan, LinkedMobile, m_FoodEffect.GetBuffInfoText()); BuffInfo.AddBuff(LinkedMobile, m_BuffInfo); } }
public BRBomb( BRGame game ) : base( 0x103C ) // 0x103C = bread, 0x1042 = pie, 0x1364 = rock, 0x13a8 = pillow, 0x2256 = bagball { Name = "da bomb"; Movable = false; Hue = 0x35; m_Game = game; m_Helpers = new ArrayList(); m_Timer = new EffectTimer( this ); m_Timer.Start(); }
// Reduce Debuff timers after each tick, dealing with them when the timer reaches 0 private void CountDebuffs() { List <EffectType> toBeRemoved = new List <EffectType>(); foreach (KeyValuePair <EffectType, EffectTimer> entry in debuffs) { // Get the current effect timer reference EffectTimer effectTimer = entry.Value; effectTimer.timer -= Time.deltaTime; // If this effect timer reaches 0 if (effectTimer.timer <= 0) { switch (entry.Key) { // Decrement burn total duration, and deal fire damage // Reset the 2 seconds timer // When duration expires, burning effect goes off case EffectType.Burn: effectTimer.timer = 1; effectTimer.duration -= 1; takeDamage(effectTimer.value); if (effectTimer.duration <= 0) { toBeRemoved.Add(entry.Key); } break; // Timer equals it's duration on freeze, so when timer goes off, // the debuff expires case EffectType.Freeze: speedModifier += effectTimer.value; toBeRemoved.Add(entry.Key); break; case EffectType.Stun: stunned = false; toBeRemoved.Add(entry.Key); break; } } } // Remove the entries after iterating through dictionary foreach (EffectType type in toBeRemoved) { debuffs.Remove(type); } }
protected override void OnTick() { m_Summoner.FixedParticles(0x3779, 10, 100, 9502, 67, 7, EffectLayer.Head); m_Summoner.PlaySound(0x24A); m_Summoner.RevealingAction(); if (!(m_Summoner.Mounted) && (m_Summoner.Body.IsHuman)) { m_Summoner.Animate(266, 7, 1, true, false, 0); } if (RunCount < MaxCount) { RunCount++; Timer m_EffectTimer = new EffectTimer(m_Summoner, RunCount, MaxCount, DateTime.Now + TimeSpan.FromSeconds(3.0)); m_EffectTimer.Start(); } }
/// <summary> /// Таймер действия эффектов (иначе - баффов) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EffectTimer_Tick(object sender, EventArgs e) { time_of_effect = time_of_effect - 1; // Если таймер закончился if (time_of_effect == -1) { EffectTimer.Stop(); // Если действовало ускорение, то возвращаем исходную скорость if (Mouse.mice[current_mouse].speed == 3) { Mouse.mice[current_mouse].speed = 2; } // Если действовало замедление, то возвращаем исходную скорость if (Mouse.mice[current_mouse].speed == 1) { Mouse.mice[current_mouse].speed = 2; } } }
public void EffectExpired(Boolean silent) { if (m_Timer != null) { m_Timer.Stop(); m_Timer = null; } if (m_FoodEffect != null) { if (LinkedMobile != null) { LinkedMobile.RemoveStatMod("Food-StrBonus"); LinkedMobile.RemoveStatMod("Food-DexBonus"); LinkedMobile.RemoveStatMod("Food-IntBonus"); if (m_BuffInfo != null) { BuffInfo.RemoveBuff(LinkedMobile, m_BuffInfo); } if (!silent) { LinkedMobile.PlaySound(0x1E6); LinkedMobile.SendMessage(12, "Your food effect has worn off"); } if (m_FoodEffect != null) { FoodEffectsCore.InvokeOnEffectExpired(LinkedMobile, m_FoodEffect); } } m_FoodEffect = null; } }
// Resolve an effect caused by a projectile when hit // When damage, take damage. When debuff, add to debuff list public void resolveEffect(ShotEffect effect) { Debug.Log("Dealing with effect " + effect.type + " of value " + effect.value + " and duration " + effect.duration); switch (effect.type) { case EffectType.PhysicalDamage: case EffectType.ExplosionDamage: takeDamage(effect.value); break; case EffectType.Burn: if (!debuffs.ContainsKey(effect.type)) { debuffs.Add(effect.type, new EffectTimer(effect.value, 1.0f, effect.duration)); } else { // ShotEffect existingEffect = debuffs[effect.type].effect; EffectTimer effTmr = debuffs[EffectType.Burn]; if (effect.value > effTmr.value) { effTmr.value = effect.value; } if (effect.duration > effTmr.timer) { effTmr.timer = effect.duration; } } break; case EffectType.Freeze: if (!debuffs.ContainsKey(effect.type)) { debuffs.Add(effect.type, new EffectTimer(effect.value, effect.duration, effect.duration)); speedModifier -= effect.value; } else { EffectTimer effTmr = debuffs[EffectType.Freeze]; if (effect.value > effTmr.value) { speedModifier += effTmr.value; effTmr.value = effect.value; speedModifier -= effTmr.value; } if (effect.duration > effTmr.timer) { effTmr.timer = effect.duration; effTmr.duration = effect.duration; } } break; case EffectType.Stun: if (!debuffs.ContainsKey(effect.type)) { debuffs.Add(effect.type, new EffectTimer(effect.value, effect.duration, effect.duration)); stunned = true; } break; default: Debug.Log("Default case! Your effect went wrong"); break; } }
public void Summonicate(TeiravonMobile necromancer, Type necrosummon, string name, int stat, int level, int damage, int res) { necromancer.BeginAction(typeof(NecroSummonGump)); BaseCreature summon = (BaseCreature)Activator.CreateInstance(necrosummon); summon.Name = name; summon.Level = 0; summon.NoKillAwards = true; m_Player.BeginAction(typeof(NecroSummonGump)); double variation = (level / 2); int bonus = (int)(1.0 + (double)(level / 3.0)) * (necromancer.PlayerLevel); int necrobonus = (int)(necromancer.Skills[SkillName.Necromancy].Value / 4); double damageboost = 1.0 + ((bonus) / 100) + (necrobonus / 200); if (damageboost < 1.0) { damageboost = 1.0; } summon.SetStr(Utility.RandomMinMax(stat - (int)(20 * variation), stat + (int)(20 * variation)) + bonus); summon.SetDex(Utility.RandomMinMax(stat - (int)(20 * variation), stat + (int)(20 * variation)) + bonus); summon.SetInt(Utility.RandomMinMax(stat - (int)(20 * variation), stat + (int)(20 * variation)) + bonus); summon.SetHits(Utility.RandomMinMax(stat - (int)(20 * variation), stat + (int)(20 * variation)) + (int)(bonus / 2) + necrobonus); summon.SetStam(Utility.RandomMinMax(stat - (int)(20 * variation), stat + (int)(20 * variation)) + (int)(bonus / 2) + necrobonus); summon.SetMana(0); summon.SetDamage((int)(damageboost * (Utility.RandomMinMax(damage - (int)(damage / 2), damage))), (int)(damageboost * (Utility.RandomMinMax(damage, damage + (int)(damage / 4))))); summon.SetDamageType(ResistanceType.Physical, 100 - ((level - 1) * 10)); summon.SetDamageType(ResistanceType.Fire, (level - 1) * 2); summon.SetDamageType(ResistanceType.Poison, ((level - 1) * 2) + ((level - 1) * 2)); summon.SetDamageType(ResistanceType.Cold, (level - 1) * 2); summon.SetDamageType(ResistanceType.Energy, (level - 1) * 2); summon.Karma = necromancer.Karma; summon.Skills.MagicResist = necromancer.Skills.MagicResist; summon.SetSkill(SkillName.Wrestling, 55 + (level * 5), 75 + (level * 5)); summon.SetSkill(SkillName.Tactics, 65 + (level * 5), 75 + (level * 5)); summon.SetResistance(ResistanceType.Physical, (int)(res * 0.75), res); summon.SetResistance(ResistanceType.Fire, (int)(res * 0.75), res); summon.SetResistance(ResistanceType.Cold, (int)(res * 0.75), res); summon.SetResistance(ResistanceType.Poison, (int)(res * 0.75), res); summon.SetResistance(ResistanceType.Energy, (int)(res * 0.75), res); if (summon.Backpack != null) { summon.Backpack.Delete(); } summon.ControlSlots = 4; summon.Controled = true; summon.ControlMaster = m_Player; Item pentagram = new BloodPentagram(); Point3D p = new Point3D(m_Player.X - 2, m_Player.Y - 3, m_Player.Z); pentagram.MoveToWorld(p, m_Player.Map); m_Player.SendMessage("You begin summoning a {0} from the netherworld!", name); m_Player.Emote("*You see {0} begin summoning*", m_Player.Name); m_Player.RevealingAction(); m_Player.FixedParticles(0x3779, 10, 100, 9502, 67, 7, EffectLayer.Head); m_Player.Freeze(TimeSpan.FromSeconds(4.0 * level)); m_Player.PlaySound(0x24A); if (!(m_Player.Mounted) && (m_Player.Body.IsHuman)) { m_Player.Animate(266, 7, 1, true, false, 0); } Timer m_EffectTimer = new EffectTimer(m_Player, 1, level - 1, DateTime.Now + TimeSpan.FromSeconds(3.0)); m_EffectTimer.Start(); DateTime SummonTime = DateTime.Now + TimeSpan.FromSeconds(4.0 * level); Timer m_Timer = new NecromancerSummonTimer(m_Player, summon, pentagram, SummonTime, m_EffectTimer); m_Timer.Start(); }
protected override void OnTick() { Mobile from = (Mobile)parent; #region Magic Clothing if (m_Item.Charges <= 0) { from.SendAsciiMessage("This item is out of charges."); // This item is out of charges. switch (m_Item.Effect) { case JewelEffect.Strength: from.RemoveStatMod(m_Item.Serial.ToString() + "Str"); from.CheckStatTimers(); break; case JewelEffect.Agility: from.RemoveStatMod(m_Item.Serial.ToString() + "Dex"); from.CheckStatTimers(); break; case JewelEffect.Cunning: from.RemoveStatMod(m_Item.Serial.ToString() + "Int"); from.CheckStatTimers(); break; case JewelEffect.Bless: from.RemoveStatMod(m_Item.Serial.ToString() + "BlessStr"); from.RemoveStatMod(m_Item.Serial.ToString() + "BlessDex"); from.RemoveStatMod(m_Item.Serial.ToString() + "BlessInt"); from.CheckStatTimers(); break; case JewelEffect.Weaken: from.RemoveStatMod(m_Item.Serial.ToString() + "LowerStr"); from.CheckStatTimers(); break; case JewelEffect.Clumsy: from.RemoveStatMod(m_Item.Serial.ToString() + "LowerDex"); from.CheckStatTimers(); break; case JewelEffect.Feeblemind: from.RemoveStatMod(m_Item.Serial.ToString() + "LowerInt"); from.CheckStatTimers(); break; case JewelEffect.Curse: from.RemoveStatMod(m_Item.Serial.ToString() + "CurseStr"); from.RemoveStatMod(m_Item.Serial.ToString() + "CurseDex"); from.RemoveStatMod(m_Item.Serial.ToString() + "CurseInt"); from.CheckStatTimers(); break; case JewelEffect.NightSight: from.EndAction(typeof(LightCycle)); from.LightLevel = 0; break; case JewelEffect.Invisibility: from.Hidden = false; break; case JewelEffect.MagicReflection: break; case JewelEffect.Protection: if (from.VirtualArmorMod >= 10) { from.VirtualArmorMod -= 10; } else { from.VirtualArmorMod = 0; } break; } Stop(); } else { if (m_Item.Effect == JewelEffect.Invisibility && parent.Hidden == false) { Stop(); } else { m_Item.ConsumeCharge(from, m_Item); m_st = new EffectTimer(from, m_Item); m_st.Start(); } } #endregion }
private void Activate(object parent) { if (Effect == JewelEffect.None || Charges <= 0) { return; } if (parent is Mobile) { Mobile from = (Mobile)parent; string modName = this.Serial.ToString(); switch (Effect) { case JewelEffect.Strength: from.AddStatMod(new StatMod(StatType.Str, modName + "Str", 10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x375a, 10, 15, 5017, EffectLayer.Waist); from.PlaySound(0x1ee); break; case JewelEffect.Agility: from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", 10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x375a, 10, 15, 5010, EffectLayer.Waist); from.PlaySound(0x28e); break; case JewelEffect.Cunning: from.AddStatMod(new StatMod(StatType.Int, modName + "Int", 10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x375a, 10, 15, 5011, EffectLayer.Head); from.PlaySound(0x1eb); break; case JewelEffect.Bless: from.AddStatMod(new StatMod(StatType.Str, modName + "BlessStr", 10, TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Dex, modName + "BlessDex", 10, TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Int, modName + "BlessInt", 10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x373a, 10, 15, 5018, EffectLayer.Waist); from.PlaySound(0x1ea); break; case JewelEffect.Weaken: from.AddStatMod(new StatMod(StatType.Str, modName + "LowerStr", -10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); from.PlaySound(0x1e6); break; case JewelEffect.Clumsy: from.AddStatMod(new StatMod(StatType.Dex, modName + "LowerDex", -10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x3779, 10, 15, 5002, EffectLayer.Head); from.PlaySound(0x1df); break; case JewelEffect.Feeblemind: from.AddStatMod(new StatMod(StatType.Int, modName + "LowerInt", -10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x3779, 10, 15, 5004, EffectLayer.Head); from.PlaySound(0x1e4); break; case JewelEffect.Curse: from.AddStatMod(new StatMod(StatType.Str, modName + "CurseStr", -10, TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Dex, modName + "CurseDex", -10, TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Int, modName + "CurseInt", -10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x374a, 10, 15, 5028, EffectLayer.Waist); from.PlaySound(0x1ea); break; case JewelEffect.NightSight: from.EndAction(typeof(LightCycle)); from.BeginAction(typeof(LightCycle)); from.LightLevel = (int)LightCycle.DungeonLevel; from.FixedParticles(0x376a, 9, 32, 5007, EffectLayer.Waist); from.PlaySound(0x1e3); break; case JewelEffect.Invisibility: Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z + 16), from.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045); from.PlaySound(0x203); from.Hidden = true; break; case JewelEffect.MagicReflection: from.MagicDamageAbsorb = 15; from.FixedParticles(0x375a, 10, 15, 5037, EffectLayer.Waist); from.PlaySound(0x1e9); break; case JewelEffect.Protection: from.VirtualArmorMod += 10; from.FixedParticles(0x375a, 9, 20, 5016, EffectLayer.Waist); from.PlaySound(0x1ed); break; } ConsumeCharge(from, this); if (m_st != null) { m_st.Stop(); } m_st = new EffectTimer(from, this); m_st.Start(); } }
protected override void OnTick() { Mobile from = (Mobile)parent; #region Magic Clothing if (m_Item.Charges <= 0) { from.SendAsciiMessage("This item is out of charges."); // This item is out of charges. switch (m_Item.Effect) { case ClothEffect.Strength: from.RemoveStatMod(m_Item.Serial.ToString() + "Str"); from.CheckStatTimers(); break; case ClothEffect.Agility: from.RemoveStatMod(m_Item.Serial.ToString() + "Dex"); from.CheckStatTimers(); break; case ClothEffect.Cunning: from.RemoveStatMod(m_Item.Serial.ToString() + "Int"); from.CheckStatTimers(); break; case ClothEffect.Bless: from.RemoveStatMod(m_Item.Serial.ToString() + "BlessStr"); from.RemoveStatMod(m_Item.Serial.ToString() + "BlessDex"); from.RemoveStatMod(m_Item.Serial.ToString() + "BlessInt"); from.CheckStatTimers(); break; case ClothEffect.Weaken: from.RemoveStatMod(m_Item.Serial.ToString() + "LowerStr"); from.CheckStatTimers(); break; case ClothEffect.Clumsy: from.RemoveStatMod(m_Item.Serial.ToString() + "LowerDex"); from.CheckStatTimers(); break; case ClothEffect.Feeblemind: from.RemoveStatMod(m_Item.Serial.ToString() + "LowerInt"); from.CheckStatTimers(); break; case ClothEffect.Curse: from.RemoveStatMod(m_Item.Serial.ToString() + "CurseStr"); from.RemoveStatMod(m_Item.Serial.ToString() + "CurseDex"); from.RemoveStatMod(m_Item.Serial.ToString() + "CurseInt"); from.CheckStatTimers(); break; case ClothEffect.NightSight: from.EndAction(typeof(LightCycle)); from.LightLevel = 0; break; case ClothEffect.Invisibility: from.Hidden = false; break; case ClothEffect.MagicReflection: break; case ClothEffect.Protection: if (from.VirtualArmorMod >= 10) from.VirtualArmorMod -= 10; else from.VirtualArmorMod = 0; break; } Stop(); } else { if (m_Item.Effect == ClothEffect.Invisibility && parent.Hidden == false) Stop(); else { m_Item.ConsumeCharge(from, m_Item); m_st = new EffectTimer(from, m_Item); m_st.Start(); } } #endregion }
public void EffectExpired(Boolean silent) { if (m_Timer != null) { m_Timer.Stop(); m_Timer = null; } if (m_FoodEffect != null) { if (LinkedMobile != null) { LinkedMobile.RemoveStatMod("Food-StrBonus"); LinkedMobile.RemoveStatMod("Food-DexBonus"); LinkedMobile.RemoveStatMod("Food-IntBonus"); if (m_BuffInfo != null) BuffInfo.RemoveBuff(LinkedMobile, m_BuffInfo); if (!silent) { LinkedMobile.PlaySound(0x1E6); LinkedMobile.SendMessage(12, "Your food effect has worn off"); } if (m_FoodEffect != null) FoodEffectsCore.InvokeOnEffectExpired(LinkedMobile, m_FoodEffect); } m_FoodEffect = null; } }
public void ApplyEffect(FoodEffect effect, Boolean silent) { if (FoodEffectsCore.Core == null || !FoodEffectsCore.Core.Enabled || !Core.AOS) { EffectExpired(true); return; } if (LinkedMobile != null) { if (m_Timer != null) { m_Timer.Stop(); m_Timer = null; } LinkedMobile.RemoveStatMod("Food-StrBonus"); LinkedMobile.RemoveStatMod("Food-DexBonus"); LinkedMobile.RemoveStatMod("Food-IntBonus"); if (m_BuffInfo != null) { BuffInfo.RemoveBuff(LinkedMobile, m_BuffInfo); } if (m_FoodEffect != null) { FoodEffectsCore.InvokeOnEffectCanceled(LinkedMobile, m_FoodEffect); } m_FoodEffect = new FoodEffect(effect.RegenHits, effect.RegenStam, effect.RegenMana, effect.StrBonus, effect.DexBonus, effect.IntBonus, effect.Duration); if (m_FoodEffect.StrBonus != 0) { LinkedMobile.AddStatMod(new StatMod(StatType.Str, "Food-StrBonus", m_FoodEffect.StrBonus, m_FoodEffect.EffectTimeSpan)); } if (m_FoodEffect.DexBonus != 0) { LinkedMobile.AddStatMod(new StatMod(StatType.Dex, "Food-DexBonus", m_FoodEffect.DexBonus, m_FoodEffect.EffectTimeSpan)); } if (m_FoodEffect.IntBonus != 0) { LinkedMobile.AddStatMod(new StatMod(StatType.Int, "Food-IntBonus", m_FoodEffect.IntBonus, m_FoodEffect.EffectTimeSpan)); } if (!silent) { LinkedMobile.FixedEffect(0x375A, 10, 15); LinkedMobile.PlaySound(0x1EE); LinkedMobile.SendMessage(12, "The food you ate is now affecting your performance..."); } m_Timer = new EffectTimer(this); FoodEffectsCore.InvokeOnEffectActivated(LinkedMobile, m_FoodEffect); m_BuffInfo = new BuffInfo(BuffIcon.ActiveMeditation, 1074240, 1114057, m_FoodEffect.EffectTimeSpan, LinkedMobile, m_FoodEffect.GetBuffInfoText()); BuffInfo.AddBuff(LinkedMobile, m_BuffInfo); } }
/// <summary> /// Изменение координат мыши и действия при нахождении бонусов и сыра /// </summary> private void MovementOfMouse() { int x = Mouse.mice[current_mouse].position.Left - Server.shift_of_map_Left; // Координата X текущей мыши int y = Mouse.mice[current_mouse].position.Top - Server.shift_of_map_Top; // Координата Y текущей мыши int step = Convert.ToInt32(Mouse.mice[current_mouse].speed); // Шаг double double_x = (Convert.ToDouble(x)) / Server.size_of_cell; // Позиция X внутри ячейки double double_y = (Convert.ToDouble(y)) / Server.size_of_cell; // Позиция Y внутри ячейки // Нажата клавиша влево if (key_left_pressed) { // Проверка на преграды и прочее if (CheckingOfMovement(Mouse.mice[current_mouse].position.Left, Mouse.mice[current_mouse].position.Top, "left", current_mouse)) { Mouse.mice[current_mouse].position.Location = new Point(Mouse.mice[current_mouse].position.Left - step, Mouse.mice[current_mouse].position.Top); } } // Нажата клавиша вправо if (key_right_pressed) { // Проверка на преграды и прочее if (CheckingOfMovement(Mouse.mice[current_mouse].position.Left, Mouse.mice[current_mouse].position.Top, "right", current_mouse)) { Mouse.mice[current_mouse].position.Location = new Point(Mouse.mice[current_mouse].position.Left + step, Mouse.mice[current_mouse].position.Top); } } // Нажата клавиша вверх if (key_up_pressed) { // Проверка на преграды и прочее if (CheckingOfMovement(Mouse.mice[current_mouse].position.Left, Mouse.mice[current_mouse].position.Top, "up", current_mouse)) { Mouse.mice[current_mouse].position.Location = new Point(Mouse.mice[current_mouse].position.Left, Mouse.mice[current_mouse].position.Top - step); } } // Нажата клавиша вниз if (key_down_pressed) { // Проверка на преграды и прочее if (CheckingOfMovement(Mouse.mice[current_mouse].position.Left, Mouse.mice[current_mouse].position.Top, "down", current_mouse)) { Mouse.mice[current_mouse].position.Location = new Point(Mouse.mice[current_mouse].position.Left, Mouse.mice[current_mouse].position.Top + step); } } // Если никакая клавиша не нажата if (!key_left_pressed && !key_right_pressed && !key_up_pressed && !key_down_pressed) { int result = AutoAligment(Mouse.mice[current_mouse].position.Left, Mouse.mice[current_mouse].position.Top); // Проверка на автоцентровку (выравнивание по правому краю) if (result == 1) { int coordinate_X_of_right_cell = Convert.ToInt32(Math.Ceiling(double_x) * Server.size_of_cell + Server.shift_of_map_Left); Mouse.mice[current_mouse].position.Location = new Point(coordinate_X_of_right_cell, y + Server.shift_of_map_Left); } // Проверка на автоцентровку (выравнивание по левому краю) if (result == 2) { int coordinate_X_of_left_cell = Convert.ToInt32(Math.Floor(double_x) * Server.size_of_cell + Server.shift_of_map_Left); Mouse.mice[current_mouse].position.Location = new Point(coordinate_X_of_left_cell, y + Server.shift_of_map_Left); } // Проверка на автоцентровку (выравнивание по нижнему краю) if (result == 3) { int coordinate_Y_of_down_cell = Convert.ToInt32(Math.Ceiling(double_y) * Server.size_of_cell + Server.shift_of_map_Top); Mouse.mice[current_mouse].position.Location = new Point(x + Server.shift_of_map_Left, coordinate_Y_of_down_cell); } // Проверка на автоцентровку (выравнивание по верхнему краю) if (result == 4) { int coordinate_Y_of_up_cell = Convert.ToInt32(Math.Floor(double_y) * Server.size_of_cell + Server.shift_of_map_Top); Mouse.mice[current_mouse].position.Location = new Point(x + Server.shift_of_map_Left, coordinate_Y_of_up_cell); } } // Если подобрали бонус if (bonus) { bonus = false; Mouse.mice[current_mouse].speed = 3; EffectTimer.Stop(); // Останавливаем таймер, если он запущен time_of_effect = 10; EffectTimer.Start(); // Запускаем таймер эффекта бонуса Server.bonus_sound.Play(); } // Если подобрали сыр if (cheese) { cheese = false; Mouse.mice[current_mouse].number_of_cheeses++; Server.cheese_sound.Play(); } // Если наткнулись на мышеловку if (trap) { trap = false; Mouse.mice[current_mouse].speed = 1; EffectTimer.Stop(); // Останавливаем таймер, если он запущен time_of_effect = 10; EffectTimer.Start(); // Запускаем таймер эффекта бонуса Server.cheese_sound.Play(); } }
// 0x103C = bread, 0x1042 = pie, 0x1364 = rock, 0x13a8 = pillow, 0x2256 = bagball public BRBomb( BRGame game ) : base(0x103C) { Name = "da bomb"; Movable = false; Hue = 0x35; m_Game = game; m_Helpers = new ArrayList(); m_Timer = new EffectTimer( this ); m_Timer.Start(); }
private void Activate(object parent) { if (Effect == ClothEffect.None || Charges <= 0) return; if (parent is Mobile) { Mobile from = (Mobile)parent; string modName = this.Serial.ToString(); switch (Effect) { case ClothEffect.Strength: from.AddStatMod(new StatMod(StatType.Str, modName + "Str", 10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x375a, 10, 15, 5017, EffectLayer.Waist); from.PlaySound(0x1ee); break; case ClothEffect.Agility: from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", 10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x375a, 10, 15, 5010, EffectLayer.Waist); from.PlaySound(0x28e); break; case ClothEffect.Cunning: from.AddStatMod(new StatMod(StatType.Int, modName + "Int", 10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x375a, 10, 15, 5011, EffectLayer.Head); from.PlaySound(0x1eb); break; case ClothEffect.Bless: from.AddStatMod(new StatMod(StatType.Str, modName + "BlessStr", 10, TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Dex, modName + "BlessDex", 10, TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Int, modName + "BlessInt", 10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x373a, 10, 15, 5018, EffectLayer.Waist); from.PlaySound(0x1ea); break; case ClothEffect.Weaken: from.AddStatMod(new StatMod(StatType.Str, modName + "LowerStr", -10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x3779, 10, 15, 5009, EffectLayer.Waist); from.PlaySound(0x1e6); break; case ClothEffect.Clumsy: from.AddStatMod(new StatMod(StatType.Dex, modName + "LowerDex", -10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x3779, 10, 15, 5002, EffectLayer.Head); from.PlaySound(0x1df); break; case ClothEffect.Feeblemind: from.AddStatMod(new StatMod(StatType.Int, modName + "LowerInt", -10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x3779, 10, 15, 5004, EffectLayer.Head); from.PlaySound(0x1e4); break; case ClothEffect.Curse: from.AddStatMod(new StatMod(StatType.Str, modName + "CurseStr", -10, TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Dex, modName + "CurseDex", -10, TimeSpan.Zero)); from.AddStatMod(new StatMod(StatType.Int, modName + "CurseInt", -10, TimeSpan.Zero)); from.CheckStatTimers(); from.FixedParticles(0x374a, 10, 15, 5028, EffectLayer.Waist); from.PlaySound(0x1ea); break; case ClothEffect.NightSight: from.EndAction(typeof(LightCycle)); from.BeginAction(typeof(LightCycle)); from.LightLevel = (int)LightCycle.DungeonLevel; from.FixedParticles(0x376a, 9, 32, 5007, EffectLayer.Waist); from.PlaySound(0x1e3); break; case ClothEffect.Invisibility: Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z + 16), from.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045); from.PlaySound(0x3C4); from.Hidden = true; break; case ClothEffect.MagicReflection: from.MagicDamageAbsorb = 15; from.FixedParticles(0x375a, 10, 15, 5037, EffectLayer.Waist); from.PlaySound(0x1e9); break; case ClothEffect.Protection: from.VirtualArmorMod += 10; from.FixedParticles(0x375a, 9, 20, 5016, EffectLayer.Waist); from.PlaySound(0x1ed); break; } ConsumeCharge(from, this); if (m_st != null) m_st.Stop(); m_st = new EffectTimer(from, this); m_st.Start(); } }