public override bool Cast() { if (!base.Cast()) { return(false); } double time = (int)(Owner.Niveau / 3) * (Maitrise / 2.0); double dnumber = Owner.Niveau * 0.80; distance = (Owner.Niveau / 2); if (distance > 10) { distance = 10; } time *= getRatio(); dnumber *= getRatio(); int number = (int)dnumber; bool asMove = false; for (int i = 0; i < number; i++) { int offset = Utility.Random(8) * 2; Map map = Owner.Map; for (int c = 0; c < m_Offsets().Length; c += 2) { int x = Owner.X + m_Offsets()[(offset + c) % m_Offsets().Length]; int y = Owner.Y + m_Offsets()[(offset + c + 1) % m_Offsets().Length]; if (map.CanSpawnMobile(x, y, Owner.Z) && Owner.Location != new Point3D(x, y, Owner.Z)) { KonohaClone clone = new KonohaClone(Owner, Owner.X - x, Owner.Y - y, time + (Utility.RandomDouble() * 2.0)); if (!asMove && Owner.CanSee(new Point3D(x, y, Owner.Z))) { int oldx = x; int oldy = y; x = Owner.X; y = Owner.Y; Owner.MoveToWorld(new Point3D(oldx, oldy, Owner.Z), Owner.Map); asMove = true; if (Owner.Combatant != null) { clone.Combatant = Owner.Combatant; clone.Combatant.Combatant = clone; Owner.Combatant = null; } } //if(clone.Location == Owner.Location) clone.MoveToWorld(new Point3D(x, y, Owner.Z), Owner.Map); m_clones.Add(clone); break; } else { if (Owner.Location == new Point3D(x, y, Owner.Z)) { x += Utility.RandomMinMax(-2, 2); y += Utility.RandomMinMax(-2, 2); } int z = map.GetAverageZ(x, y); KonohaClone clone = new KonohaClone(Owner, Owner.X - x, Owner.Y - y, time + (Utility.RandomDouble() * 2.0)); if (map.CanSpawnMobile(x, y, z)) { clone.MoveToWorld(new Point3D(x, y, z), Owner.Map); m_clones.Add(clone); break; //return true; } } } /*int x = Owner.X-Utility.RandomMinMax(1,distance); * int y = Owner.Y-Utility.RandomMinMax(1,distance); * Point3D p = new Point3D(x, y, Owner.Z); * if( !asMove && Owner.CanSee( p ) ) * { * Owner.MoveToWorld(p, Owner.Map); * asMove = true; * } * KonohaClone clone = new KonohaClone(Owner, x,y, time+ (Utility.RandomDouble()*2.0)); * clone.MoveToWorld(p, Owner.Map); * m_clones.Add(clone);*/ } m_timer = new InternalTimer(this, time + 2.0); m_timer.Start(); return(true); }
public override bool Cast() { if (!base.Cast()) { return(false); } bool asSub = false; ArrayList Targets = new ArrayList(); foreach (Mobile m in Owner.GetMobilesInRange(6)) { if (m is BaseCreature) { Targets.Add(m); } } if (Targets.Count > 0) { BaseCreature sb = null; foreach (BaseCreature c in Targets) { if (c.AI == AIType.AI_Animal /*&& c.ControlMaster != null && !c.Controlled*/) { sb = c; } } if (sb != null) { KonohaClone clone = new KonohaClone(Owner, 0, 0, 15.0); clone.MoveToWorld(Owner.Location, Owner.Map); clone.substitute = sb; clone.Direction = Owner.Direction; if (Owner.Combatant != null) { clone.Combatant = Owner.Combatant; if (Owner.Combatant.Combatant == Owner) { Owner.Combatant.Combatant = clone; } Owner.Combatant = null; } Owner.Hidden = true; asSub = true; } } if (asSub) { return(true); EndSortNubia(); } ArrayList objetTargets = new ArrayList(); foreach (Item item in Owner.GetItemsInRange(6)) { if (item.Movable) { objetTargets.Add(item); } } if (objetTargets.Count > 0) { int ind = Utility.RandomMinMax(0, objetTargets.Count - 1); Item it = objetTargets[ind] as Item; KonohaClone clone = new KonohaClone(Owner, 0, 0, 15.0); clone.subItem = it; clone.MoveToWorld(Owner.Location, Owner.Map); clone.Direction = Owner.Direction; if (Owner.Combatant != null) { clone.Combatant = Owner.Combatant; if (Owner.Combatant.Combatant == Owner) { Owner.Combatant.Combatant = clone; } Owner.Combatant = null; } Owner.Hidden = true; asSub = true; } if (!asSub) { Owner.SendMessage("Impossible de trouver un objet ou un poulet pour la substitution"); } EndSortNubia(); return(true); }