public Totem(int ItemID, string name, int hue, int maxrange, TotemType type, DateTime todelete, Mobile caster, double bonus, int effectid, int effectspeed, int effectduration, EffectLayer effectlayer, int soundid) : base(ItemID) { Name = name; Hue = hue; Movable = false; Visible = true; MaxRange = maxrange; ToDelete = todelete; Caster = caster; Bonus = bonus; EffectID = effectid; EffectSpeed = effectspeed; EffectDuration = effectduration; EffectLayer = effectlayer; SoundID = soundid; TotemType = type; if (m_DeleteTimer == null) { m_DeleteTimer = new DeleteTotemTimer(this); m_DeleteTimer.Start(); } foreach (Mobile m in this.GetMobilesInRange(20)) { m.InvalidateProperties(); m.Delta(MobileDelta.Armor); } }
public static double GetTotemBonus(Mobile m, TotemType totemtype) { if (m == null) { return(0); } ArrayList targets = new ArrayList(); Map map = m.Map; if (map != null) { foreach (Item item in m.GetItemsInRange(15)) { if (item != null && m.CanSee(item) && item is Totem) { targets.Add(item); } } } Totem chosen = null; for (int i = 0; i < targets.Count; ++i) { Totem totem = (Totem)targets[i]; if (totem != null && totem.TotemType == totemtype) { if (m.InRange(totem, totem.MaxRange)) { if (chosen == null || chosen.Bonus < totem.Bonus) { chosen = totem; } } } } if (chosen != null && m != null && chosen.TotemType != TotemType.Amulette && chosen.TotemType != TotemType.Miracle && chosen.TotemType != TotemType.Refecteur) { Effects.SendTargetParticles(m, chosen.EffectID, chosen.EffectSpeed, chosen.EffectDuration, 5005, chosen.Hue, 0, chosen.EffectLayer); } if (chosen == null) { return(0); } return(chosen.Bonus); }
private void DeleteModule(TotemType totem) { int position = searchModule(totem); try { modulos.RemoveAt(position); } catch (TotemException tE) { Console.WriteLine("Totem exception: " + tE.Message); } }
public TotemObject(int Entry, float PosX, float PosY, float PosZ, float Orientation, int Map, int Duration_ = 0) : base(Entry, PosX, PosY, PosZ, Orientation, Map, Duration_) { Caster = null; Duration = 0; Type = TotemType.TOTEM_PASSIVE; if (aiScript != null) { aiScript.Dispose(); } aiScript = null; Duration = Duration_; }
public static Totem GetTotem(Mobile m, TotemType totemtype) { if (m == null) { return(null); } ArrayList targets = new ArrayList(); Map map = m.Map; if (map != null) { foreach (Item item in m.GetItemsInRange(15)) { if (item != null && m.CanSee(item) && item is Totem) { targets.Add(item); } } } Totem chosen = null; for (int i = 0; i < targets.Count; ++i) { Totem totem = (Totem)targets[i]; if (totem != null && totem.TotemType == totemtype) { if (m.InRange(totem, totem.MaxRange)) { if (chosen == null || chosen.Bonus < totem.Bonus) { chosen = totem; } } } } return(chosen); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); int ItemID = 9328; string name = "Réfecteur"; int hue = 1942; TotemType type = TotemType.Refecteur; DateTime delete = DateTime.Now; int range = 1 + (int)(Caster.Skills[CastSkill].Value / 20); double bonus = 1 + (double)((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 25); int effectid = 14170; int effectspeed = 9; int effectduration = 18; EffectLayer layer = EffectLayer.Head; int soundid = 533; Totem totem = new Totem(ItemID, name, hue, range, type, delete, Caster, bonus, effectid, effectspeed, effectduration, layer, soundid); if (totem != null) { totem.MoveToWorld(new Point3D(p), Caster.Map); Effects.SendTargetParticles(totem, effectid, effectspeed, effectduration, 5005, hue, 0, layer); totem.PlaySound(soundid); } new RefecteurTimer(totem).Start(); } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); int ItemID = 3796; string name = "Point de paresse"; int hue = 1942; TotemType type = TotemType.PointDeParesse; DateTime delete = DateTime.Now + TimeSpan.FromSeconds(0); int range = 1 + (int)(Caster.Skills[CastSkill].Value / 10); double bonus = 1 + (Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 100; int effectid = 14138; int effectspeed = 10; int effectduration = 20; EffectLayer layer = EffectLayer.Waist; int soundid = 501; Totem totem = new Totem(ItemID, name, hue, range, type, delete, Caster, bonus, effectid, effectspeed, effectduration, layer, soundid); if (totem != null) { totem.MoveToWorld(new Point3D(p), Caster.Map); Effects.SendTargetParticles(totem, effectid, effectspeed, effectduration, 5005, hue, 0, layer); totem.PlaySound(soundid); } new PointDeParesseTimer(totem).Start(); } FinishSequence(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_MaxRange = reader.ReadInt(); m_ToDelete = reader.ReadDateTime(); m_Caster = reader.ReadMobile(); m_Bonus = reader.ReadDouble(); m_EffectID = reader.ReadInt(); m_EffectSpeed = reader.ReadInt(); m_EffectDuration = reader.ReadInt(); m_EffectLayer = (EffectLayer)reader.ReadInt(); m_SoundID = reader.ReadInt(); m_TotemType = (TotemType)reader.ReadInt(); if (m_DeleteTimer == null) { m_DeleteTimer = new DeleteTotemTimer(this); m_DeleteTimer.Start(); } if (m_TotemType == TotemType.Refecteur) new RefecteurSpell.RefecteurTimer(this).Start(); if (m_TotemType == TotemType.Miracle) new MiracleSpell.MiracleTimer(this).Start(); if (m_TotemType == TotemType.PointDeParesse) new PointDeParesseSpell.PointDeParesseTimer(this).Start(); foreach (Mobile m in this.GetMobilesInRange(20)) { m.InvalidateProperties(); m.Delta(MobileDelta.Armor); } }
private int searchModule(TotemType type) { int position = 0; bool trobat = false; while (position < modulos.Count && !trobat) { if (modulos[position].GetComponent <ModuloTotem>().getTypeOfTotem() == type) { trobat = true; } else { position += 1; } } if (trobat) { return(position); } throw new TotemException("Module not found"); }
private void AddModule(TotemType totem) { GameObject instance; switch (totem) { case TotemType.TOTEM_BASE: instance = Instantiate(Resources.Load("TotemBase", typeof(GameObject))) as GameObject; instance.AddComponent <ModuloTotemBase>(); // Agregamos la misma layer y así evitamos las colisiones instance.layer = GetComponent <Totem>().gameObject.layer; instance.tag = GetComponent <Totem>().gameObject.tag + "Module"; modulos.Add(instance); break; case TotemType.TOTEM_AGUILA: instance = Instantiate(Resources.Load("TotemFalcon", typeof(GameObject))) as GameObject; instance.AddComponent <ModuloTotemAguila>(); instance.layer = GetComponent <Totem>().gameObject.layer; instance.tag = GetComponent <Totem>().gameObject.tag + "Module"; modulos.Add(instance); break; case TotemType.TOTEM_GORILA: instance = Instantiate(Resources.Load("TotemGorilla", typeof(GameObject))) as GameObject; instance.AddComponent <ModuloTotemGorila>(); instance.layer = GetComponent <Totem>().gameObject.layer; instance.tag = GetComponent <Totem>().gameObject.tag + "Module"; modulos.Add(instance); break; case TotemType.TOTEM_TORTUGA: instance = Instantiate(Resources.Load("TotemTurtle", typeof(GameObject))) as GameObject; instance.AddComponent <ModuloTotemTortuga>(); instance.layer = GetComponent <Totem>().gameObject.layer; instance.tag = GetComponent <Totem>().gameObject.tag + "Module"; modulos.Add(instance); break; case TotemType.TOTEM_ELEFANTE: instance = Instantiate(Resources.Load("TotemElephant", typeof(GameObject))) as GameObject; instance.AddComponent <ModuloTotemElefante>(); instance.layer = GetComponent <Totem>().gameObject.layer; instance.tag = GetComponent <Totem>().gameObject.tag + "Module"; modulos.Add(instance); break; } GameObject lastModuleAdded = modulos[modulos.Count - 1]; // Sumamos los parámetros de los módulos al totem this.ataqueTotal += lastModuleAdded.GetComponent <ModuloTotem>().getAtaque(); this.defensaTotal += lastModuleAdded.GetComponent <ModuloTotem>().getDefensa(); this.movimientoTotal += lastModuleAdded.GetComponent <ModuloTotem>().getMovimiento(); this.vidaTotal += lastModuleAdded.GetComponent <ModuloTotem>().getVida(); // En caso que sea el primer módulo que se añade if (modulos.Count < 2) { lastModuleAdded.transform.position = this.transform.position; // Subimos la posición del totem para apilarlo lastModuleAdded.transform.parent = this.transform; } else { GameObject moduloAnterior = modulos[modulos.Count - 2]; lastModuleAdded.transform.position = moduloAnterior.transform.position; // Subimos la posición del totem para apilarlo lastModuleAdded.transform.position = lastModuleAdded.transform.position + moduloAnterior.transform.up * 0.7f; lastModuleAdded.transform.parent = this.transform; } this.movimiento.DistanciaLimite += movimientoTotal; aumentarVida(vidaTotal); }