Example #1
0
 protected override void OnTick()
 {
     if (t_Item.Parent != null)              //not on the ground
     {
         return;
     }
     foreach (Mobile mob in t_Item.GetMobilesInRange(0))
     {
         if (Utility.RandomDouble() < ((double)mob.BAC / 300) && mob.BAC > 0)
         {
             Map m = t_Item.Map;
             int x = t_Item.X + Utility.RandomMinMax(-1, 1);
             int y = t_Item.Y + Utility.RandomMinMax(-1, 1);
             int z = t_Item.Z;
             if (!m.CanFit(x, y, z, 16, false, true, true))
             {
                 z = m.GetAverageZ(x, y);
                 if (z == t_Item.Z || !m.CanFit(x, y, z, 16, false, true, true))
                 {
                     continue;
                 }
             }
             Item trash = new SelfDestructiveBarTrash(mob);
             trash.MoveToWorld(new Point3D(x, y, z), m);
         }
     }
 }
Example #2
0
			protected override void OnTick() {
				if(t_Item.Parent!=null) //not on the ground
					return;
				foreach(Mobile mob in t_Item.GetMobilesInRange(0)){
					if(Utility.RandomDouble()<((double)mob.BAC/300) && mob.BAC>0){
						Map m = t_Item.Map;
						int x = t_Item.X + Utility.RandomMinMax(-1,1);
						int y = t_Item.Y + Utility.RandomMinMax(-1,1);
						int z = t_Item.Z;
						if(!m.CanFit(x,y,z,16,false,true,true)) {
							z = m.GetAverageZ(x, y);
							if (z == t_Item.Z || !m.CanFit(x,y,z,16,false,true,true))
								continue;
						}
						Item trash = new SelfDestructiveBarTrash(mob);
						trash.MoveToWorld(new Point3D(x,y,z),m);
					}
				}
			}